mirror of
https://git.yoctoproject.org/poky
synced 2026-03-11 09:49:41 +01:00
libpam_1.1.3.bb: Fix compilation on uclibc when innetgr is absent
(From OE-Core rev: a0d441ec7c43fe1b4490c1c9b03a0cf5811109fd) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
92
meta/recipes-extended/pam/libpam/pam-no-innetgr.patch
Normal file
92
meta/recipes-extended/pam/libpam/pam-no-innetgr.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
innetgr may not be there so make sure that when innetgr is not present
|
||||
then we inform about it and not use it.
|
||||
|
||||
-Khem
|
||||
Index: Linux-PAM-1.1.3/modules/pam_group/pam_group.c
|
||||
===================================================================
|
||||
--- Linux-PAM-1.1.3.orig/modules/pam_group/pam_group.c
|
||||
+++ Linux-PAM-1.1.3/modules/pam_group/pam_group.c
|
||||
@@ -659,7 +659,11 @@ static int check_account(pam_handle_t *p
|
||||
}
|
||||
/* If buffer starts with @, we are using netgroups */
|
||||
if (buffer[0] == '@')
|
||||
- good &= innetgr (&buffer[1], NULL, user, NULL);
|
||||
+#ifdef HAVE_INNETGR
|
||||
+ good &= innetgr (&buffer[1], NULL, user, NULL);
|
||||
+#else
|
||||
+ pam_syslog (pamh, LOG_ERR, "pam_group does not have netgroup support");
|
||||
+#endif
|
||||
/* otherwise, if the buffer starts with %, it's a UNIX group */
|
||||
else if (buffer[0] == '%')
|
||||
good &= pam_modutil_user_in_group_nam_nam(pamh, user, &buffer[1]);
|
||||
Index: Linux-PAM-1.1.3/modules/pam_time/pam_time.c
|
||||
===================================================================
|
||||
--- Linux-PAM-1.1.3.orig/modules/pam_time/pam_time.c
|
||||
+++ Linux-PAM-1.1.3/modules/pam_time/pam_time.c
|
||||
@@ -555,9 +555,13 @@ check_account(pam_handle_t *pamh, const
|
||||
}
|
||||
/* If buffer starts with @, we are using netgroups */
|
||||
if (buffer[0] == '@')
|
||||
- good &= innetgr (&buffer[1], NULL, user, NULL);
|
||||
+#ifdef HAVE_INNETGR
|
||||
+ good &= innetgr (&buffer[1], NULL, user, NULL);
|
||||
+#else
|
||||
+ pam_syslog (pamh, LOG_ERR, "pam_time does not have netgroup support");
|
||||
+#endif
|
||||
else
|
||||
- good &= logic_field(pamh, user, buffer, count, is_same);
|
||||
+ good &= logic_field(pamh, user, buffer, count, is_same);
|
||||
D(("with user: %s", good ? "passes":"fails" ));
|
||||
|
||||
/* here we get the time field */
|
||||
Index: Linux-PAM-1.1.3/modules/pam_succeed_if/pam_succeed_if.c
|
||||
===================================================================
|
||||
--- Linux-PAM-1.1.3.orig/modules/pam_succeed_if/pam_succeed_if.c
|
||||
+++ Linux-PAM-1.1.3/modules/pam_succeed_if/pam_succeed_if.c
|
||||
@@ -231,18 +231,27 @@ evaluate_notingroup(pam_handle_t *pamh,
|
||||
}
|
||||
/* Return PAM_SUCCESS if the (host,user) is in the netgroup. */
|
||||
static int
|
||||
-evaluate_innetgr(const char *host, const char *user, const char *group)
|
||||
+evaluate_innetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
|
||||
{
|
||||
+#ifdef HAVE_INNETGR
|
||||
if (innetgr(group, host, user, NULL) == 1)
|
||||
return PAM_SUCCESS;
|
||||
+#else
|
||||
+ pam_syslog (pamh, LOG_ERR, "pam_succeed_if does not have netgroup support");
|
||||
+#endif
|
||||
+
|
||||
return PAM_AUTH_ERR;
|
||||
}
|
||||
/* Return PAM_SUCCESS if the (host,user) is NOT in the netgroup. */
|
||||
static int
|
||||
-evaluate_notinnetgr(const char *host, const char *user, const char *group)
|
||||
+evaluate_notinnetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
|
||||
{
|
||||
+#ifdef HAVE_INNETGR
|
||||
if (innetgr(group, host, user, NULL) == 0)
|
||||
return PAM_SUCCESS;
|
||||
+#else
|
||||
+ pam_syslog (pamh, LOG_ERR, "pam_succeed_if does not have netgroup support");
|
||||
+#endif
|
||||
return PAM_AUTH_ERR;
|
||||
}
|
||||
|
||||
@@ -361,14 +370,14 @@ evaluate(pam_handle_t *pamh, int debug,
|
||||
const void *rhost;
|
||||
if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
|
||||
rhost = NULL;
|
||||
- return evaluate_innetgr(rhost, user, right);
|
||||
+ return evaluate_innetgr(pamh, rhost, user, right);
|
||||
}
|
||||
/* (Rhost, user) is not in this group. */
|
||||
if (strcasecmp(qual, "notinnetgr") == 0) {
|
||||
const void *rhost;
|
||||
if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
|
||||
rhost = NULL;
|
||||
- return evaluate_notinnetgr(rhost, user, right);
|
||||
+ return evaluate_notinnetgr(pamh, rhost, user, right);
|
||||
}
|
||||
/* Fail closed. */
|
||||
return PAM_SERVICE_ERR;
|
||||
@@ -19,6 +19,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/pam/library/Linux-PAM-${PV}.tar.bz2 \
|
||||
file://99_pam \
|
||||
file://pam.d/*"
|
||||
|
||||
SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch"
|
||||
|
||||
SRC_URI[md5sum] = "6db7fcb5db6253350e3a4648ceac40e7"
|
||||
SRC_URI[sha256sum] = "17b268789b935a76e736a1150210dd12f156972973e79347668f828d43632652"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user