XRootD
XrdFfsMisc.cc File Reference
#include <cstring>
#include <sys/types.h>
#include <iostream>
#include <libgen.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <ctime>
#include <pthread.h>
#include <cstdio>
#include <syslog.h>
#include "XrdNet/XrdNetAddr.hh"
#include "XrdNet/XrdNetUtils.hh"
#include "XrdOuc/XrdOucECMsg.hh"
#include "XrdPosix/XrdPosixAdmin.hh"
#include "XrdSec/XrdSecEntity.hh"
#include "XrdSecsss/XrdSecsssID.hh"
#include "XrdFfs/XrdFfsDent.hh"
#include "XrdFfs/XrdFfsFsinfo.hh"
#include "XrdFfs/XrdFfsMisc.hh"
#include "XrdFfs/XrdFfsPosix.hh"
#include "XrdFfs/XrdFfsQueue.hh"
#include "XrdPosix/XrdPosixConfig.hh"
+ Include dependency graph for XrdFfsMisc.cc:

Go to the source code of this file.

Macros

#define _FILE_OFFSET_BITS   64
 
#define MAXROOTURLLEN   1024
 
#define nXrdConnPerUsr   8;
 

Functions

void decTo24 (unsigned int d, char *d24)
 
char * ntoa24 (unsigned int d)
 
void toChar (unsigned int r, char *d24)
 
int XrdFfsMisc_get_all_urls (const char *oldurl, char **newurls, const int nnodes)
 
int XrdFfsMisc_get_all_urls_real (const char *oldurl, char **newurls, const int nnodes)
 
char XrdFfsMisc_get_current_url (const char *oldurl, char *newurl)
 
int XrdFfsMisc_get_list_of_data_servers (char *list)
 
int XrdFfsMisc_get_number_of_data_servers ()
 
char * XrdFfsMisc_getNameByAddr (char *ipaddr)
 
void XrdFfsMisc_logging_url_cache (const char *url)
 
void XrdFfsMisc_refresh_url_cache (const char *url)
 
void XrdFfsMisc_set_Urlcachelife (const char *urlcachelife)
 
void XrdFfsMisc_xrd_init (const char *rdrurl, const char *urlcachelife, int startQueue)
 
void XrdFfsMisc_xrd_secsss_editurl (char *url, uid_t user_uid, int *id)
 
void XrdFfsMisc_xrd_secsss_init ()
 
void XrdFfsMisc_xrd_secsss_register (uid_t user_uid, gid_t user_gid, int *id)
 

Variables

short iXrdConnPerUsr = 0
 
pthread_mutex_t url_mlock
 
char XrdFfsMiscCururl [MAXROOTURLLEN] = ""
 
int XrdFfsMiscNcachedurls = 0
 
bool XrdFfsMiscSecsss = false
 
XrdSecsssIDXrdFfsMiscSssid
 
char * XrdFfsMiscUrlcache [XrdFfs_MAX_NUM_NODES]
 
pthread_mutex_t XrdFfsMiscUrlcache_mutex = PTHREAD_MUTEX_INITIALIZER
 
time_t XrdFfsMiscUrlcachelife = 60
 
time_t XrdFfsMiscUrlcachetime = 0
 

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

Definition at line 30 of file XrdFfsMisc.cc.

◆ MAXROOTURLLEN

#define MAXROOTURLLEN   1024

Definition at line 62 of file XrdFfsMisc.cc.

◆ nXrdConnPerUsr

#define nXrdConnPerUsr   8;

Definition at line 64 of file XrdFfsMisc.cc.

Function Documentation

◆ decTo24()

void decTo24 ( unsigned int  d,
char *  d24 
)

Definition at line 351 of file XrdFfsMisc.cc.

352 {
353  unsigned int r = d % 24;
354  toChar(r, d24);
355  if ((d - r) != 0) decTo24((d-r)/24, d24);
356  return;
357 }
void decTo24(unsigned int d, char *d24)
Definition: XrdFfsMisc.cc:351
void toChar(unsigned int r, char *d24)
Definition: XrdFfsMisc.cc:341

References toChar().

Referenced by ntoa24().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntoa24()

char* ntoa24 ( unsigned int  d)

Definition at line 359 of file XrdFfsMisc.cc.

359  { // caller is repsonsible to free the memory
360  char *d24 = (char*) malloc(9);
361  memset(d24, 0, 9);
362  decTo24(d, d24);
363  return d24;
364 }

References decTo24().

Referenced by XrdFfsMisc_xrd_secsss_editurl(), and XrdFfsMisc_xrd_secsss_register().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toChar()

void toChar ( unsigned int  r,
char *  d24 
)

Definition at line 341 of file XrdFfsMisc.cc.

342 {
343  const char alpha[] = "0123456789abcdefghijklmn";
344  char tmp[8];
345  memcpy(tmp, d24, 8);
346  memcpy(d24+1, tmp, 8);
347  d24[0] = alpha[r];
348  return;
349 }

Referenced by decTo24().

+ Here is the caller graph for this function:

◆ XrdFfsMisc_get_all_urls()

int XrdFfsMisc_get_all_urls ( const char *  oldurl,
char **  newurls,
const int  nnodes 
)

Definition at line 172 of file XrdFfsMisc.cc.

173 {
174  time_t currtime;
175  int i, nurls;
176 
177  pthread_mutex_lock(&XrdFfsMiscUrlcache_mutex);
178 
179  currtime = time(NULL);
180 /* setting the cache to effectively not expire will let us know if a host is down */
181  if (XrdFfsMiscCururl[0] == '\0' ||
183  strcmp(XrdFfsMiscCururl, oldurl) != 0)
184  {
185  for (i = 0; i < XrdFfsMiscNcachedurls; i++)
186  if (XrdFfsMiscUrlcache[i] != NULL) free(XrdFfsMiscUrlcache[i]);
187  for (i = 0; i < XrdFfs_MAX_NUM_NODES; i++)
188  XrdFfsMiscUrlcache[i] = (char*) malloc(MAXROOTURLLEN);
189 
190  XrdFfsMiscUrlcachetime = currtime;
191  strcpy(XrdFfsMiscCururl, oldurl);
193  for (i = XrdFfsMiscNcachedurls; i < XrdFfs_MAX_NUM_NODES; i++)
194  if (XrdFfsMiscUrlcache[i] != NULL) free(XrdFfsMiscUrlcache[i]);
195  }
196 
197  nurls = XrdFfsMiscNcachedurls;
198  for (i = 0; i < nurls; i++)
199  {
200  newurls[i] = (char*) malloc(MAXROOTURLLEN);
201  strncpy(newurls[i], XrdFfsMiscUrlcache[i], MAXROOTURLLEN -1);
202  newurls[i][MAXROOTURLLEN-1] = '\0';
203  }
204 
205  pthread_mutex_unlock(&XrdFfsMiscUrlcache_mutex);
206  return nurls;
207 }
char * XrdFfsMiscUrlcache[XrdFfs_MAX_NUM_NODES]
Definition: XrdFfsMisc.cc:126
pthread_mutex_t XrdFfsMiscUrlcache_mutex
Definition: XrdFfsMisc.cc:129
int XrdFfsMiscNcachedurls
Definition: XrdFfsMisc.cc:127
time_t XrdFfsMiscUrlcachetime
Definition: XrdFfsMisc.cc:128
int XrdFfsMisc_get_all_urls_real(const char *oldurl, char **newurls, const int nnodes)
Definition: XrdFfsMisc.cc:103
char XrdFfsMiscCururl[MAXROOTURLLEN]
Definition: XrdFfsMisc.cc:125
#define MAXROOTURLLEN
Definition: XrdFfsMisc.cc:62
time_t XrdFfsMiscUrlcachelife
Definition: XrdFfsMisc.cc:130
#define XrdFfs_MAX_NUM_NODES
Definition: XrdFfsMisc.hh:34

References MAXROOTURLLEN, XrdFfs_MAX_NUM_NODES, XrdFfsMisc_get_all_urls_real(), XrdFfsMiscCururl, XrdFfsMiscNcachedurls, XrdFfsMiscUrlcache, XrdFfsMiscUrlcache_mutex, XrdFfsMiscUrlcachelife, and XrdFfsMiscUrlcachetime.

Referenced by XrdFfsMisc_refresh_url_cache(), XrdFfsPosix_deleteall(), XrdFfsPosix_readdirall(), XrdFfsPosix_renameall(), XrdFfsPosix_statall(), XrdFfsPosix_statvfsall(), and XrdFfsPosix_truncateall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdFfsMisc_get_all_urls_real()

int XrdFfsMisc_get_all_urls_real ( const char *  oldurl,
char **  newurls,
const int  nnodes 
)

Definition at line 103 of file XrdFfsMisc.cc.

104 {
106  XrdPosixAdmin adm(oldurl,ecMsg);
107  XrdCl::URL *uVec;
108  int i, rval = 0;
109 
110  if (!adm.isOK() || !(uVec = adm.FanOut(rval))) return -1;
111 
112  if (rval > nnodes) rval = -1;
113  else for (i = 0; i < rval; i++)
114  { strncpy(newurls[i], uVec[i].GetURL().c_str(), MAXROOTURLLEN -1); newurls[i][MAXROOTURLLEN -1] = '\0'; }
115 
116  delete [] uVec;
117  return rval;
118 }
URL representation.
Definition: XrdClURL.hh:31
thread_local XrdOucECMsg ecMsg

References XrdPosixGlobals::ecMsg, XrdPosixAdmin::FanOut(), XrdPosixAdmin::isOK(), and MAXROOTURLLEN.

Referenced by XrdFfsMisc_get_all_urls().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdFfsMisc_get_current_url()

char XrdFfsMisc_get_current_url ( const char *  oldurl,
char *  newurl 
)

Definition at line 68 of file XrdFfsMisc.cc.

69 {
70  struct stat stbuf;
71 
72 /* if it is a directory, return oldurl */
73  if (XrdFfsPosix_stat(oldurl, &stbuf) == 0 && S_ISDIR(stbuf.st_mode))
74  {
75  strcpy(newurl, oldurl);
76  return 1;
77  }
78 
80  XrdPosixAdmin adm(oldurl,ecMsg);
81  if (adm.isOK() && adm.Stat())
82  {
83 // We might have been redirected to a destination server. Better
84 // to remember it and use only this one as output.
85 // if (stat && adm->GetCurrentUrl().IsValid())
86 // {
87 // strcpy(newurl, adm->GetCurrentUrl().GetUrl().c_str());
88 // delete adm;
89  strcpy(newurl, oldurl); // This needs to change!!!
90  return 1;
91  }
92  return 0;
93 }
int XrdFfsPosix_stat(const char *path, struct stat *buf)
Definition: XrdFfsPosix.cc:66
int stat(const char *path, struct stat *buf)

References XrdPosixGlobals::ecMsg, XrdPosixAdmin::isOK(), stat(), XrdPosixAdmin::Stat(), and XrdFfsPosix_stat().

+ Here is the call graph for this function:

◆ XrdFfsMisc_get_list_of_data_servers()

int XrdFfsMisc_get_list_of_data_servers ( char *  list)

Definition at line 209 of file XrdFfsMisc.cc.

