41 char *user, *passwd, *p;
44 setbuf(stdout,
nullptr);
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) !=
nullptr) {
56 if ((p = strchr(buf,
'\n')) !=
nullptr)
59 if ((user = strtok(buf,
" ")) ==
nullptr) {
63 if ((passwd = strtok(
nullptr,
"")) ==
nullptr) {
75 printf(
"ERR No such user\n");
80 char *crypted =
nullptr;
81 if ((crypted =
crypt(passwd, nispasswd)) && strcmp(nispasswd, crypted) == 0) {
86 printf(
"ERR Wrong password\n");
90 printf(
"BH message=\"Missing crypto capability\"\n");
int main(int argc, char **argv)
char * crypt(const char *wort, const char *salt)
char * get_nis_password(char *user, char *nisdomain, char *nismap)
void rfc1738_unescape(char *url)