XRootD
Loading...
Searching...
No Matches
XrdMacaroonsHandler.cc File Reference
#include "XrdMacaroonsHandler.hh"
#include "XrdMacaroonsUtils.hh"
#include "XrdAcc/XrdAccAuthorize.hh"
#include "XrdAcc/XrdAccPrivs.hh"
#include "XrdOuc/XrdOucTUtils.hh"
#include "XrdOuc/XrdOucUtils.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 56 of file XrdMacaroonsHandler.cc.

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

References is_reserved_caveat().

Referenced by is_reserved_caveat(), and Macaroons::Handler::ProcessReq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_supported_caveat()

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

Definition at line 63 of file XrdMacaroonsHandler.cc.

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

References is_supported_caveat().

Referenced by is_supported_caveat(), and Macaroons::Handler::ProcessReq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unquote()

char * unquote ( const char * str)

Definition at line 23 of file XrdMacaroonsHandler.cc.

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

References unquote().

Here is the call graph for this function: