- fixed tls connection accepting when TLSVerifyClient = allow

- /etc/openldap/ldap.conf removed from files owned by openldap-servers
- minor changes in spec file to supress warnings
- some changes in init script, so it would be possible to use it when
  using old configuration style
This commit is contained in:
Jan Zeleny 2009-11-16 13:06:35 +00:00
parent e5c21d4af6
commit 4333efc198
3 changed files with 77 additions and 12 deletions

View File

@ -43,6 +43,7 @@ slapd=/usr/sbin/slapd
slaptest=/usr/sbin/slaptest slaptest=/usr/sbin/slaptest
lockfile=/var/lock/subsys/slapd lockfile=/var/lock/subsys/slapd
configdir=/etc/openldap/slapd.d/ configdir=/etc/openldap/slapd.d/
configfile=/etc/openldap/slapd.conf
pidfile=/var/run/slapd.pid pidfile=/var/run/slapd.pid
slapd_pidfile=/var/run/openldap/slapd.pid slapd_pidfile=/var/run/openldap/slapd.pid
@ -104,7 +105,6 @@ function checkkeytab() {
function configtest() { function configtest() {
local user= ldapuid= dbdir= file= local user= ldapuid= dbdir= file=
[ -d $configdir ] || exit 6
# Check for simple-but-common errors. # Check for simple-but-common errors.
user=ldap user=ldap
prog=`basename ${slapd}` prog=`basename ${slapd}`
@ -112,11 +112,20 @@ function configtest() {
# Unaccessible database files. # Unaccessible database files.
slaptestflags="" slaptestflags=""
dbdirs="" dbdirs=""
if [ -d $configdir ]; then
for configfile in `ls -1 $configdir/cn\=config/olcDatabase*`; do for configfile in `ls -1 $configdir/cn\=config/olcDatabase*`; do
dbdirs=$dbdirs" dbdirs=$dbdirs"
"`LANG=C egrep '^olcDbDirectory[[:space:]]*:[[:space:]]+[[:print:]]+$' $configfile | sed 's,^olcDbDirectory: ,,'` "`LANG=C egrep '^olcDbDirectory[[:space:]]*:[[:space:]]+[[:print:]]+$' $configfile | sed 's,^olcDbDirectory: ,,'`
done done
elif [ -f $configfile ]; then
dbdirs=`LANG=C egrep '^directory[[:space:]]+' $configfile | sed 's,^directory[[:space:]]*,,'`
else
exit 6
fi
for dbdir in $dbdirs; do for dbdir in $dbdirs; do
if [ ! -d $dbdir ]; then
exit 6
fi
for file in `find ${dbdir}/ -not -uid $ldapuid -and \( -name "*.dbb" -or -name "*.gdbm" -or -name "*.bdb" -or -name "__db.*" -or -name "log.*" -or -name alock \)` ; do for file in `find ${dbdir}/ -not -uid $ldapuid -and \( -name "*.dbb" -or -name "*.gdbm" -or -name "*.bdb" -or -name "__db.*" -or -name "log.*" -or -name alock \)` ; do
echo -n $"$file is not owned by \"$user\"" ; warning ; echo echo -n $"$file is not owned by \"$user\"" ; warning ; echo
done done
@ -134,7 +143,11 @@ function configtest() {
echo -n $"$file is not readable by \"$user\"" ; warning ; echo echo -n $"$file is not readable by \"$user\"" ; warning ; echo
fi fi
# Unaccessible TLS configuration files. # Unaccessible TLS configuration files.
if [ -d $configdir ]; then
tlsconfigs=`LANG=C egrep '^olc(TLSCACertificateFile|TLSCertificateFile|TLSCertificateKeyFile)[[:space:]]*:[[:space:]]' $configdir/cn\=config.ldif | awk '{print $2}'` tlsconfigs=`LANG=C egrep '^olc(TLSCACertificateFile|TLSCertificateFile|TLSCertificateKeyFile)[[:space:]]*:[[:space:]]' $configdir/cn\=config.ldif | awk '{print $2}'`
elif [ -f $configfile ]; then
tlsconfigs=`LANG=C egrep '^(TLSCACertificateFile|TLSCertificateFile|TLSCertificateKeyFile)[[:space:]]+' $configfile | awk '{print $2}'`
fi
for file in $tlsconfigs ; do for file in $tlsconfigs ; do
if ! testasuser $user -r $file ; then if ! testasuser $user -r $file ; then
echo -n $"$file is not readable by \"$user\"" ; warning ; echo echo -n $"$file is not readable by \"$user\"" ; warning ; echo
@ -218,24 +231,39 @@ case "$1" in
configtest configtest
;; ;;
start) start)
msg=`status -p $pidfile ${slapd} > /dev/null 2>&1`
RETVAL=$?
if [ "$RETVAL" != "0" ]; then
echo $msg
RETVAL=1
else
start start
RETVAL=$? RETVAL=$?
fi
;; ;;
stop) stop)
msg=`status -p $pidfile ${slapd} > /dev/null 2>&1`
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
echo $msg
RETVAL=7
else
stop stop
RETVAL=$? RETVAL=$?
fi
;; ;;
status) status)
status -p $pidfile ${slapd} status -p $pidfile ${slapd}
RETVAL=$? RETVAL=$?
;; ;;
restart|force-reload) restart|force-reload)
status -p $pidfile ${slapd} > /dev/null 2>&1 || exit 7
stop stop
start start
RETVAL=$? RETVAL=$?
;; ;;
condrestart|try-restart) condrestart|try-restart)
status -p $pidfile ${slapd} || exit 0 status -p $pidfile ${slapd} > /dev/null 2>&1 || exit 0
stop stop
start start
;; ;;

View File

@ -0,0 +1,29 @@
--- openldap-2.4.19/servers/slapd/connection.c.orig 2009-11-16 12:54:33.000000000 +0100
+++ openldap-2.4.19/servers/slapd/connection.c 2009-11-16 13:23:25.000000000 +0100
@@ -1376,6 +1376,11 @@ connection_read( ber_socket_t s, conn_re
c->c_connid, (int) s, c->c_tls_ssf, c->c_ssf, 0 );
slap_sasl_external( c, c->c_tls_ssf, &authid );
if ( authid.bv_val ) free( authid.bv_val );
+ } else if ( rc == 1 ) { /* need to retry */
+ slapd_set_read( s, 0 );
+ slapd_set_write( s, 1 );
+ connection_return( c );
+ return 0;
}
/* if success and data is ready, fall thru to data input loop */
@@ -1875,6 +1880,14 @@ int connection_write(ber_socket_t s)
return -1;
}
+#ifdef HAVE_TLS
+ if ( c->c_is_tls && c->c_needs_tls_accept ) {
+ connection_return( c );
+ connection_read_activate( s );
+ return 0;
+ }
+#endif
+
c->c_n_write++;
Debug( LDAP_DEBUG_TRACE,

View File

@ -11,7 +11,7 @@
Summary: LDAP support libraries Summary: LDAP support libraries
Name: openldap Name: openldap
Version: %{version} Version: %{version}
Release: 1%{?dist} Release: 2%{?dist}
License: OpenLDAP License: OpenLDAP
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz
@ -35,6 +35,7 @@ Patch6: openldap-2.3.19-gethostbyXXXX_r.patch
Patch9: openldap-2.3.37-smbk5pwd.patch Patch9: openldap-2.3.37-smbk5pwd.patch
Patch10: openldap-2.4.6-multilib.patch Patch10: openldap-2.4.6-multilib.patch
Patch11: openldap-2.4.16-doc-cacertdir.patch Patch11: openldap-2.4.16-doc-cacertdir.patch
Patch12: openldap-2.4.19-tls-accept.patch
# Patches for the evolution library # Patches for the evolution library
Patch200: openldap-2.4.6-evolution-ntlm.patch Patch200: openldap-2.4.6-evolution-ntlm.patch
@ -130,6 +131,7 @@ pushd openldap-%{version}
%patch9 -p1 -b .smbk5pwd %patch9 -p1 -b .smbk5pwd
%patch10 -p1 -b .multilib %patch10 -p1 -b .multilib
%patch11 -p1 -b .cacertdir %patch11 -p1 -b .cacertdir
%patch12 -p1 -b .tls-accept
cp %{_datadir}/libtool/config/config.{sub,guess} build/ cp %{_datadir}/libtool/config/config.{sub,guess} build/
popd popd
@ -490,7 +492,7 @@ if [ -f /var/lib/ldap/need_db_upgrade ]; then
fi fi
if [ ! -f %{_sysconfdir}/pki/tls/certs/slapd.pem ] ; then if [ ! -f %{_sysconfdir}/pki/tls/certs/slapd.pem ] ; then
pushd %{_sysconfdir}/pki/tls/certs pushd %{_sysconfdir}/pki/tls/certs > /dev/null 2>&1
umask 077 umask 077
cat << EOF | make slapd.pem > /dev/null 2>&1 cat << EOF | make slapd.pem > /dev/null 2>&1
-- --
@ -586,7 +588,6 @@ fi
%doc README.schema %doc README.schema
%ghost %config(noreplace) %{_sysconfdir}/pki/tls/certs/slapd.pem %ghost %config(noreplace) %{_sysconfdir}/pki/tls/certs/slapd.pem
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/slapd %attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/slapd
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/ldap*.conf
%attr(0640,root,ldap) %config(noreplace,missingok) %{_sysconfdir}/openldap/slapd.conf %attr(0640,root,ldap) %config(noreplace,missingok) %{_sysconfdir}/openldap/slapd.conf
%attr(0640,root,ldap) %ghost %{_sysconfdir}/openldap/slapd.conf.bak %attr(0640,root,ldap) %ghost %{_sysconfdir}/openldap/slapd.conf.bak
%attr(0640,ldap,ldap) %ghost %{_sysconfdir}/openldap/slapd.d %attr(0640,ldap,ldap) %ghost %{_sysconfdir}/openldap/slapd.d
@ -632,6 +633,13 @@ fi
%attr(0644,root,root) %{evolution_connector_libdir}/*.a %attr(0644,root,root) %{evolution_connector_libdir}/*.a
%changelog %changelog
* Mon Nov 16 2009 Jan Zeleny <jzeleny@redhat.com> - 2.4.19-2
- fixed tls connection accepting when TLSVerifyClient = allow
- /etc/openldap/ldap.conf removed from files owned by openldap-servers
- minor changes in spec file to supress warnings
- some changes in init script, so it would be possible to use it when
using old configuration style
* Fri Nov 06 2009 Jan Zeleny <jzeleny@redhat.com> - 2.4.19-1 * Fri Nov 06 2009 Jan Zeleny <jzeleny@redhat.com> - 2.4.19-1
- rebased openldap to 2.4.19 - rebased openldap to 2.4.19
- rebased bdb to 4.8.24 - rebased bdb to 4.8.24