diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ldaptest.pl | 101 | ||||
-rw-r--r-- | tests/nsswitch.test | 40 | ||||
-rw-r--r-- | tests/testd.c | 41 | ||||
-rw-r--r-- | tests/testgr.c | 71 | ||||
-rw-r--r-- | tests/testnss.c | 656 | ||||
-rw-r--r-- | tests/testpw.c | 151 | ||||
-rw-r--r-- | tests/testpw3.c | 48 | ||||
-rw-r--r-- | tests/testpw4.c | 77 | ||||
-rw-r--r-- | tests/testpw5.c | 127 | ||||
-rw-r--r-- | tests/testpw6.c | 187 |
10 files changed, 0 insertions, 1499 deletions
diff --git a/tests/ldaptest.pl b/tests/ldaptest.pl deleted file mode 100644 index 615e6b3..0000000 --- a/tests/ldaptest.pl +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/perl - -# -# $Header: /home/project/cvs/nss_ldap/tests/ldaptest.pl,v 1.2 2001/01/09 00:21:21 lukeh Exp $ -# - - -sub printarr { - foreach (@_) { - print $_." "; - } - print "\n"; -} -sub printhost { - foreach (@_) { - if ($_ !~ /^[\w\.\d]+$/) { - @addr = unpack('C4',$_); - print $addr[0].".".$addr[1].".".$addr[2].".".$addr[3]." "; - } else { - print $_." "; - } - } - print "\n"; -} - - -print "*** getpwnam ***\n"; -printarr(getpwnam("root")); -print "*** getpwuid ***\n"; -printarr(getpwuid(0)); -print "*** setpwent ***\n"; -setpwent(); -print "*** getpwent ***\n"; -while(@ent = getpwent()) { - printarr(@ent); -} -print "*** endpwent ***\n"; -endpwent(); -print "*** getgrnam ***\n"; -printarr(getgrnam("wheel")); -print "*** getgrgid ***\n"; -printarr(getgrgid(10)); -print "*** setgrent ***\n"; -setgrent(); -print "*** getgrent ***\n"; -while(@ent = getgrent()) { - printarr(@ent); -} -print "*** endgrent ***\n"; -endgrent(); -print "*** gethostbyname ***\n"; -printhost(gethostbyname("localhost")); -print "*** gethostbyaddr ***\n"; -printhost(gethostbyaddr(pack(C4,(127,0,0,1)),2)); -print "*** sethostent ***\n"; -sethostent(0); -print "*** gethostent ***\n"; -while(@ent = gethostent()) { - printhost(@ent); -} -print "*** endhostent ***\n"; -endhostent(); -# I dont appear to have networks. but we'll try anyway. -print "*** getnetbyname ***\n"; -printhost(getnetbyname("localnet")); -print "*** getnetbyaddr ***\n"; -# this may not be the right call. who uses 'networks' anyways!? -printhost(getnetbyaddr(127,2)); -print "*** setnetent ***\n"; -setnetent(0); -print "*** getnetent ***\n"; -while(@ent = getnetent()) { - printhost(@ent); -} -print "*** endnetent ***\n"; -endnetent(); -print "*** getservbyname ***\n"; -printarr(getservbyname("telnet","tcp")); -print "*** getservbyport ***\n"; -printarr(getservbyport(23,"tcp")); -print "*** setservent ***\n"; -setservent(0); -print "*** getservent ***\n"; -while(@ent = getservent()) { - printarr(@ent); -} -print "*** endservent ***\n"; -endservent(); -print "*** getprotobyname ***\n"; -printarr(getprotobyname("icmp")); -print "*** getprotobynumber ***\n"; -printarr(getprotobynumber(1)); -print "*** setprotoent ***\n"; -setprotoent(0); -print "*** getprotoent ***\n"; -while(@ent = getprotoent()) { - printarr(@ent); -} -print "*** endprotoent ***\n"; -endprotoent(); - diff --git a/tests/nsswitch.test b/tests/nsswitch.test deleted file mode 100644 index dd8f532..0000000 --- a/tests/nsswitch.test +++ /dev/null @@ -1,40 +0,0 @@ -#ident $Id$ -# -# An example file that could be copied over to /etc/nsswitch.conf; it -# uses LDAP conjunction with files. -# -# "hosts:" and "services:" in this file are used only if the -# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports. - -# the following two lines obviate the "+" entry in /etc/passwd and /etc/group. -passwd: ldap -group: ldap - -# consult DNS first, we will need it to resolve the LDAP host. (If we -# can't resolve it, we're in infinite recursion, because libldap calls -# gethostbyname(). Careful!) -hosts: files ldap - -# LDAP is nominally authoritative for the following maps. -services: ldap -networks: ldap -protocols: ldap -rpc: ldap -ethers: ldap - -# no support for netmasks, bootparams, publickey yet. -netmasks: files -bootparams: files -publickey: files -automount: files - -# I'm pretty sure nsswitch.conf is consulted directly by sendmail, -# here, so we can't do much here. Instead, use bbense's LDAP -# rules ofr sendmail. -aliases: files -sendmailvars: files - -# No one has written the LDAP support for netgroups yet, so we'll -# have to stick with NIS. -netgroup: files nis - diff --git a/tests/testd.c b/tests/testd.c deleted file mode 100644 index f47081a..0000000 --- a/tests/testd.c +++ /dev/null @@ -1,41 +0,0 @@ - -#import <lber.h> -#import <ldap.h> -#import "ldap-nss.h" -#import "util.h" -#import "dnsconfig.h" - -void -printcf (ldap_config_t * cf) -{ - printf ("host %s\n", cf->ldc_host); - printf ("port %d\n", cf->ldc_port); - printf ("base %s\n", cf->ldc_base); -#if 0 - char *ldc_host; - int ldc_port; - char *ldc_base; - int ldc_scope; - char *ldc_binddn; - char *ldc_bindpw; - struct ldap_config *ldc_next; -#endif -} - -void -main (void) -{ -/* - NSS_STATUS _nss_ldap_readconfigfromdns( - ldap_config_t *result, - char *buf, - size_t buflen - */ - ldap_config_t cf; - char buf[1024]; - - _nss_ldap_readconfigfromdns (&cf, buf, sizeof (buf)); - printcf (&cf); - printcf (cf.ldc_next); - exit (0); -} diff --git a/tests/testgr.c b/tests/testgr.c deleted file mode 100644 index 4907238..0000000 --- a/tests/testgr.c +++ /dev/null @@ -1,71 +0,0 @@ -#include <stdio.h> -#include <grp.h> -#include <signal.h> - -void -main (int argc, char **argv) -{ -#if 0 - struct group - { /* see getgrent(3) */ - char *gr_name; - char *gr_passwd; - gid_t gr_gid; - char **gr_mem; - }; -#endif - - scan_group (); - exit (0); -} - -void -dump (struct group *g) -{ - char mem[2048]; - char **p; - - int doit = (g->gr_mem && *(g->gr_mem)); - p = g->gr_mem; - strcpy (mem, ""); - while (doit) - { - if (p != g->gr_mem) - strcat (mem, ","); - strcat (mem, *p); - if (*(++p) == NULL) - break; - } - printf ("%s:%s:%d:%s\n", g->gr_name, g->gr_passwd, g->gr_gid, mem); - -} - -scan_group () -{ - struct group *g; - - signal(SIGPIPE, SIG_IGN); - - setgrent (); - - while ((g = getgrent ()) != NULL) - { - dump (g); - } - - endgrent (); - - sleep(10); - - printf ("==> getgrnam(qmail)\n"); - g = getgrnam ("qmail"); - if (g != NULL) - dump (g); -#if 0 - printf ("==> getgrnam(testgroup)\n"); - g = getgrnam ("testgroup"); - if (g != NULL) - dump (g); -#endif - -} diff --git a/tests/testnss.c b/tests/testnss.c deleted file mode 100644 index 50b36c8..0000000 --- a/tests/testnss.c +++ /dev/null @@ -1,656 +0,0 @@ -/* - testnss.c - simple tests of developed nss code - - Copyright (C) 2006 West Consulting - Copyright (C) 2006 Arthur de Jong - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1301 USA -*/ - -#include "config.h" - -#include <string.h> -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <arpa/inet.h> - -#include "nss/prototypes.h" - -static char *nssstatus(enum nss_status retv) -{ - switch(retv) - { - case NSS_STATUS_TRYAGAIN: return "NSS_STATUS_TRYAGAIN"; - case NSS_STATUS_UNAVAIL: return "NSS_STATUS_UNAVAIL"; - case NSS_STATUS_NOTFOUND: return "NSS_STATUS_NOTFOUND"; - case NSS_STATUS_SUCCESS: return "NSS_STATUS_SUCCESS"; - case NSS_STATUS_RETURN: return "NSS_STATUS_RETURN"; - default: return "NSS_STATUS_**ILLEGAL**"; - } -} - -static void printpasswd(struct passwd *pw) -{ - printf("struct passwd {\n" - " pw_name=\"%s\",\n" - " pw_passwd=\"%s\",\n" - " pw_uid=%d,\n" - " pw_gid=%d,\n" - " pw_gecos=\"%s\",\n" - " pw_dir=\"%s\",\n" - " pw_shell=\"%s\"\n" - "}\n",pw->pw_name,pw->pw_passwd, - (int)(pw->pw_uid),(int)(pw->pw_gid), - pw->pw_gecos,pw->pw_dir,pw->pw_shell); -} - -static void printalias(struct aliasent *alias) -{ - int i; - printf("struct alias {\n" - " alias_name=\"%s\",\n" - " alias_members_len=%d,\n", - alias->alias_name,(int)alias->alias_members_len); - for (i=0;i<(int)alias->alias_members_len;i++) - printf(" alias_members[%d]=\"%s\",\n", - i,alias->alias_members[i]); - printf(" alias_local=%d\n" - "}\n",(int)alias->alias_local); -} - -static void printgroup(struct group *group) -{ - int i; - printf("struct group {\n" - " gr_name=\"%s\",\n" - " gr_passwd=\"%s\",\n" - " gr_gid=%d,\n", - group->gr_name,group->gr_passwd,(int)group->gr_gid); - for (i=0;group->gr_mem[i]!=NULL;i++) - printf(" gr_mem[%d]=\"%s\",\n", - i,group->gr_mem[i]); - printf(" gr_mem[%d]=NULL\n" - "}\n",i); -} - -static void printhost(struct hostent *host) -{ - int i,j; - char buffer[1024]; - printf("struct hostent {\n" - " h_name=\"%s\",\n", - host->h_name); - for (i=0;host->h_aliases[i]!=NULL;i++) - printf(" h_aliases[%d]=\"%s\",\n", - i,host->h_aliases[i]); - printf(" h_aliases[%d]=NULL,\n",i); - if (host->h_addrtype==AF_INET) - printf(" h_addrtype=AF_INET,\n"); - else if (host->h_addrtype==AF_INET6) - printf(" h_addrtype=AF_INET6,\n"); - else - printf(" h_addrtype=%d,\n",host->h_addrtype); - printf(" h_length=%d,\n",host->h_length); - for (i=0;host->h_addr_list[i]!=NULL;i++) - { - if (inet_ntop(host->h_addrtype,host->h_addr_list[i], - buffer,1024)!=NULL) - { - printf(" h_addr_list[%d]=%s,\n",i,buffer); - } - else - { - printf(" h_addr_list[%d]=",i); - for (j=0;j<host->h_length;j++) - printf("%02x",(int)((const uint8_t*)host->h_addr_list[i])[j]); - printf(",\n"); - } - } - printf(" h_addr_list[%d]=NULL\n" - "}\n",i); -} - -static void printnetwork(struct netent *network) -{ - int i; - printf("struct netent {\n" - " n_name=\"%s\",\n", - network->n_name); - for (i=0;network->n_aliases[i]!=NULL;i++) - printf(" n_aliases[%d]=\"%s\",\n", - i,network->n_aliases[i]); - printf(" n_aliases[%d]=NULL,\n",i); - if (network->n_addrtype==AF_INET) - printf(" n_addrtype=AF_INET,\n"); - else if (network->n_addrtype==AF_INET6) - printf(" n_addrtype=AF_INET6,\n"); - else - printf(" n_addrtype=%d,\n",network->n_addrtype); - printf(" n_net=%s\n" - "}\n",inet_ntoa(inet_makeaddr(network->n_net,0))); -} - -static void printether(struct etherent *ether) -{ - printf("struct etherent {\n" - " e_name=\"%s\",\n" - " e_addr=%s\n" - "}\n", - ether->e_name,ether_ntoa(&(ether->e_addr))); -} - -static void printproto(struct protoent *protocol) -{ - int i; - printf("struct protoent {\n" - " p_name=\"%s\",\n", - protocol->p_name); - for (i=0;protocol->p_aliases[i]!=NULL;i++) - printf(" p_aliases[%d]=\"%s\",\n", - i,protocol->p_aliases[i]); - printf(" p_aliases[%d]=NULL,\n" - " p_proto=%d\n" - "}\n",i,(int)(protocol->p_proto)); -} - -static void printshadow(struct spwd *shadow) -{ - printf("struct spwd {\n" - " sp_namp=\"%s\",\n" - " sp_pwdp=\"%s\",\n" - " sp_lstchg=%ld,\n" - " sp_min=%ld,\n" - " sp_max=%ld,\n" - " sp_warn=%ld,\n" - " sp_inact=%ld,\n" - " sp_expire=%ld,\n" - " sp_flag=%lu\n" - "}\n", - shadow->sp_namp,shadow->sp_pwdp,shadow->sp_lstchg, - shadow->sp_min,shadow->sp_max,shadow->sp_warn, - shadow->sp_inact,shadow->sp_expire,shadow->sp_flag); -} - -static void printnetgroup(struct __netgrent *netgroup) -{ - printf("struct __netgrent {\n"); - if (netgroup->type==triple_val) - { - printf(" type=triple_val,\n"); - if (netgroup->val.triple.host==NULL) - printf(" val.triple.host=NULL,\n"); - else - printf(" val.triple.host=\"%s\",\n",netgroup->val.triple.host); - if (netgroup->val.triple.user==NULL) - printf(" val.triple.user=NULL,\n"); - else - printf(" val.triple.user=\"%s\",\n",netgroup->val.triple.user); - if (netgroup->val.triple.domain==NULL) - printf(" val.triple.domain=NULL,\n"); - else - printf(" val.triple.domain=\"%s\",\n",netgroup->val.triple.domain); - } - else - { - printf(" type=triple_val,\n" - " val.group=\"%s\",\n", - netgroup->val.group); - } - printf(" ...\n" - "}\n"); -} - -static void printrpc(struct rpcent *rpc) -{ - int i; - printf("struct rpcent {\n" - " r_name=\"%s\",\n", - rpc->r_name); - for (i=0;rpc->r_aliases[i]!=NULL;i++) - printf(" r_aliases[%d]=\"%s\",\n", - i,rpc->r_aliases[i]); - printf(" r_aliases[%d]=NULL,\n" - " r_number=%d\n" - "}\n",i,(int)(rpc->r_number)); -} - -static void printserv(struct servent *serv) -{ - int i; - printf("struct servent {\n" - " s_name=\"%s\",\n", - serv->s_name); - for (i=0;serv->s_aliases[i]!=NULL;i++) - printf(" s_aliases[%d]=\"%s\",\n", - i,serv->s_aliases[i]); - printf(" s_aliases[%d]=NULL,\n" - " s_port=%d,\n" - " s_proto=\"%s\"\n" - "}\n",i,(int)(ntohs(serv->s_port)), - serv->s_proto); -} - -/* the main program... */ -int main(int argc,char *argv[]) -{ - struct passwd passwdresult; - struct aliasent aliasresult; - struct group groupresult; - struct hostent hostresult; - struct netent netresult; - struct etherent etherresult; - struct spwd shadowresult; - struct __netgrent netgroupresult; - struct protoent protoresult; - struct rpcent rpcresult; - struct servent servresult; - char buffer[1024]; - enum nss_status res; - int errnocp,h_errnocp; - long int start,size=40; - gid_t *gidlist=(gid_t *)buffer; - char address[1024]; - - /* test getpwnam() */ - printf("\nTEST getpwnam()\n"); - res=_nss_ldap_getpwnam_r("arthur",&passwdresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printpasswd(&passwdresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test getpwnam() with non-existing user */ - printf("\nTEST getpwnam() with non-existing user\n"); - res=_nss_ldap_getpwnam_r("nonexist",&passwdresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printpasswd(&passwdresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test getpwuid() */ - printf("\nTEST getpwuid()\n"); - res=_nss_ldap_getpwuid_r(1004,&passwdresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printpasswd(&passwdresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}pwent() */ - printf("\nTEST {set,get,end}pwent()\n"); - res=_nss_ldap_setpwent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getpwent_r(&passwdresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printpasswd(&passwdresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endpwent(); - printf("status=%s\n",nssstatus(res)); - - /* test getaliasbyname() */ - printf("\nTEST getaliasbyname()\n"); - res=_nss_ldap_getaliasbyname_r("wij@arthurenhella.demon.nl",&aliasresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printalias(&aliasresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}aliasent() */ - printf("\nTEST {set,get,end}aliasent()\n"); - res=_nss_ldap_setaliasent(); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getaliasent_r(&aliasresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printalias(&aliasresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endaliasent(); - printf("status=%s\n",nssstatus(res)); - - /* test getgrnam() */ - printf("\nTEST getgrnam()\n"); - res=_nss_ldap_getgrnam_r("testgroup",&groupresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printgroup(&groupresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test getgrgid() */ - printf("\nTEST getgrgid()\n"); - res=_nss_ldap_getgrgid_r(100,&groupresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printgroup(&groupresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test initgroups() */ - printf("\nTEST initgroups()\n"); - res=_nss_ldap_initgroups_dyn("arthur",10,&start,&size,&gidlist,size,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - { - for (size=0;size<start;size++) - { - printf("gidlist[%d]=%d\n",(int)size,(int)gidlist[size]); - } - } - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}grent() */ - printf("\nTEST {set,get,end}grent()\n"); - res=_nss_ldap_setgrent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getgrent_r(&groupresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printgroup(&groupresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endgrent(); - printf("status=%s\n",nssstatus(res)); - - /* test gethostbyname2(AF_INET) */ - printf("\nTEST gethostbyname2(AF_INET)\n"); - res=_nss_ldap_gethostbyname2_r("oostc",AF_INET,&hostresult,buffer,1024,&errnocp,&h_errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printhost(&hostresult); - else - { - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - } - - /* test gethostbyname2(AF_INET6) */ -/* this is currently unsupported - printf("\nTEST gethostbyname2(AF_INET6)\n"); - res=_nss_ldap_gethostbyname2_r("appelscha",AF_INET6,&hostresult,buffer,1024,&errnocp,&h_errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printhost(&hostresult); - else - { - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - } -*/ - - /* test gethostbyaddr(AF_INET) */ - printf("\nTEST gethostbyaddr(AF_INET)\n"); - inet_pton(AF_INET,"192.43.210.81",address); - res=_nss_ldap_gethostbyaddr_r(address,sizeof(struct in_addr),AF_INET, - &hostresult,buffer,1024,&errnocp,&h_errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printhost(&hostresult); - else - { - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - } - - /* test gethostbyaddr(AF_INET6) */ -/* this is currently unsupported - printf("\nTEST gethostbyaddr(AF_INET6)\n"); - inet_pton(AF_INET6,"2001:200:0:8002:203:47ff:fea5:3085",address); - res=_nss_ldap_gethostbyaddr_r(address,sizeof(struct in6_addr),AF_INET6, - &hostresult,buffer,1024,&errnocp,&h_errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printhost(&hostresult); - else - { - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - } -*/ - - /* test {set,get,end}hostent() */ - printf("\nTEST {set,get,end}hostent()\n"); - res=_nss_ldap_sethostent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_gethostent_r(&hostresult,buffer,1024,&errnocp,&h_errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printhost(&hostresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - res=_nss_ldap_endhostent(); - printf("status=%s\n",nssstatus(res)); - - /* test ether_hostton() */ - printf("\nTEST ether_hostton()\n"); - res=_nss_ldap_gethostton_r("spiritus",ðerresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printether(ðerresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test ether_ntohost() */ - printf("\nTEST ether_ntohost()\n"); - res=_nss_ldap_getntohost_r(ether_aton("00:E0:4C:39:D3:6A"), - ðerresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printether(ðerresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}etherent() */ - printf("\nTEST {set,get,end}etherent()\n"); - res=_nss_ldap_setetherent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getetherent_r(ðerresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printether(ðerresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endetherent(); - printf("status=%s\n",nssstatus(res)); - - /* test getspnam() */ - printf("\nTEST getspnam()\n"); - res=_nss_ldap_getspnam_r("arthur",&shadowresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printshadow(&shadowresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}spent() */ - printf("\nTEST {set,get,end}spent()\n"); - res=_nss_ldap_setspent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getspent_r(&shadowresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printshadow(&shadowresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endspent(); - printf("status=%s\n",nssstatus(res)); - - /* test {set,get,end}netgrent() */ - printf("\nTEST {set,get,end}netgrent()\n"); - res=_nss_ldap_setnetgrent("westcomp",&netgroupresult); - printf("status=%s\n",nssstatus(res)); - while ((_nss_ldap_getnetgrent_r(&netgroupresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printnetgroup(&netgroupresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endnetgrent(&netgroupresult); - printf("status=%s\n",nssstatus(res)); - - /* test getprotobyname() */ - printf("\nTEST getprotobyname()\n"); - res=_nss_ldap_getprotobyname_r("foo",&protoresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printproto(&protoresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test getprotobynumber() */ - printf("\nTEST getprotobynumber()\n"); - res=_nss_ldap_getprotobynumber_r(10,&protoresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printproto(&protoresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}protoent() */ - printf("\nTEST {set,get,end}protoent()\n"); - res=_nss_ldap_setprotoent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getprotoent_r(&protoresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printproto(&protoresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endprotoent(); - printf("status=%s\n",nssstatus(res)); - - /* test getrpcbyname() */ - printf("\nTEST getrpcbyname()\n"); - res=_nss_ldap_getrpcbyname_r("rpcfoo",&rpcresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printrpc(&rpcresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test getrpcbynumber() */ - printf("\nTEST getrpcbynumber()\n"); - res=_nss_ldap_getrpcbynumber_r(7899,&rpcresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printrpc(&rpcresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}rpcent() */ - printf("\nTEST {set,get,end}rpcent()\n"); - res=_nss_ldap_setrpcent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getrpcent_r(&rpcresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printrpc(&rpcresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endrpcent(); - printf("status=%s\n",nssstatus(res)); - - /* test getservbyname() */ - printf("\nTEST getservbyname()\n"); - res=_nss_ldap_getservbyname_r("srvfoo","udp",&servresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printserv(&servresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test getrpcbynumber() */ - printf("\nTEST getservbyport()\n"); - res=_nss_ldap_getservbyport_r(ntohs(9988),NULL,&servresult,buffer,1024,&errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printserv(&servresult); - else - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - - /* test {set,get,end}servent() */ - printf("\nTEST {set,get,end}servent()\n"); - res=_nss_ldap_setservent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getservent_r(&servresult,buffer,1024,&errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printserv(&servresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - res=_nss_ldap_endservent(); - printf("status=%s\n",nssstatus(res)); - - /* test getnetbyname() */ - printf("\nTEST getnetbyname()\n"); - res=_nss_ldap_getnetbyname_r("west",&netresult,buffer,1024,&errnocp,&h_errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printnetwork(&netresult); - else - { - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - } - - /* test getnetbyaddr() */ - printf("\nTEST getnetbyaddr()\n"); - res=_nss_ldap_getnetbyaddr_r(inet_network("192.43.210.0"),AF_INET,&netresult,buffer,1024,&errnocp,&h_errnocp); - printf("status=%s\n",nssstatus(res)); - if (res==NSS_STATUS_SUCCESS) - printnetwork(&netresult); - else - { - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - } - - /* test {set,get,end}netent() */ - printf("\nTEST {set,get,end}netent()\n"); - res=_nss_ldap_setnetent(1); - printf("status=%s\n",nssstatus(res)); - while ((res=_nss_ldap_getnetent_r(&netresult,buffer,1024,&errnocp,&h_errnocp))==NSS_STATUS_SUCCESS) - { - printf("status=%s\n",nssstatus(res)); - printnetwork(&netresult); - } - printf("status=%s\n",nssstatus(res)); - printf("errno=%d:%s\n",(int)errnocp,strerror(errnocp)); - printf("h_errno=%d:%s\n",(int)h_errnocp,hstrerror(h_errnocp)); - res=_nss_ldap_endnetent(); - printf("status=%s\n",nssstatus(res)); - - return 0; -} diff --git a/tests/testpw.c b/tests/testpw.c deleted file mode 100644 index 04fb793..0000000 --- a/tests/testpw.c +++ /dev/null @@ -1,151 +0,0 @@ - -/* $Id$ */ - -/* This program just tests getpwent/getpwnam. You want to have nss_ldap - * plugged in, so to speak, to test anything useful. - */ - -#include "config.h" - -#ifdef _REENTRANT -#ifdef HAVE_PTHREAD_H -#include <pthread.h> -#else -#include <thread.h> -#endif /* _REENTRANT */ - -#endif /* HAVE_PTHREAD_H */ -#include <stdio.h> -#include <pwd.h> -#include <sys/types.h> - -#if NeXT -#define uid_t int -#else -#include <dlfcn.h> /* why? */ -#endif - -void test_passwd (void); -void scan_passwd (void); - -int ARGC; -char **ARGV; - -#define MAX_THREADS 16 - -void -main (int argc, char **argv) -{ -#ifdef _REENTRANT - int i; -#endif - ARGC = argc; - ARGV = argv; - -#ifdef _REENTRANT - for (i = 0; i < MAX_THREADS; i++) - { -#ifdef HAVE_PTHREAD_H - pthread_t tid; - pthread_create (NULL, 0, test_passwd, NULL, 0, &tid); - pthread_continue (tid); -#else - thread_t tid; - thr_create (NULL, 0, test_passwd, NULL, 0, &tid); - thr_continue (tid); -#endif /* HAVE_PTHREAD_H */ - } - while (thr_join (NULL, NULL, NULL) == 0); -#else - test_passwd (); -#endif - exit (0); -} - -#ifdef _REENTRANT -static void -ret (int status) -{ - thr_exit (&status); -} -#else -#define ret exit -#endif - -void -test_passwd (void) -{ - struct passwd *pw; - uid_t uid; -#ifdef _REENTRANT - char buf[1024]; - struct passwd pbuf; -#endif - - printf (">>>>>> getpwnam(\"%s\")\n", ARGC > 1 ? ARGV[1] : "root"); -#ifdef _REENTRANT - pw = getpwnam_r (ARGC > 1 ? ARGV[1] : "root", &pbuf, buf, sizeof (buf)); -#else - pw = getpwnam (ARGC > 1 ? ARGV[1] : "root"); -#endif - - if (!pw) - ret (1); - - printf ("%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, - pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell); - uid = pw->pw_uid; - - printf (">>>>>> getpwuid(%d)\n", uid); - -#ifdef _REENTRANT - pw = getpwuid_r (uid, &pbuf, buf, sizeof (buf)); -#else - pw = getpwuid (uid); -#endif - - if (!pw) - ret (1); - - printf ("%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, - pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell); - - if (ARGC > 2 && !strcmp (ARGV[2], "no")) - { - printf (">>>>>> Enumeration skipped.\n"); - } - else - { - printf (">>>>>> setpwent()\n"); - setpwent (); - - printf (">>>>>> getpwent()\n"); - scan_passwd (); - - printf (">>>>>> endpwent()\n"); - endpwent (); - } - - ret (0); -} - -void -scan_passwd (void) -{ - int i = 1; - struct passwd *p; -#ifdef _REENTRANT - char buf[1024]; - struct passwd pbuf; - while ((p = getpwent_r (&pbuf, buf, sizeof (buf))) != NULL) -#else - while ((p = getpwent ()) != NULL) -#endif - { - printf ("%s:%s:%d:%d:%s:%s:%s\n", - p->pw_name, - p->pw_passwd, - p->pw_uid, p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); - i++; - } -} diff --git a/tests/testpw3.c b/tests/testpw3.c deleted file mode 100644 index 35cc855..0000000 --- a/tests/testpw3.c +++ /dev/null @@ -1,48 +0,0 @@ -#include <stdio.h> -#include <pwd.h> - -void -main (int argc, char **argv) -{ - scan_passwd (); - - exit (0); -} -scan_passwd () -{ - struct passwd p; - char buf[1024]; - int i = 1; - -#ifdef WEIRD_GETPWENT - FILE *fp = NULL; -#endif - memset (buf, 0xFF, sizeof (buf)); - -#ifdef WEIRD_GETPWENT - setpwent_r (&fp); -#else - setpwent_r (); -#endif - -#ifdef WEIRD_GETPWENT - while (getpwent_r (&p, buf, (int) sizeof (buf), &fp) == 0) -#else - while (getpwent_r (&p, buf, (int) sizeof (buf)) == 0) -#endif - { - printf ("%s:%s:%d:%d:%s:%s:%s\n", - p.pw_name, - p.pw_passwd, - p.pw_uid, p.pw_gid, p.pw_gecos, p.pw_dir, p.pw_shell); - i++; - } - -#ifdef WEIRD_GETPWENT - endpwent_r (&fp); -#else - endpwent_r (); -#endif - fprintf (stderr, ">>>>>>> %d\n", i); - -} diff --git a/tests/testpw4.c b/tests/testpw4.c deleted file mode 100644 index 9dba073..0000000 --- a/tests/testpw4.c +++ /dev/null @@ -1,77 +0,0 @@ -/* test IRS, independently of getpwnam et al. */ - -#include <stdio.h> -#include <pwd.h> -#include <bsd/netdb.h> -#include <netinet/in.h> -#include <sys/socket.h> -#include "irs-nss.h" - -static const char *testhost = "davinci.eng.sun.com"; -static char rcsid[] = "$Id$"; - -void -main (void) -{ - - struct irs_pw *irs; - struct irs_ho *irs2; - struct passwd *pwd; - struct hostent *h; - - int i; - - i = 0; - - printf ("Testing irs_pw enumeration...\n"); - - /* test users */ - irs = irs_ldap_pw (NULL); - - (irs->rewind) (irs); - while ((pwd = (irs->next) (irs))) - { - printf ("%s:%s:%d:%d:%s:%s:%s\n", - pwd->pw_name, - pwd->pw_passwd, - pwd->pw_uid, - pwd->pw_gid, pwd->pw_gecos, pwd->pw_dir, pwd->pw_shell); - i++; - } - (irs->close) (irs); - free (irs); - - fprintf (stderr, ">>>>>>> %d entries\n", i); - - /* test hosts */ - - printf ("Testing irs_ho enumeration...\n"); - - irs2 = irs_ldap_ho (NULL); - i = 0; - - (irs2->rewind) (irs2); - while ((h = (irs2->next) (irs2))) - { - struct in_addr addr; - bcopy (h->h_addr, &addr.s_addr, h->h_length); - printf ("%s\t%s\n", (char *) inet_ntoa (addr), h->h_name); - i++; - } - (irs2->close) (irs2); - fprintf (stderr, ">>>>>>> %d entries\n", i); - - printf ("Testing irs_ho byname...\n"); - - h = (irs2->byname) (irs2, testhost); - if (h != NULL) - { - struct in_addr addr; - bcopy (h->h_addr, &addr.s_addr, h->h_length); - printf ("%s\t%s\n", (char *) inet_ntoa (addr), h->h_name); - } - - free (irs); - - exit (0); -} diff --git a/tests/testpw5.c b/tests/testpw5.c deleted file mode 100644 index bb79e3a..0000000 --- a/tests/testpw5.c +++ /dev/null @@ -1,127 +0,0 @@ - -/* $Id$ */ - -/* This program just tests getpwent/getpwnam. You want to have nss_ldap - * plugged in, so to speak, to test anything useful. - */ - -#include "config.h" - -#ifdef _REENTRANT -#ifdef HAVE_THREAD_H -#include <thread.h> -#else -#include <pthread.h> -#endif -#endif -#include <stdio.h> -#include <pwd.h> -#include <stdlib.h> - -#if NeXT -#define uid_t int -#else -#include <dlfcn.h> /* why? */ -#endif - -void test_passwd (void); - -int ARGC; -char **ARGV; - -#define MAX_THREADS 16 - -void -main (int argc, char **argv) -{ -#ifdef _REENTRANT - int i; -#endif - ARGC = argc; - ARGV = argv; - -#ifdef _REENTRANT - for (i = 0; i < MAX_THREADS; i++) - { - thread_t tid; - thr_create (NULL, 0, test_passwd, NULL, 0, &tid); - thr_continue (tid); - } - while (thr_join (NULL, NULL, NULL) == 0); -#else - test_passwd (); -#endif - exit (0); -} - -#ifdef _REENTRANT -static void -ret (int status) -{ - thr_exit (&status); -} -#else -#define ret exit -#endif - -void -test_passwd (void) -{ - struct passwd *pw; - uid_t uid; -#ifdef _REENTRANT - char buf[1024]; - struct passwd pbuf; -#endif - - - - printf (">>>>>> setpwent()\n"); - setpwent (); - - printf (">>>>>> getpwent()\n"); - scan_passwd (); - - printf (">>>>>> endpwent()\n"); - endpwent (); - - ret (0); -} - -scan_passwd () -{ - int i = 1; - struct passwd *p; -#ifdef _REENTRANT - char buf[1024]; - struct passwd pbuf; - while ((p = getpwent_r (&pbuf, buf, sizeof (buf))) != NULL) -#else - while ((p = getpwent ()) != NULL) -#endif - { - printf ("%s:%s:%d:%d:%s:%s:%s\n", - p->pw_name, - p->pw_passwd, - p->pw_uid, p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); - - if (p == NULL) - ret (1); - -#ifdef _REENTRANT - p = getpwnam_r (p->pw_name, &pbuf, buf, sizeof (buf)); -#else - p = getpwnam (p->pw_name); -#endif - - if (p == NULL) - ret (2); - - printf ("%s:%s:%d:%d:%s:%s:%s\n", - p->pw_name, - p->pw_passwd, - p->pw_uid, p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); - - i++; - } -} diff --git a/tests/testpw6.c b/tests/testpw6.c deleted file mode 100644 index 6d776ca..0000000 --- a/tests/testpw6.c +++ /dev/null @@ -1,187 +0,0 @@ - -/* $Id$ */ - -/* This program just tests getpwent/getpwnam. You want to have nss_ldap - * plugged in, so to speak, to test anything useful. - */ - -#include "config.h" - -#ifdef _REENTRANT -#ifdef HAVE_PTHREAD_H -#include <pthread.h> -#else -#include <thread.h> -#endif /* _REENTRANT */ - -#endif /* HAVE_PTHREAD_H */ -#include <stdio.h> -#include <pwd.h> -#include <sys/types.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -void test_passwd (void); -void scan_passwd (void); - -int ARGC; -char **ARGV; - -#define MAX_THREADS 8 - -void -main (int argc, char **argv) -{ -#ifdef _REENTRANT - int i; -#ifdef HAVE_PTHREAD_H - pthread_t tids[MAX_THREADS]; -#endif -#endif - pid_t pid; - ARGC = argc; - ARGV = argv; - - /* PRIME */ - scan_passwd(); - - pid = fork(); - if (pid == 0) { - printf("IN CHILD\n"); - } else { - printf("IN PARENT\n"); - } - -#ifdef _REENTRANT - for (i = 0; i < MAX_THREADS; i++) - { -#ifdef HAVE_PTHREAD_H - pthread_create(&tids[i], NULL, test_passwd, NULL); -#else - thread_t tid; - thr_create (NULL, 0, test_passwd, NULL, 0, &tid); - thr_continue (tid); -#endif /* HAVE_PTHREAD_H */ - } -#ifdef HAVE_PTHREAD_H - for (i = 0; i < MAX_THREADS; i++) pthread_join(tids[i], NULL); -#else - while (thr_join (NULL, NULL, NULL) == 0); -#endif -#else - test_passwd (); -#endif - exit (0); -} - -#ifdef _REENTRANT -static void -ret (int status) -{ -#ifdef HAVE_PTHREAD_H - pthread_exit(&status); -#else - thr_exit (&status); -#endif -} -#else -#define ret exit -#endif - -void -test_passwd (void) -{ - struct passwd *pw; - uid_t uid; -#ifdef _REENTRANT - char buf[1024]; - struct passwd pbuf; -#endif - int pid; - - printf (">>>>>> getpwnam(\"%s\")\n", ARGC > 1 ? ARGV[1] : "testuser"); -#ifdef _REENTRANT -#if GETHOSTBYNAME_R_ARGS == 6 - if (getpwnam_r (ARGC > 1 ? ARGV[1] : "testuser", &pbuf, buf, sizeof (buf), &pw) != 0) pw = NULL; -#else - pw = getpwnam_r (ARGC > 1 ? ARGV[1] : "testuser", &pbuf, buf, sizeof (buf)); -#endif -#else - pw = getpwnam (ARGC > 1 ? ARGV[1] : "testuser"); -#endif - - if (!pw) - ret (1); - - printf ("%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, - pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell); - uid = pw->pw_uid; - - - printf (">>>>>> getpwuid(%d)\n", uid); - -#ifdef _REENTRANT -#if GETHOSTBYNAME_R_ARGS == 6 - if (getpwuid_r (uid, &pbuf, buf, sizeof(buf), &pw) != 0) pw = NULL; -#else - pw = getpwuid_r (uid, &pbuf, buf, sizeof (buf)); -#endif -#else - pw = getpwuid (uid); -#endif - - if (!pw) - ret (1); - - - printf ("%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, pw->pw_uid, - pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell); - - if (ARGC > 2 && !strcmp (ARGV[2], "no")) - { - printf (">>>>>> Enumeration skipped.\n"); - } - else - { - printf (">>>>>> setpwent()\n"); - setpwent (); - - printf (">>>>>> getpwent()\n"); - scan_passwd (); - - printf (">>>>>> endpwent()\n"); - endpwent (); - } - - ret (0); -} - -void -scan_passwd (void) -{ - int i = 1; - struct passwd *p; -#ifdef _REENTRANT - char buf[1024]; - struct passwd pbuf; -#endif - - -#ifdef _REENTRANT -#if GETHOSTBYNAME_R_ARGS == 6 - while (getpwent_r (&pbuf, buf, sizeof (buf), &p) == 0 && p != NULL) -#else - while ((p = getpwent_r (&pbuf, buf, sizeof (buf))) != NULL) -#endif -#else - while ((p = getpwent ()) != NULL) -#endif - { - printf ("%s:%s:%d:%d:%s:%s:%s\n", - p->pw_name, - p->pw_passwd, - p->pw_uid, p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); - i++; - } -} |