From b04aa02d9d1c16a35a6907162a64053d97f8bed1 Mon Sep 17 00:00:00 2001 From: Daouda Lo Date: Fri, 23 May 2003 12:51:28 +0000 Subject: - LookupById implementations (for lu_user and lu_group) --- USER/USER.xs | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 5 deletions(-) (limited to 'USER/USER.xs') diff --git a/USER/USER.xs b/USER/USER.xs index ca360a0..0e5f674 100644 --- a/USER/USER.xs +++ b/USER/USER.xs @@ -100,8 +100,58 @@ Admin_DESTROY(self) if (self) lu_end(self) ; safefree((char*)self); +int +Admin_UserAdd(self, enthash) + USER::ADMIN *self + SV * enthash + INIT: + HV *hv; + SV **ssv; + if ( SvROK(enthash) && (SvTYPE(SvRV(enthash)) == SVt_PVHV) ) + hv = (HV*)SvRV(enthash); + else{ + warn("XS_UserAdd: enthash was not an HV ref"); + } + CODE: + USER__ENT *ent; + USER__ERR *error; + long uidNumber, gidNumber; + GValueArray *values; + ssv = hv_fetch( hv, "username", 13, 0 ); + if( ssv != NULL ){ + if( SvPOK( *ssv ) ) + warn ("user added"); + /*strcpy( abin->szDescription, SvPV(*ssv,na) );*/ + else{ + warn("XS_UserAdd: hash elem szDescription was not POK"); + } + } + else + warn("XS_UserAdd: hash elem szDescription was null"); + ssv = hv_fetch( hv, "uid", 3, 0); + if( ssv != NULL ){ + if( SvIOK( *ssv ) ) + warn("user added"); + /* abin->lTrackId = (long)SvIV( *ssv );*/ + else{ + warn("XS_UserAdd: hash elem Uid was not IOK"); + } + } + else + warn("XS_UserAdd: hash elem xxxxxx was null"); + +void +Admin_UserDel(self, ent) + USER::ADMIN *self + USER::ENT *ent + void -Admin_lookup_user_name(self, name) +Admin_UserEdit(self, ent) + USER::ADMIN *self + USER::ENT *ent + +void +Admin_LookupUserByName(self, name) USER::ADMIN *self char *name PPCODE: @@ -114,8 +164,50 @@ Admin_lookup_user_name(self, name) lu_ent_free(ent); } +void +Admin_LookupUserById(self, id) + USER::ADMIN *self + long id + PPCODE: + USER__ENT *ent; + USER__ERR *error = NULL; + ent = lu_ent_new(); + if (lu_user_lookup_id(self, id, ent, &error)) { + XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(ent)), gv_stashpv("USER::ENT", 1)))); + } else { + lu_ent_free(ent); + } + +void +Admin_LookupGroupByName(self, name) + USER::ADMIN *self + char *name + PPCODE: + USER__ENT *ent; + USER__ERR *error = NULL; + ent = lu_ent_new(); + if (lu_group_lookup_name(self, name, ent, &error)) { + XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(ent)), gv_stashpv("USER::ENT", 1)))); + } else { + lu_ent_free(ent); + } + +void +Admin_LookupGroupById(self, id) + USER::ADMIN *self + int id + PPCODE: + USER__ENT *ent; + USER__ERR *error = NULL; + ent = lu_ent_new(); + if (lu_group_lookup_id(self, id, ent, &error)) { + XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(ent)), gv_stashpv("USER::ENT", 1)))); + } else { + lu_ent_free(ent); + } + AV * -Admin_users_enumerate_full(self) +Admin_UsersEnumerateFull(self) USER::ADMIN *self CODE: int c; @@ -134,7 +226,7 @@ Admin_users_enumerate_full(self) RETVAL AV * -Admin_groups_enumerate_full(self) +Admin_GroupsEnumerateFull(self) USER::ADMIN *self CODE: int c; @@ -153,7 +245,7 @@ Admin_groups_enumerate_full(self) RETVAL AV * -Admin_get_user_shells(self) +Admin_GetUserShells(self) USER::ADMIN *self CODE: int i = 0; @@ -486,7 +578,7 @@ Ent_get_attributes(self) MODULE = USER PACKAGE = USER PREFIX = User_ void -User_read_config_files() +User_ReadConfigFiles() CODE: /*force read of /etc/sysconfig/userdrakefilter*/ -- cgit v1.2.1