Commit f2a9089e authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

cleanup most of the -pedantic warnings (ITS#2884) and other small fixes

parent 271fff13
......@@ -36,6 +36,10 @@
#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 */
/*
......
......@@ -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 );
......
......@@ -435,6 +435,7 @@ slap_parse_sync_cookie(
} else {
cookie->rid = -1;
}
return 0;
}
int
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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++ = '$';
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment