]>
git.ipfire.org Git - thirdparty/squid.git/blob - helpers/basic_auth/YP/yp_auth.c
2 * Adapted By Rabellino Sergio (rabellino@di.unito.it) For Solaris 2.x
3 * From NCSA Authentication module
20 #include <sys/types.h>
32 int get_nis_password();
36 main(int argc
, char **argv
)
42 char *user
, *passwd
, *p
;
47 fprintf(stderr
, "Usage: yp_auth <domainname> <nis map for password>\n");
48 fprintf(stderr
, "\n");
49 fprintf(stderr
, "Example yp_auth mydomain.com passwd.byname\n");
55 while (fgets(buf
, 256, stdin
) != NULL
) {
56 if ((p
= strchr(buf
, '\n')) != NULL
)
57 *p
= '\0'; /* strip \n */
59 if ((user
= strtok(buf
, " ")) == NULL
) {
63 if ((passwd
= strtok(NULL
, "")) == NULL
) {
67 res
= get_nis_password(user
, nispasswd
, nisdomain
, nismap
);
70 /* User does not exist */
72 } else if (strcmp(nispasswd
, (char *) crypt(passwd
, nispasswd
))) {
73 /* Password incorrect */
76 /* All ok !, thanks... */