22 #include "RConfigure.h" 52 Create(host, user, nmeth, authmeth, details);
65 Create(host, user, nmeth, authmeth, details);
76 const char *details) :
TObject()
78 Create(host, user, 1, &authmeth, (
char **)&details);
89 Create(host, user, 1, &authmeth, (
char **)&details);
101 Int_t *authmeth,
char **details)
124 else if (srv ==
"1" || srv.
BeginsWith(
"root"))
126 else if (srv ==
"2" || srv.
BeginsWith(
"proof"))
153 for (i = 0; i <
kMAXSEC; i++) {
169 if (details && details[i] && strlen(details[i]) > 0) {
199 char *tmp =
new char[strlen(asstring)+1];
200 strncpy(tmp,asstring,strlen(asstring));
201 tmp[strlen(asstring)] = 0;
212 fNmet =
TString((
const char *)strtok(0,
" "));
226 sscanf(det.
Data(),
"%10s",cmet);
227 Int_t met = atoi(cmet);
228 if (met > -1 && met <
kMAXSEC) {
230 while (det.
First(
' ') == 0)
241 for (i = fNumMethods; i <
kMAXSEC ; i++) {
282 if (meth < 0 || meth >=
kMAXSEC)
return;
294 if (details && strlen(details) > 0) {
378 Info(
"GetDetails",
" %d: returning fDetails[%d]: %s",
382 static const char *empty =
" ";
409 if (details && strlen(details) > 0) {
428 char srvnam[5][8] = {
"any",
"sockd",
"rootd",
"proofd",
"???" };
434 "%s +------------------------------------------------------------------+",proc);
435 Info(
"Print",
"%s + Host:%s - srv:%s - User:%s - # of available methods:%d",
439 Info(
"Print",
"%s + Method: %d (%s) Ok:%d Ko:%d Dets:%s", proc,
444 "%s +------------------------------------------------------------------+",proc);
452 Info(
"PrintEstablished",
453 "+------------------------------------------------------------------------------+");
454 Info(
"PrintEstablished",
"+ Host:%s - Number of active sec contexts: %d",
468 Info(
"PrintEstablished",
469 "+------------------------------------------------------------------------------+");
486 for ( ; j < nmet; j++) {
494 }
else if (fmet[j] >= 0 && fmet[j] <
kMAXSEC) {
495 tMethods[j] = fmet[j];
499 tDetails[j] = (
const char *)tmp;
502 Warning(
"ReOrder",
"Method id out of range (%d) - skipping",fmet[j]);
507 Int_t k = nmet, i = 0;
569 for (i = 0; i < tNumMethods; i++) {
677 if (details && strlen(details) > 0) {
727 const char *details,
const char *token,
731 token, expdate, sctx, key);
void SetDetails(Int_t level, const char *details)
Set authentication details for specified level.
TString fDetails[kMAXSEC]
void AsString(TString &out) const
Return a static string with all info in a serialized form.
THostAuth()
Default constructor.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void PrintEstablished() const
Print info about established authentication vis-a-vis of this Host.
virtual void Print(Option_t *option="F") const
If opt is "F" (default) print object content.
const char * GetHostName() const
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
const char * GetProtocol() const
This class represents an Internet Protocol (IP) address.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
const char * GetDetails(Int_t level)
Return authentication details for specified level or "" if the specified level does not exist for thi...
static char * GetDefaultDetails(Int_t method, Int_t opt, const char *user)
Determine default authentication details for method 'sec' and user 'usr'.
void CountFailure(Int_t level)
Count failures for 'method'.
Bool_t HasMethod(Int_t level, Int_t *pos=0)
Return kTRUE if method 'level' is in the list.
const char * GetUser() const
Int_t GetSuccess(Int_t idx) const
void CountSuccess(Int_t level)
Count successes for 'method'.
Bool_t IsActive() const
Check remote OffSet and expiring Date.
void Create(const char *host, const char *user, Int_t nmeth=0, Int_t *authmeth=0, char **details=0)
Create hostauth object.
TList * Established() const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Ssiz_t First(char c) const
Find first occurrence of a character c.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
Int_t GetFailure(Int_t idx) const
R__EXTERN TSystem * gSystem
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
char * Form(const char *fmt,...)
void AddMethod(Int_t level, const char *details=0)
Add method to the list.
TString & Remove(Ssiz_t pos)
TRootSecContext * CreateSecContext(const char *user, const char *host, Int_t meth, Int_t offset, const char *details, const char *token, TDatime expdate=kROOTTZERO, void *ctx=0, Int_t key=-1)
Create a Security context and add it to local list Return pointer to it to be stored in TAuthenticate...
Ssiz_t Last(char c) const
Find last occurrence of a character c.
const char * GetHost() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Int_t GetMethod(Int_t idx) const
void ReOrder(Int_t nmet, Int_t *fmet)
Reorder nmet methods according fmet[nmet].
Mother of all ROOT objects.
virtual ~THostAuth()
The dtor.
void SetFirst(Int_t level)
Set 'method' to be the first used (if in the list ...).
virtual void Add(TObject *obj)
void Update(THostAuth *ha)
Update info with the one in ha Remaining methods, if any, get lower priority.
const char * GetDetailsByIdx(Int_t idx) const
void SetLast(Int_t level)
Set 'method' to be the last used (if in the list ...).
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
void AddFirst(Int_t level, const char *details=0)
Add new method in first position If already in the list, set as first method 'level' with authenticat...
virtual void Print(Option_t *option="") const
Print object content.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
const char * Data() const
static const char * GetAuthMethod(Int_t idx)
Static method returning the method corresponding to idx.
void Reset()
Remove all methods, leaving Active status and list of associted TSceContexts unchanged.