CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
helper_allow.cc
Go to the documentation of this file.
1 
4 #include <unistd.h>
5 
6 #include <string>
7 
8 #include "helper_log.h"
9 #include "helper_util.h"
10 #include "json.h"
11 typedef struct json_value JSON;
12 
13 using namespace std; // NOLINT
14 
15 
16 int main() {
18 
19  // Handshake
20  string msg = ReadMsg();
21  ParseHandshakeInit(msg);
22  WriteMsg("{\"cvmfs_authz_v1\":{\"msgid\":1,\"revision\":0}}");
24  "authz allow helper invoked, connected to cvmfs process %d",
25  getppid());
26 
27  while (true) {
28  msg = ReadMsg();
29  LogAuthz(kLogAuthzDebug, "got authz request %s", msg.c_str());
30  ParseRequest(msg);
31  WriteMsg("{\"cvmfs_authz_v1\":{\"msgid\":3,\"revision\":0,\"status\":0}}");
32  }
33 
34  return 0;
35 }
void ParseHandshakeInit(const string &msg)
Definition: helper_util.cc:41
const unsigned kLogAuthzDebug
Definition: helper_log.h:10
string ReadMsg()
Definition: helper_util.cc:106
const unsigned kLogAuthzSyslog
Definition: helper_log.h:11
int main()
Definition: helper_allow.cc:16
void WriteMsg(const string &msg)
Definition: helper_util.cc:135
void CheckCallContext()
Definition: helper_util.cc:32
void ParseRequest(const string &msg)
Definition: helper_util.cc:68
void LogAuthz(const int flags, const char *format,...)
Definition: helper_log.cc:110
struct json_value JSON
Definition: helper_allow.cc:11