Secure.cpp File Reference

#include "blocxx/BLOCXX_config.h"
#include "blocxx/Array.hpp"
#include "blocxx/Secure.hpp"
#include "blocxx/FileSystem.hpp"
#include "blocxx/String.hpp"
#include "blocxx/Paths.hpp"
#include "blocxx/Format.hpp"
#include "blocxx/LazyGlobal.hpp"
#include <dirent.h>
#include <fcntl.h>
#include <grp.h>
#include <limits.h>
#include <pwd.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstdlib>
#include <cstdio>
#include <cerrno>
#include <vector>
#include <algorithm>

Go to the source code of this file.

Namespaces

namespace  BLOCXX_NAMESPACE
namespace  BLOCXX_NAMESPACE::Secure

Defines

#define THRBLOCXX_IF(tst, ExceptionClass, msg)
#define THRBLOCXX_ERRNO_IF(tst, ExceptionClass, msg)
#define ABORT_IF(tst, msg)   THRBLOCXX_IF((tst), Secure::ProcessAbortException, (msg))
#define ABORT_ERRNO_IF(tst, msg)   THRBLOCXX_ERRNO_IF((tst), Secure::ProcessAbortException, (msg))

Functions

int setresgid (gid_t rgid, gid_t egid, gid_t sgid)
int setresuid (uid_t ruid, uid_t euid, uid_t suid)
void BLOCXX_NAMESPACE::Secure::dropPrivilegesPermanently (::uid_t newuid,::gid_t newgid, EChildGroupAction extendedGroupAction)
void BLOCXX_NAMESPACE::Secure::addPlatformSpecificEnvVars (StringArray &absEnvironment)
StringArray BLOCXX_NAMESPACE::Secure::minimalEnvironment ()
void BLOCXX_NAMESPACE::Secure::runAs (char const *username, EChildGroupAction extendedGroupAction=E_SOURCE_EXTENDED_GROUPS)
 Look up user ID and group ID for username in password file, chdir to "/", then drop privileges and run with that user ID and group ID.

Variables

LazyGlobal< StringArray, int,
MinimalEnvironmentConstructor > 
BLOCXX_NAMESPACE::Secure::g_minimalEnvironment = { 0 , 0, {0, PTHREAD_MUTEX_INITIALIZER} }


Define Documentation

#define ABORT_ERRNO_IF ( tst,
msg   )     THRBLOCXX_ERRNO_IF((tst), Secure::ProcessAbortException, (msg))

#define ABORT_IF ( tst,
msg   )     THRBLOCXX_IF((tst), Secure::ProcessAbortException, (msg))

#define THRBLOCXX_ERRNO_IF ( tst,
ExceptionClass,
msg   ) 

Value:

do \
   { \
      if (tst) \
      { \
         BLOCXX_THROW_ERRNO_MSG(ExceptionClass, (msg)); \
      } \
   } while (false)

Definition at line 94 of file Secure.cpp.

#define THRBLOCXX_IF ( tst,
ExceptionClass,
msg   ) 

Value:

do \
   { \
      if (tst) \
      { \
         BLOCXX_THROW(ExceptionClass, (msg)); \
      } \
   } while (false)

Definition at line 85 of file Secure.cpp.


Function Documentation

int setresgid ( gid_t  rgid,
gid_t  egid,
gid_t  sgid 
)

int setresuid ( uid_t  ruid,
uid_t  euid,
uid_t  suid 
)


Generated on Wed Feb 25 19:05:00 2009 for blocxx by  doxygen 1.5.6