210 {
211  XrdNetAddr uAddr;
212  int i, n = 0;
213  const char *netName;
214  const char *hName, *hNend, *hPort, *hPend;
215  char *url, *rc, *hostip, hsep;
216 
217  rc = (char*)malloc(sizeof(char) * XrdFfs_MAX_NUM_NODES * MAXROOTURLLEN);
218  rc[0] = '\0';
219  pthread_mutex_lock(&XrdFfsMiscUrlcache_mutex);
220  for (i = 0; i < XrdFfsMiscNcachedurls; i++)
221  {
222  url = strdup(XrdFfsMiscUrlcache[i]);
223  hostip = &url[7];
224  if (XrdNetUtils::Parse(hostip, &hName, &hNend, &hPort, &hPend))
225  {n++;
226  hsep = *hNend;
227  hostip[hNend-hostip] = 0;
228  hostip[hPend-hostip] = 0;
229  if (uAddr.Set(hName,0) || !(netName = uAddr.Name()))
230  {hostip[hNend-hostip] = hsep;
231  hName = hostip;
232  hPend = hNend;
233  }
234  strcat(rc, hName);
235  if (hPort != hNend)
236  {strcat(rc, ":");
237  strcat(rc, hPort);
238  }
239  strcat(rc, "\n");
240  }
241  free(url);
242  }
243  pthread_mutex_unlock(&XrdFfsMiscUrlcache_mutex);
244  strcpy(list, rc);
245  free(rc);
246  return n;
247 }
const char * Name(const char *eName=0, const char **eText=0)
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition: XrdNetAddr.cc:216
static bool Parse(const char *hSpec, const char **hName, const char **hNend, const char **hPort, const char **hPend)
Definition: XrdNetUtils.cc:745

References MAXROOTURLLEN, XrdNetAddrInfo::Name(), XrdNetUtils::Parse(), XrdNetAddr::Set(), XrdFfs_MAX_NUM_NODES, XrdFfsMiscNcachedurls, XrdFfsMiscUrlcache, and XrdFfsMiscUrlcache_mutex.

Referenced by XrdFfsMisc_logging_url_cache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdFfsMisc_get_number_of_data_servers()

int XrdFfsMisc_get_number_of_data_servers ( )

Definition at line 132 of file XrdFfsMisc.cc.

133 {
134  return XrdFfsMiscNcachedurls;
135 }

References XrdFfsMiscNcachedurls.

Referenced by XrdFfsPosix_statall().

+ Here is the caller graph for this function:

◆ XrdFfsMisc_getNameByAddr()

char* XrdFfsMisc_getNameByAddr ( char *  ipaddr)

Definition at line 95 of file XrdFfsMisc.cc.

96 {
97  XrdNetAddr netAddr;
98  const char *theName;
99  if (netAddr.Set(ipaddr,0) || !(theName = netAddr.Name())) theName = ipaddr;
100  return strdup(theName);
101 }

References XrdNetAddrInfo::Name(), and XrdNetAddr::Set().

+ Here is the call graph for this function:

◆ XrdFfsMisc_logging_url_cache()

void XrdFfsMisc_logging_url_cache ( const char *  url)

Definition at line 273 of file XrdFfsMisc.cc.

274 {
275  int i;
276  char *hostlist, *p1, *p2;
277 
278  if (url != NULL) XrdFfsMisc_refresh_url_cache(url);
279 
280  hostlist = (char*) malloc(sizeof(char) * XrdFfs_MAX_NUM_NODES * 256);
282 
283  syslog(LOG_INFO, "INFO: use the following %d data servers :", i);
284  p1 = hostlist;
285  p2 = strchr(p1, '\n');
286  while (p2 != NULL)
287  {
288  p2[0] = '\0';
289  syslog(LOG_INFO, " %s", p1);
290  p1 = p2 +1;
291  p2 = strchr(p1, '\n');
292  }
293  free(hostlist);
294 }
int XrdFfsMisc_get_list_of_data_servers(char *list)
Definition: XrdFfsMisc.cc:209
void XrdFfsMisc_refresh_url_cache(const char *url)
Definition: XrdFfsMisc.cc:249

References XrdFfs_MAX_NUM_NODES, XrdFfsMisc_get_list_of_data_servers(), and XrdFfsMisc_refresh_url_cache().

Referenced by XrdFfsMisc_xrd_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdFfsMisc_refresh_url_cache()

void XrdFfsMisc_refresh_url_cache ( const char *  url)

Definition at line 249 of file XrdFfsMisc.cc.

