BSD 4_3 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 12 May 1983 07:24:48 +0000 (23:24 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 12 May 1983 07:24:48 +0000 (23:24 -0800)
Work on file usr/contrib/courier/examples/passwd/lookup.c

Synthesized-from: CSRG/cd1/4.3

usr/contrib/courier/examples/passwd/lookup.c [new file with mode: 0644]

diff --git a/usr/contrib/courier/examples/passwd/lookup.c b/usr/contrib/courier/examples/passwd/lookup.c
new file mode 100644 (file)
index 0000000..2e2402e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Sample program to access remote password lookup.
+ *
+ * Usage: lookup machine username
+ */
+#include <stdio.h>
+#include "PasswordLookup.h"
+
+main(argc, argv)
+       int argc;
+       char **argv;
+{
+       Passwd passwd;
+
+       if (argc != 3) {
+               fprintf(stderr, "Usage: %s machine username\n", argv[0]);
+               exit(1);
+       }
+       BindPasswordLookupToMachine(argv[1]);
+       passwd = LookupUser(argv[2]);
+       if (strcmp(passwd.pw_name, argv[2]) != 0)
+               printf("User %s unknown on %s.\n", argv[2], argv[1]);
+       else
+               display(&passwd);
+}
+
+display(p)
+       Passwd *p;
+{
+       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);
+}