1 /*****************************************************************************
2 * libnss-afs (nss_afs_test.c)
4 * Copyright 2008, licensed under GNU Library General Public License (LGPL)
5 * see COPYING file for details
7 * by Adam Megacz <megacz@hcoop.net>
8 * derived from Frank Burkhardt's libnss_ptdb,
9 * which was derived from Todd M. Lewis' libnss_pts
10 *****************************************************************************/
13 #include <sys/socket.h>
14 #include <netinet/in.h>
15 #include <sys/types.h>
18 #include <sys/select.h>
23 int main(int argc
,char **argv
,char **envp
) {
26 char *buf
, *arg
, *name
;
32 printf("Usage: %s [name or id]\n\n",argv
[0]);
33 printf("Attempts lookup of a username or userid.\n");
34 printf("Statically linked against nss_afs.c.\n");
38 if ( ( arg
[0] > '0' ) && ( arg
[0] < '9' ) ) {
41 res
=ptsid2name(uid
,&buf
,&buflen
);
44 res
=ptsname2id(arg
,&uid
);
47 case NSS_STATUS_SUCCESS
:
48 printf("uid=%i name=%s\n",uid
,name
);
50 case NSS_STATUS_NOTFOUND
:
51 printf("not found.\n");
53 case NSS_STATUS_UNAVAIL
:
54 printf("unable to contact ptserver or library internal error.\n");