XRootD
Loading...
Searching...
No Matches
XrdMacaroonsHandler.cc File Reference
#include "XrdMacaroonsHandler.hh"
#include "XrdAcc/XrdAccAuthorize.hh"
#include "XrdAcc/XrdAccPrivs.hh"
#include "XrdOuc/XrdOucTUtils.hh"
#include "XrdSec/XrdSecEntity.hh"
#include "XrdSys/XrdSysError.hh"
#include <cstring>
#include <iostream>
#include <set>
#include <sstream>
#include <string>
#include <json.h>
#include <macaroons.h>
#include <uuid/uuid.h>
Include dependency graph for XrdMacaroonsHandler.cc:

Go to the source code of this file.

Functions

static bool is_reserved_caveat (const std::string &cv)
static bool is_supported_caveat (const std::string &cv)
char * unquote (const char *str)

Function Documentation

◆ is_reserved_caveat()

bool is_reserved_caveat ( const std::string & cv)
static

Definition at line 54 of file XrdMacaroonsHandler.cc.

55{
56 return cv.compare(0, 5, "name:") == 0 ||
57 cv.compare(0, 5, "path:") == 0 ||
58 cv.compare(0, 7, "before:") == 0;
59}

Referenced by Macaroons::Handler::ProcessReq().

Here is the caller graph for this function:

◆ is_supported_caveat()

bool is_supported_caveat ( const std::string & cv)
static

Definition at line 61 of file XrdMacaroonsHandler.cc.

62{
63 return cv.compare(0, 9, "activity:") == 0;
64}

Referenced by Macaroons::Handler::ProcessReq().

Here is the caller graph for this function:

◆ unquote()

char * unquote ( const char * str)

Definition at line 21 of file XrdMacaroonsHandler.cc.

21 {
22 int l = strlen(str);
23 char *r = (char *) malloc(l + 1);
24 r[0] = '\0';
25 int i, j = 0;
26
27 for (i = 0; i < l; i++) {
28
29 if (str[i] == '%') {
30 char savec[3];
31 if (l <= i + 3) {
32 free(r);
33 return nullptr;
34 }
35 savec[0] = str[i + 1];
36 savec[1] = str[i + 2];
37 savec[2] = '\0';
38
39 r[j] = strtol(savec, 0, 16);
40
41 i += 2;
42 } else if (str[i] == '+') r[j] = ' ';
43 else r[j] = str[i];
44
45 j++;
46 }
47
48 r[j] = '\0';
49
50 return r;
51
52}