250 {
251  int i, nurls;
252  char *surl, **turls;
253 
254  turls = (char**) malloc(sizeof(char*) * XrdFfs_MAX_NUM_NODES);
255 
256 // invalid the cache first
257  pthread_mutex_lock(&XrdFfsMiscUrlcache_mutex);
259  pthread_mutex_unlock(&XrdFfsMiscUrlcache_mutex);
260 
261  if (url != NULL)
262  surl = strdup(url);
263  else
264  surl = strdup(XrdFfsMiscCururl);
265 
266  nurls = XrdFfsMisc_get_all_urls(surl, turls, XrdFfs_MAX_NUM_NODES);
267 
268  free(surl);
269  for (i = 0; i < nurls; i++) free(turls[i]);
270  free(turls);
271 }
int XrdFfsMisc_get_all_urls(const char *oldurl, char **newurls, const int nnodes)
Definition: XrdFfsMisc.cc:172

References XrdFfs_MAX_NUM_NODES, XrdFfsMisc_get_all_urls(), XrdFfsMiscCururl, XrdFfsMiscUrlcache_mutex, and XrdFfsMiscUrlcachetime.

Referenced by XrdFfsMisc_logging_url_cache(), and XrdFfsMisc_xrd_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdFfsMisc_set_Urlcachelife()

void XrdFfsMisc_set_Urlcachelife ( const char *  urlcachelife)

Definition at line 137 of file XrdFfsMisc.cc.

138 {
139  int t, len;
140  char *life = strdup(urlcachelife);
141  char last = 's';
142 
143  if (life == NULL) return;
144 
145  len = strlen(life);
146  if (! isdigit(life[len-1]))
147  {
148  last = life[len-1];
149  life[len-1] = '\0';
150  }
151  sscanf(life, "%d", &t);
152  XrdFfsMiscUrlcachelife = (time_t) t;
153  life[len-1] = last;
154  switch (last)
155  {
156  case 'm': /* minute */
158  break;
159  case 'h': /* hour */
160  XrdFfsMiscUrlcachelife *= 3600;
161  break;
162  case 'd': /* day */
163  XrdFfsMiscUrlcachelife *= 3600*24;
164  break;
165  default: /* second */
166  ;
167  }
168  free(life);
169  return;
170 }

References XrdFfsMiscUrlcachelife.

Referenced by XrdFfsMisc_xrd_init().

+ Here is the caller graph for this function:

◆ XrdFfsMisc_xrd_init()

void XrdFfsMisc_xrd_init ( const char *  rdrurl,
const char *  urlcachelife,
int  startQueue 
)

Definition at line 296 of file XrdFfsMisc.cc.

297 {
298  static int OneTimeInitDone = 0;
299 
300 // Do not execute this more than once
301 //
302  if (OneTimeInitDone) return;
303  OneTimeInitDone = 1;
304 
305 // EnvPutInt(NAME_FIRSTCONNECTMAXCNT,2);
306 // EnvPutInt(NAME_DATASERVERCONN_TTL, 99999999);
307 // EnvPutInt(NAME_LBSERVERCONN_TTL, 99999999);
308 // EnvPutInt(NAME_READAHEADSIZE,0);
309 // EnvPutInt(NAME_READCACHESIZE,0);
310 // EnvPutInt(NAME_REQUESTTIMEOUT, 30);
311  XrdPosixConfig::SetEnv("WorkerThreads", 50);
312 
313  if (getenv("XROOTDFS_SECMOD") != NULL && !strcmp(getenv("XROOTDFS_SECMOD"), "sss"))
315 
316  openlog("XrootdFS", LOG_ODELAY | LOG_PID, LOG_DAEMON);
317 
318  XrdFfsMisc_set_Urlcachelife(urlcachelife);
321 
322 #ifndef NOUSE_QUEUE
323  if (startQueue)
324  {
325  if (getenv("XROOTDFS_NWORKERS") != NULL)
326  XrdFfsQueue_create_workers(atoi(getenv("XROOTDFS_NWORKERS")));
327  else
329 
330  syslog(LOG_INFO, "INFO: Starting %d workers", XrdFfsQueue_count_workers());
331  }
332 #endif
333 
334  pthread_mutex_init(&url_mlock, NULL);
335 
337 }
void XrdFfsDent_cache_init()
Definition: XrdFfsDent.cc:207
void XrdFfsMisc_set_Urlcachelife(const char *urlcachelife)
Definition: XrdFfsMisc.cc:137
void XrdFfsMisc_logging_url_cache(const char *url)
Definition: XrdFfsMisc.cc:273
void XrdFfsMisc_xrd_secsss_init()
Definition: XrdFfsMisc.cc:371
pthread_mutex_t url_mlock
Definition: XrdFfsMisc.cc:66
int XrdFfsQueue_count_workers()
Definition: XrdFfsQueue.cc:254
int XrdFfsQueue_create_workers(int n)
Definition: XrdFfsQueue.cc:192
static void SetEnv(const char *kword, int kval)

