initial import
[patches.git] / shadow-4.0.13-nonis.patch
CommitLineData
5e993f12 1--- src/login_nopam.c
2+++ src/login_nopam.c
3@@ -50,7 +50,9 @@
4 #include <netinet/in.h>
5 #include <arpa/inet.h> /* for inet_ntoa() */
6 extern struct group *getgrnam ();
7+#ifdef USE_NIS
8 extern int innetgr ();
9+#endif
10
11 #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
12 #undef MAXHOSTNAMELEN
13@@ -178,6 +180,7 @@ static char *myhostname (void)
14 return (name);
15 }
16
17+#ifdef USE_NIS
18 /* netgroup_match - match group against machine or user */
19 static int
20 netgroup_match (const char *group, const char *machine, const char *user)
21@@ -193,6 +196,7 @@ netgroup_match (const char *group, const
22
23 return innetgr (group, machine, user, mydomain);
24 }
25+#endif
26
27 /* user_match - match a username against one token */
28 static int user_match (const char *tok, const char *string)
29@@ -214,8 +218,10 @@ static int user_match (const char *tok,
30 *at = 0;
31 return (user_match (tok, string)
32 && from_match (at + 1, myhostname ()));
33+#ifdef USE_NIS
34 } else if (tok[0] == '@') { /* netgroup */
35 return (netgroup_match (tok + 1, (char *) 0, string));
36+#endif
37 } else if (string_match (tok, string)) { /* ALL or exact match */
38 return (YES);
39 } else if ((group = getgrnam (tok))) { /* try group membership */
40@@ -271,9 +277,12 @@ static int from_match (const char *tok,
41 * contain a "." character. If the token is a network number, return YES
42 * if it matches the head of the string.
43 */
44+#ifdef USE_NIS
45 if (tok[0] == '@') { /* netgroup */
46 return (netgroup_match (tok + 1, string, (char *) 0));
47- } else if (string_match (tok, string)) { /* ALL or exact match */
48+ } else
49+#endif
50+ if (string_match (tok, string)) { /* ALL or exact match */
51 return (YES);
52 } else if (tok[0] == '.') { /* domain: match last fields */
53 if ((str_len = strlen (string)) > (tok_len = strlen (tok))