Module Name: src
Committed By: tron
Date: Wed May 28 10:12:43 UTC 2014
Modified Files:
src/external/bsd/openldap/dist/build: mkversion
src/external/bsd/openldap/dist/clients/tools: common.c
src/external/bsd/openldap/dist/include: Makefile.in ldap_queue.h
portable.hin
src/external/bsd/openldap/dist/libraries/libldap: os-ip.c os-local.c
tls_o.c
src/external/bsd/openldap/dist/libraries/liblutil: detach.c md5.c
passwd.c
Removed Files:
src/external/bsd/openldap/dist/contrib/ldapc++: LICENSE
src/external/bsd/openldap/dist/contrib/slapd-modules/acl: README
src/external/bsd/openldap/dist/doc/guide: COPYRIGHT LICENSE
src/external/bsd/openldap/dist/libraries/libldap_r: thr_lwp.c
src/external/bsd/openldap/dist/libraries/liblutil: fetch.c ldif.c
Log Message:
Resolve conflicts from last import.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/openldap/dist/build/mkversion
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/openldap/dist/clients/tools/common.c
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/bsd/openldap/dist/contrib/ldapc++/LICENSE
cvs rdiff -u -r1.1.1.3 -r0 \
src/external/bsd/openldap/dist/contrib/slapd-modules/acl/README
cvs rdiff -u -r1.1.1.4 -r0 src/external/bsd/openldap/dist/doc/guide/COPYRIGHT
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/openldap/dist/doc/guide/LICENSE
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/openldap/dist/include/Makefile.in \
src/external/bsd/openldap/dist/include/portable.hin
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/openldap/dist/include/ldap_queue.h
cvs rdiff -u -r1.5 -r1.6 \
src/external/bsd/openldap/dist/libraries/libldap/os-ip.c
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/openldap/dist/libraries/libldap/os-local.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/openldap/dist/libraries/libldap/tls_o.c
cvs rdiff -u -r1.1.1.3 -r0 \
src/external/bsd/openldap/dist/libraries/libldap_r/thr_lwp.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/openldap/dist/libraries/liblutil/detach.c \
src/external/bsd/openldap/dist/libraries/liblutil/md5.c
cvs rdiff -u -r1.1.1.3 -r0 \
src/external/bsd/openldap/dist/libraries/liblutil/fetch.c \
src/external/bsd/openldap/dist/libraries/liblutil/ldif.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/openldap/dist/libraries/liblutil/passwd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/openldap/dist/build/mkversion
diff -u src/external/bsd/openldap/dist/build/mkversion:1.4 src/external/bsd/openldap/dist/build/mkversion:1.5
--- src/external/bsd/openldap/dist/build/mkversion:1.4 Sun Dec 12 15:46:27 2010
+++ src/external/bsd/openldap/dist/build/mkversion Wed May 28 10:12:43 2014
@@ -1,9 +1,9 @@
#! /bin/sh
# Create a version.c file
-# OpenLDAP: pkg/ldap/build/mkversion,v 1.14.2.5 2010/04/13 20:22:21 kurt Exp
+# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
-## Copyright 1998-2010 The OpenLDAP Foundation.
+## Copyright 1998-2014 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@ APPLICATION=$1
cat << __EOF__
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,7 +67,7 @@ cat << __EOF__
*/
static const char copyright[] =
-"Copyright 1998-2010 The OpenLDAP Foundation. All rights reserved.\n"
+"Copyright 1998-2014 The OpenLDAP Foundation. All rights reserved.\n"
"COPYING RESTRICTIONS APPLY\n";
$static $const char $SYMBOL[] =
Index: src/external/bsd/openldap/dist/clients/tools/common.c
diff -u src/external/bsd/openldap/dist/clients/tools/common.c:1.3 src/external/bsd/openldap/dist/clients/tools/common.c:1.4
--- src/external/bsd/openldap/dist/clients/tools/common.c:1.3 Sun Dec 12 15:46:28 2010
+++ src/external/bsd/openldap/dist/clients/tools/common.c Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: common.c,v 1.3 2010/12/12 15:46:28 adam Exp $ */
+/* $NetBSD: common.c,v 1.4 2014/05/28 10:12:43 tron Exp $ */
/* common.c - common routines for the ldap client tools */
-/* OpenLDAP: pkg/ldap/clients/tools/common.c,v 1.78.2.31 2010/04/15 22:16:49 quanah Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* Portions Copyright 2003 Kurt D. Zeilenga.
* Portions Copyright 2003 IBM Corporation.
* All rights reserved.
@@ -68,6 +68,7 @@ int nocanon = 0;
int referrals = 0;
int verbose = 0;
int ldif = 0;
+ber_len_t ldif_wrap = LDIF_LINE_WIDTH;
char *prog = NULL;
/* connection */
@@ -240,6 +241,10 @@ tool_init( tool_type_t type )
void
tool_destroy( void )
{
+ static int destroyed;
+ if ( destroyed++ )
+ return;
+
#ifdef HAVE_CYRUS_SASL
sasl_done();
#endif
@@ -254,20 +259,47 @@ tool_destroy( void )
if ( pr_cookie.bv_val != NULL ) {
ber_memfree( pr_cookie.bv_val );
- pr_cookie.bv_val = NULL;
- pr_cookie.bv_len = 0;
+ BER_BVZERO( &pr_cookie );
}
if ( binddn != NULL ) {
ber_memfree( binddn );
+ binddn = NULL;
}
if ( passwd.bv_val != NULL ) {
ber_memfree( passwd.bv_val );
+ BER_BVZERO( &passwd );
}
if ( infile != NULL ) {
ber_memfree( infile );
+ infile = NULL;
+ }
+
+ if ( assertion ) {
+ ber_memfree( assertion );
+ assertion = NULL;
+ }
+
+ if ( authzid ) {
+ ber_memfree( authzid );
+ authzid = NULL;
+ }
+
+ if ( proxydn ) {
+ ber_memfree( proxydn );
+ proxydn = NULL;
+ }
+
+ if ( preread_attrs ) {
+ ber_memfree( preread_attrs );
+ preread_attrs = NULL;
+ }
+
+ if ( postread_attrs ) {
+ ber_memfree( postread_attrs );
+ postread_attrs = NULL;
}
}
@@ -311,8 +343,9 @@ N_(" -I use SASL Interactive mo
N_(" -n show what would be done but don't actually do it\n"),
N_(" -N do not use reverse DNS to canonicalize SASL host name\n"),
N_(" -O props SASL security properties\n"),
-N_(" -o <opt>[=<optparam] general options\n"),
+N_(" -o <opt>[=<optparam>] general options\n"),
N_(" nettimeout=<timeout> (in seconds, or \"none\" or \"max\")\n"),
+N_(" ldif-wrap=<width> (in columns, or \"no\" for no wrapping)\n"),
N_(" -p port port on LDAP server\n"),
N_(" -Q use SASL Quiet mode\n"),
N_(" -R realm SASL realm\n"),
@@ -336,6 +369,8 @@ NULL
fputs( _(*cpp), stderr );
}
}
+
+ tool_destroy();
}
void tool_perror(
@@ -379,7 +414,7 @@ tool_args( int argc, char **argv )
case 'c': /* continuous operation mode */
contoper++;
break;
- case 'C':
+ case 'C': /* referrals: obsolete */
referrals++;
break;
case 'd':
@@ -427,7 +462,7 @@ tool_args( int argc, char **argv )
assertctl = 1 + crit;
assert( assertion == NULL );
- assertion = cvalue;
+ assertion = ber_strdup( cvalue );
} else if ( strcasecmp( control, "authzid" ) == 0 ) {
if( authzid != NULL ) {
@@ -450,7 +485,7 @@ tool_args( int argc, char **argv )
}
assert( authzid == NULL );
- authzid = cvalue;
+ authzid = ber_strdup( cvalue );
#ifdef LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ
} else if ( strcasecmp( control, "proxydn" ) == 0 ) {
@@ -472,7 +507,7 @@ tool_args( int argc, char **argv )
}
assert( proxydn == NULL );
- proxydn = cvalue;
+ proxydn = ber_strdup( cvalue );
#endif /* LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ */
} else if ( ( strcasecmp( control, "relax" ) == 0 ) ||
@@ -542,7 +577,7 @@ tool_args( int argc, char **argv )
}
preread = 1 + crit;
- preread_attrs = cvalue;
+ preread_attrs = ber_strdup( cvalue );
} else if ( strcasecmp( control, "postread" ) == 0 ) {
if( postread ) {
@@ -551,7 +586,7 @@ tool_args( int argc, char **argv )
}
postread = 1 + crit;
- postread_attrs = cvalue;
+ postread_attrs = ber_strdup( cvalue );
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
} else if ( strcasecmp( control, "chaining" ) == 0 ) {
@@ -599,6 +634,19 @@ tool_args( int argc, char **argv )
}
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
+#ifdef LDAP_CONTROL_X_SESSION_TRACKING
+ } else if ( strcasecmp( control, "sessiontracking" ) == 0 ) {
+ if ( sessionTracking ) {
+ fprintf( stderr, "%s: session tracking can be only specified once\n", prog );
+ exit( EXIT_FAILURE );
+ }
+ sessionTracking = 1;
+ if( crit ) {
+ fprintf( stderr, "sessiontracking: critical flag not allowed\n" );
+ usage();
+ }
+#endif /* LDAP_CONTROL_X_SESSION_TRACKING */
+
/* this shouldn't go here, really; but it's a feature... */
} else if ( strcasecmp( control, "abandon" ) == 0 ) {
abcan = Intr_Abandon;
@@ -618,15 +666,6 @@ tool_args( int argc, char **argv )
gotintr = abcan;
}
-#ifdef LDAP_CONTROL_X_SESSION_TRACKING
- } else if ( strcasecmp( control, "sessiontracking" ) == 0 ) {
- if ( sessionTracking ) {
- fprintf( stderr, "%s: session tracking can be only specified once\n", prog );
- exit( EXIT_FAILURE );
- }
- sessionTracking = 1;
-#endif /* LDAP_CONTROL_X_SESSION_TRACKING */
-
} else if ( tool_is_oid( control ) ) {
LDAPControl *tmpctrls, ctrl;
@@ -638,6 +677,8 @@ tool_args( int argc, char **argv )
}
unknown_ctrls = tmpctrls;
ctrl.ldctl_oid = control;
+ /* don't free it */
+ control = NULL;
ctrl.ldctl_value.bv_val = NULL;
ctrl.ldctl_value.bv_len = 0;
ctrl.ldctl_iscritical = crit;
@@ -672,6 +713,10 @@ tool_args( int argc, char **argv )
control );
usage();
}
+ if ( control ) {
+ ber_memfree( control );
+ control = NULL;
+ }
break;
case 'f': /* read from file */
if( infile != NULL ) {
@@ -753,11 +798,30 @@ tool_args( int argc, char **argv )
prog, (long)nettimeout.tv_sec );
exit( EXIT_FAILURE );
}
+
+ } else if ( strcasecmp( control, "ldif-wrap" ) == 0 ) {
+ if ( cvalue == 0 ) {
+ ldif_wrap = LDIF_LINE_WIDTH;
+
+ } else if ( strcasecmp( cvalue, "no" ) == 0 ) {
+ ldif_wrap = LDIF_LINE_WIDTH_MAX;
+
+ } else {
+ unsigned int u;
+ if ( lutil_atou( &u, cvalue ) ) {
+ fprintf( stderr,
+ _("Unable to parse ldif-wrap=\"%s\"\n"), cvalue );
+ exit( EXIT_FAILURE );
+ }
+ ldif_wrap = (ber_len_t)u;
+ }
+
} else {
fprintf( stderr, "Invalid general option name: %s\n",
control );
usage();
}
+ ber_memfree(control);
break;
case 'O':
#ifdef HAVE_CYRUS_SASL
@@ -1069,6 +1133,12 @@ tool_args( int argc, char **argv )
}
#endif
}
+
+ if ( ( pw_file || want_bindpw ) && !BER_BVISNULL( &passwd ) ) {
+ fprintf( stderr, "%s: -%c incompatible with -w\n",
+ prog, ( pw_file ? 'y' : 'W' ) );
+ exit( EXIT_FAILURE );
+ }
}
@@ -1261,23 +1331,24 @@ dnssrv_free:;
if( private_setup ) private_setup( ld );
- /* referrals */
+ /* referrals: obsolete */
if( ldap_set_option( ld, LDAP_OPT_REFERRALS,
referrals ? LDAP_OPT_ON : LDAP_OPT_OFF ) != LDAP_OPT_SUCCESS )
{
fprintf( stderr, "Could not set LDAP_OPT_REFERRALS %s\n",
referrals ? "on" : "off" );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
#ifdef HAVE_CYRUS_SASL
/* canon */
- if( ldap_set_option( ld, LDAP_OPT_X_SASL_NOCANON,
- nocanon ? LDAP_OPT_ON : LDAP_OPT_OFF ) != LDAP_OPT_SUCCESS )
- {
- fprintf( stderr, "Could not set LDAP_OPT_X_SASL_NOCANON %s\n",
- nocanon ? "on" : "off" );
- exit( EXIT_FAILURE );
+ if( nocanon ) {
+ if( ldap_set_option( ld, LDAP_OPT_X_SASL_NOCANON,
+ LDAP_OPT_ON ) != LDAP_OPT_SUCCESS )
+ {
+ fprintf( stderr, "Could not set LDAP_OPT_X_SASL_NOCANON on\n" );
+ tool_exit( ld, EXIT_FAILURE );
+ }
}
#endif
if( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &protocol )
@@ -1285,7 +1356,7 @@ dnssrv_free:;
{
fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n",
protocol );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
#ifdef HAVE_TLS
@@ -1297,7 +1368,7 @@ dnssrv_free:;
tool_perror( "ldap_start_tls", rc, NULL, NULL, msg, NULL );
ldap_memfree(msg);
if ( use_tls > 1 ) {
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
}
}
@@ -1309,7 +1380,7 @@ dnssrv_free:;
{
fprintf( stderr, "Could not set LDAP_OPT_NETWORK_TIMEOUT %ld\n",
(long)nettimeout.tv_sec );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
}
}
@@ -1343,8 +1414,8 @@ tool_bind( LDAP *ld )
if ( sessionTracking ) {
LDAPControl c;
- if (stValue.bv_val == NULL && st_value( ld, &stValue ) ) {
- exit( EXIT_FAILURE );
+ if ( BER_BVISNULL( &stValue) && st_value( ld, &stValue ) ) {
+ tool_exit( ld, EXIT_FAILURE );
}
c.ldctl_oid = LDAP_CONTROL_X_SESSION_TRACKING;
@@ -1368,7 +1439,7 @@ tool_bind( LDAP *ld )
if ( pw_file ) {
if ( lutil_get_filed_password( pw_file, &passwd ) ) {
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
} else {
@@ -1393,7 +1464,7 @@ tool_bind( LDAP *ld )
fprintf( stderr,
"Could not set LDAP_OPT_X_SASL_SECPROPS: %s\n",
sasl_secprops );
- exit( LDAP_LOCAL_ERROR );
+ tool_exit( ld, LDAP_LOCAL_ERROR );
}
}
@@ -1415,11 +1486,11 @@ tool_bind( LDAP *ld )
tool_perror( "ldap_sasl_interactive_bind_s",
rc, NULL, NULL, msg, NULL );
ldap_memfree(msg);
- exit( rc );
+ tool_exit( ld, rc );
}
#else
fprintf( stderr, "%s: not compiled with SASL support\n", prog );
- exit( LDAP_NOT_SUPPORTED );
+ tool_exit( ld, LDAP_NOT_SUPPORTED );
#endif
} else {
int msgid, err, rc;
@@ -1439,26 +1510,28 @@ tool_bind( LDAP *ld )
if ( msgid == -1 ) {
tool_perror( "ldap_sasl_bind(SIMPLE)", rc,
NULL, NULL, NULL, NULL );
- exit( rc );
+ tool_exit( ld, rc );
}
}
rc = ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result );
if ( rc == -1 ) {
tool_perror( "ldap_result", -1, NULL, NULL, NULL, NULL );
- exit( LDAP_LOCAL_ERROR );
+ tool_exit( ld, LDAP_LOCAL_ERROR );
}
if ( rc == 0 ) {
tool_perror( "ldap_result", LDAP_TIMEOUT, NULL, NULL, NULL, NULL );
- exit( LDAP_LOCAL_ERROR );
+ tool_exit( ld, LDAP_LOCAL_ERROR );
}
- rc = ldap_parse_result( ld, result, &err, &matched, &info, &refs,
- &ctrls, 1 );
- if ( rc != LDAP_SUCCESS ) {
- tool_perror( "ldap_bind parse result", rc, NULL, matched, info, refs );
- exit( LDAP_LOCAL_ERROR );
+ if ( result ) {
+ rc = ldap_parse_result( ld, result, &err, &matched, &info, &refs,
+ &ctrls, 1 );
+ if ( rc != LDAP_SUCCESS ) {
+ tool_perror( "ldap_bind parse result", rc, NULL, matched, info, refs );
+ tool_exit( ld, LDAP_LOCAL_ERROR );
+ }
}
#ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
@@ -1508,7 +1581,7 @@ tool_bind( LDAP *ld )
if( info ) ber_memfree( info );
if( refs ) ber_memvfree( (void **)refs );
- if ( err != LDAP_SUCCESS ) exit( err );
+ if ( err != LDAP_SUCCESS ) tool_exit( ld, err );
}
}
}
@@ -1525,6 +1598,16 @@ tool_unbind( LDAP *ld )
(void) ldap_unbind_ext( ld, NULL, NULL );
}
+void
+tool_exit( LDAP *ld, int status )
+{
+ if ( ld != NULL ) {
+ tool_unbind( ld );
+ }
+ tool_destroy();
+ exit( status );
+}
+
/* Set server controls. Add controls extra_c[0..count-1], if set. */
void
@@ -1561,7 +1644,7 @@ tool_server_controls( LDAP *ld, LDAPCont
ctrls = (LDAPControl**) malloc(sizeof(c) + (count + unknown_ctrls_num + 1)*sizeof(LDAPControl*));
if ( ctrls == NULL ) {
fprintf( stderr, "No memory\n" );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
if ( assertctl ) {
@@ -1601,11 +1684,11 @@ tool_server_controls( LDAP *ld, LDAPCont
ber_init2( ber, NULL, LBER_USE_DER );
if ( ber_printf( ber, "s", proxydn ) == -1 ) {
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
if ( ber_flatten2( ber, &c[i].ldctl_value, 0 ) == -1 ) {
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
c[i].ldctl_oid = LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ;
@@ -1662,13 +1745,13 @@ tool_server_controls( LDAP *ld, LDAPCont
if( ber_printf( ber, "{v}", attrs ) == -1 ) {
fprintf( stderr, "preread attrs encode failed.\n" );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
err = ber_flatten2( ber, &c[i].ldctl_value, 0 );
if( err < 0 ) {
fprintf( stderr, "preread flatten failed (%d)\n", err );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
c[i].ldctl_oid = LDAP_CONTROL_PRE_READ;
@@ -1692,13 +1775,13 @@ tool_server_controls( LDAP *ld, LDAPCont
if( ber_printf( ber, "{v}", attrs ) == -1 ) {
fprintf( stderr, "postread attrs encode failed.\n" );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
err = ber_flatten2( ber, &c[i].ldctl_value, 0 );
if( err < 0 ) {
fprintf( stderr, "postread flatten failed (%d)\n", err );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
c[i].ldctl_oid = LDAP_CONTROL_POST_READ;
@@ -1721,7 +1804,7 @@ tool_server_controls( LDAP *ld, LDAPCont
if ( err == -1 ) {
ber_free( ber, 1 );
fprintf( stderr, _("Chaining behavior control encoding error!\n") );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
if ( chainingContinuation > -1 ) {
@@ -1729,7 +1812,7 @@ tool_server_controls( LDAP *ld, LDAPCont
if ( err == -1 ) {
ber_free( ber, 1 );
fprintf( stderr, _("Chaining behavior control encoding error!\n") );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
}
@@ -1737,11 +1820,11 @@ tool_server_controls( LDAP *ld, LDAPCont
if ( err == -1 ) {
ber_free( ber, 1 );
fprintf( stderr, _("Chaining behavior control encoding error!\n") );
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
if ( ber_flatten2( ber, &c[i].ldctl_value, 0 ) == -1 ) {
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
} else {
@@ -1757,8 +1840,8 @@ tool_server_controls( LDAP *ld, LDAPCont
#ifdef LDAP_CONTROL_X_SESSION_TRACKING
if ( sessionTracking ) {
- if ( stValue.bv_val == NULL && st_value( ld, &stValue ) ) {
- exit( EXIT_FAILURE );
+ if ( BER_BVISNULL( &stValue ) && st_value( ld, &stValue ) ) {
+ tool_exit( ld, EXIT_FAILURE );
}
c[i].ldctl_oid = LDAP_CONTROL_X_SESSION_TRACKING;
@@ -1790,7 +1873,7 @@ tool_server_controls( LDAP *ld, LDAPCont
free( ctrls );
if ( crit ) {
- exit( EXIT_FAILURE );
+ tool_exit( ld, EXIT_FAILURE );
}
}
@@ -1843,6 +1926,7 @@ print_prepostread( LDAP *ld, LDAPControl
while ( ber_scanf( ber, "{m" /*}*/, &bv ) != LBER_ERROR ) {
int i;
BerVarray vals = NULL;
+ char *str = NULL;
if ( ber_scanf( ber, "[W]", &vals ) == LBER_ERROR ||
vals == NULL )
@@ -1850,14 +1934,25 @@ print_prepostread( LDAP *ld, LDAPControl
/* error? */
return 1;
}
+
+ if ( ldif ) {
+ char *ptr;
+
+ str = malloc( bv.bv_len + STRLENOF(": ") + 1 );
+
+ ptr = str;
+ ptr = lutil_strncopy( ptr, bv.bv_val, bv.bv_len );
+ ptr = lutil_strcopy( ptr, ": " );
+ }
for ( i = 0; vals[ i ].bv_val != NULL; i++ ) {
tool_write_ldif(
ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- bv.bv_val, vals[ i ].bv_val, vals[ i ].bv_len );
+ ldif ? str : bv.bv_val, vals[ i ].bv_val, vals[ i ].bv_len );
}
ber_bvarray_free( vals );
+ if ( str ) free( str );
}
}
@@ -1937,7 +2032,8 @@ print_paged_results( LDAP *ld, LDAPContr
}
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "pagedresults", buf, ptr - buf );
+ ldif ? "pagedresults: " : "pagedresults",
+ buf, ptr - buf );
}
return 0;
@@ -1957,7 +2053,7 @@ print_sss( LDAP *ld, LDAPControl *ctrl )
err, ldap_err2string(err), attr ? " " : "", attr ? attr : "" );
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "sortResult", buf, rc );
+ ldif ? "sortResult: " : "sortResult", buf, rc );
}
return rc;
@@ -1997,7 +2093,7 @@ print_vlv( LDAP *ld, LDAPControl *ctrl )
ber_memfree( bv.bv_val );
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "vlvResult", buf, rc );
+ ldif ? "vlvResult" : "vlvResult", buf, rc );
}
return rc;
@@ -2157,7 +2253,7 @@ print_ppolicy( LDAP *ld, LDAPControl *ct
}
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "ppolicy", buf, ptr - buf );
+ ldif ? "ppolicy: " : "ppolicy", buf, ptr - buf );
}
return rc;
@@ -2253,7 +2349,7 @@ tool_write_ldif( int type, char *name, c
{
char *ldif;
- if (( ldif = ldif_put( type, name, value, vallen )) == NULL ) {
+ if (( ldif = ldif_put_wrap( type, name, value, vallen, ldif_wrap )) == NULL ) {
return( -1 );
}
@@ -2293,4 +2389,3 @@ tool_is_oid( const char *s )
return 1;
}
-
Index: src/external/bsd/openldap/dist/include/Makefile.in
diff -u src/external/bsd/openldap/dist/include/Makefile.in:1.4 src/external/bsd/openldap/dist/include/Makefile.in:1.5
--- src/external/bsd/openldap/dist/include/Makefile.in:1.4 Sun Dec 12 15:46:32 2010
+++ src/external/bsd/openldap/dist/include/Makefile.in Wed May 28 10:12:43 2014
@@ -1,8 +1,8 @@
# include Makefile.in for OpenLDAP
-# OpenLDAP: pkg/ldap/include/Makefile.in,v 1.33.2.5 2010/04/13 20:22:47 kurt Exp
+# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
-## Copyright 1998-2010 The OpenLDAP Foundation.
+## Copyright 1998-2014 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
@@ -20,7 +20,8 @@ install-local: FORCE
for header in $(srcdir)/lber.h lber_types.h \
$(srcdir)/ldap.h $(srcdir)/ldap_cdefs.h \
$(srcdir)/ldap_schema.h $(srcdir)/ldap_utf8.h \
- $(srcdir)/slapi-plugin.h ldap_features.h; \
+ $(srcdir)/slapi-plugin.h ldap_features.h \
+ $(srcdir)/ldif.h ; \
do \
$(INSTALL) $(INSTALLFLAGS) -m 644 $$header $(DESTDIR)$(includedir); \
done
Index: src/external/bsd/openldap/dist/include/portable.hin
diff -u src/external/bsd/openldap/dist/include/portable.hin:1.4 src/external/bsd/openldap/dist/include/portable.hin:1.5
--- src/external/bsd/openldap/dist/include/portable.hin:1.4 Sun Dec 12 16:10:18 2010
+++ src/external/bsd/openldap/dist/include/portable.hin Wed May 28 10:12:43 2014
@@ -4,7 +4,7 @@
/* begin of portable.h.pre */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation
+ * Copyright 1998-2014 The OpenLDAP Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -333,12 +333,6 @@
/* Define to 1 if you have the <ltdl.h> header file. */
#undef HAVE_LTDL_H
-/* if you have SunOS LWP package */
-#undef HAVE_LWP
-
-/* Define to 1 if you have the <lwp/lwp.h> header file. */
-#undef HAVE_LWP_LWP_H
-
/* define if you have Mach Cthreads */
#undef HAVE_MACH_CTHREADS
@@ -369,6 +363,9 @@
/* define this if you have mkversion */
#undef HAVE_MKVERSION
+/* define if you have MozNSS */
+#undef HAVE_MOZNSS
+
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
@@ -378,6 +375,9 @@
/* define if strerror_r returns char* instead of int */
#undef HAVE_NONPOSIX_STRERROR_R
+/* Define to 1 if you have the <nssutil.h> header file. */
+#undef HAVE_NSSUTIL_H
+
/* if you have NT Event Log */
#undef HAVE_NT_EVENT_LOG
@@ -606,6 +606,9 @@
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
+/* Define to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
+
/* Define to 1 if you have the `strtouq' function. */
#undef HAVE_STRTOUQ
@@ -943,6 +946,9 @@
/* define to support LAN Manager passwords */
#undef SLAPD_LMHASH
+/* define to support MDB backend */
+#undef SLAPD_MDB
+
/* define to support LDAP Metadirectory backend */
#undef SLAPD_META
Index: src/external/bsd/openldap/dist/include/ldap_queue.h
diff -u src/external/bsd/openldap/dist/include/ldap_queue.h:1.2 src/external/bsd/openldap/dist/include/ldap_queue.h:1.3
--- src/external/bsd/openldap/dist/include/ldap_queue.h:1.2 Tue Nov 26 01:31:43 2013
+++ src/external/bsd/openldap/dist/include/ldap_queue.h Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: ldap_queue.h,v 1.2 2013/11/26 01:31:43 christos Exp $ */
+/* $NetBSD: ldap_queue.h,v 1.3 2014/05/28 10:12:43 tron Exp $ */
/* ldap_queue.h -- queue macros */
-/* OpenLDAP: pkg/ldap/include/ldap_queue.h,v 1.13.2.5 2010/04/13 20:22:48 kurt Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2001-2010 The OpenLDAP Foundation.
+ * Copyright 2001-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
- * FreeBSD: src/sys/sys/queue.h,v 1.32.2.5 2001/09/30 21:12:54 luigi Exp
+ * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.5 2001/09/30 21:12:54 luigi Exp $
*
* See also: ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
*/
Index: src/external/bsd/openldap/dist/libraries/libldap/os-ip.c
diff -u src/external/bsd/openldap/dist/libraries/libldap/os-ip.c:1.5 src/external/bsd/openldap/dist/libraries/libldap/os-ip.c:1.6
--- src/external/bsd/openldap/dist/libraries/libldap/os-ip.c:1.5 Tue May 24 16:03:15 2011
+++ src/external/bsd/openldap/dist/libraries/libldap/os-ip.c Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: os-ip.c,v 1.5 2011/05/24 16:03:15 joerg Exp $ */
+/* $NetBSD: os-ip.c,v 1.6 2014/05/28 10:12:43 tron Exp $ */
/* os-ip.c -- platform-specific TCP & UDP related code */
-/* OpenLDAP: pkg/ldap/libraries/libldap/os-ip.c,v 1.118.2.20 2010/04/13 20:22:58 kurt Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* Portions Copyright 1999 Lars Uffmann.
* All rights reserved.
*
@@ -278,7 +278,8 @@ int
ldap_int_poll(
LDAP *ld,
ber_socket_t s,
- struct timeval *tvp )
+ struct timeval *tvp,
+ int wr )
{
int rc;
@@ -290,9 +291,10 @@ ldap_int_poll(
{
struct pollfd fd;
int timeout = INFTIM;
+ short event = wr ? POLL_WRITE : POLL_READ;
fd.fd = s;
- fd.events = POLL_WRITE;
+ fd.events = event;
if ( tvp != NULL ) {
timeout = TV2MILLISEC( tvp );
@@ -312,7 +314,7 @@ ldap_int_poll(
return -2;
}
- if ( fd.revents & POLL_WRITE ) {
+ if ( fd.revents & event ) {
if ( ldap_pvt_is_socket_ready( ld, s ) == -1 ) {
return -1;
}
@@ -422,8 +424,8 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t
if (LDAP_IS_UDP(ld)) {
if (ld->ld_options.ldo_peer)
ldap_memfree(ld->ld_options.ldo_peer);
- ld->ld_options.ldo_peer=ldap_memalloc(sizeof(struct sockaddr));
- AC_MEMCPY(ld->ld_options.ldo_peer,sin,sizeof(struct sockaddr));
+ ld->ld_options.ldo_peer=ldap_memcalloc(1, sizeof(struct sockaddr_storage));
+ AC_MEMCPY(ld->ld_options.ldo_peer,sin,addrlen);
return ( 0 );
}
#endif
@@ -438,13 +440,21 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t
if ( opt_tv && ldap_pvt_ndelay_on(ld, s) == -1 )
return ( -1 );
- if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) {
- if ( opt_tv && ldap_pvt_ndelay_off(ld, s) == -1 )
- return ( -1 );
- return ( 0 );
- }
+ do{
+ osip_debug(ld, "attempting to connect: \n", 0, 0, 0);
+ if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) {
+ osip_debug(ld, "connect success\n", 0, 0, 0);
+
+ if ( opt_tv && ldap_pvt_ndelay_off(ld, s) == -1 )
+ return ( -1 );
+ return ( 0 );
+ }
+ err = sock_errno();
+ osip_debug(ld, "connect errno: %d\n", err, 0, 0);
+
+ } while(err == EINTR &&
+ LDAP_BOOL_GET( &ld->ld_options, LDAP_BOOL_RESTART ));
- err = sock_errno();
if ( err != EINPROGRESS && err != EWOULDBLOCK ) {
return ( -1 );
}
@@ -454,7 +464,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t
return ( -2 );
}
- rc = ldap_int_poll( ld, s, opt_tv );
+ rc = ldap_int_poll( ld, s, opt_tv, 1 );
osip_debug(ld, "ldap_pvt_connect: %d\n", rc, 0, 0);
@@ -594,16 +604,12 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *
hints.ai_socktype = socktype;
snprintf(serv, sizeof serv, "%d", port );
-#ifdef LDAP_R_COMPILE
/* most getaddrinfo(3) use non-threadsafe resolver libraries */
- ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
-#endif
+ LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex);
err = getaddrinfo( host, serv, &hints, &res );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock(&ldap_int_resolv_mutex);
-#endif
+ LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex);
if ( err != 0 ) {
osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
@@ -729,9 +735,9 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *
async);
if ( (rc == 0) || (rc == -2) ) {
- i = ldap_int_connect_cbs( ld, sb, &s, srv, (struct sockaddr *)&sin );
- if ( i )
- rc = i;
+ int err = ldap_int_connect_cbs( ld, sb, &s, srv, (struct sockaddr *)&sin );
+ if ( err )
+ rc = err;
else
break;
}
@@ -972,6 +978,32 @@ ldap_mark_select_clear( LDAP *ld, Sockbu
#endif
}
+void
+ldap_clear_select_write( LDAP *ld, Sockbuf *sb )
+{
+ struct selectinfo *sip;
+ ber_socket_t sd;
+
+ sip = (struct selectinfo *)ld->ld_selectinfo;
+
+ ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
+
+#ifdef HAVE_POLL
+ /* for UNIX poll(2) */
+ {
+ int i;
+ for(i=0; i < sip->si_maxfd; i++) {
+ if( sip->si_fds[i].fd == sd ) {
+ sip->si_fds[i].events &= ~POLL_WRITE;
+ }
+ }
+ }
+#else
+ /* for UNIX select(2) */
+ FD_CLR( sd, &sip->si_writefds );
+#endif
+}
+
int
ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
Index: src/external/bsd/openldap/dist/libraries/libldap/os-local.c
diff -u src/external/bsd/openldap/dist/libraries/libldap/os-local.c:1.6 src/external/bsd/openldap/dist/libraries/libldap/os-local.c:1.7
--- src/external/bsd/openldap/dist/libraries/libldap/os-local.c:1.6 Tue May 24 16:03:15 2011
+++ src/external/bsd/openldap/dist/libraries/libldap/os-local.c Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: os-local.c,v 1.6 2011/05/24 16:03:15 joerg Exp $ */
+/* $NetBSD: os-local.c,v 1.7 2014/05/28 10:12:43 tron Exp $ */
/* os-local.c -- platform-specific domain socket code */
-/* OpenLDAP: pkg/ldap/libraries/libldap/os-local.c,v 1.44.2.10 2010/04/13 20:22:59 kurt Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -330,11 +330,6 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *
oslocal_debug(ld, "ldap_connect_to_path\n",0,0,0);
- s = ldap_pvt_socket( ld );
- if ( s == AC_SOCKET_INVALID ) {
- return -1;
- }
-
if ( path == NULL || path[0] == '\0' ) {
path = LDAPI_SOCK;
} else {
@@ -344,6 +339,11 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *
}
}
+ s = ldap_pvt_socket( ld );
+ if ( s == AC_SOCKET_INVALID ) {
+ return -1;
+ }
+
oslocal_debug(ld, "ldap_connect_to_path: Trying %s\n", path, 0, 0);
memset( &server, '\0', sizeof(server) );
@@ -353,10 +353,7 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *
rc = ldap_pvt_connect(ld, s, &server, async);
if (rc == 0) {
- int err;
- err = ldap_int_connect_cbs( ld, sb, &s, srv, (struct sockaddr *)&server );
- if ( err )
- rc = err;
+ rc = ldap_int_connect_cbs( ld, sb, &s, srv, (struct sockaddr *)&server );
}
if ( rc ) {
ldap_pvt_close_socket(ld, s);
Index: src/external/bsd/openldap/dist/libraries/libldap/tls_o.c
diff -u src/external/bsd/openldap/dist/libraries/libldap/tls_o.c:1.3 src/external/bsd/openldap/dist/libraries/libldap/tls_o.c:1.4
--- src/external/bsd/openldap/dist/libraries/libldap/tls_o.c:1.3 Sun Dec 12 15:46:33 2010
+++ src/external/bsd/openldap/dist/libraries/libldap/tls_o.c Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: tls_o.c,v 1.3 2010/12/12 15:46:33 adam Exp $ */
+/* $NetBSD: tls_o.c,v 1.4 2014/05/28 10:12:43 tron Exp $ */
/* tls_o.c - Handle tls/ssl using OpenSSL */
-/* OpenLDAP: pkg/ldap/libraries/libldap/tls_o.c,v 1.5.2.12 2010/04/15 21:25:28 quanah Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2008-2010 The OpenLDAP Foundation.
+ * Copyright 2008-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,10 +39,6 @@
#include "ldap-int.h"
#include "ldap-tls.h"
-#ifdef LDAP_R_COMPILE
-#include <ldap_pvt_thread.h>
-#endif
-
#ifdef HAVE_OPENSSL_SSL_H
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
@@ -225,6 +221,25 @@ tlso_ctx_init( struct ldapoptions *lo, s
(const unsigned char *) "OpenLDAP", sizeof("OpenLDAP")-1 );
}
+#ifdef SSL_OP_NO_TLSv1
+#ifdef SSL_OP_NO_TLSv1_1
+#ifdef SSL_OP_NO_TLSv1_2
+ if ( lo->ldo_tls_protocol_min > LDAP_OPT_X_TLS_PROTOCOL_TLS1_2)
+ SSL_CTX_set_options( ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 |
+ SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 |
+ SSL_OP_NO_TLSv1_2 );
+ else
+#endif
+ if ( lo->ldo_tls_protocol_min > LDAP_OPT_X_TLS_PROTOCOL_TLS1_1)
+ SSL_CTX_set_options( ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 |
+ SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 );
+ else
+#endif
+ if ( lo->ldo_tls_protocol_min > LDAP_OPT_X_TLS_PROTOCOL_TLS1_0)
+ SSL_CTX_set_options( ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 |
+ SSL_OP_NO_TLSv1);
+ else
+#endif
if ( lo->ldo_tls_protocol_min > LDAP_OPT_X_TLS_PROTOCOL_SSL3 )
SSL_CTX_set_options( ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 );
else if ( lo->ldo_tls_protocol_min > LDAP_OPT_X_TLS_PROTOCOL_SSL2 )
@@ -507,12 +522,8 @@ tlso_session_chkhost( LDAP *ld, tls_sess
}
#ifdef LDAP_PF_INET6
- if (name[0] == '[' && strchr(name, ']')) {
- char *n2 = ldap_strdup(name+1);
- *strchr(n2, ']') = 0;
- if (inet_pton(AF_INET6, n2, &addr))
- ntype = IS_IP6;
- LDAP_FREE(n2);
+ if (inet_pton(AF_INET6, name, &addr)) {
+ ntype = IS_IP6;
} else
#endif
if ((ptr = strrchr(name, '.')) && isdigit((unsigned char)ptr[1])) {
@@ -663,10 +674,8 @@ static int
tlso_session_strength( tls_session *sess )
{
tlso_session *s = (tlso_session *)sess;
- const SSL_CIPHER *c;
- c = SSL_get_current_cipher(s);
- return SSL_CIPHER_get_bits(c, NULL);
+ return SSL_CIPHER_get_bits(SSL_get_current_cipher(s), NULL);
}
/*
@@ -1216,14 +1225,10 @@ tlso_tmp_dh_cb( SSL *ssl, int is_export,
int i;
/* Do we have params of this length already? */
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &tlso_dh_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &tlso_dh_mutex );
for ( p = tlso_dhparams; p; p=p->next ) {
if ( p->keylength == key_length ) {
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &tlso_dh_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &tlso_dh_mutex );
return p->param;
}
}
@@ -1256,9 +1261,7 @@ tlso_tmp_dh_cb( SSL *ssl, int is_export,
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &tlso_dh_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &tlso_dh_mutex );
return dh;
}
Index: src/external/bsd/openldap/dist/libraries/liblutil/detach.c
diff -u src/external/bsd/openldap/dist/libraries/liblutil/detach.c:1.2 src/external/bsd/openldap/dist/libraries/liblutil/detach.c:1.3
--- src/external/bsd/openldap/dist/libraries/liblutil/detach.c:1.2 Mon Jun 20 09:11:17 2011
+++ src/external/bsd/openldap/dist/libraries/liblutil/detach.c Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: detach.c,v 1.2 2011/06/20 09:11:17 mrg Exp $ */
+/* $NetBSD: detach.c,v 1.3 2014/05/28 10:12:43 tron Exp $ */
/* detach.c -- routines to daemonize a process */
-/* OpenLDAP: pkg/ldap/libraries/liblutil/detach.c,v 1.18.2.5 2010/04/13 20:23:05 kurt Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,10 +51,10 @@
#include "lutil.h"
-void
+int
lutil_detach( int debug, int do_close )
{
- int i, sd, nbits;
+ int i, sd, nbits, pid;
#ifdef HAVE_SYSCONF
nbits = sysconf( _SC_OPEN_MAX );
@@ -73,10 +73,11 @@ lutil_detach( int debug, int do_close )
if ( debug == 0 ) {
for ( i = 0; i < 5; i++ ) {
#ifdef HAVE_THR
- switch ( fork1() )
+ pid = fork1();
#else
- switch ( fork() )
+ pid = fork();
#endif
+ switch ( pid )
{
case -1:
sleep( 5 );
@@ -86,7 +87,7 @@ lutil_detach( int debug, int do_close )
break;
default:
- _exit( EXIT_SUCCESS );
+ return pid;
}
break;
}
@@ -141,4 +142,5 @@ lutil_detach( int debug, int do_close )
#ifdef SIGPIPE
(void) SIGNAL( SIGPIPE, SIG_IGN );
#endif
+ return 0;
}
Index: src/external/bsd/openldap/dist/libraries/liblutil/md5.c
diff -u src/external/bsd/openldap/dist/libraries/liblutil/md5.c:1.2 src/external/bsd/openldap/dist/libraries/liblutil/md5.c:1.3
--- src/external/bsd/openldap/dist/libraries/liblutil/md5.c:1.2 Fri Jul 1 02:01:21 2011
+++ src/external/bsd/openldap/dist/libraries/liblutil/md5.c Wed May 28 10:12:43 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: md5.c,v 1.2 2011/07/01 02:01:21 joerg Exp $ */
+/* $NetBSD: md5.c,v 1.3 2014/05/28 10:12:43 tron Exp $ */
/* md5.c -- MD5 message-digest algorithm */
-/* OpenLDAP: pkg/ldap/libraries/liblutil/md5.c,v 1.19.2.5 2010/04/13 20:23:06 kurt Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Index: src/external/bsd/openldap/dist/libraries/liblutil/passwd.c
diff -u src/external/bsd/openldap/dist/libraries/liblutil/passwd.c:1.3 src/external/bsd/openldap/dist/libraries/liblutil/passwd.c:1.4
--- src/external/bsd/openldap/dist/libraries/liblutil/passwd.c:1.3 Sun Dec 12 15:46:33 2010
+++ src/external/bsd/openldap/dist/libraries/liblutil/passwd.c Wed May 28 10:12:43 2014
@@ -1,9 +1,9 @@
-/* $NetBSD: passwd.c,v 1.3 2010/12/12 15:46:33 adam Exp $ */
+/* $NetBSD: passwd.c,v 1.4 2014/05/28 10:12:43 tron Exp $ */
-/* OpenLDAP: pkg/ldap/libraries/liblutil/passwd.c,v 1.104.2.10 2010/04/13 20:23:06 kurt Exp */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -427,7 +427,7 @@ static int pw_string(
}
#endif /* SLAPD_LMHASH || SLAPD_CRYPT */
-static int pw_string64(
+int lutil_passwd_string64(
const struct berval *sc,
const struct berval *hash,
struct berval *b64,
@@ -1054,7 +1054,7 @@ static int hash_ssha1(
(const unsigned char *)salt.bv_val, salt.bv_len );
lutil_SHA1Final( SHA1digest, &SHA1context );
- return pw_string64( scheme, &digest, hash, &salt);
+ return lutil_passwd_string64( scheme, &digest, hash, &salt);
}
static int hash_sha1(
@@ -1074,7 +1074,7 @@ static int hash_sha1(
(const unsigned char *)passwd->bv_val, passwd->bv_len );
lutil_SHA1Final( SHA1digest, &SHA1context );
- return pw_string64( scheme, &digest, hash, NULL);
+ return lutil_passwd_string64( scheme, &digest, hash, NULL);
}
#endif
@@ -1106,7 +1106,7 @@ static int hash_smd5(
(const unsigned char *) salt.bv_val, salt.bv_len );
lutil_MD5Final( MD5digest, &MD5context );
- return pw_string64( scheme, &digest, hash, &salt );
+ return lutil_passwd_string64( scheme, &digest, hash, &salt );
}
static int hash_md5(
@@ -1128,7 +1128,7 @@ static int hash_md5(
(const unsigned char *) passwd->bv_val, passwd->bv_len );
lutil_MD5Final( MD5digest, &MD5context );
- return pw_string64( scheme, &digest, hash, NULL );
+ return lutil_passwd_string64( scheme, &digest, hash, NULL );
;
}