diff options
author | Daouda Lo <daouda@mandriva.com> | 2003-04-23 16:04:45 +0000 |
---|---|---|
committer | Daouda Lo <daouda@mandriva.com> | 2003-04-23 16:04:45 +0000 |
commit | de04d282baea43eb5ed0fb545c37c5772a97c8d8 (patch) | |
tree | 3f068fc862e0706517519039486d2b0ee4b2b92e | |
parent | ba0253ba16dc06b6f287e22bba75fe8a30eb7c11 (diff) | |
download | userdrake-de04d282baea43eb5ed0fb545c37c5772a97c8d8.tar userdrake-de04d282baea43eb5ed0fb545c37c5772a97c8d8.tar.gz userdrake-de04d282baea43eb5ed0fb545c37c5772a97c8d8.tar.bz2 userdrake-de04d282baea43eb5ed0fb545c37c5772a97c8d8.tar.xz userdrake-de04d282baea43eb5ed0fb545c37c5772a97c8d8.zip |
- compiling and testing
-rw-r--r-- | USER/USER.xs | 76 |
1 files changed, 34 insertions, 42 deletions
diff --git a/USER/USER.xs b/USER/USER.xs index 0b6d022..9a64433 100644 --- a/USER/USER.xs +++ b/USER/USER.xs @@ -84,7 +84,7 @@ void Admin_start(self) USER::ADMIN *self CODE: - USER__ERR error; + USER__ERR *error; self = lu_start(NULL, 0, NULL, NULL, NULL, NULL, &error); void @@ -92,37 +92,34 @@ Admin_DESTROY(self) USER::ADMIN *self CODE: lu_end(self); - lu_ctx_free(self) + lu_ctx_free(self); void Admin_lookup_user_name(self, name) USER::ADMIN *self char *name - PREINIT: - USER::ENT *ent; - USER__ERR *err; PPCODE: + USER__ENT *ent; + USER__ERR *err; ent = lu_ent_new(); - if ( lu_user_lookup_name(self, name, ent, &err)) { - XPUSHs(sv_2mortal(newSViv(ent))) + if (lu_user_lookup_name(self, name, ent, &err)) { + XPUSHs(sv_2mortal(newSViv(ent))); } else { - /* No such user. Clean up and bug out. */ - lu_ent_free(ent); + lu_ent_free(ent); } AV * Admin_users_enumerate_full(self, pattern) USER::ADMIN *self char *pattern - PREINIT: - int c; - USER__ERR *err; CODE: + int c; + USER__ERR *error; RETVAL = (AV*)sv_2mortal((SV*)newAV()); GPtrArray *accounts; - results=lu_users_enumerate_full(self, pattern, &error); + accounts = lu_users_enumerate_full(self, pattern, &error); for (c = 0; (accounts != NULL) && (c < accounts->len); c++) { - if( av_store( RETVAL, c, newSViv(g_ptr_array_index(accounts, c)) ) == NULL ){ + if( av_store(RETVAL, c, newSViv(g_ptr_array_index(accounts, c))) == NULL ){ warn("XS_UsersEnumerateFull: failed to store elems"); } } @@ -136,11 +133,11 @@ Admin_groups_enumerate_full(self, pattern) char *pattern PREINIT: int c; - USER__ERR *err; + USER__ERR *error; CODE: RETVAL = (AV*)sv_2mortal((SV*)newAV()); GPtrArray *accounts; - results=lu_groups_enumerate_full(self, pattern, &error); + accounts=lu_groups_enumerate_full(self, pattern, &error); for (c = 0; (accounts != NULL) && (c < accounts->len); c++) { if( av_store( RETVAL, c, newSViv(g_ptr_array_index(accounts, c)) ) == NULL ){ warn("XS_UsersEnumerateFull: failed to store elems"); @@ -150,7 +147,7 @@ Admin_groups_enumerate_full(self, pattern) OUTPUT: RETVAL -MODULE = USER PACKAGE = USER::ENT Prefix = PREFIX_ +MODULE = USER PACKAGE = USER::ENT PREFIX = Ent_ USER::ENT * Ent_new (CLASS) @@ -161,21 +158,16 @@ Ent_new (CLASS) warn("unable to malloc USER__ENT"); XSRETURN_UNDEF; } + RETVAL = lu_ent_new(); OUTPUT: RETVAL -void -Ent_begin(self) - USER::ENT *self - PPCODE: - self = lu_ent_new() - void Ent_DESTROY(self) USER::ENT *self CODE: lu_ent_free(self); - safefree(self) + safefree(self); HV * Ent_get_attributes(self) @@ -187,25 +179,25 @@ Ent_get_attributes(self) case lu_invalid: break; case lu_user: - hv_store(RETVAL, "type", 4, newSVpv("user"), 0); - hv_store(RETVAL, "username", 8, newSVpv(get_name(ent, LU_USERNAME)), 0); - hv_store(RETVAL, "uid", 3, newSViv(get_int(ent, LU_UIDNUMBER)), 0); - hv_store(RETVAL, "gid", 3, newSViv(get_int(ent, LU_GIDNUMBER)), 0); - hv_store(RETVAL, "gecos", 5, newSVpv(get_name(ent, LU_GECOS)), 0); - hv_store(RETVAL, "home", 4, newSVpv(get_name(ent, LU_HOMEDIRECTORY)), 0); - hv_store(RETVAL, "shell", 5, newSVpv(get_name(ent, LU_LOGINSHELL)), 0); - hv_store(RETVAL, "shadowpass", 10, newSVpv(get_name(ent, LU_SHADOWPASSWORD)), 0); - hv_store(RETVAL, "shadowlastchange", 16, newSViv(get_name(ent, LU_SHADOWLASTCHANGE)), 0); - hv_store(RETVAL, "shadowmin", 9, newSViv(get_name(ent, LU_SHADOWMIN)), 0); - hv_store(RETVAL, "shadowmax", 9, newSViv(get_name(ent, LU_SHADOWMAX)), 0); - hv_store(RETVAL, "shadowwarning", 13, newSVpv(get_name(ent, LU_SHADOWWARNING)), 0); - hv_store(RETVAL, "shadowinact", 11, newSViv(get_name(ent, LU_SHADOWINACTIVE)), 0); - hv_store(RETVAL, "shadowexpire", 12, newSViv(get_name(ent, LU_SHADOWINACTIVE)), 0); - hv_store(RETVAL, "shadowflag", 10, newSViv(get_name(ent, LU_SHADOWINACTIVE)), 0); + hv_store(RETVAL, "type", 4, newSVpv("user", 0), 0); + hv_store(RETVAL, "username", 8, newSVpv(get_name(self, LU_USERNAME), 0), 0); + hv_store(RETVAL, "uid", 3, newSViv(get_int(self, LU_UIDNUMBER)), 0); + hv_store(RETVAL, "gid", 3, newSViv(get_int(self, LU_GIDNUMBER)), 0); + hv_store(RETVAL, "gecos", 5, newSVpv(get_name(self, LU_GECOS), 0), 0); + hv_store(RETVAL, "home", 4, newSVpv(get_name(self, LU_HOMEDIRECTORY), 0), 0); + hv_store(RETVAL, "shell", 5, newSVpv(get_name(self, LU_LOGINSHELL), 0), 0); + hv_store(RETVAL, "shadowpass", 10, newSVpv(get_name(self, LU_SHADOWPASSWORD), 0), 0); + hv_store(RETVAL, "shadowlastchange", 16, newSViv(get_name(self, LU_SHADOWLASTCHANGE)), 0); + hv_store(RETVAL, "shadowmin", 9, newSViv(get_name(self, LU_SHADOWMIN)), 0); + hv_store(RETVAL, "shadowmax", 9, newSViv(get_name(self, LU_SHADOWMAX)), 0); + hv_store(RETVAL, "shadowwarning", 13, newSVpv(get_name(self, LU_SHADOWWARNING), 0), 0); + hv_store(RETVAL, "shadowinact", 11, newSViv(get_name(self, LU_SHADOWINACTIVE)), 0); + hv_store(RETVAL, "shadowexpire", 12, newSViv(get_name(self, LU_SHADOWINACTIVE)), 0); + hv_store(RETVAL, "shadowflag", 10, newSViv(get_name(self, LU_SHADOWINACTIVE)), 0); case lu_group: - hv_store(RETVAL, "type", 4, newSVpv("group"), 0); - hv_store(RETVAL, "groupname", 8, newSVpv(get_name(ent, LU_GROUPNAME)), 0); - hv_store(RETVAL, "gid", 3, newSViv(get_int(ent, LU_GIDNUMBER)), 0); + hv_store(RETVAL, "type", 4, newSVpv("group", 0), 0); + hv_store(RETVAL, "groupname", 8, newSVpv(get_name(self, LU_GROUPNAME), 0), 0); + hv_store(RETVAL, "gid", 3, newSViv(get_int(self, LU_GIDNUMBER)), 0); break; default: break; |