17 # include <sys/types.h>
47 TAFS *GetTAFS(
const char *
f,
const char *u,
Int_t lf) {
68 TString usr = (user && strlen(user) > 0) ? user :
"";
72 usr = (
const char *) u->
fUser;
75 Info(
"TAFS",
"user undefined");
86 if (!stat(fpw, &st)) {
92 if (
read(fd, pw, pwlen) != pwlen) {
101 Info(
"TAFS",
"could not read credentials from %s", fpw);
113 if (!
gROOT->IsBatch()) {
115 gROOT->GetPluginManager()->FindHandler(
"TGPasswdDialog")))
119 "could not load plugin for the password dialog box");
135 while (
gROOT->IsInterrupted())
138 if (isatty(0) != 0 && isatty(1) != 0) {
139 Gl_config(
"noecho", 1);
140 pw = Getline((
char *) prompt.
Data());
141 Gl_config(
"noecho", 0);
143 Warning(
"TAFS",
"not tty: cannot prompt for passwd: failure");
150 if (pw[strlen(pw)-1] ==
'\n')
151 pw[strlen(pw) - 1] = 0;
158 Info(
"TAFS",
"token acquisition failed: %s", emsg);
virtual ~TAFS()
Destructor.
double read(const std::string &file_name)
reading
TAFS(const char *fn=0, const char *usr=0, int life=-1)
Constructor: get AFS token for usr using credentials from file 'fpw'.
static Bool_t fgUsePwdDialog
Int_t Verify()
Return seconds to expiration (negative means expired)
static void SetUsePwdDialog(Bool_t on=kTRUE)
Switch on/off usage of password dialog box.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Int_t LoadPlugin()
Load the plugin library for this handler.
Long_t ExecPlugin(int nargs, const T &...params)
const char * Data() const
char * AFSLocalCell()
Returns a pointer to a string with the local cell.
static TPluginHandler * fgPasswdDialog
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
void * GetAFSToken(const char *usr, const char *pwd, int pwlen=-1, int life=DFLTTOKENLIFETIME, char **emsg=0)
Get AFS token for the local cell for 'usr'.
int VerifyAFSToken(void *token)
Verify validity an AFS token.
void DeleteAFSToken(void *token)
Delete an AFS token returned by a successful call to GetAFSToken.
R__EXTERN TSystem * gSystem
virtual void DispatchOneEvent(Bool_t pendingOnly=kFALSE)
Dispatch a single event.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.