From b7d1b10bca392750165438c480d11ecf75771079 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 14 Jun 2000 21:11:56 +0000 Subject: [PATCH] Minor cleanup --- libraries/liblber/io.c | 11 +++++++---- servers/slapd/add.c | 2 +- servers/slapd/connection.c | 6 +++--- servers/slapd/dn.c | 3 +++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 859b70c137..27220e4267 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -231,9 +231,9 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) if ( sb->sb_debug ) { ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug, - "ber_flush: %ld bytes to sd %ld%s\n", towrite, - (long) sb->sb_fd, ber->ber_rwptr != ber->ber_buf ? - " (re-flush)" : "" ); + "ber_flush: %ld bytes to sd %ld%s\n", + towrite, (long) sb->sb_fd, + ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" ); ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug, ber->ber_rwptr, towrite ); } @@ -523,8 +523,10 @@ ber_get_next( } do { /* reading the tag... */ - if (ber_int_sb_read( sb, ber->ber_rwptr, 1)<=0) + if (ber_int_sb_read( sb, ber->ber_rwptr, 1)<=0) { return LBER_DEFAULT; + } + if (! (ber->ber_rwptr[0] & LBER_MORE_TAG_MASK) ) { ber->ber_tag>>=sizeof(ber->ber_tag) - ((char *) &ber->ber_tag - ber->ber_rwptr); @@ -532,6 +534,7 @@ ber_get_next( goto get_lenbyte; } } while( PTR_IN_VAR(ber->ber_rwptr, ber->ber_tag )); + errno = ERANGE; /* this is a serious error. */ return LBER_DEFAULT; } diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 1b7333f5cf..b9b2c63f7e 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -86,7 +86,7 @@ do_add( Connection *conn, Operation *op ) e->e_attrs = NULL; e->e_private = NULL; - Debug( LDAP_DEBUG_ARGS, " do_add: ndn (%s)\n", e->e_ndn, 0, 0 ); + Debug( LDAP_DEBUG_ARGS, "do_add: ndn (%s)\n", e->e_ndn, 0, 0 ); /* get the attrs */ for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT; diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index f1e075eb45..a86d9b0f37 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -975,9 +975,9 @@ connection_input( } errno = 0; - if ( (tag = ber_get_next( conn->c_sb, &len, conn->c_currentber )) - != LDAP_TAG_MESSAGE ) - { + + tag = ber_get_next( conn->c_sb, &len, conn->c_currentber ); + if ( tag != LDAP_TAG_MESSAGE ) { int err = errno; ber_socket_t sd; diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 72891cfb47..a20d5a2cb5 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -137,18 +137,21 @@ dn_validate( char *dn ) *d++ = *s; } break; + case B4SEPARATOR: if ( RDN_SEPARATOR( *s ) ) { state = B4TYPE; *d++ = *s; } break; + default: dn = NULL; Debug( LDAP_DEBUG_ANY, "dn_validate - unknown state %d\n", state, 0, 0 ); break; } + if ( *s == '\\' ) { gotesc = 1; } else { -- 2.39.5