XRootD
Loading...
Searching...
No Matches
XrdSysPrivGuard Class Reference

#include <XrdSysPriv.hh>

+ Collaboration diagram for XrdSysPrivGuard:

Public Member Functions

 XrdSysPrivGuard (const char *user)
 
 XrdSysPrivGuard (uid_t uid, gid_t gid)
 
virtual ~XrdSysPrivGuard ()
 
bool Valid () const
 

Detailed Description

Definition at line 86 of file XrdSysPriv.hh.

Constructor & Destructor Documentation

◆ XrdSysPrivGuard() [1/2]

XrdSysPrivGuard::XrdSysPrivGuard ( uid_t uid,
gid_t gid )

Definition at line 340 of file XrdSysPriv.cc.

341{
342 // Constructor. Create a guard object for temporarily change to privileges
343 // of {'uid', 'gid'}
344
345 dum = 1;
346 valid = 0;
347
348 Init(uid, gid);
349}

◆ XrdSysPrivGuard() [2/2]

XrdSysPrivGuard::XrdSysPrivGuard ( const char * user)

Definition at line 352 of file XrdSysPriv.cc.

353{
354 // Constructor. Create a guard object for temporarily change to privileges
355 // of 'usr'
356
357 dum = 1;
358 valid = 0;
359
360#if !defined(WINDOWS)
361 if (usr && strlen(usr) > 0) {
362 struct passwd *pw;
363 XrdSysPwd thePwd(usr, &pw);
364 if (pw)
365 Init(pw->pw_uid, pw->pw_gid);
366 }
367#else
368 if (usr) { }
369#endif
370}

◆ ~XrdSysPrivGuard()

XrdSysPrivGuard::~XrdSysPrivGuard ( )
virtual

Definition at line 373 of file XrdSysPriv.cc.

374{
375 // Destructor. Restore state and unlock the global mutex.
376
377 if (!dum) {
378 XrdSysPriv::Restore();
379 XrdSysPriv::fgMutex.UnLock();
380 }
381}

Member Function Documentation

◆ Valid()

bool XrdSysPrivGuard::Valid ( ) const
inline

Definition at line 92 of file XrdSysPriv.hh.

92{ return valid; }

Referenced by XrdSecProtocolpwd::Authenticate(), and XrdSecProtocolpwd::Init().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: