X-Git-Url: http://git.home-dn.net/?p=manu%2Fsuphp.git;a=blobdiff_plain;f=src%2FAPI_Linux.hpp;h=74db0e4f77038a69a25e073fbe0245eca1e6577c;hp=a547d40dba6d2960c11ffe95a86a88bf9a82d65b;hb=849f4a7977b5780eacae8fad7a078d05f4a615ee;hpb=b0eaa3f1fbf491fdc8a3044cf20754f14254338a diff --git a/src/API_Linux.hpp b/src/API_Linux.hpp index a547d40..74db0e4 100644 --- a/src/API_Linux.hpp +++ b/src/API_Linux.hpp @@ -1,5 +1,5 @@ /* - suPHP - (c)2002-2005 Sebastian Marsching + suPHP - (c)2002-2008 Sebastian Marsching This file is part of suPHP. @@ -41,162 +41,173 @@ namespace suPHP { */ class API_Linux : public API { private: - static SmartPtr logger; - /** - * Internal function for checking wheter path - * points to a symlink - */ - bool isSymlink(const std::string path) const - throw (SystemException); - - /** - * Internal function to read the target of a symlink - */ - std::string readSymlink(const std::string path) const - throw (SystemException); + static SmartPtr logger; + /** + * Internal function for checking wheter path + * points to a symlink + */ + bool isSymlink(const std::string path) const + throw (SystemException); + + /** + * Internal function to read the target of a symlink + */ + std::string readSymlink(const std::string path) const + throw (SystemException); public: - /** - * Get environment variable - */ - virtual Environment getProcessEnvironment(); - - /** - * Get UserInfo from username - */ - virtual UserInfo getUserInfo(const std::string username) - throw (LookupException); - - /** - * Get UserInfo from UID - */ - virtual UserInfo getUserInfo(const int uid); - - /** - * Get GroupInfo from groupname - */ - virtual GroupInfo getGroupInfo(const std::string groupname) - throw (LookupException); - - /** - * Get GroupInfo from GID - */ - virtual GroupInfo getGroupInfo(const int gid); - - /** - * Get UserInfo for effective UID - */ - virtual UserInfo getEffectiveProcessUser(); - - /** - * Get UserInfo for real UID - */ - virtual UserInfo getRealProcessUser(); - - /** - * Get GroupInfo for effective GID - */ - virtual GroupInfo getEffectiveProcessGroup(); - - /** - * Get GroupInfo for real GID - */ - virtual GroupInfo getRealProcessGroup(); - - - virtual Logger& getSystemLogger(); - - /** - * Set UID of current process - */ - virtual void setProcessUser(const UserInfo& user) const - throw (SystemException); - - /** - * Set GID of current process - */ - virtual void setProcessGroup(const GroupInfo& group) const - throw (SystemException); - - /** - * Returns username from UserInfo - */ - virtual std::string UserInfo_getUsername(const UserInfo& uinfo) const - throw (LookupException); - - /** - * Returns group from UserInfo - */ - virtual GroupInfo UserInfo_getGroupInfo(const UserInfo& uinfo) const throw (LookupException); - - /** - * Checks whether UserInfo objects represents the super-user - */ - virtual bool UserInfo_isSuperUser(const UserInfo& uinfo) const; - - /** - * Returns groupname from GroupInfo - */ - std::string GroupInfo_getGroupname(const GroupInfo& ginfo) const - throw (LookupException); - - /** - * Checks whether file exists - */ - virtual bool File_exists(const File& file) const; - - /** - * Returns real path to file - */ - virtual std::string File_getRealPath(const File& file) const - throw (SystemException); - - /** - * Checks for a permission bit - */ - virtual bool File_hasPermissionBit(const File& file, FileMode perm) - const throw (SystemException); - - /** - * Returns UID of file - */ - virtual UserInfo File_getUser(const File& file) const - throw (SystemException); - - /** - * Returns GID of file - */ - virtual GroupInfo File_getGroup(const File& file) const - throw (SystemException); - - /** - * Runs another program (replaces current process) - */ - virtual void execute(std::string program, const CommandLine& cline, - const Environment& env) const - throw (SystemException); - - /** - * Returns current working directory - */ - virtual std::string getCwd() const throw (SystemException); - - /** - * Sets current working directory - */ - virtual void setCwd(const std::string& dir) const - throw (SystemException); - - /** - * Sets umask - */ - virtual void setUmask(int umask) const throw (SystemException); - - /** - * Sets new root directory for current process - */ - virtual void chroot(const std::string& dir) const - throw (SystemException); + /** + * Get environment variable + */ + virtual Environment getProcessEnvironment(); + + /** + * Get UserInfo from username + */ + virtual UserInfo getUserInfo(const std::string username) + throw (LookupException); + + /** + * Get UserInfo from UID + */ + virtual UserInfo getUserInfo(const int uid); + + /** + * Get GroupInfo from groupname + */ + virtual GroupInfo getGroupInfo(const std::string groupname) + throw (LookupException); + + /** + * Get GroupInfo from GID + */ + virtual GroupInfo getGroupInfo(const int gid); + + /** + * Get UserInfo for effective UID + */ + virtual UserInfo getEffectiveProcessUser(); + + /** + * Get UserInfo for real UID + */ + virtual UserInfo getRealProcessUser(); + + /** + * Get GroupInfo for effective GID + */ + virtual GroupInfo getEffectiveProcessGroup(); + + /** + * Get GroupInfo for real GID + */ + virtual GroupInfo getRealProcessGroup(); + + + virtual Logger& getSystemLogger(); + + /** + * Set UID of current process + */ + virtual void setProcessUser(const UserInfo& user) const + throw (SystemException); + + /** + * Set GID of current process + */ + virtual void setProcessGroup(const GroupInfo& group) const + throw (SystemException); + + /** + * Returns username from UserInfo + */ + virtual std::string UserInfo_getUsername(const UserInfo& uinfo) const + throw (LookupException); + + /** + * Returns group from UserInfo + */ + virtual GroupInfo UserInfo_getGroupInfo(const UserInfo& uinfo) const throw (LookupException); + + /** + * Returns home directory from UserInfo + */ + virtual std::string UserInfo_getHomeDirectory(const UserInfo& uinfo) const + throw (LookupException); + + /** + * Checks whether UserInfo objects represents the super-user + */ + virtual bool UserInfo_isSuperUser(const UserInfo& uinfo) const; + + /** + * Returns groupname from GroupInfo + */ + std::string GroupInfo_getGroupname(const GroupInfo& ginfo) const + throw (LookupException); + + /** + * Checks whether file exists + */ + virtual bool File_exists(const File& file) const; + + /** + * Returns real path to file + */ + virtual std::string File_getRealPath(const File& file) const + throw (SystemException); + + /** + * Checks for a permission bit + */ + virtual bool File_hasPermissionBit(const File& file, FileMode perm) + const throw (SystemException); + + /** + * Returns UID of file + */ + virtual UserInfo File_getUser(const File& file) const + throw (SystemException); + + /** + * Returns GID of file + */ + virtual GroupInfo File_getGroup(const File& file) const + throw (SystemException); + + /** + * Checks whether a file is a symlink + */ + virtual bool File_isSymlink(const File& file) const throw (SystemException); + + /** + * Runs another program (replaces current process) + */ + virtual void execute(std::string program, const CommandLine& cline, + const Environment& env) const + throw (SystemException); + + /** + * Returns current working directory + */ + virtual std::string getCwd() const throw (SystemException); + + /** + * Sets current working directory + */ + virtual void setCwd(const std::string& dir) const + throw (SystemException); + + /** + * Sets umask + */ + virtual void setUmask(int umask) const throw (SystemException); + + /** + * Sets new root directory for current process + */ + virtual void chroot(const std::string& dir) const + throw (SystemException); }; };