scummvm random work
[patches.git] / shadow-no-innetgr.patch
CommitLineData
5e993f12 1Index: configure.in
2===================================================================
3RCS file: /cvsroot/shadow/configure.in,v
4retrieving revision 1.150
5diff -u -p -r1.150 configure.in
6--- configure.in 3 Aug 2006 10:14:05 -0000 1.150
7+++ configure.in 5 Aug 2006 19:19:10 -0000
8@@ -32,11 +32,11 @@ AC_HEADER_SYS_WAIT
9 AC_CHECK_HEADERS(errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
10 utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
11 utime.h ulimit.h sys/resource.h gshadow.h shadow.h lastlog.h \
12- locale.h rpc/key_prot.h)
13+ locale.h rpc/key_prot.h netdb.h)
14
15 AC_CHECK_FUNCS(a64l fchmod fchown fsync getgroups gethostname getspnam \
16 gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
17- memcpy memset setgroups sigaction strchr updwtmp updwtmpx)
18+ memcpy memset setgroups sigaction strchr updwtmp updwtmpx innetgr)
19 AC_SYS_LARGEFILE
20
21 dnl Checks for typedefs, structures, and compiler characteristics.
22Index: src/login_nopam.c
23===================================================================
24RCS file: /cvsroot/shadow/src/login_nopam.c,v
25retrieving revision 1.8
26diff -u -p -r1.8 login_nopam.c
27--- src/login_nopam.c 7 Sep 2005 15:00:45 -0000 1.8
28+++ src/login_nopam.c 5 Aug 2006 19:19:10 -0000
29@@ -37,7 +37,9 @@
30 #include <stdio.h>
31 #include <syslog.h>
32 #include <ctype.h>
33+#ifdef HAVE_NETDB_H
34 #include <netdb.h>
35+#endif
36 #include <grp.h>
37 #ifdef PRIMARY_GROUP_MATCH
38 #include <pwd.h>
39@@ -49,8 +51,6 @@
40 #include <sys/socket.h>
41 #include <netinet/in.h>
42 #include <arpa/inet.h> /* for inet_ntoa() */
43-extern struct group *getgrnam ();
44-extern int innetgr ();
45
46 #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
47 #undef MAXHOSTNAMELEN
48@@ -178,6 +178,7 @@ static char *myhostname (void)
49 return (name);
50 }
51
52+#ifdef HAVE_INNETGR
53 /* netgroup_match - match group against machine or user */
54 static int
55 netgroup_match (const char *group, const char *machine, const char *user)
56@@ -193,6 +194,7 @@ netgroup_match (const char *group, const
57
58 return innetgr (group, machine, user, mydomain);
59 }
60+#endif
61
62 /* user_match - match a username against one token */
63 static int user_match (const char *tok, const char *string)
64@@ -214,8 +216,10 @@ static int user_match (const char *tok,
65 *at = 0;
66 return (user_match (tok, string)
67 && from_match (at + 1, myhostname ()));
68+#ifdef HAVE_INNETGR
69 } else if (tok[0] == '@') { /* netgroup */
70 return (netgroup_match (tok + 1, (char *) 0, string));
71+#endif
72 } else if (string_match (tok, string)) { /* ALL or exact match */
73 return (YES);
74 } else if ((group = getgrnam (tok))) { /* try group membership */
75@@ -271,9 +275,12 @@ static int from_match (const char *tok,
76 * contain a "." character. If the token is a network number, return YES
77 * if it matches the head of the string.
78 */
79+#ifdef HAVE_INNETGR
80 if (tok[0] == '@') { /* netgroup */
81 return (netgroup_match (tok + 1, string, (char *) 0));
82- } else if (string_match (tok, string)) { /* ALL or exact match */
83+ } else
84+#endif
85+ if (string_match (tok, string)) { /* ALL or exact match */
86 return (YES);
87 } else if (tok[0] == '.') { /* domain: match last fields */
88 if ((str_len = strlen (string)) > (tok_len = strlen (tok))