References XrdPosixConfig::SetEnv(), url_mlock, XrdFfsDent_cache_init(), XrdFfsMisc_logging_url_cache(), XrdFfsMisc_refresh_url_cache(), XrdFfsMisc_set_Urlcachelife(), XrdFfsMisc_xrd_secsss_init(), XrdFfsQueue_count_workers(), and XrdFfsQueue_create_workers().

+ Here is the call graph for this function:

◆ XrdFfsMisc_xrd_secsss_editurl()

void XrdFfsMisc_xrd_secsss_editurl ( char *  url,
uid_t  user_uid,
int *  id 
)

Definition at line 424 of file XrdFfsMisc.cc.

425 {
426  char user_num[9], nurl[MAXROOTURLLEN], *tmp;
427 
428 // Xrootd proxy also use some of the stat()/unlink(), etc funcitons here, without user "sss". It use the default
429 // connection login name. Don't change this behavior. (so for proxy, use no "sss", and always have *id = 0
430  if (id != NULL || XrdFfsMiscSecsss)
431  {
432  tmp = ntoa24(user_uid);
433  memcpy(user_num, tmp, 9);
434  free(tmp);
435  if (id == NULL) user_num[strlen(user_num)] = 48;
436  else user_num[strlen(user_num)] = *id + 48;
437 
438  nurl[0] = '\0';
439  strncat(nurl, "root://", 8);
440  strncat(nurl, user_num, 9);
441  strncat(nurl, "@", 2);
442  strncat(nurl, &(url[7]), MAXROOTURLLEN-17);
443  strncpy(url, nurl, MAXROOTURLLEN);
444  }
445 }
bool XrdFfsMiscSecsss
Definition: XrdFfsMisc.cc:369
char * ntoa24(unsigned int d)
Definition: XrdFfsMisc.cc:359

References MAXROOTURLLEN, ntoa24(), and XrdFfsMiscSecsss.

Referenced by XrdFfsPosix_deleteall(), XrdFfsPosix_readdirall(), XrdFfsPosix_renameall(), XrdFfsPosix_statall(), and XrdFfsPosix_truncateall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdFfsMisc_xrd_secsss_init()

void XrdFfsMisc_xrd_secsss_init ( )

Definition at line 371 of file XrdFfsMisc.cc.

372 {
373  XrdFfsMiscSecsss = true;
375 
376 /* Enforce "sss" security */
377  setenv("XrdSecPROTOCOL", "sss", 1);
378 }
XrdSecsssID * XrdFfsMiscSssid
Definition: XrdFfsMisc.cc:368

References XrdSecsssID::idDynamic, XrdFfsMiscSecsss, and XrdFfsMiscSssid.

Referenced by XrdFfsMisc_xrd_init().

+ Here is the caller graph for this function:

◆ XrdFfsMisc_xrd_secsss_register()

void XrdFfsMisc_xrd_secsss_register ( uid_t  user_uid,
gid_t  user_gid,
int *  id 
)

Definition at line 380 of file XrdFfsMisc.cc.

