summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-10-14 19:11:49 +0000
committerArthur de Jong <arthur@arthurdejong.org>2010-10-14 19:11:49 +0000
commit6c1fd9d223e14b80db18058a720a61be415c1936 (patch)
tree02039bf02d95ac0b1a939ff7d2e4804be6b44f52
parent147840dcf4a3ed565ca8311f8a3d489c668126cb (diff)
parentfc416e8a93e327fb04f95b70e728e4bbeb9a3657 (diff)
merge changes from trunk
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1275 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--compat/ldap_passwd_s.c4
-rw-r--r--configure.ac42
-rw-r--r--nslcd/myldap.c17
-rw-r--r--nslcd/pam.c8
-rw-r--r--nss/Makefile.am2
5 files changed, 41 insertions, 32 deletions
diff --git a/compat/ldap_passwd_s.c b/compat/ldap_passwd_s.c
index 85825cb..6fc5cff 100644
--- a/compat/ldap_passwd_s.c
+++ b/compat/ldap_passwd_s.c
@@ -29,7 +29,7 @@
#include <ldap.h>
#include "compat/ldap_compat.h"
-#include "nslcd/log.h"
+#include "compat/attrs.h"
#ifndef LDAP_EXOP_MODIFY_PASSWD
#ifdef LDAP_EXOP_X_MODIFY_PASSWD
@@ -66,7 +66,7 @@ extern int ldap_extended_operation_s(LDAP *ld,LDAP_CONST char *reqoid,
the new password to set and newpasswd is sometimes returned (though not
by us). See RFC 3062 for details.*/
int ldap_passwd_s(LDAP *ld,struct berval *user,struct berval *oldpw,
- struct berval *newpw,struct berval *newpasswd,
+ struct berval *newpw,struct berval UNUSED(*newpasswd),
LDAPControl **sctrls,LDAPControl **cctrls)
{
#ifndef HAVE_LDAP_EXTENDED_OPERATION_S
diff --git a/configure.ac b/configure.ac
index 0785d4d..69f8999 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,10 +252,10 @@ AC_MSG_RESULT($PAM_LDAP_SONAME)
AC_SUBST(PAM_LDAP_SONAME)
# check which modules should be build
-AC_ARG_WITH(nss-ldap-maps,
- AS_HELP_STRING([--with-nss-ldap-maps=MAP LIST],
+AC_ARG_WITH(nss-maps,
+ AS_HELP_STRING([--with-nss-maps=MAP LIST],
[comma separated list of NSS maps to build @<:@all@:>@]),
- ,[ with_nss_ldap_maps="all" ])
+ ,[ with_nss_maps="all" ])
# checks for availability of header files
AC_CHECK_HEADERS([ctype.h strings.h pthread.h fcntl.h limits.h])
@@ -309,6 +309,18 @@ AC_CHECK_TYPES(struct ether_addr,,,[
#include <netinet/ether.h>
#endif])
+# check for ether_aton and ether_ntoa functions
+AC_CHECK_FUNCS(ether_aton ether_ntoa ether_aton_r ether_ntoa_r)
+AC_CHECK_DECLS([ether_aton,ether_ntoa],,,[
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <netinet/if_ether.h>
+ #ifdef HAVE_NETINET_ETHER_H
+ #include <netinet/ether.h>
+ #endif])
+
# check to see if socklen_t is defined
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t,size_t,[Define to `size_t' if not defined elswhere.]),[
@@ -403,15 +415,15 @@ then
# check which module source files to use
AC_MSG_CHECKING([which NSS maps to build])
- if test "x$with_nss_ldap_maps" = "xall"
+ if test "x$with_nss_maps" = "xall"
then
case "$with_nss_flavour" in
- glibc) with_nss_ldap_maps="aliases,ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow" ;;
- solaris) with_nss_ldap_maps="ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow" ;;
+ glibc) with_nss_maps="aliases,ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow" ;;
+ solaris) with_nss_maps="ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow" ;;
esac
fi
- AC_MSG_RESULT($with_nss_ldap_maps)
- NSS_MODULE_OBJS="`echo "$with_nss_ldap_maps " | sed 's/,/ /g;s/ */.$(OBJEXT) /g'`"
+ AC_MSG_RESULT($with_nss_maps)
+ NSS_MODULE_OBJS="`echo "$with_nss_maps " | sed 's/,/ /g;s/ */.$(OBJEXT) /g'`"
AC_SUBST(NSS_MODULE_OBJS)
# find out how to link the library
@@ -538,21 +550,9 @@ then
AC_SEARCH_LIBS(daemon,bsd)
AC_REPLACE_FUNCS(daemon)
- # replace ether_ntoa_r() and ether_aton_r() if they are not found
+ # replace ether_aton_r() and ether_ntoa_r() if they are not found
AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_LIBOBJ(ether)])
- # check requirements for our replacement functions
- AC_CHECK_FUNCS(ether_ntoa ether_aton)
- AC_CHECK_DECLS([ether_ntoa,ether_aton],,,[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <net/if.h>
- #include <netinet/in.h>
- #include <netinet/if_ether.h>
- #ifdef HAVE_NETINET_ETHER_H
- #include <netinet/ether.h>
- #endif])
-
# check to see if struct sockaddr_storage is defined
AC_CHECK_TYPE(struct sockaddr_storage,,
AC_DEFINE(sockaddr_storage,sockaddr_in,[Define to `sockaddr_in' if not defined elsewhere.]),[
diff --git a/nslcd/myldap.c b/nslcd/myldap.c
index 9c97244..afbc898 100644
--- a/nslcd/myldap.c
+++ b/nslcd/myldap.c
@@ -62,10 +62,10 @@
#ifdef HAVE_GSSSASL_H
#include <gsssasl.h>
#endif
-/* Try to handle systems with both SASL libraries installed */
-#if defined(HAVE_SASL_SASL_H) && defined(HAVE_SASL_AUXPROP_REQUEST)
+#ifdef HAVE_SASL_SASL_H
#include <sasl/sasl.h>
-#elif defined(HAVE_SASL_H)
+#endif
+#ifdef HAVE_SASL_H
#include <sasl.h>
#endif
#include <ctype.h>
@@ -622,6 +622,8 @@ static void myldap_session_check(MYLDAP_SESSION *session)
static int do_open(MYLDAP_SESSION *session)
{
int rc,rc2;
+ int sd=-1;
+ struct timeval tv;
/* check if the idle time for the connection has expired */
myldap_session_check(session);
/* if the connection is still there (ie. ldap_unbind() wasn't
@@ -683,6 +685,15 @@ static int do_open(MYLDAP_SESSION *session)
log_log(LOG_WARNING,"ldap_unbind() failed: %s",ldap_err2string(rc2));
return rc;
}
+ /* set timeout options on socket to avoid hang in some cases */
+ if (ldap_get_option(session->ld,LDAP_OPT_DESC,&sd)==LDAP_SUCCESS)
+ {
+ /* ignore errors */
+ tv.tv_sec=nslcd_cfg->ldc_timelimit;
+ tv.tv_usec=500;
+ (void)setsockopt(sd,SOL_SOCKET,SO_RCVTIMEO,(void *)&tv,sizeof(tv));
+ (void)setsockopt(sd,SOL_SOCKET,SO_SNDTIMEO,(void *)&tv,sizeof(tv));
+ }
/* update last activity and finish off state */
time(&(session->lastactivity));
return LDAP_SUCCESS;
diff --git a/nslcd/pam.c b/nslcd/pam.c
index 8afb27f..35bf8d8 100644
--- a/nslcd/pam.c
+++ b/nslcd/pam.c
@@ -284,9 +284,7 @@ int nslcd_pam_authz(TFILE *fp,MYLDAP_SESSION *session)
char username[256];
char userdn[256];
char servicename[64];
- char ruser[32];
- char rhost[256];
- char tty[256];
+ char ruser[256],rhost[HOST_NAME_MAX+1],tty[64];
char hostname[HOST_NAME_MAX+1];
DICT *dict;
/* read request parameters */
@@ -350,7 +348,7 @@ int nslcd_pam_sess_o(TFILE *fp,MYLDAP_SESSION *session)
char username[256];
char userdn[256];
char servicename[64];
- char tty[64],rhost[64],ruser[256];
+ char tty[64],rhost[HOST_NAME_MAX+1],ruser[256];
int32_t sessionid;
/* read request parameters */
READ_STRING(fp,username);
@@ -379,7 +377,7 @@ int nslcd_pam_sess_c(TFILE *fp,MYLDAP_SESSION *session)
char username[256];
char userdn[256];
char servicename[64];
- char tty[64],rhost[64],ruser[256];
+ char tty[64],rhost[HOST_NAME_MAX+1],ruser[256];
int32_t sessionid;
/* read request parameters */
READ_STRING(fp,username);
diff --git a/nss/Makefile.am b/nss/Makefile.am
index 712c20e..4c790bd 100644
--- a/nss/Makefile.am
+++ b/nss/Makefile.am
@@ -32,7 +32,7 @@ EXTRA_nss_ldap_so_SOURCES = aliases.c ethers.c group.c hosts.c netgroup.c \
networks.c passwd.c protocols.c rpc.c services.c \
shadow.c
nss_ldap_so_DEPENDENCIES = $(NSS_MODULE_OBJS)
-nss_ldap_so_LDADD = ../common/libtio.a ../common/libprot.a $(NSS_MODULE_OBJS)
+nss_ldap_so_LDADD = $(NSS_MODULE_OBJS) ../common/libtio.a ../common/libprot.a
EXTRA_DIST = exports.glibc exports.solaris