From 5c44fef72776e8e48ffc1a3df102ebcd04da0e4e Mon Sep 17 00:00:00 2001 From: didg Date: Wed, 3 Dec 2008 19:17:27 +0000 Subject: [PATCH] solaris bug #1242278, #1240793, #1079670, from Andrew Morgan --- configure.in | 28 ++++++++++++++-------------- etc/atalkd/config.c | 16 +++++++++++++--- etc/uams/uams_dhx_pam.c | 30 +++++++++++++++++------------- macros/db3-check.m4 | 8 +++++++- 4 files changed, 51 insertions(+), 31 deletions(-) diff --git a/configure.in b/configure.in index e730fce6..01b24fd3 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.179.2.3.2.37.2.8 2008-12-02 03:11:58 didg Exp $ +dnl $Id: configure.in,v 1.179.2.3.2.37.2.9 2008-12-03 19:17:27 didg Exp $ dnl configure.in for netatalk AC_INIT(etc/afpd/main.c) @@ -380,19 +380,6 @@ dnl Check for CNID database backends bdb_required=no AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no]) -dnl Check for Berkeley DB library -if test "x$bdb_required" = "xyes"; then - AC_PATH_BDB(, [ - AC_MSG_RESULT([]) - AC_MSG_RESULT([Make sure you have the required Berkeley DB libraries AND headers installed.]) - AC_MSG_RESULT([You can download the latest version from http://www.sleepycat.com.]) - AC_MSG_RESULT([If you have installed BDB in a non standard location use the]) - AC_MSG_RESULT([--with-bdb=/path/to/bdb configure option and make sure]) - AC_MSG_RESULT([your linker is configured to check for libraries there.]) - AC_MSG_ERROR([Berkeley DB library required but not found!]) - ]) -fi - dnl Check for quota support AC_CHECK_QUOTA @@ -930,6 +917,19 @@ AM_PATH_LIBGCRYPT([1:1.2.3],[neta_cv_compile_dhx2=yes dnl -- look for openssl, if found enables DHX UAM and Randnum UAM AC_PATH_SSL +dnl Check for Berkeley DB library +if test "x$bdb_required" = "xyes"; then + AC_PATH_BDB(, [ + AC_MSG_RESULT([]) + AC_MSG_RESULT([Make sure you have the required Berkeley DB libraries AND headers installed.]) + AC_MSG_RESULT([You can download the latest version from http://www.sleepycat.com.]) + AC_MSG_RESULT([If you have installed BDB in a non standard location use the]) + AC_MSG_RESULT([--with-bdb=/path/to/bdb configure option and make sure]) + AC_MSG_RESULT([your linker is configured to check for libraries there.]) + AC_MSG_ERROR([Berkeley DB library required but not found!]) + ]) +fi + dnl -- check for crypt AC_CRYPT diff --git a/etc/atalkd/config.c b/etc/atalkd/config.c index fe3eb2a6..22ff63a3 100644 --- a/etc/atalkd/config.c +++ b/etc/atalkd/config.c @@ -1,5 +1,5 @@ /* - * $Id: config.c,v 1.13.6.5.2.5 2008-11-14 10:04:52 didg Exp $ + * $Id: config.c,v 1.13.6.5.2.6 2008-12-03 19:17:27 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -832,8 +832,9 @@ struct interface *newiface( name ) int plumb() { struct interface *iface; - char device[ MAXPATHLEN + 1], *p; + char device[ MAXPATHLEN + 1], *p, *t; int fd, ppa; + int digits = 0; for ( iface = interfaces; iface != NULL; iface = iface->i_next ) { if ( strcmp( iface->i_name, LOOPIFACE ) == 0 ) { @@ -842,7 +843,16 @@ int plumb() strcpy( device, "/dev/" ); strcat( device, iface->i_name ); - if (( p = strpbrk( device, "0123456789" )) == NULL ) { + for (t = device; *t != '\0' ; ++t) { + if (isdigit(*t) == 0) { + p = t + 1; + } + else { + digits++; + } + } + + if (digits == 0) { LOG(log_error, logtype_atalkd, "plumb: invalid device: %s", device ); return -1; } diff --git a/etc/uams/uams_dhx_pam.c b/etc/uams/uams_dhx_pam.c index 249cc731..8d589836 100644 --- a/etc/uams/uams_dhx_pam.c +++ b/etc/uams/uams_dhx_pam.c @@ -1,5 +1,5 @@ /* - * $Id: uams_dhx_pam.c,v 1.24.6.5.2.1 2005-09-27 10:40:41 didg Exp $ + * $Id: uams_dhx_pam.c,v 1.24.6.5.2.2 2008-12-03 19:17:27 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) @@ -193,12 +193,6 @@ static int dhx_setup(void *obj, char *ibuf, int ibuflen _U_, BIGNUM *bn, *gbn, *pbn; DH *dh; - /* TODO: seed dhx_setup properly... this is a hack */ -#ifdef sun - /* *SEVERE* hack... fix */ - RAND_load_file("/var/adm/messages", KEYSIZE); -#endif /* sun */ - /* get the client's public key */ if (!(bn = BN_bin2bn(ibuf, KEYSIZE, NULL))) { /* Log Entry */ @@ -243,12 +237,22 @@ static int dhx_setup(void *obj, char *ibuf, int ibuflen _U_, /* generate key and make sure that we have enough space */ dh->p = pbn; dh->g = gbn; - if (!DH_generate_key(dh) || (BN_num_bytes(dh->pub_key) > KEYSIZE)) { - /* Log Entry */ - LOG(log_info, logtype_uams, "uams_dhx_pam.c :PAM: Err Generating Key -- Not enough Space? -- %s", - strerror(errno)); - /* Log Entry */ - goto pam_fail; + if (DH_generate_key(dh) == 0) { + unsigned long dherror; + char errbuf[256]; + + ERR_load_crypto_strings(); + dherror = ERR_get_error(); + ERR_error_string_n(dherror, errbuf, 256); + + LOG(log_info, logtype_uams, "uams_dhx_pam.c :PAM: Err Generating Key (OpenSSL error code: %u, %s)", dherror, errbuf); + + ERR_free_strings(); + goto pam_fail; + } + if (BN_num_bytes(dh->pub_key) > KEYSIZE) { + LOG(log_info, logtype_uams, "uams_dhx_pam.c :PAM: Err Generating Key -- Not enough Space? -- %s", strerror(errno)); + goto pam_fail; } /* figure out the key. store the key in rbuf for now. */ diff --git a/macros/db3-check.m4 b/macros/db3-check.m4 index c21cbbba..5d79ed8b 100644 --- a/macros/db3-check.m4 +++ b/macros/db3-check.m4 @@ -1,4 +1,4 @@ -dnl $Id: db3-check.m4,v 1.11.6.9.2.2 2006-09-09 01:36:39 didg Exp $ +dnl $Id: db3-check.m4,v 1.11.6.9.2.3 2008-12-03 19:17:27 didg Exp $ dnl Autoconf macros to check for the Berkeley DB library @@ -207,11 +207,17 @@ dnl bdbbindir="`echo $bdbdir | sed 's/include\/db4\.*.*/bin/'`" CPPFLAGS="-I${bdbdir}${subdir} $CFLAGS" CFLAGS="" LDFLAGS="-L$bdblibdir $LDFLAGS" + if test "x$need_dash_r" = "xyes"; then + LDFLAGS="$LDFLAGS -R${bdblibdir}" + fi NETATALK_BERKELEY_LINK if test x"${atalk_cv_lib_db}" != x"no"; then NETATALK_BDB_CHECK_VERSION if test x"${atalk_cv_bdb_version}" != x"no"; then BDB_LIBS="-L${bdblibdir} ${atalk_cv_lib_db}" + if test "x$need_dash_r" = "xyes"; then + BDB_LIBS="$BDB_LIBS -R${bdblibdir}" + fi BDB_CFLAGS="-I${bdbdir}${subdir}" BDB_BIN=$bdbbindir BDB_PATH="`echo $bdbdir | sed 's,include\/db4$,,'`" -- 2.39.2