blob: 5e551ac48f30f0d87d12ec3abe4012349b0805a6 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001innetgr may not be there so make sure that when innetgr is not present
2then we inform about it and not use it.
3
4-Khem
5
6Upstream-Status: Pending
7
8Signed-off-by: Scott Garman <scott.a.garman@intel.com>
9
10Index: Linux-PAM-1.1.3/modules/pam_group/pam_group.c
11===================================================================
12--- Linux-PAM-1.1.3.orig/modules/pam_group/pam_group.c
13+++ Linux-PAM-1.1.3/modules/pam_group/pam_group.c
14@@ -659,7 +659,11 @@ static int check_account(pam_handle_t *p
15 }
16 /* If buffer starts with @, we are using netgroups */
17 if (buffer[0] == '@')
18- good &= innetgr (&buffer[1], NULL, user, NULL);
19+#ifdef HAVE_INNETGR
20+ good &= innetgr (&buffer[1], NULL, user, NULL);
21+#else
22+ pam_syslog (pamh, LOG_ERR, "pam_group does not have netgroup support");
23+#endif
24 /* otherwise, if the buffer starts with %, it's a UNIX group */
25 else if (buffer[0] == '%')
26 good &= pam_modutil_user_in_group_nam_nam(pamh, user, &buffer[1]);
27Index: Linux-PAM-1.1.3/modules/pam_time/pam_time.c
28===================================================================
29--- Linux-PAM-1.1.3.orig/modules/pam_time/pam_time.c
30+++ Linux-PAM-1.1.3/modules/pam_time/pam_time.c
31@@ -555,9 +555,13 @@ check_account(pam_handle_t *pamh, const
32 }
33 /* If buffer starts with @, we are using netgroups */
34 if (buffer[0] == '@')
35- good &= innetgr (&buffer[1], NULL, user, NULL);
36+#ifdef HAVE_INNETGR
37+ good &= innetgr (&buffer[1], NULL, user, NULL);
38+#else
39+ pam_syslog (pamh, LOG_ERR, "pam_time does not have netgroup support");
40+#endif
41 else
42- good &= logic_field(pamh, user, buffer, count, is_same);
43+ good &= logic_field(pamh, user, buffer, count, is_same);
44 D(("with user: %s", good ? "passes":"fails" ));
45
46 /* here we get the time field */
47Index: Linux-PAM-1.1.3/modules/pam_succeed_if/pam_succeed_if.c
48===================================================================
49--- Linux-PAM-1.1.3.orig/modules/pam_succeed_if/pam_succeed_if.c
50+++ Linux-PAM-1.1.3/modules/pam_succeed_if/pam_succeed_if.c
51@@ -231,18 +231,27 @@ evaluate_notingroup(pam_handle_t *pamh,
52 }
53 /* Return PAM_SUCCESS if the (host,user) is in the netgroup. */
54 static int
55-evaluate_innetgr(const char *host, const char *user, const char *group)
56+evaluate_innetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
57 {
58+#ifdef HAVE_INNETGR
59 if (innetgr(group, host, user, NULL) == 1)
60 return PAM_SUCCESS;
61+#else
62+ pam_syslog (pamh, LOG_ERR, "pam_succeed_if does not have netgroup support");
63+#endif
64+
65 return PAM_AUTH_ERR;
66 }
67 /* Return PAM_SUCCESS if the (host,user) is NOT in the netgroup. */
68 static int
69-evaluate_notinnetgr(const char *host, const char *user, const char *group)
70+evaluate_notinnetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
71 {
72+#ifdef HAVE_INNETGR
73 if (innetgr(group, host, user, NULL) == 0)
74 return PAM_SUCCESS;
75+#else
76+ pam_syslog (pamh, LOG_ERR, "pam_succeed_if does not have netgroup support");
77+#endif
78 return PAM_AUTH_ERR;
79 }
80
81@@ -361,14 +370,14 @@ evaluate(pam_handle_t *pamh, int debug,
82 const void *rhost;
83 if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
84 rhost = NULL;
85- return evaluate_innetgr(rhost, user, right);
86+ return evaluate_innetgr(pamh, rhost, user, right);
87 }
88 /* (Rhost, user) is not in this group. */
89 if (strcasecmp(qual, "notinnetgr") == 0) {
90 const void *rhost;
91 if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
92 rhost = NULL;
93- return evaluate_notinnetgr(rhost, user, right);
94+ return evaluate_notinnetgr(pamh, rhost, user, right);
95 }
96 /* Fail closed. */
97 return PAM_SERVICE_ERR;