26 #include <sys/types.h>
36 main(
int argc,
char **argv)
41 char *user, *passwd, *p;
47 fprintf(stderr,
"Usage: basic_nis_auth <domainname> <nis map for password>\n");
48 fprintf(stderr,
"\n");
49 fprintf(stderr,
"Example basic_nis_auth mydomain.com passwd.byname\n");
55 while (fgets(buf, 256, stdin) !=
NULL) {
56 if ((p = strchr(buf,
'\n')) !=
NULL)
59 if ((user = strtok(buf,
" ")) ==
NULL) {
63 if ((passwd = strtok(
NULL,
"")) ==
NULL) {
75 printf(
"ERR No such user\n");
81 if ((crypted =
crypt(passwd, nispasswd)) && strcmp(nispasswd, crypted) == 0) {
86 printf(
"ERR Wrong password\n");
90 printf(
"BH message=\"Missing crypto capability\"\n");