Logo ROOT   6.18/05
Reference Guide
XrdProofdClientMgr.h
Go to the documentation of this file.
1// @(#)root/proofd:$Id$
2// Author: G. Ganis Jan 2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_XrdProofdClientMgr
13#define ROOT_XrdProofdClientMgr
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// XrdProofdClientMgr //
18// //
19// Author: G. Ganis, CERN, 2008 //
20// //
21// Class managing clients. //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include <list>
26
27#include "XpdSysPthread.h"
28
29#include "XrdProofdConfig.h"
30
31#include "XrdOuc/XrdOucString.hh"
32
33#define XPD_LOGGEDIN 1
34#define XPD_NEED_AUTH 2
35#define XPD_ADMINUSER 4
36#define XPD_NEED_MAP 8
37
38class XrdProofdClient;
39class XrdProofdConfig;
42class XrdProtocol_Config;
43class XrdSecService;
44class XrdSysError;
45class XrdSysPlugin;
46
47
49
52 XrdOucString fSecLib;
53 XrdSecService *fCIA; // Security framework
54 XrdSysPlugin *fSecPlugin; // Security framework plugin
55
58
59 XrdOucString fClntAdminPath; // Client admin area
60 int fNDisconnected; // Clients previously connected still offline
63
64 std::list<XrdProofdClient *> fProofdClients; // keeps track of all users
65
67 XrdOucString &cidpath, XrdOucString &emsg);
69 const char *user, XrdOucString &emsg);
71 XrdOucString &path, XrdOucString &e);
72 int RestoreAdminPath(XrdOucString &cpath, XrdOucString &emsg);
73 int ParsePreviousClients(XrdOucString &emsg);
74 int MapClient(XrdProofdProtocol *xp, bool all = 1);
75 char *FilterSecConfig(int &nd);
76
77 void RegisterDirectives();
78 int DoDirectiveClientMgr(char *, XrdOucStream *, bool);
79
80 // Security service
81 XrdSecService *LoadSecurity();
82
83public:
84 XrdProofdClientMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e);
86
88
89 int Config(bool rcf = 0);
91 char *val, XrdOucStream *cfg, bool rcf);
92 int CheckClients();
93
94 XrdProofdClient *GetClient(const char *usr, const char *grp = 0, bool create = 1);
96 return fProofdClients.size(); }
97
98 void Broadcast(XrdProofdClient *c, const char *msg);
99 void TerminateSessions(XrdProofdClient *c, const char *msg, int srvtype);
100
102
103 int Auth(XrdProofdProtocol *xp);
104 int Login(XrdProofdProtocol *xp);
105
106 int CheckFrequency() const { return fCheckFrequency; }
107 inline XrdProofdPipe *Pipe() { return &fPipe; }
108};
109#endif
#define d(i)
Definition: RSha256.hxx:102
#define c(i)
Definition: RSha256.hxx:101
#define e(i)
Definition: RSha256.hxx:103
#define XrdSysError
Definition: XpdSysError.h:8
#define XrdSysPlugin
Definition: XpdSysPlugin.h:8
#define SafeDel(x)
Definition: XrdProofdAux.h:332
#define XrdSysMutexHelper
Definition: XrdSysToOuc.h:17
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
int Auth(XrdProofdProtocol *xp)
Analyse client authentication info.
XrdSecService * fCIA
XrdOucString fClntAdminPath
int CreateAdminPath(XrdProofdProtocol *p, XrdOucString &path, XrdOucString &e)
Create the client directory in the admin path.
int CheckAdminPath(XrdProofdProtocol *p, XrdOucString &cidpath, XrdOucString &emsg)
Check the old-clients admin for an existing entry for this client and read the client ID;.
int CheckClients()
Regular checks of the client admin path; run by the cron job.
char * FilterSecConfig(int &nd)
Grep directives of the form "xpd.sec...", "sec.protparm" and "sec.protocol" from file 'cfn' and save ...
int CheckClient(XrdProofdProtocol *p, const char *user, XrdOucString &emsg)
Perform checks on the client username.
XrdProofdClientMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e)
Constructor.
std::list< XrdProofdClient * > fProofdClients
XrdProofdClient * GetClient(const char *usr, const char *grp=0, bool create=1)
Handle request for localizing a client instance for {usr, grp} from the list.
int Process(XrdProofdProtocol *p)
XrdProofdManager * fMgr
XrdSysPlugin * fSecPlugin
int RestoreAdminPath(XrdOucString &cpath, XrdOucString &emsg)
void Broadcast(XrdProofdClient *c, const char *msg)
Broadcast message 'msg' to the connected instances of client 'clnt' or to all connected instances if ...
void TerminateSessions(XrdProofdClient *c, const char *msg, int srvtype)
Terminate sessions of client 'clnt' or to of all clients if clnt == 0.
int ParsePreviousClients(XrdOucString &emsg)
Client entries for the clients still connected when the daemon terminated.
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
XrdSysRecMutex * fMutex
int MapClient(XrdProofdProtocol *xp, bool all=1)
Process a login request.
XrdProofdPipe * Pipe()
int DoDirectiveClientMgr(char *, XrdOucStream *, bool)
Process 'clientmgr' directive eg: xpd.clientmgr checkfq:120 activityto:600.
void RegisterDirectives()
Register directives for configuration.
int Login(XrdProofdProtocol *xp)
Process a login request.
XrdSecService * LoadSecurity()
Load security framework and plugins, if not already done.
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
static constexpr double pi