From abd9be4def262989fda50137a75b2cb34868ab2b Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 9 Dec 2001 02:34:45 +0000 Subject: [PATCH] Remove lint and misc MSVC updates --- build/main.dsw | 3 +++ clients/ud/edit.c | 19 +++++++------- clients/ud/main.c | 1 - include/lutil.h | 8 ++++++ include/queue-compat.h | 2 +- libraries/liblber/decode.c | 7 +++++- libraries/liblber/liblber.dsp | 4 +++ libraries/libldap/charray.c | 3 ++- libraries/libldap/ldap-int.h | 4 ++- libraries/libldap/libldap.dsp | 4 --- libraries/libldap/request.c | 1 - libraries/libldap/search.c | 20 ++++++++++----- libraries/libldap/url.c | 2 +- libraries/libldap_r/libldap_r.dsp | 4 --- libraries/libldbm/ldbm.c | 2 ++ libraries/liblutil/csn.c | 5 +++- libraries/liblutil/liblutil.dsp | 8 ++++++ libraries/liblutil/uuid.c | 40 ++++++++++++++++++++++++------ servers/slapd/acl.c | 2 -- servers/slapd/back-bdb/backbdb.dsp | 20 +++++++++++++++ servers/slapd/back-bdb/config.c | 4 ++- servers/slapd/back-bdb/dn2id.c | 2 +- servers/slapd/back-bdb/init.c | 2 +- servers/slapd/back-ldbm/search.c | 2 +- servers/slapd/backend.c | 2 +- servers/slapd/backglue.c | 2 -- servers/slapd/compare.c | 2 +- servers/slapd/entry.c | 2 +- servers/slapd/libslapd.dsp | 8 ++++++ servers/slapd/limits.c | 2 +- servers/slapd/modify.c | 3 ++- servers/slapd/result.c | 17 ++++++++----- servers/slapd/saslauthz.c | 11 +++++--- servers/slapd/tools/slapadd.c | 3 +++ 34 files changed, 160 insertions(+), 61 deletions(-) diff --git a/build/main.dsw b/build/main.dsw index 2226ef1f65..d08cf6e223 100644 --- a/build/main.dsw +++ b/build/main.dsw @@ -677,6 +677,9 @@ Package=<4> Begin Project Dependency Project_Dep_Name libavl End Project Dependency + Begin Project Dependency + Project_Dep_Name liblber + End Project Dependency }}} ############################################################################### diff --git a/clients/ud/edit.c b/clients/ud/edit.c index 9e20860383..53aeb57dfd 100644 --- a/clients/ud/edit.c +++ b/clients/ud/edit.c @@ -130,7 +130,6 @@ load_editor( void ) { FILE *fp; char *cp, *editor = UD_DEFAULT_EDITOR; - int tmpfd; #ifndef HAVE_SPAWNLP int pid; int status; @@ -145,16 +144,18 @@ load_editor( void ) #ifdef HAVE_MKSTEMP strcpy(entry_temp_file, LDAP_TMPDIR LDAP_DIRSEP "udXXXXXX"); - tmpfd = mkstemp(entry_temp_file); + { + int tmpfd = mkstemp(entry_temp_file); - if( tmpfd < 0 ) { - perror("mkstemp"); - return -1; - } + if( tmpfd < 0 ) { + perror("mkstemp"); + return -1; + } - if ((fp = fdopen(tmpfd, "w")) == NULL) { - perror("fdopen"); - return(-1); + if ((fp = fdopen(tmpfd, "w")) == NULL) { + perror("fdopen"); + return(-1); + } } #else diff --git a/clients/ud/main.c b/clients/ud/main.c index cec5a03e63..d6b5947c4e 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -327,7 +327,6 @@ void change_base( int type, char **base, char *s ) { register char *cp; /* utility pointers */ - char **rdns; /* for parsing */ char *output_string = NULL; /* for nice output */ int num_picked; /* # of selected base */ int j; /* used with num_picked */ diff --git a/include/lutil.h b/include/lutil.h index 5adc4b998e..b5f038be5e 100644 --- a/include/lutil.h +++ b/include/lutil.h @@ -110,6 +110,14 @@ lutil_progname LDAP_P(( LDAP_LUTIL_F( int ) lutil_pair( ber_socket_t sd[2] ); +/* uuid.c */ +LDAP_LUTIL_F( size_t ) +lutil_uuidstr( char *buf, size_t len ); + +/* csn.c */ +LDAP_LUTIL_F( size_t ) +lutil_csnstr( char *buf, size_t len, unsigned int replica, unsigned int mod ); + /* * Sometimes not all declarations in a header file are needed. * An indicator to this is whether or not the symbol's type has diff --git a/include/queue-compat.h b/include/queue-compat.h index 1ba68a7262..e1915d862d 100644 --- a/include/queue-compat.h +++ b/include/queue-compat.h @@ -48,7 +48,7 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ -#include /* for __offsetof */ +#define __offsetof offsetof /* * This file defines five types of data structures: singly-linked lists, diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index d79f8cbeb6..482834ed5c 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -137,6 +137,11 @@ ber_skip_tag( BerElement *ber, ber_len_t *len ) *len = lc; } + /* BER length should be non-negative */ + if( *len < 0 ) { + return LBER_DEFAULT; + } + /* BER element should have enough data left */ if( *len > ber_pvt_ber_remaining( ber ) ) { return LBER_DEFAULT; @@ -293,7 +298,7 @@ ber_get_stringa( BerElement *ber, char **buf ) return LBER_DEFAULT; } - if ( (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) { + if ( datalen > 0 && (ber_len_t) ber_read( ber, *buf, datalen ) != datalen ) { LBER_FREE( *buf ); *buf = NULL; return LBER_DEFAULT; diff --git a/libraries/liblber/liblber.dsp b/libraries/liblber/liblber.dsp index e02e1f3f76..e414c67d3e 100644 --- a/libraries/liblber/liblber.dsp +++ b/libraries/liblber/liblber.dsp @@ -219,6 +219,10 @@ SOURCE=.\options.c # End Source File # Begin Source File +SOURCE="..\..\include\queue-compat.h" +# End Source File +# Begin Source File + SOURCE=.\sockbuf.c # End Source File # End Target diff --git a/libraries/libldap/charray.c b/libraries/libldap/charray.c index 41432d21b4..5037f6610a 100644 --- a/libraries/libldap/charray.c +++ b/libraries/libldap/charray.c @@ -77,8 +77,9 @@ ldap_charray_merge( aa = (char **) LDAP_REALLOC( (char *) *a, (n + nn + 1) * sizeof(char *) ); - if( aa == NULL ) + if( aa == NULL ) { return -1; + } *a = aa; diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 693686a280..8609ce2768 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -18,6 +18,8 @@ #include "../liblber/lber-int.h" +#include + #ifdef HAVE_CYRUS_SASL /* the need for this should be removed */ #include @@ -194,7 +196,7 @@ typedef struct ldap_conn { #endif BerElement *lconn_ber; /* ber receiving on this conn. */ - struct ldap_conn *lconn_next; + struct ldap_conn *lconn_next; } LDAPConn; diff --git a/libraries/libldap/libldap.dsp b/libraries/libldap/libldap.dsp index d4e46e37c3..a409864fce 100644 --- a/libraries/libldap/libldap.dsp +++ b/libraries/libldap/libldap.dsp @@ -199,10 +199,6 @@ SOURCE=.\free.c # End Source File # Begin Source File -SOURCE=.\friendly.c -# End Source File -# Begin Source File - SOURCE=.\getattr.c # End Source File # Begin Source File diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index a909f4c4f7..3ee6501a4e 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -568,7 +568,6 @@ ldap_free_request_int( LDAP *ld, LDAPRequest *lr ) void ldap_free_request( LDAP *ld, LDAPRequest *lr ) { - LDAPRequest *tmplr, *nextlr; LDAPRequest **ttmplr; Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n", diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 50f50067ff..9a54165cb5 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -73,7 +73,7 @@ static int put_filter_list LDAP_P(( * * Example: * char *attrs[] = { "mail", "title", 0 }; - * ldap_search_ext( ld, "c=us,o=UM", LDAP_SCOPE_SUBTREE, "cn~=bob", + * ldap_search_ext( ld, "dc=example,dc=com", LDAP_SCOPE_SUBTREE, "cn~=bob", * attrs, attrsonly, sctrls, ctrls, timeout, sizelimit, * &msgid ); */ @@ -203,7 +203,7 @@ ldap_search_ext_s( * * Example: * char *attrs[] = { "mail", "title", 0 }; - * msgid = ldap_search( ld, "c=us@o=UM", LDAP_SCOPE_SUBTREE, "cn~=bob", + * msgid = ldap_search( ld, "dc=example,dc=com", LDAP_SCOPE_SUBTREE, "cn~=bob", * attrs, attrsonly ); */ int @@ -466,7 +466,7 @@ ldap_pvt_find_wildcard( const char *s ) /* unescape filter value */ /* support both LDAP v2 and v3 escapes */ -/* output can include nul characters */ +/* output can include nul characters! */ ber_slen_t ldap_pvt_filter_value_unescape( char *fval ) { @@ -487,7 +487,6 @@ ldap_pvt_filter_value_unescape( char *fval ) if (( v1 = hex2value( fval[v] )) >= 0 ) { /* LDAPv3 escape */ - if (( v2 = hex2value( fval[v+1] )) < 0 ) { /* must be two digit code */ return -1; @@ -498,9 +497,18 @@ ldap_pvt_filter_value_unescape( char *fval ) } else { /* LDAPv2 escape */ - fval[r++] = fval[v]; + switch( fval[v] ) { + case '(': + case ')': + case '*': + case '\\': + fval[r++] = fval[v]; + break; + default: + /* illegal escape */ + return -1; + } } - break; default: diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 8db923b2a5..c716f2f035 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -17,7 +17,7 @@ * scope is one of these three strings: base one sub (default=base) * filter is an string-represented filter as in RFC 2254 * - * e.g., ldap://host:port/dc=com?o,cn?base?o=openldap?extension + * e.g., ldap://host:port/dc=com?o,cn?base?(o=openldap)?extension * * We also tolerate URLs that look like: and */ diff --git a/libraries/libldap_r/libldap_r.dsp b/libraries/libldap_r/libldap_r.dsp index 4d8e7f5770..4803399cc8 100644 --- a/libraries/libldap_r/libldap_r.dsp +++ b/libraries/libldap_r/libldap_r.dsp @@ -196,10 +196,6 @@ SOURCE=..\libldap\free.c # End Source File # Begin Source File -SOURCE=..\libldap\friendly.c -# End Source File -# Begin Source File - SOURCE=..\libldap\getattr.c # End Source File # Begin Source File diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index b9aedcf25c..0e404ec6c5 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -120,8 +120,10 @@ ldbm_db_errcall( const char *prefix, char *message ) int ldbm_initialize( const char* home ) { +#if DB_VERSION_MAJOR < 3 int err; u_int32_t envFlags; +#endif if(ldbm_initialized++) return 1; diff --git a/libraries/liblutil/csn.c b/libraries/liblutil/csn.c index 9c92737724..a56af6b658 100644 --- a/libraries/liblutil/csn.c +++ b/libraries/liblutil/csn.c @@ -32,6 +32,8 @@ #include #include +#include + size_t lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) { @@ -55,7 +57,8 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) ltm->tm_year + 1900, ltm->tm_mon, ltm->tm_mday, ltm->tm_hour, ltm->tm_min, ltm->tm_sec, op, replica, mod ); - return ( n < len ) ? n : 0; + if( n < 0 ) return 0; + return ( (size_t) n < len ) ? n : 0; } #ifdef TEST diff --git a/libraries/liblutil/liblutil.dsp b/libraries/liblutil/liblutil.dsp index 1e32beb4a5..b089105318 100644 --- a/libraries/liblutil/liblutil.dsp +++ b/libraries/liblutil/liblutil.dsp @@ -140,6 +140,10 @@ SOURCE=..\..\include\ac\bytes.h # End Source File # Begin Source File +SOURCE=.\csn.c +# End Source File +# Begin Source File + SOURCE=.\debug.c # End Source File # Begin Source File @@ -281,5 +285,9 @@ SOURCE=.\sockpair.c SOURCE=.\utils.c # End Source File +# Begin Source File + +SOURCE=.\uuid.c +# End Source File # End Target # End Project diff --git a/libraries/liblutil/uuid.c b/libraries/liblutil/uuid.c index 7497c96888..0bb664a0dc 100644 --- a/libraries/liblutil/uuid.c +++ b/libraries/liblutil/uuid.c @@ -9,8 +9,6 @@ * This is free software; you can redistribute and use it * under the same terms as OpenLDAP itself. */ -/* Adapted for incorporatation into OpenLDAP by Kurt Zeilenga */ - /* * Sorry this file is so scary, but it needs to run on a wide range of * platforms. The only exported routine is lutil_uuidstr() which is all @@ -20,13 +18,21 @@ #include "portable.h" #include +#include #include + #ifdef HAVE_SYS_UUID_H # include +#elif defined( _WIN32 ) +# include #else # include # include + + /* 100 usec intervals from 10/10/1582 to 1/1/1970 */ +# define UUID_TPLUS 0x01B21DD2138140LL + # ifdef HAVE_SYS_SYSCTL_H # include # include @@ -36,9 +42,6 @@ #include -/* 100 usec intervals from 10/10/1582 to 1/1/1970 */ -#define UUID_TPLUS 0x01B21DD2138140LL - #ifndef HAVE_SYS_UUID_H static unsigned char * lutil_eaddr( void ) @@ -175,7 +178,7 @@ lutil_eaddr( void ) ** We use DCE version one, and the DCE variant. Our unique identifier is ** the first ethernet address on the system. */ -int +size_t lutil_uuidstr( char *buf, size_t len ) { #ifdef HAVE_SYS_UUID_H @@ -200,11 +203,34 @@ lutil_uuidstr( char *buf, size_t len ) return 0; } - strncpy( buf, s, l ); + strncpy( buf, s, len ); free( s ); return l; +#elif defined( _WIN32 ) + UUID uuid; + unsigned char *uuidstr; + size_t uuidlen; + + if( UuidCreate( &uuid ) != RPC_S_OK ) { + return 0; + } + + if( UuidToString( &uuid, &uuidstr ) != RPC_S_OK ) { + return 0; + } + + uuidlen = strlen( uuidstr ); + if( uuidlen >= len ) { + return 0; + } + + strncpy( buf, uuidstr, len ); + free( uuidstr ); + + return uuidlen; + #else struct timeval tv; unsigned long long tl; diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 193eba4d0c..dda814b385 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -346,7 +346,6 @@ acl_get( continue; } else if ( a->acl_dn_style == ACL_STYLE_ONE ) { - char *rdn; int rdnlen = -1; if ( dnlen <= patlen ) @@ -549,7 +548,6 @@ acl_mask( continue; } else if ( b->a_dn_style == ACL_STYLE_ONE ) { - char *rdn; int rdnlen = -1; if ( odnlen <= patlen ) diff --git a/servers/slapd/back-bdb/backbdb.dsp b/servers/slapd/back-bdb/backbdb.dsp index 8e97d8dd40..4c3a21730f 100644 --- a/servers/slapd/back-bdb/backbdb.dsp +++ b/servers/slapd/back-bdb/backbdb.dsp @@ -131,6 +131,14 @@ SOURCE=.\add.c # End Source File # Begin Source File +SOURCE=.\attr.c +# End Source File +# Begin Source File + +SOURCE=.\attribute.c +# End Source File +# Begin Source File + SOURCE=".\back-bdb.h" # End Source File # Begin Source File @@ -147,6 +155,10 @@ SOURCE=.\config.c # End Source File # Begin Source File +SOURCE=.\dbcache.c +# End Source File +# Begin Source File + SOURCE=.\delete.c # End Source File # Begin Source File @@ -187,10 +199,18 @@ SOURCE=.\idl.h # End Source File # Begin Source File +SOURCE=.\index.c +# End Source File +# Begin Source File + SOURCE=.\init.c # End Source File # Begin Source File +SOURCE=.\key.c +# End Source File +# Begin Source File + SOURCE=.\modify.c # End Source File # Begin Source File diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 75d41a4dc4..a2f7910748 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -13,7 +13,9 @@ #include "back-bdb.h" #define SLAP_BDB_ALLOW_DBNOTXN -#define SLAP_BDB_ALLOW_DIRTY_READ +#ifdef DB_DIRTY_READ +# define SLAP_BDB_ALLOW_DIRTY_READ +#endif int bdb_db_config( diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index d3735e4160..3a81a54c1d 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -379,7 +379,7 @@ bdb_dn2idl( ID *ids ) { int rc; - DBT key, data; + DBT key; struct bdb_info *bdb = (struct bdb_info *) be->be_private; DB *db = bdb->bi_dn2id->bdi_db; diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 2ced049683..5ee04ab9da 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -432,8 +432,8 @@ bdb_initialize( bi->bi_op_abandon = bdb_abandon; bi->bi_extended = bdb_extended; -#endif bi->bi_acl_group = bdb_group; +#endif bi->bi_acl_attribute = bdb_attribute; bi->bi_chk_referrals = bdb_referrals; diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index f4484ecf60..98c1fd11eb 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -214,7 +214,7 @@ searchit: /* if candidates exceed to-be-checked entries, abort */ if ( !isroot && limit->lms_s_unchecked != -1 ) { - if ( ID_BLOCK_NIDS( candidates ) > limit->lms_s_unchecked ) { + if ( ID_BLOCK_NIDS( candidates ) > (unsigned) limit->lms_s_unchecked ) { send_search_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL, NULL, NULL, NULL, 0 ); rc = 0; diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 9398661b2e..d199d8486d 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -565,7 +565,7 @@ be_issuffix( ) { int i; - int len = strlen(suffix); + size_t len = strlen(suffix); for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i] != NULL; i++ ) { if ( len != be->be_nsuffix[i]->bv_len ) { diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 310519b3df..cd2363ee97 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -627,8 +627,6 @@ glue_tool_entry_open ( int mode ) { - int i, rc; - /* We don't know which backend to talk to yet, so just * remember the mode and move on... */ diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 6c24393c00..f7d81050ac 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -176,7 +176,7 @@ do_compare( #ifdef NEW_LOGGING LDAP_LOG(( "operation", LDAP_LEVEL_ARGS, "do_compare: conn %d dn (%s) attr(%s) value (%s)\n", - conn->c_connid, dn, ava.aa_desc->ad_cname->bv_val, + conn->c_connid, dn, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val )); #else Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n", diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 3608eeaefb..ebd740f3c0 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -438,7 +438,7 @@ entry_putlen(unsigned char **buf, ber_len_t len) **buf = (unsigned char) len; } else { int i; - **buf = 0x80 | (lenlen - 1); + **buf = 0x80 | ((unsigned char) lenlen - 1); for (i=lenlen-1; i>0; i--) { (*buf)[i] = (unsigned char) len; len >>= 8; diff --git a/servers/slapd/libslapd.dsp b/servers/slapd/libslapd.dsp index 7251ceffb8..63554a7277 100644 --- a/servers/slapd/libslapd.dsp +++ b/servers/slapd/libslapd.dsp @@ -232,6 +232,10 @@ SOURCE=.\kerberos.c # End Source File # Begin Source File +SOURCE=.\limits.c +# End Source File +# Begin Source File + SOURCE=.\lock.c # End Source File # Begin Source File @@ -276,6 +280,10 @@ SOURCE=".\proto-slap.h" # End Source File # Begin Source File +SOURCE=.\referral.c +# End Source File +# Begin Source File + SOURCE=.\repl.c # End Source File # Begin Source File diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index fb65b4c13e..4a19e01a5e 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -49,7 +49,7 @@ get_limits( case SLAP_LIMITS_ONE: case SLAP_LIMITS_SUBTREE: case SLAP_LIMITS_CHILDREN: { - long d; + size_t d; if ( ndn == NULL || ndn[0] == '\0' ) { break; diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 313c134602..b988009479 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -23,10 +23,11 @@ #include #include +#include "lutil.h" + #include "ldap_pvt.h" #include "slap.h" - int do_modify( Connection *conn, diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 5f954f19df..48638cad56 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -187,12 +187,14 @@ send_ldap_response( int rc; long bytes; + if (op->o_response) { + op->o_response( conn, op, tag, msgid, err, matched, + text, ref, resoid, resdata, sasldata, ctrls ); + return; + } + assert( ctrls == NULL ); /* ctrls not implemented */ - if (op->o_response) - return op->o_response( conn, op, tag, msgid, err, matched, - text, ref, resoid, resdata, sasldata, ctrls); - ber = ber_alloc_t( LBER_USE_DER ); #ifdef NEW_LOGGING @@ -556,11 +558,14 @@ send_search_result( ber_tag_t tag; ber_int_t msgid; char *tmp = NULL; + assert( !LDAP_API_ERROR( err ) ); - if (op->o_sresult) - return op->o_sresult(conn, op, err, matched, text, refs, + if (op->o_sresult) { + op->o_sresult(conn, op, err, matched, text, refs, ctrls, nentries); + return; + } #ifdef NEW_LOGGING LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 5a8b689be5..280e50ad15 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -592,7 +592,7 @@ COMPLETE: int slap_sasl_authorized( char *authcDN, char *authzDN ) { - int rc; + int rc = LDAP_INAPPROPRIATE_AUTH; #ifdef HAVE_CYRUS_SASL /* User binding as anonymous */ @@ -619,19 +619,22 @@ int slap_sasl_authorized( char *authcDN, char *authzDN ) /* Check source rules */ rc = slap_sasl_check_authz( authcDN, authzDN, SASL_AUTHZ_SOURCE_ATTR, authcDN ); - if( rc == LDAP_SUCCESS ) + if( rc == LDAP_SUCCESS ) { goto DONE; + } /* Check destination rules */ rc = slap_sasl_check_authz( authzDN, authcDN, SASL_AUTHZ_DEST_ATTR, authcDN ); - if( rc == LDAP_SUCCESS ) + if( rc == LDAP_SUCCESS ) { goto DONE; + } -#endif rc = LDAP_INAPPROPRIATE_AUTH; DONE: +#endif + #ifdef NEW_LOGGING LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY, "slap_sasl_authorized: return %d\n", rc )); diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c index 55b536c43d..c32d593ae4 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -14,6 +14,9 @@ #include #include +#include +#include + #include "slapcommon.h" int -- 2.39.2