00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #define LIBTEKLTI_EXPORT (1)
00021
00022 #ifndef _cplusplus
00023 #define _cplusplus
00024 #endif
00025
00026 #include "teklti.h"
00027
00028 MKTEKUUID(UTekUserUnixRW, "76184080-3E87-11DA-9E50-000BDBC434D9")
00029 MKTEKDEBUGSTRING(DBTekUserUnixRW, "TekUserUnixRW")
00030
00031
00040 TekUserUnixRW::TekUserUnixRW()
00041 {
00042 TEKSTD_IMPLEMENT_INTERFACE(UTekUser)
00043 TEKSTD_IMPLEMENT_INTERFACE(UTekUserUnixRW)
00044 TEKSTD_IMPLEMENT_ENDBASE
00045
00046 memset(&this->Priv_UserInfo, '\0', sizeof(struct TekUserInfo));
00047 }
00048
00049
00053 TekUserUnixRW::~TekUserUnixRW()
00054 {
00055 if ( this->Priv_UserInfo.TekUserInfo_Description != NULL )
00056 ucharempty(this->Priv_UserInfo.TekUserInfo_Description);
00057 if ( this->Priv_UserInfo.TekUserInfo_Username != NULL )
00058 ucharempty(this->Priv_UserInfo.TekUserInfo_Username);
00059 if ( this->Priv_UserInfo.TekUserInfo_HomeDir != NULL )
00060 ucharempty(this->Priv_UserInfo.TekUserInfo_HomeDir);
00061 }
00062
00063
00069 TEKERR TekUserUnixRW::put_TekUserInfo(struct TekUserInfo * SUInfo)
00070 {
00071 if ( SUInfo == NULL )
00072 memset(&this->Priv_UserInfo, '\0', sizeof(struct TekUserInfo));
00073 else
00074 memcpy(&this->Priv_UserInfo, SUInfo, sizeof(struct TekUserInfo));
00075
00076 return TEKERR_OK;
00077 }
00078
00084 TEKERR TekUserUnixRW::get_Description(uchar_t** RetVal)
00085 {
00086 #ifndef NO_SIZE_T_CHECKS
00087 if ( RetVal == NULL )
00088 return TEKERR_POINTER;
00089 #endif
00090
00091
00092 *RetVal = uchardup(this->Priv_UserInfo.TekUserInfo_Description);
00093
00094
00095 return TEKERR_OK;
00096 }
00097
00103 TEKERR TekUserUnixRW::get_GroupID(gid_t * RetVal)
00104 {
00105 #ifndef NO_SIZE_T_CHECKS
00106 if ( RetVal == NULL )
00107 return TEKERR_POINTER;
00108 #endif
00109
00110
00111 *RetVal = this->Priv_UserInfo.TekUserInfo_GroupID;
00112
00113
00114 return TEKERR_OK;
00115 }
00116
00122 TEKERR TekUserUnixRW::get_HomeDir(uchar_t ** RetVal)
00123 {
00124 #ifndef NO_SIZE_T_CHECKS
00125 if ( RetVal == NULL )
00126 return TEKERR_POINTER;
00127 #endif
00128
00129
00130 *RetVal = uchardup(this->Priv_UserInfo.TekUserInfo_HomeDir);
00131
00132
00133 return TEKERR_OK;
00134 }
00135
00141 TEKERR TekUserUnixRW::get_UserID(uid_t * RetVal)
00142 {
00143 #ifndef NO_SIZE_T_CHECKS
00144 if ( RetVal == NULL )
00145 return TEKERR_POINTER;
00146 #endif
00147
00148
00149 *RetVal = this->Priv_UserInfo.TekUserInfo_UserID;
00150
00151
00152 return TEKERR_OK;
00153 }
00154
00160 TEKERR TekUserUnixRW::get_Username(uchar_t ** RetVal)
00161 {
00162 #ifndef NO_SIZE_T_CHECKS
00163 if ( RetVal == NULL )
00164 return TEKERR_POINTER;
00165 #endif
00166
00167
00168 *RetVal = uchardup(this->Priv_UserInfo.TekUserInfo_Username);
00169
00170
00171 return TEKERR_OK;
00172 }
00173
00174
00181 TEKERR TekUserUnixRW::put_Description(const uchar_t * NewDescription)
00182 {
00183 #ifndef NO_SIZE_T_CHECKS
00184 if ( NewDescription == NULL )
00185 return TEKERR_POINTER;
00186 #endif
00187
00188
00189 if ( this->Priv_UserInfo.TekUserInfo_Description != NULL )
00190 ucharempty(this->Priv_UserInfo.TekUserInfo_Description);
00191
00192
00193 this->Priv_UserInfo.TekUserInfo_Description =
00194 uchardup(NewDescription);
00195
00196 if ( this->Priv_UserInfo.TekUserInfo_Description == NULL )
00197 return TEKERR_MEMORY;
00198
00199
00200 return TEKERR_OK;
00201 }
00202
00208 TEKERR TekUserUnixRW::put_GroupID(gid_t NewGroupID)
00209 {
00210 return TEKERR_NOTIMPL;
00211 }
00212
00213
00219 TEKERR TekUserUnixRW::put_HomeDir(const uchar_t * NewHomeDir)
00220 {
00221 #ifndef NO_SIZE_T_CHECKS
00222 if ( NewHomeDir == NULL )
00223 return TEKERR_POINTER;
00224 #endif
00225
00226
00227 if ( this->Priv_UserInfo.TekUserInfo_HomeDir != NULL )
00228 ucharempty(this->Priv_UserInfo.TekUserInfo_HomeDir);
00229
00230
00231 this->Priv_UserInfo.TekUserInfo_HomeDir =
00232 uchardup(NewHomeDir);
00233
00234 if ( this->Priv_UserInfo.TekUserInfo_HomeDir == NULL )
00235 return TEKERR_MEMORY;
00236
00237
00238 return TEKERR_OK;
00239 }
00240
00241
00250 TEKERR TekUserUnixRW::put_Password(uchar_t * NewPassword)
00251 {
00252 return TEKERR_NOTIMPL;
00253 }
00254
00255
00261 TEKERR TekUserUnixRW::put_UserID(uid_t NewID)
00262 {
00263 return TEKERR_NOTIMPL;
00264 }
00265
00266
00272 TEKERR TekUserUnixRW::put_Username(const uchar_t * NewUsername)
00273 {
00274 #ifndef NO_SIZE_T_CHECKS
00275 if ( NewUsername == NULL )
00276 return TEKERR_POINTER;
00277 #endif
00278
00279
00280 if ( this->Priv_UserInfo.TekUserInfo_Username != NULL )
00281 ucharempty(this->Priv_UserInfo.TekUserInfo_Username);
00282
00283
00284 this->Priv_UserInfo.TekUserInfo_Username =
00285 uchardup(NewUsername);
00286
00287 if ( this->Priv_UserInfo.TekUserInfo_Username == NULL )
00288 return TEKERR_MEMORY;
00289
00290
00291 return TEKERR_OK;
00292 }
00293
00299 TEKERR TekUserUnixRW::Save()
00300 {
00301 TekUserDB * PrivDB;
00302
00303
00304 PrivDB = (TekUserDB *)this->Priv_UserInfo.TekUserInfo_DB;
00305
00306 #ifndef NO_INTERNAL_NULL_CHECKS
00307
00308 if ( PrivDB == NULL )
00309 return TEKERR_FAIL;
00310 #endif
00311
00312
00313 PrivDB->WriteUser(this);
00314
00315
00316 return TEKERR_OK;
00317 }
00318