Macro test authentication methods stand alone.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ +
+ TestAuth.C +
+ +
+ Test of authentication methods +
+ +
+ Syntax: +
+ +
+ .x TestAuth.C(<port>,"<user>") +
+ +
+ <port> = rootd port (default 1094) +
+ <user> = login user
name for the
test +
+ (default from getpwuid) +
+ +
+ >>> MAKE SURE that rootd is running <<< +
+ +
+ See $ROOTSYS/README/README.AUTH for additional details +
+ +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ +
+ Basic
test parameters: +
+ +
+ Local User is : ganis
+ Authentication
Details :
pt:0 ru:1 us:ganis
+ Current directory is : /home/ganis/local/root/root/tutorials
+ +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ +
+ Testing UsrPwd ... +
ganis@localhost password:
+ +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ +
+ Result of the tests: +
+ +
+ Method: 0 (UsrPwd): successful! (reuse: successful!) +
+ +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int TestAuth(int port = 1094, char *user = "")
{
Bool_t HaveMeth[6] = {1,0,0,0,0,1};
Int_t TestMeth[6] = {0,0,0,0,0,0};
Int_t TestReUse[6] = {3,3,3,3,3,3};
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("+ +\n");
printf("+ TestAuth.C +\n");
printf("+ +\n");
printf("+ Test of authentication methods +\n");
printf("+ +\n");
printf("+ Syntax: +\n");
printf("+ +\n");
printf("+ .x TestAuth.C(<port>,\"<user>\") +\n");
printf("+ +\n");
printf("+ <port> = rootd port (default 1094) +\n");
printf("+ <user> = login user name for the test +\n");
printf("+ (default from getpwuid) +\n");
printf("+ +\n");
printf("+ >>> MAKE SURE that rootd is running <<< +\n");
printf("+ +\n");
printf("+ See $ROOTSYS/README/README.AUTH for additional details +\n");
printf("+ +\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n");
if (User == "") {
if (!u) {
printf("\n >>>> 'user' not defined: please enter a valid username:\n");
char utmp[256] = {0};
scanf("%s",utmp);
if (strlen(utmp)) {
User = utmp;
} else {
printf(">>>> no 'user' defined: return!\n");
return 1;
}
} else {
}
}
printf("\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("+ +\n");
printf("+ Basic test parameters: +\n");
printf("+ +\n");
printf(
"+ Local User is : %s \n",User.
Data());
printf(
"+ Authentication Details : %s \n",
Details.Data());
printf(
"+ TFTP string : %s \n",TFTPPath.
Data());
printf("+ +\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
if (lDebug > 0)
printf("+ +\n");
printf("+ Testing UsrPwd ... +\n");
if (ha) {
} else {
}
if (lDebug > 0)
{
TestMeth[0] = 1;
} else {
printf(" >>>>>>>>>>>>>>>> Test of UsrPwd authentication failed \n");
}}
if (TestMeth[0] == 1) {
TestReUse[0] = 0;
if (OffSet > -1) {
TestReUse[0] = 1;
}
}
}
}
printf("+ +\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
if (lDebug > 0)
if (hasv1) {
} else {
}
if (hasv2) {
hak->Reset();
hak->Update(hasv2);
} else {
}
printf("\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("+ +\n");
printf("+ Result of the tests: +\n");
printf("+ +\n");
char status[4][20] = {"failed!","successful!","not testable","not tested"};
int i = 0;
for( i=0; i<6; i++ ) {
if (HaveMeth[i] && TestMeth[i] < 2) {
if (i < 5) {
printf("+ Method: %d %8s: %11s (reuse: %11s) +\n",i,
status[TestMeth[i]],status[TestReUse[i]]);
} else
printf("+ Method: %d %8s: %11s +\n",i,
status[TestMeth[i]]);
}
}
for( i=0; i<6; i++ ) {
if (HaveMeth[i] && TestMeth[i] > 1) {
if (NotPrinted) {
printf("+ +\n");
printf("+ Could not be tested: +\n");
printf("+ +\n");
}
printf("+ Method: %d %8s: %11s +\n",i,
status[TestMeth[i]]);
}
}
printf("+ +\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
}
winID h TVirtualViewer3D TVirtualGLPainter p
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
static void Show(Option_t *opt="S")
Print info about the authentication sector.
static Int_t ReadRootAuthrc()
Read authentication directives from $ROOTAUTHRC, $HOME/.rootauthrc or <Root_etc_dir>/system....
static TList * GetAuthInfo()
Static method returning the list with authentication details.
static const char * GetAuthMethod(Int_t idx)
Static method returning the method corresponding to idx.
static THostAuth * HasHostAuth(const char *host, const char *user, Option_t *opt="R")
Checks if a THostAuth with exact match for {host,user} exists in the fgAuthInfo list If opt = "P" use...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
void Reset()
Remove all methods, leaving Active status and list of associted TSceContexts unchanged.
void AddMethod(Int_t level, const char *details=nullptr)
Add method to the list.
void Print(Option_t *option="") const override
Print object content.
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
TList * Established() const
void Update(THostAuth *ha)
Update info with the one in ha Remaining methods, if any, get lower priority.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
const char * Data() const
virtual const char * HostName()
Return the system's host name.
virtual const char * WorkingDirectory()
Return working directory.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.