[linux-pam] build: fix build when crypt() is not part of crypt_libs [ticket#46]
by kukuk
commit 01e0038fa55581c4afc9d63b6180d2ea77ba2940
Author: Thorsten Kukuk <kukuk(a)thkukuk.de>
Date: Mon Apr 4 11:35:57 2016 +0200
build: fix build when crypt() is not part of crypt_libs [ticket#46]
* configure.ac: Don't set empty -l option in crypt check
Signed-off-by: Yousong Zhou <yszhou4tech(a)gmail.com>
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 739390e..b377e56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -401,7 +401,7 @@ AS_IF([test "x$ac_cv_header_xcrypt_h" = "xyes"],
[crypt_libs="crypt"])
BACKUP_LIBS=$LIBS
-AC_SEARCH_LIBS([crypt],[$crypt_libs], LIBCRYPT="-l$ac_lib", LIBCRYPT="")
+AC_SEARCH_LIBS([crypt],[$crypt_libs], LIBCRYPT="${ac_lib:+-l$ac_lib}", LIBCRYPT="")
AC_CHECK_FUNCS(crypt_r crypt_gensalt_r)
LIBS=$BACKUP_LIBS
AC_SUBST(LIBCRYPT)
8 years, 1 month
[linux-pam] build: use $host_cpu for lib64 directory handling [ticket#46]
by kukuk
commit 4a1867dce6f60c2985271a64b70bc7fb702bbe0a
Author: Thorsten Kukuk <kukuk(a)thkukuk.de>
Date: Mon Apr 4 11:33:11 2016 +0200
build: use $host_cpu for lib64 directory handling [ticket#46]
* configure.ac: use $host_cpu for lib64 directory handling.
Signed-off-by: Yousong Zhou <yszhou4tech(a)gmail.com>
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 20f6ba3..739390e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,7 @@ dnl If we use /usr as prefix, use /etc for config files
fi
if test ${libdir} = '${exec_prefix}/lib'
then
- case "`uname -m`" in
+ case "$host_cpu" in
x86_64|ppc64|s390x|sparc64)
libdir="/lib64" ;;
*)
8 years, 1 month
[linux-pam] Fix whitespace issues
by Dmitry V. Levin
commit df87fb69e44d024ce4a0a052c78b85d261e6c6a3
Author: Dmitry V. Levin <ldv(a)altlinux.org>
Date: Fri Apr 1 17:07:44 2016 +0000
Fix whitespace issues
Remove blank lines at EOF introduced by commit
a684595c0bbd88df71285f43fb27630e3829121e,
making the project free of warnings reported by
git diff --check 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD
* libpam/pam_dynamic.c: Remove blank line at EOF.
* modules/pam_echo/pam_echo.c: Likewise.
* modules/pam_keyinit/pam_keyinit.c: Likewise.
* modules/pam_mkhomedir/pam_mkhomedir.c: Likewise.
* modules/pam_pwhistory/pam_pwhistory.c: Likewise.
* modules/pam_rhosts/pam_rhosts.c: Likewise.
* modules/pam_sepermit/pam_sepermit.c: Likewise.
* modules/pam_stress/pam_stress.c: Likewise.
libpam/pam_dynamic.c | 1 -
modules/pam_echo/pam_echo.c | 1 -
modules/pam_keyinit/pam_keyinit.c | 1 -
modules/pam_mkhomedir/pam_mkhomedir.c | 1 -
modules/pam_pwhistory/pam_pwhistory.c | 1 -
modules/pam_rhosts/pam_rhosts.c | 1 -
modules/pam_sepermit/pam_sepermit.c | 1 -
modules/pam_stress/pam_stress.c | 1 -
8 files changed, 0 insertions(+), 8 deletions(-)
---
diff --git a/libpam/pam_dynamic.c b/libpam/pam_dynamic.c
index 50bfd79..c063083 100644
--- a/libpam/pam_dynamic.c
+++ b/libpam/pam_dynamic.c
@@ -136,4 +136,3 @@ _pam_dlerror (void)
return dlerror ();
#endif
}
-
diff --git a/modules/pam_echo/pam_echo.c b/modules/pam_echo/pam_echo.c
index 860ff0a..8e3d35f 100644
--- a/modules/pam_echo/pam_echo.c
+++ b/modules/pam_echo/pam_echo.c
@@ -261,4 +261,3 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc,
else
return PAM_IGNORE;
}
-
diff --git a/modules/pam_keyinit/pam_keyinit.c b/modules/pam_keyinit/pam_keyinit.c
index 5dd7b06..b2fa5d9 100644
--- a/modules/pam_keyinit/pam_keyinit.c
+++ b/modules/pam_keyinit/pam_keyinit.c
@@ -250,4 +250,3 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags UNUSED,
return PAM_SUCCESS;
}
-
diff --git a/modules/pam_mkhomedir/pam_mkhomedir.c b/modules/pam_mkhomedir/pam_mkhomedir.c
index daed63a..84c922f 100644
--- a/modules/pam_mkhomedir/pam_mkhomedir.c
+++ b/modules/pam_mkhomedir/pam_mkhomedir.c
@@ -232,4 +232,3 @@ int pam_sm_close_session (pam_handle_t * pamh UNUSED, int flags UNUSED,
{
return PAM_SUCCESS;
}
-
diff --git a/modules/pam_pwhistory/pam_pwhistory.c b/modules/pam_pwhistory/pam_pwhistory.c
index 0c07dc1..3efb0ca 100644
--- a/modules/pam_pwhistory/pam_pwhistory.c
+++ b/modules/pam_pwhistory/pam_pwhistory.c
@@ -234,4 +234,3 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv)
return PAM_SUCCESS;
}
-
diff --git a/modules/pam_rhosts/pam_rhosts.c b/modules/pam_rhosts/pam_rhosts.c
index d6e7030..ed98d63 100644
--- a/modules/pam_rhosts/pam_rhosts.c
+++ b/modules/pam_rhosts/pam_rhosts.c
@@ -135,4 +135,3 @@ pam_sm_setcred (pam_handle_t *pamh UNUSED, int flags UNUSED,
{
return PAM_SUCCESS;
}
-
diff --git a/modules/pam_sepermit/pam_sepermit.c b/modules/pam_sepermit/pam_sepermit.c
index 0b90a39..c653290 100644
--- a/modules/pam_sepermit/pam_sepermit.c
+++ b/modules/pam_sepermit/pam_sepermit.c
@@ -443,4 +443,3 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
{
return pam_sm_authenticate(pamh, flags, argc, argv);
}
-
diff --git a/modules/pam_stress/pam_stress.c b/modules/pam_stress/pam_stress.c
index 44c3a30..87a6e7c 100644
--- a/modules/pam_stress/pam_stress.c
+++ b/modules/pam_stress/pam_stress.c
@@ -545,4 +545,3 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
return retval;
}
-
8 years, 1 month
[linux-pam] Use TI-RPC functions if we compile and link against libtirpc. The old SunRPC functions don't work wi
by kukuk
commit 549aef483c9f1852e1fbefabc4ebbbe72e00c243
Author: Thorsten Kukuk <kukuk(a)thkukuk.de>
Date: Fri Apr 1 15:28:09 2016 +0200
Use TI-RPC functions if we compile and link against libtirpc.
The old SunRPC functions don't work with IPv6.
* configure.ac: Set and restore CPPFLAGS
* modules/pam_unix/pam_unix_passwd.c: Replace getrpcport with
rpcb_getaddr if available.
configure.ac | 4 ++
modules/pam_unix/pam_unix_passwd.c | 73 +++++++++++++++++++++++++++++++++++-
2 files changed, 76 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 534194d..20f6ba3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -451,18 +451,21 @@ AC_ARG_ENABLE([nis],
AS_IF([test "x$enable_nis" != "xno"], [
old_CFLAGS=$CFLAGS
+ old_CPPFLAGS=$CPPFLAGS
old_LIBS=$LIBS
dnl if there's libtirpc available, prefer that over the system
dnl implementation.
PKG_CHECK_MODULES([TIRPC], [libtirpc], [
CFLAGS="$CFLAGS $TIRPC_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $TIRPC_CFLAGS"
LIBS="$LIBS $TIRPC_LIBS"
], [:;])
PKG_CHECK_MODULES([NSL], [libnsl], [],
[AC_CHECK_LIB([nsl],[yp_match],[NSL_LIBS="-lnsl"],[NSL_LIBS=""])])
CFLAGS="$CFLAGS $NSL_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $NSL_CFLAGS"
LIBS="$LIBS $NSL_LIBS"
AC_CHECK_FUNCS([yp_get_default_domain yperr_string yp_master yp_bind yp_match yp_unbind])
@@ -475,6 +478,7 @@ AS_IF([test "x$enable_nis" != "xno"], [
])
CFLAGS="$old_CFLAGS"
+ CPPFLAGS="$old_CPPFLAGS"
LIBS="$old_LIBS"
])
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c
index e3d3209..fa29327 100644
--- a/modules/pam_unix/pam_unix_passwd.c
+++ b/modules/pam_unix/pam_unix_passwd.c
@@ -92,7 +92,7 @@
# include "yppasswd.h"
-# if !HAVE_DECL_GETRPCPORT
+# if !HAVE_DECL_GETRPCPORT &&!HAVE_RPCB_GETADDR
extern int getrpcport(const char *host, unsigned long prognum,
unsigned long versnum, unsigned int proto);
# endif /* GNU libc 2.1 */
@@ -114,11 +114,48 @@ extern int getrpcport(const char *host, unsigned long prognum,
#define MAX_PASSWD_TRIES 3
#ifdef HAVE_NIS
+#ifdef HAVE_RPCB_GETADDR
+static unsigned short
+__taddr2port (const struct netconfig *nconf, const struct netbuf *nbuf)
+{
+ unsigned short port = 0;
+ struct __rpc_sockinfo si;
+ struct sockaddr_in *sin;
+ struct sockaddr_in6 *sin6;
+ if (!__rpc_nconf2sockinfo(nconf, &si))
+ return 0;
+
+ switch (si.si_af)
+ {
+ case AF_INET:
+ sin = nbuf->buf;
+ port = sin->sin_port;
+ break;
+ case AF_INET6:
+ sin6 = nbuf->buf;
+ port = sin6->sin6_port;
+ break;
+ default:
+ break;
+ }
+
+ return htons (port);
+}
+#endif
+
static char *getNISserver(pam_handle_t *pamh, unsigned int ctrl)
{
char *master;
char *domainname;
int port, err;
+#if defined(HAVE_RPCB_GETADDR)
+ struct netconfig *nconf;
+ struct netbuf svcaddr;
+ char addrbuf[INET6_ADDRSTRLEN];
+ void *handle;
+ int found;
+#endif
+
#ifdef HAVE_YP_GET_DEFAULT_DOMAIN
if ((err = yp_get_default_domain(&domainname)) != 0) {
@@ -146,7 +183,41 @@ static char *getNISserver(pam_handle_t *pamh, unsigned int ctrl)
yperr_string(err));
return NULL;
}
+#ifdef HAVE_RPCB_GETADDR
+ svcaddr.len = 0;
+ svcaddr.maxlen = sizeof (addrbuf);
+ svcaddr.buf = addrbuf;
+ port = 0;
+ found = 0;
+
+ handle = setnetconfig();
+ while ((nconf = getnetconfig(handle)) != NULL) {
+ if (!strcmp(nconf->nc_proto, "udp")) {
+ if (rpcb_getaddr(YPPASSWDPROG, YPPASSWDPROC_UPDATE,
+ nconf, &svcaddr, master)) {
+ port = __taddr2port (nconf, &svcaddr);
+ endnetconfig (handle);
+ found=1;
+ break;
+ }
+
+ if (rpc_createerr.cf_stat != RPC_UNKNOWNHOST) {
+ clnt_pcreateerror (master);
+ pam_syslog (pamh, LOG_ERR,
+ "rpcb_getaddr (%s) failed!", master);
+ return NULL;
+ }
+ }
+ }
+
+ if (!found) {
+ pam_syslog (pamh, LOG_ERR,
+ "Cannot find suitable transport for protocol 'udp'");
+ return NULL;
+ }
+#else
port = getrpcport(master, YPPASSWDPROG, YPPASSWDPROC_UPDATE, IPPROTO_UDP);
+#endif
if (port == 0) {
pam_syslog(pamh, LOG_WARNING,
"yppasswdd not running on NIS master host");
8 years, 1 month