]> git.sur5r.net Git - openldap/commitdiff
cleanup most of the -pedantic warnings (ITS#2884) and other small fixes
authorPierangelo Masarati <ando@openldap.org>
Wed, 17 Dec 2003 20:55:46 +0000 (20:55 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 17 Dec 2003 20:55:46 +0000 (20:55 +0000)
servers/slapd/acl.c
servers/slapd/controls.c
servers/slapd/ldapsync.c
servers/slapd/result.c
servers/slapd/saslauthz.c
servers/slapd/schema_init.c
servers/slapd/sessionlog.c

index c68fe36a353b8f76cf72b3805b5187ba6709499f..06d9d762b35b470c48bc77134bb8ecb08d615fa4 100644 (file)
 #include "sets.h"
 #include "lber_pvt.h"
 
+#ifdef LDAP_SLAPI
+#include "slapi.h"
+#endif /* LDAPI_SLAPI */
+
 #define ACL_BUF_SIZE   1024    /* use most appropriate size */
 
 /*
index 530857c47830dbbf001ffadfa898fa204f3c62b0..eed5c8bd796756d9cc3f13bee81a0aec7fa02532 100644 (file)
@@ -752,11 +752,17 @@ static int parseProxyAuthz (
        {
                int     rc;
                char            buf[ SLAP_LDAPDN_MAXLEN ];
-               struct berval   id = { ctrl->ldctl_value.bv_len, (char *)buf },
+               struct berval   id,
                                user = { 0, NULL },
                                realm = { 0, NULL },
                                mech = { 0, NULL };
 
+               if ( sizeof( buf ) <= ctrl->ldctl_value.bv_len ) {
+                       return LDAP_INVALID_SYNTAX;
+               }
+
+               id.bv_len = ctrl->ldctl_value.bv_len;
+               id.bv_val = buf;
                strncpy( buf, ctrl->ldctl_value.bv_val, sizeof( buf ) );
 
                rc = slap_parse_user( &id, &user, &realm, &mech );
index 7241f1318e862d017c624cf71ea0ad08fb269d4f..2d87f64fa4ed706cb0df10c20f94840a6385f426 100644 (file)
@@ -435,6 +435,7 @@ slap_parse_sync_cookie(
        } else {
                cookie->rid = -1;
        }
+       return 0;
 }
 
 int
index 2374d94b564ec5532c12b99259a32d8cb9a1d953..1b8a9dda42ae363f5e3abf9d837f3895b69dfdc0 100644 (file)
@@ -289,7 +289,7 @@ send_ldap_response(
 {
        BerElementBuffer berbuf;
        BerElement      *ber = (BerElement *) &berbuf;
-       int             rc;
+       int             rc = LDAP_SUCCESS;
        long    bytes;
 
        if (op->o_callback) {
index 4ad85482eb1b4bfd94496f5bba487f5d6c5c2f1d..1bf2af2a301f2c68578a3b0f33c27447801e27a1 100644 (file)
@@ -266,7 +266,7 @@ is_dn:              bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
        {
                Connection      c = *op->o_conn;
                char            buf[ SLAP_LDAPDN_MAXLEN ];
-               struct berval   id = { uri->bv_len, (char *)buf },
+               struct berval   id,
                                user = { 0, NULL },
                                realm = { 0, NULL },
                                mech = { 0, NULL };
@@ -275,6 +275,8 @@ is_dn:              bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
                        return LDAP_INVALID_SYNTAX;
                }
 
+               id.bv_len = uri->bv_len;
+               id.bv_val = buf;
                strncpy( buf, uri->bv_val, sizeof( buf ) );
 
                rc = slap_parse_user( &id, &user, &realm, &mech );
@@ -642,7 +644,10 @@ exact_match:
                        goto exact_match;
 
                } else if ( d > 0 ) {
-                       struct berval bv = { op.o_req_ndn.bv_len, assertDN->bv_val + d };
+                       struct berval bv;
+
+                       bv.bv_len = op.o_req_ndn.bv_len;
+                       bv.bv_val = assertDN->bv_val + d;
 
                        if ( bv.bv_val[ -1 ] == ',' && dn_match( &op.o_req_ndn, &bv ) ) {
                                rc = LDAP_SUCCESS;
index 8369a43204a121943b7c366f538d7e1168b5e2fe..8a70eaefbb68530ea2a8269412e2726fbccd897c 100644 (file)
@@ -97,7 +97,7 @@ sequenceValidate(
 static int certificateValidate( Syntax *syntax, struct berval *in )
 {
        X509 *xcert=NULL;
-       unsigned char *p = in->bv_val;
+       unsigned char *p = (unsigned char *)in->bv_val;
  
        xcert = d2i_X509(NULL, &p, in->bv_len);
        if ( !xcert ) return LDAP_INVALID_SYNTAX;
@@ -167,7 +167,7 @@ int octetStringIndexer(
        HASH_CONTEXT HASHcontext;
        unsigned char HASHdigest[HASH_BYTES];
        struct berval digest;
-       digest.bv_val = HASHdigest;
+       digest.bv_val = (char *)HASHdigest;
        digest.bv_len = sizeof(HASHdigest);
 
        for( i=0; values[i].bv_val != NULL; i++ ) {
@@ -186,14 +186,15 @@ int octetStringIndexer(
                HASH_Init( &HASHcontext );
                if( prefix != NULL && prefix->bv_len > 0 ) {
                        HASH_Update( &HASHcontext,
-                               prefix->bv_val, prefix->bv_len );
+                               (unsigned char *)prefix->bv_val,
+                               prefix->bv_len );
                }
                HASH_Update( &HASHcontext,
-                       syntax->ssyn_oid, slen );
+                       (unsigned char *)syntax->ssyn_oid, slen );
                HASH_Update( &HASHcontext,
-                       mr->smr_oid, mlen );
+                       (unsigned char *)mr->smr_oid, mlen );
                HASH_Update( &HASHcontext,
-                       values[i].bv_val, values[i].bv_len );
+                       (unsigned char *)values[i].bv_val, values[i].bv_len );
                HASH_Final( HASHdigest, &HASHcontext );
 
                ber_dupbv_x( &keys[i], &digest, ctx );
@@ -224,7 +225,7 @@ int octetStringFilter(
        unsigned char HASHdigest[HASH_BYTES];
        struct berval *value = (struct berval *) assertedValue;
        struct berval digest;
-       digest.bv_val = HASHdigest;
+       digest.bv_val = (char *)HASHdigest;
        digest.bv_len = sizeof(HASHdigest);
 
        slen = syntax->ssyn_oidlen;
@@ -235,14 +236,14 @@ int octetStringFilter(
        HASH_Init( &HASHcontext );
        if( prefix != NULL && prefix->bv_len > 0 ) {
                HASH_Update( &HASHcontext,
-                       prefix->bv_val, prefix->bv_len );
+                       (unsigned char *)prefix->bv_val, prefix->bv_len );
        }
        HASH_Update( &HASHcontext,
-               syntax->ssyn_oid, slen );
+               (unsigned char *)syntax->ssyn_oid, slen );
        HASH_Update( &HASHcontext,
-               mr->smr_oid, mlen );
+               (unsigned char *)mr->smr_oid, mlen );
        HASH_Update( &HASHcontext,
-               value->bv_val, value->bv_len );
+               (unsigned char *)value->bv_val, value->bv_len );
        HASH_Final( HASHdigest, &HASHcontext );
 
        ber_dupbv_x( keys, &digest, ctx );
@@ -397,7 +398,7 @@ octetStringSubstringsIndexer(
        HASH_CONTEXT HASHcontext;
        unsigned char HASHdigest[HASH_BYTES];
        struct berval digest;
-       digest.bv_val = HASHdigest;
+       digest.bv_val = (char *)HASHdigest;
        digest.bv_len = sizeof(HASHdigest);
 
        nkeys=0;
@@ -460,17 +461,17 @@ octetStringSubstringsIndexer(
                                HASH_Init( &HASHcontext );
                                if( prefix != NULL && prefix->bv_len > 0 ) {
                                        HASH_Update( &HASHcontext,
-                                               prefix->bv_val, prefix->bv_len );
+                                               (unsigned char *)prefix->bv_val, prefix->bv_len );
                                }
 
                                HASH_Update( &HASHcontext,
-                                       &pre, sizeof( pre ) );
+                                       (unsigned char *)&pre, sizeof( pre ) );
                                HASH_Update( &HASHcontext,
-                                       syntax->ssyn_oid, slen );
+                                       (unsigned char *)syntax->ssyn_oid, slen );
                                HASH_Update( &HASHcontext,
-                                       mr->smr_oid, mlen );
+                                       (unsigned char *)mr->smr_oid, mlen );
                                HASH_Update( &HASHcontext,
-                                       &values[i].bv_val[j],
+                                       (unsigned char *)&values[i].bv_val[j],
                                        SLAP_INDEX_SUBSTR_MAXLEN );
                                HASH_Final( HASHdigest, &HASHcontext );
 
@@ -489,16 +490,16 @@ octetStringSubstringsIndexer(
                                HASH_Init( &HASHcontext );
                                if( prefix != NULL && prefix->bv_len > 0 ) {
                                        HASH_Update( &HASHcontext,
-                                               prefix->bv_val, prefix->bv_len );
+                                               (unsigned char *)prefix->bv_val, prefix->bv_len );
                                }
                                HASH_Update( &HASHcontext,
-                                       &pre, sizeof( pre ) );
+                                       (unsigned char *)&pre, sizeof( pre ) );
                                HASH_Update( &HASHcontext,
-                                       syntax->ssyn_oid, slen );
+                                       (unsigned char *)syntax->ssyn_oid, slen );
                                HASH_Update( &HASHcontext,
-                                       mr->smr_oid, mlen );
+                                       (unsigned char *)mr->smr_oid, mlen );
                                HASH_Update( &HASHcontext,
-                                       values[i].bv_val, j );
+                                       (unsigned char *)values[i].bv_val, j );
                                HASH_Final( HASHdigest, &HASHcontext );
 
                                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
@@ -509,16 +510,16 @@ octetStringSubstringsIndexer(
                                HASH_Init( &HASHcontext );
                                if( prefix != NULL && prefix->bv_len > 0 ) {
                                        HASH_Update( &HASHcontext,
-                                               prefix->bv_val, prefix->bv_len );
+                                               (unsigned char *)prefix->bv_val, prefix->bv_len );
                                }
                                HASH_Update( &HASHcontext,
-                                       &pre, sizeof( pre ) );
+                                       (unsigned char *)&pre, sizeof( pre ) );
                                HASH_Update( &HASHcontext,
-                                       syntax->ssyn_oid, slen );
+                                       (unsigned char *)syntax->ssyn_oid, slen );
                                HASH_Update( &HASHcontext,
-                                       mr->smr_oid, mlen );
+                                       (unsigned char *)mr->smr_oid, mlen );
                                HASH_Update( &HASHcontext,
-                                       &values[i].bv_val[values[i].bv_len-j], j );
+                                       (unsigned char *)&values[i].bv_val[values[i].bv_len-j], j );
                                HASH_Final( HASHdigest, &HASHcontext );
 
                                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
@@ -590,7 +591,7 @@ octetStringSubstringsFilter (
                return LDAP_SUCCESS;
        }
 
-       digest.bv_val = HASHdigest;
+       digest.bv_val = (char *)HASHdigest;
        digest.bv_len = sizeof(HASHdigest);
 
        slen = syntax->ssyn_oidlen;
@@ -611,16 +612,16 @@ octetStringSubstringsFilter (
                HASH_Init( &HASHcontext );
                if( prefix != NULL && prefix->bv_len > 0 ) {
                        HASH_Update( &HASHcontext,
-                               prefix->bv_val, prefix->bv_len );
+                               (unsigned char *)prefix->bv_val, prefix->bv_len );
                }
                HASH_Update( &HASHcontext,
-                       &pre, sizeof( pre ) );
+                       (unsigned char *)&pre, sizeof( pre ) );
                HASH_Update( &HASHcontext,
-                       syntax->ssyn_oid, slen );
+                       (unsigned char *)syntax->ssyn_oid, slen );
                HASH_Update( &HASHcontext,
-                       mr->smr_oid, mlen );
+                       (unsigned char *)mr->smr_oid, mlen );
                HASH_Update( &HASHcontext,
-                       value->bv_val, klen );
+                       (unsigned char *)value->bv_val, klen );
                HASH_Final( HASHdigest, &HASHcontext );
 
                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
@@ -645,16 +646,16 @@ octetStringSubstringsFilter (
                                HASH_Init( &HASHcontext );
                                if( prefix != NULL && prefix->bv_len > 0 ) {
                                        HASH_Update( &HASHcontext,
-                                               prefix->bv_val, prefix->bv_len );
+                                               (unsigned char *)prefix->bv_val, prefix->bv_len );
                                }
                                HASH_Update( &HASHcontext,
-                                       &pre, sizeof( pre ) );
+                                       (unsigned char *)&pre, sizeof( pre ) );
                                HASH_Update( &HASHcontext,
-                                       syntax->ssyn_oid, slen );
+                                       (unsigned char *)syntax->ssyn_oid, slen );
                                HASH_Update( &HASHcontext,
-                                       mr->smr_oid, mlen );
+                                       (unsigned char *)mr->smr_oid, mlen );
                                HASH_Update( &HASHcontext,
-                                       &value->bv_val[j], klen ); 
+                                       (unsigned char *)&value->bv_val[j], klen ); 
                                HASH_Final( HASHdigest, &HASHcontext );
 
                                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
@@ -674,16 +675,16 @@ octetStringSubstringsFilter (
                HASH_Init( &HASHcontext );
                if( prefix != NULL && prefix->bv_len > 0 ) {
                        HASH_Update( &HASHcontext,
-                               prefix->bv_val, prefix->bv_len );
+                               (unsigned char *)prefix->bv_val, prefix->bv_len );
                }
                HASH_Update( &HASHcontext,
-                       &pre, sizeof( pre ) );
+                       (unsigned char *)&pre, sizeof( pre ) );
                HASH_Update( &HASHcontext,
-                       syntax->ssyn_oid, slen );
+                       (unsigned char *)syntax->ssyn_oid, slen );
                HASH_Update( &HASHcontext,
-                       mr->smr_oid, mlen );
+                       (unsigned char *)mr->smr_oid, mlen );
                HASH_Update( &HASHcontext,
-                       &value->bv_val[value->bv_len-klen], klen );
+                       (unsigned char *)&value->bv_val[value->bv_len-klen], klen );
                HASH_Final( HASHdigest, &HASHcontext );
 
                ber_dupbv_x( &keys[nkeys++], &digest, ctx );
@@ -1116,7 +1117,7 @@ UTF8StringValidate(
 {
        ber_len_t count;
        int len;
-       unsigned char *u = in->bv_val;
+       unsigned char *u = (unsigned char *)in->bv_val;
 
        if( in->bv_len == 0 && syntax == slap_schema.si_syn_directoryString ) {
                /* directory strings cannot be empty */
@@ -1158,7 +1159,7 @@ UTF8StringValidate(
 
                /* make sure len corresponds with the offset
                        to the next character */
-               if( LDAP_UTF8_OFFSET( u ) != len ) return LDAP_INVALID_SYNTAX;
+               if( LDAP_UTF8_OFFSET( (char *)u ) != len ) return LDAP_INVALID_SYNTAX;
        }
 
        if( count != 0 ) {
@@ -1819,7 +1820,7 @@ UUIDNormalize(
        struct berval *normalized,
        void *ctx )
 {
-       unsigned char octet;
+       unsigned char octet = '\0';
        int i;
        int j;
        normalized->bv_len = 16;
@@ -2222,7 +2223,7 @@ certificateExactNormalize(
 
        assert( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) );
 
-       p = val->bv_val;
+       p = (unsigned char *)val->bv_val;
        xcert = d2i_X509( NULL, &p, val->bv_len);
        if( xcert == NULL ) goto done;
 
@@ -2238,7 +2239,8 @@ certificateExactNormalize(
        if( rc != LDAP_SUCCESS ) goto done;
 
        normalized->bv_len = seriallen + issuer_dn.bv_len + 1;
-       p = normalized->bv_val = ch_malloc(normalized->bv_len+1);
+       normalized->bv_val = ch_malloc(normalized->bv_len+1);
+       p = (unsigned char *)normalized->bv_val;
        AC_MEMCPY(p, serial, seriallen);
        p += seriallen;
        *p++ = '$';
index d2b1242a548d8017825a4429093cc188fbf020bb..9cc3a45a651ceec076937c81b3f791e1004021dd 100644 (file)
@@ -45,7 +45,7 @@ slap_send_session_log(
 
        uuid_attr[0].an_desc = NULL;
        uuid_attr[0].an_oc = NULL;
-       uuid_attr[0].an_oc_exclude = NULL;
+       uuid_attr[0].an_oc_exclude = 0;
        uuid_attr[0].an_name.bv_len = 0;
        uuid_attr[0].an_name.bv_val = NULL;
        e.e_attrs = NULL;
@@ -94,6 +94,7 @@ slap_send_session_log(
                        rs->sr_ctrls = NULL;
                }
        }
+       return LDAP_SUCCESS;
 }
 
 int