381 {
382  struct passwd pw, *pwp;
383  struct group gr, *grp;
384  char user_num[9], *pwbuf, *grbuf, *tmp;
385  static size_t pwbuflen = 0;
386  static size_t grbuflen = 0;
387 
388  if (pwbuflen == 0) pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
389  if (grbuflen == 0) grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
390 
391  XrdSecEntity XrdFfsMiscUent("");
392 
393  tmp = ntoa24((unsigned int)user_uid);
394  memcpy(user_num, tmp, 9);
395  free(tmp);
396 
397  if (id != NULL) {
398  pthread_mutex_lock(&url_mlock);
399  *id = iXrdConnPerUsr +1; // id = 1 to nXrdConnPerUsr+1 (8)
401  pthread_mutex_unlock(&url_mlock);
402  user_num[strlen(user_num)] = *id + 48; // this require that *id stay as single digit.
403  }
404  else
405  user_num[strlen(user_num)] = 48; // id = NULL
406 
407  if (XrdFfsMiscSecsss)
408  {
409  pwbuf = (char*) malloc(pwbuflen);
410  getpwuid_r(user_uid, &pw, pwbuf, pwbuflen, &pwp);
411  grbuf = (char*) malloc(grbuflen);
412  getgrgid_r(user_gid, &gr, grbuf, grbuflen, &grp);
413 
414  XrdFfsMiscUent.name = pw.pw_name;
415  XrdFfsMiscUent.grps = gr.gr_name;
416  XrdFfsMiscUent.uid = user_uid;
417  XrdFfsMiscUent.gid = user_gid;
418  XrdFfsMiscSssid->Register(user_num, &XrdFfsMiscUent, 0);
419  free(pwbuf);
420  free(grbuf);
421  }
422 }
#define nXrdConnPerUsr
Definition: XrdFfsMisc.cc:64
short iXrdConnPerUsr
Definition: XrdFfsMisc.cc:65
bool Register(const char *lgnid, const XrdSecEntity *Ident, bool doReplace=false, bool defer=false)
Definition: XrdSecsssID.cc:224

References XrdSecEntity::gid, XrdSecEntity::grps, iXrdConnPerUsr, XrdSecEntity::name, ntoa24(), nXrdConnPerUsr, XrdSecsssID::Register(), XrdSecEntity::uid, url_mlock, XrdFfsMiscSecsss, and XrdFfsMiscSssid.

+ Here is the call graph for this function:

Variable Documentation

◆ iXrdConnPerUsr

short iXrdConnPerUsr = 0

Definition at line 65 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_xrd_secsss_register().

◆ url_mlock

pthread_mutex_t url_mlock

Definition at line 66 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_xrd_init(), and XrdFfsMisc_xrd_secsss_register().

◆ XrdFfsMiscCururl

char XrdFfsMiscCururl[MAXROOTURLLEN] = ""

Definition at line 125 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_get_all_urls(), and XrdFfsMisc_refresh_url_cache().

◆ XrdFfsMiscNcachedurls

int XrdFfsMiscNcachedurls = 0

◆ XrdFfsMiscSecsss

bool XrdFfsMiscSecsss = false

◆ XrdFfsMiscSssid

XrdSecsssID* XrdFfsMiscSssid

Definition at line 368 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_xrd_secsss_init(), and XrdFfsMisc_xrd_secsss_register().

◆ XrdFfsMiscUrlcache

char* XrdFfsMiscUrlcache[XrdFfs_MAX_NUM_NODES]

Definition at line 126 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_get_all_urls(), and XrdFfsMisc_get_list_of_data_servers().

◆ XrdFfsMiscUrlcache_mutex

pthread_mutex_t XrdFfsMiscUrlcache_mutex = PTHREAD_MUTEX_INITIALIZER

◆ XrdFfsMiscUrlcachelife

time_t XrdFfsMiscUrlcachelife = 60

Definition at line 130 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_get_all_urls(), and XrdFfsMisc_set_Urlcachelife().

◆ XrdFfsMiscUrlcachetime

time_t XrdFfsMiscUrlcachetime = 0

Definition at line 128 of file XrdFfsMisc.cc.

Referenced by XrdFfsMisc_get_all_urls(), and XrdFfsMisc_refresh_url_cache().