mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-06-09 08:42:22 -04:00
Import changes from HEAD including
updated MacOS X support modlist2mods error reporting
This commit is contained in:
parent
da8acf6e36
commit
0ae3b3a929
13 changed files with 508 additions and 472 deletions
1
CHANGES
1
CHANGES
|
|
@ -20,6 +20,7 @@ OpenLDAP 2.0.8 Engineering
|
|||
Fixed libldap TLS/SASL crash bugs (ITS#889)
|
||||
Fixed liblber exception bugs
|
||||
Updated slapd anonymous write default to deny
|
||||
Updated slapd syntax erorr reporting
|
||||
Updated libldap TLS seeding (ITS#948)
|
||||
Updated libldap TLS certificate handling
|
||||
Updated libldap referral/reference handling (ITS#905,1047)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
dnl $OpenLDAP$
|
||||
dnl
|
||||
dnl Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
|
||||
dnl Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
|
||||
dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
|
||||
dnl
|
||||
dnl OpenLDAP Autoconf Macros
|
||||
|
|
|
|||
2
aclocal.m4
vendored
2
aclocal.m4
vendored
|
|
@ -12,7 +12,7 @@ dnl PARTICULAR PURPOSE.
|
|||
|
||||
dnl $OpenLDAP$
|
||||
dnl
|
||||
dnl Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
|
||||
dnl Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
|
||||
dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
|
||||
dnl
|
||||
dnl OpenLDAP Autoconf Macros
|
||||
|
|
|
|||
|
|
@ -708,13 +708,9 @@ AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
|
|||
dnl ====================================================================
|
||||
dnl Check for NT Threads
|
||||
AC_DEFUN([OL_NT_THREADS], [
|
||||
AC_CACHE_CHECK([for NT Threads], [ol_cv_nt_threads], [
|
||||
AC_CHECK_FUNC(_beginthread,
|
||||
[ol_cv_nt_threads=yes],
|
||||
[ol_cv_nt_threads=no])
|
||||
])
|
||||
AC_CHECK_FUNC(_beginthread)
|
||||
|
||||
if test $ol_cv_nt_threads = yes ; then
|
||||
if test $ac_cv_func__beginthread = yes ; then
|
||||
AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
|
||||
fi
|
||||
])
|
||||
|
|
|
|||
|
|
@ -133,13 +133,14 @@ ber_realloc( BerElement *ber, ber_len_t len )
|
|||
|
||||
assert( BER_VALID( ber ) );
|
||||
|
||||
have = (ber->ber_end - ber->ber_buf) / EXBUFSIZ;
|
||||
total = ber_pvt_ber_total( ber );
|
||||
have = total / EXBUFSIZ;
|
||||
need = (len < EXBUFSIZ ? 1 : (len + (EXBUFSIZ - 1)) / EXBUFSIZ);
|
||||
total = have * EXBUFSIZ + need * EXBUFSIZ;
|
||||
|
||||
oldbuf = ber->ber_buf;
|
||||
|
||||
ber->ber_buf = (char *) LBER_REALLOC( ber->ber_buf, total );
|
||||
ber->ber_buf = (char *) LBER_REALLOC( oldbuf, total );
|
||||
|
||||
if ( ber->ber_buf == NULL ) {
|
||||
ber->ber_buf = oldbuf;
|
||||
|
|
@ -251,8 +252,9 @@ ber_alloc_t( int options )
|
|||
|
||||
ber = (BerElement *) LBER_CALLOC( 1, sizeof(BerElement) );
|
||||
|
||||
if ( ber == NULL )
|
||||
return( NULL );
|
||||
if ( ber == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ber->ber_valid = LBER_VALID_BERELEMENT;
|
||||
ber->ber_tag = LBER_DEFAULT;
|
||||
|
|
@ -260,19 +262,19 @@ ber_alloc_t( int options )
|
|||
ber->ber_debug = ber_int_debug;
|
||||
|
||||
assert( BER_VALID( ber ) );
|
||||
return( ber );
|
||||
return ber;
|
||||
}
|
||||
|
||||
BerElement *
|
||||
ber_alloc( void ) /* deprecated */
|
||||
{
|
||||
return( ber_alloc_t( 0 ) );
|
||||
return ber_alloc_t( 0 );
|
||||
}
|
||||
|
||||
BerElement *
|
||||
der_alloc( void ) /* deprecated */
|
||||
{
|
||||
return( ber_alloc_t( LBER_USE_DER ) );
|
||||
return ber_alloc_t( LBER_USE_DER );
|
||||
}
|
||||
|
||||
BerElement *
|
||||
|
|
@ -284,7 +286,7 @@ ber_dup( BerElement *ber )
|
|||
assert( BER_VALID( ber ) );
|
||||
|
||||
if ( (new = ber_alloc_t( ber->ber_options )) == NULL ) {
|
||||
return( NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*new = *ber;
|
||||
|
|
@ -367,7 +369,7 @@ int ber_flatten(
|
|||
return -1;
|
||||
}
|
||||
|
||||
bv = LBER_MALLOC( sizeof(struct berval));
|
||||
bv = LBER_MALLOC( sizeof(struct berval) );
|
||||
if ( bv == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -379,7 +381,7 @@ int ber_flatten(
|
|||
|
||||
} else {
|
||||
/* copy the berval */
|
||||
ber_len_t len = ber->ber_ptr - ber->ber_buf;
|
||||
ber_len_t len = ber_pvt_ber_write( ber );
|
||||
|
||||
bv->bv_val = (char *) LBER_MALLOC( len + 1 );
|
||||
if ( bv->bv_val == NULL ) {
|
||||
|
|
@ -405,6 +407,7 @@ ber_reset( BerElement *ber, int was_writing )
|
|||
if ( was_writing ) {
|
||||
ber->ber_end = ber->ber_ptr;
|
||||
ber->ber_ptr = ber->ber_buf;
|
||||
|
||||
} else {
|
||||
ber->ber_ptr = ber->ber_end;
|
||||
}
|
||||
|
|
@ -463,8 +466,10 @@ ber_get_next(
|
|||
if (ber->ber_rwptr == (char *) &ber->ber_tag) {
|
||||
if (ber_int_sb_read( sb, ber->ber_rwptr, 1)<=0)
|
||||
return LBER_DEFAULT;
|
||||
|
||||
if ((ber->ber_rwptr[0] & LBER_BIG_TAG_MASK)
|
||||
!= LBER_BIG_TAG_MASK) {
|
||||
!= LBER_BIG_TAG_MASK)
|
||||
{
|
||||
ber->ber_tag = ber->ber_rwptr[0];
|
||||
ber->ber_rwptr = (char *) &ber->ber_usertag;
|
||||
goto get_lenbyte;
|
||||
|
|
@ -492,17 +497,21 @@ ber_get_next(
|
|||
get_lenbyte:
|
||||
if (ber->ber_rwptr==(char *) &ber->ber_usertag) {
|
||||
unsigned char c;
|
||||
if (ber_int_sb_read( sb, (char *) &c, 1)<=0)
|
||||
if (ber_int_sb_read( sb, (char *) &c, 1)<=0) {
|
||||
return LBER_DEFAULT;
|
||||
}
|
||||
|
||||
if (c & 0x80U) {
|
||||
int len = c & 0x7fU;
|
||||
if ( (len==0) || ( len>sizeof( ber->ber_len ) ) ) {
|
||||
errno = ERANGE;
|
||||
return LBER_DEFAULT;
|
||||
}
|
||||
|
||||
ber->ber_rwptr = (char *) &ber->ber_len +
|
||||
sizeof(ber->ber_len) - len;
|
||||
ber->ber_len = 0;
|
||||
|
||||
} else {
|
||||
ber->ber_len = c;
|
||||
goto fill_buffer;
|
||||
|
|
@ -517,6 +526,7 @@ get_lenbyte:
|
|||
to_go = (char *) &ber->ber_len + sizeof( ber->ber_len ) -
|
||||
ber->ber_rwptr;
|
||||
assert( to_go > 0 );
|
||||
|
||||
res = BerRead( sb, netlen, to_go );
|
||||
if (res <= 0) {
|
||||
return LBER_DEFAULT;
|
||||
|
|
@ -528,8 +538,10 @@ get_lenbyte:
|
|||
ber->ber_len <<= 8;
|
||||
ber->ber_len |= netlen[to_go];
|
||||
}
|
||||
if (PTR_IN_VAR(ber->ber_rwptr, ber->ber_len))
|
||||
|
||||
if (PTR_IN_VAR(ber->ber_rwptr, ber->ber_len)) {
|
||||
return LBER_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
fill_buffer:
|
||||
|
|
@ -584,6 +596,7 @@ fill_buffer:
|
|||
}
|
||||
return (ber->ber_tag);
|
||||
}
|
||||
|
||||
assert( 0 ); /* ber structure is messed up ?*/
|
||||
return LBER_DEFAULT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
|||
osip_debug(ld, "ldap_connect_to_host\n",0,0,0);
|
||||
|
||||
if (host != NULL) {
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
#if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
|
||||
char serv[7];
|
||||
int err;
|
||||
struct addrinfo hints, *res, *sai;
|
||||
|
|
@ -308,7 +308,8 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
|||
|
||||
snprintf(serv, sizeof serv, "%d", ntohs(port));
|
||||
if ( err = getaddrinfo(host, serv, &hints, &res) ) {
|
||||
osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n", AC_GAI_STRERROR(err), 0, 0);
|
||||
osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
|
||||
AC_GAI_STRERROR(err), 0, 0);
|
||||
return -1;
|
||||
}
|
||||
sai = res;
|
||||
|
|
@ -355,6 +356,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
|||
} while ((sai = sai->ai_next) != NULL);
|
||||
freeaddrinfo(res);
|
||||
return rc;
|
||||
|
||||
#else
|
||||
struct in_addr in;
|
||||
if (! inet_aton( host, &in) ) {
|
||||
|
|
|
|||
|
|
@ -194,8 +194,12 @@ do_add( Connection *conn, Operation *op )
|
|||
#endif
|
||||
{
|
||||
int update = be->be_update_ndn != NULL;
|
||||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
size_t textlen = sizeof textbuf;
|
||||
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text,
|
||||
textbuf, textlen );
|
||||
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
NULL, text, NULL, NULL );
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ static Listener * slap_open_listener(
|
|||
|
||||
case AF_INET: {
|
||||
char *s;
|
||||
#if defined( HAVE_GETADDRINFO ) && defined( INET_NTOP )
|
||||
#if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
|
||||
char addr[INET_ADDRSTRLEN];
|
||||
inet_ntop( AF_INET, &((struct sockaddr_in *)*sal)->sin_addr,
|
||||
addr, sizeof(addr) );
|
||||
|
|
|
|||
|
|
@ -215,7 +215,11 @@ do_modify(
|
|||
{
|
||||
int update = be->be_update_ndn != NULL;
|
||||
const char *text;
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text );
|
||||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
size_t textlen = sizeof textbuf;
|
||||
|
||||
rc = slap_modlist2mods( modlist, update, &mods, &text,
|
||||
textbuf, textlen );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
|
|
@ -283,7 +287,8 @@ int slap_modlist2mods(
|
|||
LDAPModList *ml,
|
||||
int update,
|
||||
Modifications **mods,
|
||||
const char **text )
|
||||
const char **text,
|
||||
char *textbuf, size_t textlen )
|
||||
{
|
||||
int rc;
|
||||
Modifications **modtail = mods;
|
||||
|
|
@ -303,6 +308,8 @@ int slap_modlist2mods(
|
|||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
slap_mods_free( mod );
|
||||
snprintf( textbuf, textlen, "%s: %s", ml->ml_type, text );
|
||||
*text = textbuf;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +320,11 @@ int slap_modlist2mods(
|
|||
{
|
||||
/* attribute requires binary transfer */
|
||||
slap_mods_free( mod );
|
||||
*text = "attribute requires ;binary transfer";
|
||||
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: requires ;binary transfer",
|
||||
ml->ml_type );
|
||||
*text = textbuf;
|
||||
return LDAP_UNDEFINED_TYPE;
|
||||
}
|
||||
|
||||
|
|
@ -322,14 +333,20 @@ int slap_modlist2mods(
|
|||
{
|
||||
/* attribute requires binary transfer */
|
||||
slap_mods_free( mod );
|
||||
*text = "attribute disallows ;binary transfer";
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: disallows ;binary transfer",
|
||||
ml->ml_type );
|
||||
*text = textbuf;
|
||||
return LDAP_UNDEFINED_TYPE;
|
||||
}
|
||||
|
||||
if (!update && is_at_no_user_mod( ad->ad_type )) {
|
||||
/* user modification disallowed */
|
||||
slap_mods_free( mod );
|
||||
*text = "no user modification allowed";
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: no user modification allowed",
|
||||
ml->ml_type );
|
||||
*text = textbuf;
|
||||
return LDAP_CONSTRAINT_VIOLATION;
|
||||
}
|
||||
|
||||
|
|
@ -347,6 +364,11 @@ int slap_modlist2mods(
|
|||
ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
|
||||
slap_mods_free( mod );
|
||||
*text = "no validator for syntax";
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: no validator for syntax %s",
|
||||
ml->ml_type,
|
||||
ad->ad_type->sat_syntax->ssyn_oid );
|
||||
*text = textbuf;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +380,10 @@ int slap_modlist2mods(
|
|||
|
||||
if( rc != 0 ) {
|
||||
slap_mods_free( mod );
|
||||
*text = "value contains invalid data";
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: value #%ld contains invalid data",
|
||||
ml->ml_type, (long) nvals );
|
||||
*text = textbuf;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
}
|
||||
|
|
@ -371,7 +396,10 @@ int slap_modlist2mods(
|
|||
&& nvals > 1 && is_at_single_value( ad->ad_type ))
|
||||
{
|
||||
slap_mods_free( mod );
|
||||
*text = "multiple values provided";
|
||||
snprintf( textbuf, textlen,
|
||||
"%s: multiple value provided",
|
||||
ml->ml_type );
|
||||
*text = textbuf;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -397,7 +397,9 @@ LDAP_SLAPD_F( int ) slap_modlist2mods(
|
|||
LDAPModList *ml,
|
||||
int update,
|
||||
Modifications **mods,
|
||||
const char **text );
|
||||
const char **text,
|
||||
char *textbuf,
|
||||
size_t textlen );
|
||||
|
||||
LDAP_SLAPD_F( int ) slap_mods_opattrs(
|
||||
Operation *op,
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ LDAP_BEGIN_DECL
|
|||
#define SLAP_MAX_INCOMING (1<<18 - 1)
|
||||
#define SLAP_MAX_WORKER_THREADS 32
|
||||
|
||||
#define SLAP_TEXT_BUFLEN (256)
|
||||
|
||||
/* psuedo error code indicating abandoned operation */
|
||||
#define SLAPD_ABANDON (-1)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ fi
|
|||
|
||||
echo "Starting slapd on TCP/IP port $PORT..."
|
||||
. $CONFFILTER $BACKEND < $CONF > $DBCONF
|
||||
$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > /dev/null 2>&1 &
|
||||
$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING >> /dev/null 2>&1 &
|
||||
PID=$!
|
||||
|
||||
echo "Using ldapsearch to retrieve all the entries..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue