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