Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008
00009
00010
00011
00012 #include "vul_user_info.h"
00013
00014
00015 #if defined(VCL_WIN32) && !defined(__CYGWIN__)
00016 #include <direct.h>
00017 #else
00018 #include <unistd.h>
00019 #include <pwd.h>
00020 #endif
00021
00022 #include <vcl_iostream.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 void vul_user_info::init(uid_type )
00033 {
00034 vcl_cerr << "Not implemented\n";
00035 }
00036
00037 void vul_user_info::init(char const* name_)
00038 {
00039 #if !defined(VCL_WIN32) || defined(__CYGWIN__)
00040 struct passwd* pw = getpwnam(name_);
00041 if (!pw) {
00042 #endif
00043 this->ok = false;
00044 this->uid = 0;
00045 this->gid = 0;
00046 this->name = name_;
00047 #if !defined(VCL_WIN32) || defined(__CYGWIN__)
00048 } else {
00049 this->ok = true;
00050 this->uid = pw->pw_uid;
00051 this->gid = pw->pw_gid;
00052 this->name = pw->pw_name;
00053 this->home_directory = pw->pw_dir;
00054 this->full_name = pw->pw_gecos;
00055 this->shell = pw->pw_shell;
00056 this->passwd = pw->pw_passwd;
00057 }
00058 #endif
00059 }