(unsigned char *)bv.bv_val,
bv.bv_len );
- if ( retcode == -1 || retcode > bv.bv_len ) {
+ if ( retcode == -1 || (unsigned) retcode > bv.bv_len ) {
fprintf( stderr, "Unable to parse value of general control %s\n",
control );
usage();
sctrlsp = sctrls;
}
- assert( nsctrls < sizeof(sctrls)/sizeof(sctrls[0]) );
+ assert( nsctrls < (int) (sizeof(sctrls)/sizeof(sctrls[0])) );
if ( authmethod == LDAP_AUTH_SASL ) {
#ifdef HAVE_CYRUS_SASL
ber_init2( ber, NULL, LBER_USE_DER );
- if ( ber_printf( ber, "s", proxydn ) == LBER_ERROR ) {
+ if ( ber_printf( ber, "s", proxydn ) == -1 ) {
exit( EXIT_FAILURE );
}
&sync_cookie );
}
- if ( err == LBER_ERROR ) {
+ if ( err == -1 ) {
ber_free( syncber, 1 );
fprintf( stderr, _("ldap sync control encoding error!\n") );
return EXIT_FAILURE;
}
- if ( ber_flatten( syncber, &syncbvalp ) == LBER_ERROR ) {
+ if ( ber_flatten( syncber, &syncbvalp ) == -1 ) {
return EXIT_FAILURE;
}
tool_write_ldif( LDIF_PUT_TEXT,
"text", line,
- next ? next - line : strlen( line ) );
+ next ? (size_t) (next - line) : strlen( line ));
line = next ? next + 1 : NULL;
}
ldap_int_bisect_delete( ber_int_t **vp, ber_len_t *np, int id, int idx )
{
ber_int_t *v;
- ber_len_t n;
- int i;
+ ber_len_t i, n;
assert( vp != NULL );
assert( np != NULL );
rc ? "!!! " : "",
rc );
#endif /* LDAP_SYNC_TRACE */
- if ( rc == LBER_ERROR ) {
+ if ( rc < 0 ) {
rc = LDAP_OTHER;
goto done;
}
/* See if we've already requested this DN with this conn */
LDAPRequest *lp;
int looped = 0;
- int len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
+ ber_len_t len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
for ( lp = origreq; lp; ) {
if ( lp->lr_conn == lc
&& len == lp->lr_dn.bv_len
if (( lc = find_connection( ld, srv, 1 )) != NULL ) {
LDAPRequest *lp;
int looped = 0;
- int len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
+ ber_len_t len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
for ( lp = lr; lp; lp = lp->lr_parent ) {
if ( lp->lr_conn == lc
&& len == lp->lr_dn.bv_len )
const struct berval *cred,
const char **text )
{
- int i;
+ ber_len_t i;
char UcasePassword[15];
des_cblock key;
des_key_schedule schedule;
const char **text )
{
- int i;
+ ber_len_t i;
char UcasePassword[15];
des_cblock key;
des_key_schedule schedule;
*len = ret;
}
- if ( ret >= bufsize ) {
+ if ( (unsigned) ret >= bufsize ) {
if ( next ) {
*next = &buf[ bufsize - 1 ];
}
OpenLDAPaciValidatePerms(
struct berval *perms )
{
- int i;
+ ber_len_t i;
for ( i = 0; i < perms->bv_len; ) {
switch ( perms->bv_val[ i ] ) {
assert (bufptr != NULL);
bufptr += sizeof (unsigned long int);
- for (count=0; count <= sizeof (unsigned long int); ++count) {
+ for (count=0; count <= (int) sizeof (unsigned long int); ++count) {
val <<= 8;
val += (unsigned long int) *bufptr--;
}
{
tmp->a_flags = a->a_flags & SLAP_ATTR_PERSISTENT_FLAGS;
if ( a->a_vals != NULL ) {
- int i;
+ unsigned i, j;
tmp->a_numvals = a->a_numvals;
tmp->a_vals = ch_malloc( (tmp->a_numvals + 1) * sizeof(struct berval) );
assert( a->a_nvals != NULL );
if ( a->a_nvals != a->a_vals ) {
- int j;
tmp->a_nvals = ch_malloc( (tmp->a_numvals + 1) * sizeof(struct berval) );
for ( j = 0; !BER_BVISNULL( &a->a_nvals[j] ); j++ ) {
AttributeDescription *entry = slap_schema.si_ad_entry;
DB_TXN *ltid = NULL, *lt2, *rtxn;
ID eid = NOID;
- struct bdb_op_info opinfo = {0};
+ struct bdb_op_info opinfo = {{{ 0 }}};
int subentry;
DB_LOCK lock;
/* Copy a pointer "src" to a pointer "dst" from big-endian to native order */
#define BDB_DISK2ID( src, dst ) \
- do { int i0; ID tmp = 0; unsigned char *_p; \
+ do { unsigned i0; ID tmp = 0; unsigned char *_p; \
_p = (unsigned char *)(src); \
for ( i0=0; i0<sizeof(ID); i0++ ) { \
tmp <<= 8; tmp |= *_p++; \
if ( islocked )
bdb_cache_entryinfo_unlock( elru );
- if ( count >= bdb->bi_cache.c_minfree ) {
+ if ( (unsigned) count >= bdb->bi_cache.c_minfree ) {
ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex );
bdb->bi_cache.c_cursize -= count;
ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_count_mutex );
AttributeDescription *children = slap_schema.si_ad_children;
AttributeDescription *entry = slap_schema.si_ad_entry;
DB_TXN *ltid = NULL, *lt2;
- struct bdb_op_info opinfo = {0};
+ struct bdb_op_info opinfo = {{{ 0 }}};
ID eid;
DB_LOCK lock, plock;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
DB_TXN *ltid = NULL, *lt2;
- struct bdb_op_info opinfo = {0};
+ struct bdb_op_info opinfo = {{{ 0 }}};
Entry dummy = {0};
int fakeroot = 0;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
DB_TXN *ltid = NULL, *lt2;
- struct bdb_op_info opinfo = {0};
+ struct bdb_op_info opinfo = {{{ 0 }}};
Entry dummy = {0};
Entry *np = NULL; /* newSuperior Entry */
{
int key;
- for ( key = 0; key < 8*sizeof(slap_mask_t) && !( bitmask & 0x1U ); key++ ) {
+ for ( key = 0; key < 8 * (int)sizeof(slap_mask_t) && !( bitmask & 0x1U );
+ key++ )
bitmask >>= 1;
- }
return key;
}
holes[nholes++].id = e->e_id;
}
} else if ( !hole ) {
- unsigned i;
+ unsigned i, j;
e->e_id = ei->bei_id;
for ( i=0; i<nholes; i++) {
if ( holes[i].id == e->e_id ) {
- int j;
free(holes[i].dn.bv_val);
for (j=i;j<nholes;j++) holes[j] = holes[j+1];
holes[j].id = 0;
Operation *op;
SlapReply *rs;
Entry **entries;
- int elen;
- int eind;
+ ID elen;
+ ID eind;
} enumCookie;
struct ldif_info {
LDAPControl **ctrls = NULL;
/* set to the maximum number of controls this backend can add */
- LDAPControl c[ 2 ] = { 0 };
+ LDAPControl c[ 2 ] = {{ 0 }};
int n = 0, i, j1 = 0, j2 = 0;
*pctrls = NULL;
goto done;
}
- assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) );
+ assert( j1 + j2 <= (int) (sizeof( c )/sizeof( c[0] )) );
if ( op->o_ctrls ) {
for ( n = 0; op->o_ctrls[ n ]; n++ )
return 1;
}
- if ( snprintf( binddn, sizeof( binddn ), "binddn=%s", argv[ 1 ] ) >= sizeof( binddn ) ) {
+ if ( sizeof( binddn ) <= (unsigned) snprintf( binddn,
+ sizeof( binddn ), "binddn=%s", argv[ 1 ] ))
+ {
Debug( LDAP_DEBUG_ANY, "%s: line %d: \"pseudorootdn\" too long.\n",
fname, lineno, 0 );
return 1;
int
get_len_of_next_assert_value ( struct berval* bv, char separator )
{
- int i = 0;
+ ber_len_t i = 0;
while (1) {
if ( (bv->bv_val[ i ] == separator) || ( i >= bv->bv_len) )
break;
p = ber_bvchr( dn_in, ',' );
- return p ? p - dn_in->bv_val : dn_in->bv_len;
+ return p ? (ber_len_t) (p - dn_in->bv_val) : dn_in->bv_len;
}
*/
int entry_encode(Entry *e, struct berval *bv)
{
- ber_len_t len, dnlen, ndnlen;
- int i, nattrs, nvals;
+ ber_len_t len, dnlen, ndnlen, i;
+ int nattrs, nvals;
Attribute *a;
unsigned char *ptr;
/* FIXME: Catch old code that doesn't set sm_numvals.
*/
if ( !BER_BVISNULL( &mod->sm_values[mod->sm_numvals] )) {
- int i;
+ unsigned i;
for ( i = 0; !BER_BVISNULL( &mod->sm_values[i] ); i++ );
assert( mod->sm_numvals == i );
}
if ( a != NULL ) {
MatchingRule *mr;
struct berval *cvals;
- int rc, i, p;
- unsigned flags;
+ int rc;
+ unsigned i, p, flags;
mr = mod->sm_desc->ad_type->sat_equality;
if( mr == NULL || !mr->smr_match ) {
/* value already exists */
*text = textbuf;
snprintf( textbuf, textlen,
- "modify/%s: %s: value #%d already exists",
+ "modify/%s: %s: value #%u already exists",
op, mod->sm_desc->ad_cname.bv_val, i );
return LDAP_TYPE_OR_VALUE_EXISTS;
}
MatchingRule *mr = mod->sm_desc->ad_type->sat_equality;
struct berval *cvals;
int *id2 = NULL;
- int i, j, rc = 0;
- unsigned flags;
+ int rc = 0;
+ unsigned i, j, flags;
char dummy = '\0';
/*
LDAP_SLIST_FOREACH( mr, &mr_list, smr_next ) {
AttributeType *at;
- MatchingRuleUse mru_storage = { 0 },
+ MatchingRuleUse mru_storage = {{ 0 }},
*mru = &mru_storage;
char **applies_oids = NULL;
if ( dd ) {
len = snprintf( ptr, size, "%d+", dd );
- assert( len >= 0 && len < size );
+ assert( len >= 0 && (unsigned) len < size );
size -= len;
ptr += len;
}
len = snprintf( ptr, size, "%02d:%02d", hh, mm );
- assert( len >= 0 && len < size );
+ assert( len >= 0 && (unsigned) len < size );
size -= len;
ptr += len;
if ( ss ) {
len = snprintf( ptr, size, ":%02d", ss );
- assert( len >= 0 && len < size );
+ assert( len >= 0 && (unsigned) len < size );
size -= len;
ptr += len;
}
a = attr_find( rs->sr_entry->e_attrs,
slap_schema.si_ad_entryCSN );
if ( a ) {
- int len = a->a_vals[0].bv_len;
+ ber_len_t len = a->a_vals[0].bv_len;
if ( len > pd->csn.bv_len )
len = pd->csn.bv_len;
if ( memcmp( a->a_vals[0].bv_val, pd->csn.bv_val, len ) > 0 ) {
struct berval *valp )
{
struct berval val, bv;
- int i;
+ ber_len_t i;
int rc = LDAP_SUCCESS;
assert( valp != NULL );
}
if ( !BER_BVISNULL( &ctrls[ i ]->ldctl_value ) ) {
- int j;
+ ber_len_t j;
ptr = lutil_strcopy( ptr, " controlValue \"" );
for ( j = 0; j < ctrls[ i ]->ldctl_value.bv_len; j++ )
ptr = lutil_strcopy( ptr, dli->dli_oc->soc_cname.bv_val );
ptr = lutil_strcopy( ptr, "))" );
- assert( dli->dli_default_filter.bv_len == ptr - dli->dli_default_filter.bv_val );
+ assert( ptr == &dli->dli_default_filter.bv_val[dli->dli_default_filter.bv_len] );
return 0;
}
Filter f = { 0 };
char filtbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(entryUUID=)" ) ];
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
- AttributeName attrs[ 2 ] = { 0 };
+ AttributeName attrs[ 2 ] = {{{ 0 }}};
int s, rc;
if ( op == NULL ) {
Filter f = { 0 };
char filter_str[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(queryId=)" ) ];
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
- AttributeName attrs[ 2 ] = { 0 };
+ AttributeName attrs[ 2 ] = {{{ 0 }}};
int rc;
BerVarray vals = NULL;
BerVarray vals = NULL;
Filter f = { 0 }, f2 = { 0 };
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
- AttributeName attrs[ 2 ] = { 0 };
+ AttributeName attrs[ 2 ] = {{{ 0 }}};
connection_fake_init( &conn, &opbuf, thrctx );
op = &opbuf.ob_op;
slap_callback cb = { 0 };
SlapReply rs = { REP_RESULT };
- Modifications mod = { 0 };
+ Modifications mod = {{ 0 }};
thrctx = ldap_pvt_thread_pool_context();
}
ber_printf( ber, /*{*/ "N}" );
- if (ber_flatten2( ber, &(c.ldctl_value), 1 ) == LBER_DEFAULT) {
+ if (ber_flatten2( ber, &(c.ldctl_value), 1 ) == -1) {
return NULL;
}
(void)ber_free_buf(ber);
{
char *ptr;
struct berval nv, npw;
- int i, j;
+ ber_len_t i, j;
assert (bv && (bv->bv_len > 0) && (bv->bv_val) && oldtime && oldpw );
rc = ber_flatten2( ber, &c.ldctl_value, 0 );
- if( rc == LBER_ERROR ) return LDAP_OTHER;
+ if( rc == -1 ) return LDAP_OTHER;
c.ldctl_oid = oid->bv_val;
c.ldctl_iscritical = 0;
}
Debug( level, "SASL [conn=%ld] %s: %s\n",
- conn ? conn->c_connid: -1,
+ conn ? (long) conn->c_connid: -1L,
label, message );
*out_len = 0;
Debug( LDAP_DEBUG_ARGS, "SASL Canonicalize [conn=%ld]: %s=\"%s\"\n",
- conn ? conn->c_connid : -1,
+ conn ? (long) conn->c_connid : -1L,
(flags & SASL_CU_AUTHID) ? "authcid" : "authzid",
in ? in : "<empty>");
prop_set( props, names[0], dn.bv_val, dn.bv_len );
Debug( LDAP_DEBUG_ARGS, "SASL Canonicalize [conn=%ld]: %s=\"%s\"\n",
- conn ? conn->c_connid : -1, names[0]+1,
+ conn ? (long) conn->c_connid : -1L, names[0]+1,
dn.bv_val ? dn.bv_val : "<EMPTY>" );
/* Not needed any more, SASL has copied it */
Debug( LDAP_DEBUG_ARGS, "SASL proxy authorize [conn=%ld]: "
"authcid=\"%s\" authzid=\"%s\"\n",
- conn ? conn->c_connid : -1, auth_identity, requested_user );
+ conn ? (long) conn->c_connid : -1L, auth_identity, requested_user );
if ( conn->c_sasl_dn.bv_val ) {
BER_BVZERO( &conn->c_sasl_dn );
}
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "SASL Proxy Authorize [conn=%ld]: "
"proxy authorization disallowed (%d)\n",
- (long) (conn ? conn->c_connid : -1), rc, 0 );
+ conn ? (long) conn->c_connid : -1L, rc, 0 );
sasl_seterror( sconn, 0, "not authorized" );
return SASL_NOAUTHZ;
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" proxy authorization allowed authzDN=\"%s\"\n",
- (long) (conn ? conn->c_connid : -1),
+ conn ? (long) conn->c_connid : -1L,
authzDN.bv_val ? authzDN.bv_val : "", 0 );
return SASL_OK;
}
/* leave room for at least one char of attributeType,
* one for '=' and one for ',' */
- if ( d < STRLENOF( "x=,") ) {
+ if ( d < (int) STRLENOF( "x=,") ) {
goto CONCLUDED;
}
void *ctx )
{
struct berval tmp, nvalue;
- int flags;
- int i, wasspace;
+ int flags, wasspace;
+ ber_len_t i;
assert( SLAP_MR_IS_VALUE_OF_SYNTAX( use ) != 0 );
int match = 0;
SubstringsAssertion *sub = assertedValue;
struct berval left = *value;
- int i;
+ ber_len_t i;
int priorspace=0;
if ( !BER_BVISNULL( &sub->sa_initial ) ) {
struct berval *in )
{
struct berval bv = *in;
- int c;
+ ber_len_t c;
for ( c = 0; c < in->bv_len; c++ ) {
if ( in->bv_val[c] == '\\' ) {
void *ctx )
{
BerVarray lines = NULL, nlines = NULL;
- int l, c;
+ ber_len_t l, c;
int rc = LDAP_SUCCESS;
MatchingRule *xmr = NULL;
char *p;
}
*--p = '\0';
- assert( p - normalized->bv_val == normalized->bv_len );
+ assert( p == &normalized->bv_val[normalized->bv_len] );
done:;
if ( nlines != NULL ) {
checkNum( struct berval *in, struct berval *out )
{
/* parse serialNumber */
- int neg = 0;
+ ber_len_t neg = 0, extra = 0;
char first = '\0';
- int extra = 0;
out->bv_val = in->bv_val;
out->bv_len = 0;
struct berval *is,
void *ctx )
{
- int n;
+ ber_len_t n;
if( in->bv_len < 3 ) return LDAP_INVALID_SYNTAX;
ber_dupbv_x( &ni, is, ctx );
} else {
- ber_int_t src, dst;
+ ber_len_t src, dst;
ni.bv_len = is->bv_len - numdquotes;
ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx );
p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
p = lutil_strcopy( p, /*{*/ "\" }" );
- assert( p - out->bv_val == out->bv_len );
+ assert( p == &out->bv_val[out->bv_len] );
done:;
Debug( LDAP_DEBUG_TRACE, "<<< serialNumberAndIssuerPretty: <%s> => <%s>\n",
unsigned char *ptr, zero = '\0';
char *sptr;
int first;
- int i;
- ber_len_t len, nlen;
+ ber_len_t i, len, nlen;
assert( in != NULL );
assert( !BER_BVISNULL( in ) );
*sptr++ = 'H';
*sptr = '\0';
- assert( sptr - out->bv_val == nlen );
+ assert( sptr == &out->bv_val[nlen] );
out->bv_len = nlen;
p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
p = lutil_strcopy( p, /*{*/ "\" }" );
- assert( p - out->bv_val == out->bv_len );
+ assert( p == &out->bv_val[out->bv_len] );
func_leave:
Debug( LDAP_DEBUG_TRACE, "<<< serialNumberAndIssuerNormalize: <%s> => <%s>\n",
static int
checkTime( struct berval *in, struct berval *out )
{
- int i;
+ int rc;
+ ber_len_t i;
char buf[STRLENOF("YYYYmmddHHMMSSZ") + 1];
struct berval bv;
return -1;
}
- i = generalizedTimeValidate( NULL, &bv );
- if ( i == LDAP_SUCCESS && out != NULL ) {
+ rc = generalizedTimeValidate( NULL, &bv );
+ if ( rc == LDAP_SUCCESS && out != NULL ) {
out->bv_len = bv.bv_len;
}
- return i != LDAP_SUCCESS;
+ return rc != LDAP_SUCCESS;
}
static int
ber_dupbv_x( &ni, is, ctx );
} else {
- ber_int_t src, dst;
+ ber_len_t src, dst;
ni.bv_len = is->bv_len - numdquotes;
ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx );
p = lutil_strncopy( p, tu.bv_val, tu.bv_len );
p = lutil_strcopy( p, /*{*/ "\" }" );
- assert( p - out->bv_val == out->bv_len );
+ assert( p == &out->bv_val[out->bv_len] );
done:;
Debug( LDAP_DEBUG_TRACE, "<<< issuerAndThisUpdatePretty: <%s> => <%s>\n",
p = lutil_strncopy( p, tu2.bv_val, tu2.bv_len );
p = lutil_strcopy( p, /*{*/ "\" }" );
- assert( p - out->bv_val == out->bv_len );
+ assert( p == & out->bv_val[out->bv_len] );
func_leave:
Debug( LDAP_DEBUG_TRACE, "<<< issuerAndThisUpdateNormalize: <%s> => <%s>\n",
Syntax *syntax,
struct berval *in )
{
- int i;
+ ber_len_t i;
assert( in != NULL );
assert( !BER_BVISNULL( in ) );
struct berval *normalized,
void *ctx )
{
- int i;
+ ber_len_t i;
assert( val != NULL );
assert( normalized != NULL );
assert( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) != 0 );
ptr = ber_bvchr( val, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
bv.bv_len = val->bv_len - ( ptr + 1 - val->bv_val );
ptr = ber_bvchr( &bv, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
bv.bv_len = val->bv_len - ( ptr + 1 - val->bv_val );
ptr = ber_bvchr( &bv, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
bv = *in;
ptr = ber_bvchr( &bv, '#' );
- if ( ptr == NULL || ptr - bv.bv_val == bv.bv_len ) {
+ if ( ptr == NULL || ptr == &bv.bv_val[bv.bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
bv.bv_len = in->bv_len - ( bv.bv_val - in->bv_val );
ptr = ber_bvchr( &bv, '#' );
- if ( ptr == NULL || ptr - in->bv_val == in->bv_len ) {
+ if ( ptr == NULL || ptr == &in->bv_val[in->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
bv.bv_len = in->bv_len - ( bv.bv_val - in->bv_val );
ptr = ber_bvchr( &bv, '#' );
- if ( ptr == NULL || ptr - in->bv_val == in->bv_len ) {
+ if ( ptr == NULL || ptr == &in->bv_val[in->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
struct berval bv;
char buf[ STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" ) + 1 ];
char *ptr;
- int i;
+ ber_len_t i;
assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 );
assert( !BER_BVISEMPTY( val ) );
gt = *val;
ptr = ber_bvchr( >, '#' );
- if ( ptr == NULL || ptr - gt.bv_val == gt.bv_len ) {
+ if ( ptr == NULL || ptr == >.bv_val[gt.bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val );
ptr = ber_bvchr( &cnt, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val );
ptr = ber_bvchr( &sid, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
}
*ptr = '\0';
- assert( ptr - bv.bv_val == bv.bv_len );
+ assert( ptr == &bv.bv_val[bv.bv_len] );
if ( csnValidate( syntax, &bv ) != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
struct berval bv;
char buf[ STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" ) + 1 ];
char *ptr;
- int i;
+ ber_len_t i;
assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 );
assert( !BER_BVISEMPTY( val ) );
gt = *val;
ptr = ber_bvchr( >, '#' );
- if ( ptr == NULL || ptr - gt.bv_val == gt.bv_len ) {
+ if ( ptr == NULL || ptr == >.bv_val[gt.bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val );
ptr = ber_bvchr( &cnt, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val );
ptr = ber_bvchr( &sid, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
}
*ptr = '\0';
- assert( ptr - bv.bv_val == bv.bv_len );
+ assert( ptr == &bv.bv_val[bv.bv_len] );
if ( csnValidate( syntax, &bv ) != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
}
{
struct berval cnt, sid, mod;
char *ptr;
- int i;
+ ber_len_t i;
assert( val != NULL );
assert( normalized != NULL );
}
ptr = ber_bvchr( val, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val );
ptr = ber_bvchr( &cnt, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val );
ptr = ber_bvchr( &sid, '#' );
- if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) {
+ if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) {
return LDAP_INVALID_SYNTAX;
}
if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
char abuf[BUFSIZ/2], *ptr = abuf;
- int len = 0, alen;
+ unsigned len = 0, alen;
sprintf(abuf, "scope=%d deref=%d", op->ors_scope, op->ors_deref);
Statslog( LDAP_DEBUG_STATS,
pblock_set_default( Slapi_PBlock *pb, int param, void *value )
{
slapi_pblock_class_t pbClass;
- size_t i;
+ int i;
pbClass = pblock_get_param_class( param );
if ( pbClass == PBLOCK_CLASS_INVALID ) {
static int checkBVString(const struct berval *bv)
{
- int i;
+ ber_len_t i;
for ( i = 0; i < bv->bv_len; i++ ) {
if ( bv->bv_val[i] == '\0' )
rc = snprintf( url, size, "ldap%s://%s/", ( secure ? "s" : "" ), ldaphost );
}
- if ( rc > 0 && rc < size ) {
+ if ( rc > 0 && (size_t) rc < size ) {
rc = ldap_initialize( &ld, url );
} else {
ld = NULL;
abs(si->si_type), rhint );
}
- if ( (rc = ber_flatten2( ber, &c[0].ldctl_value, 0 ) ) == LBER_ERROR ) {
+ if ( (rc = ber_flatten2( ber, &c[0].ldctl_value, 0 ) ) == -1 ) {
ber_free_buf( ber );
return rc;
}
Modifications mod;
struct berval first = BER_BVNULL;
- int rc, i, j, len;
+ int rc, i, j;
+ ber_len_t len;
slap_callback cb = { NULL };
SlapReply rs_modify = {REP_RESULT};
new = attr_find( dni->new_entry->e_attrs,
slap_schema.si_ad_entryCSN );
if ( new && old ) {
- int rc, len = old->a_vals[0].bv_len;
+ int rc;
+ ber_len_t len = old->a_vals[0].bv_len;
if ( len > new->a_vals[0].bv_len )
len = new->a_vals[0].bv_len;
rc = memcmp( old->a_vals[0].bv_val,
{
char *ptr, ibuf[64]; /* many digits */
struct berval ibv, tmp, vtmp;
- int i;
+ unsigned i;
ibv.bv_val = ibuf;
for (i=0; i<a->a_numvals; i++) {
- ibv.bv_len = sprintf(ibv.bv_val, "{%d}", i);
+ ibv.bv_len = sprintf(ibv.bv_val, "{%u}", i);
vtmp = a->a_vals[i];
if ( vtmp.bv_val[0] == '{' ) {
ptr = ber_bvchr(&vtmp, '}');
k = strtol( vals[i].bv_val + 1, &next, 0 );
if ( next == vals[i].bv_val + 1 ||
next[ 0 ] != '}' ||
- next - vals[i].bv_val > vals[i].bv_len )
+ (ber_len_t) (next - vals[i].bv_val) > vals[i].bv_len )
{
ch_free( nnew );
ch_free( new );