XRootD
Loading...
Searching...
No Matches
XrdSysPriv.cc File Reference
#include "XrdSys/XrdSysPriv.hh"
#include <cstdio>
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysPwd.hh"
#include <unistd.h>
#include <pwd.h>
#include <cerrno>
+ Include dependency graph for XrdSysPriv.cc:

Go to the source code of this file.

Macros

#define NOGC   ((gid_t)(-1))
 
#define NOUC   ((uid_t)(-1))
 
#define XSPERR(x)   ((x == 0) ? -1 : -x)
 

Functions

static int getresgid (gid_t *r, gid_t *e, gid_t *)
 
static int getresuid (uid_t *r, uid_t *e, uid_t *)
 
static int setresgid (gid_t r, gid_t e, gid_t)
 
static int setresuid (uid_t r, uid_t e, uid_t)
 

Macro Definition Documentation

◆ NOGC

#define NOGC   ((gid_t)(-1))

Definition at line 52 of file XrdSysPriv.cc.

Referenced by setresgid().

◆ NOUC

#define NOUC   ((uid_t)(-1))

Definition at line 51 of file XrdSysPriv.cc.

Referenced by setresuid().

◆ XSPERR

#define XSPERR ( x)    ((x == 0) ? -1 : -x)

Definition at line 53 of file XrdSysPriv.cc.

Referenced by XrdSysPriv::ChangePerm(), setresgid(), and setresuid().

Function Documentation

◆ getresgid()

static int getresgid ( gid_t * r,
gid_t * e,
gid_t *  )
static

Definition at line 89 of file XrdSysPriv.cc.

90{
91 *r = getgid();
92 *e = getegid();
93 return 0;
94}

Referenced by XrdSysPriv::ChangePerm().

+ Here is the caller graph for this function:

◆ getresuid()

static int getresuid ( uid_t * r,
uid_t * e,
uid_t *  )
static

Definition at line 96 of file XrdSysPriv.cc.

97{
98 *r = getuid();
99 *e = geteuid();
100 return 0;
101}

Referenced by XrdSysPriv::ChangePerm().

+ Here is the caller graph for this function:

◆ setresgid()

static int setresgid ( gid_t r,
gid_t e,
gid_t  )
static

Definition at line 75 of file XrdSysPriv.cc.

76{
77 if (r != NOGC && setgid(r) == -1)
78 return XSPERR(errno);
79 return ((e != NOGC) ? setegid(e) : 0);
80}
#define XSPERR(x)
Definition XrdSysPriv.cc:53
#define NOGC
Definition XrdSysPriv.cc:52

References NOGC, and XSPERR.

Referenced by XrdSysPriv::ChangePerm().

+ Here is the caller graph for this function:

◆ setresuid()

static int setresuid ( uid_t r,
uid_t e,
uid_t  )
static

Definition at line 82 of file XrdSysPriv.cc.

83{
84 if (r != NOUC && setuid(r) == -1)
85 return XSPERR(errno);
86 return ((e != NOUC) ? seteuid(e) : 0);
87}
#define NOUC
Definition XrdSysPriv.cc:51

References NOUC, and XSPERR.

Referenced by XrdSysPriv::ChangePerm().

+ Here is the caller graph for this function: