Commit d50eb2e9 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

C translator portability changes (ITS#1609)

parent 6d9307b5
...@@ -601,11 +601,12 @@ ldap_dnfree( LDAPDN *dn ) ...@@ -601,11 +601,12 @@ ldap_dnfree( LDAPDN *dn )
int int
ldap_str2dn( LDAP_CONST char *str, LDAPDN **dn, unsigned flags ) ldap_str2dn( LDAP_CONST char *str, LDAPDN **dn, unsigned flags )
{ {
struct berval bv = { 0, (char *)str }; struct berval bv;
assert( str ); assert( str );
bv.bv_len = strlen( str ); bv.bv_len = strlen( str );
bv.bv_val = (char *) str;
return ldap_bv2dn( &bv, dn, flags ); return ldap_bv2dn( &bv, dn, flags );
} }
...@@ -687,7 +688,9 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags ) ...@@ -687,7 +688,9 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags )
for ( ; p < end; p++ ) { for ( ; p < end; p++ ) {
int err; int err;
struct berval tmpbv = { bv->bv_len - ( p - str ), (char *)p }; struct berval tmpbv;
tmpbv.bv_len = bv->bv_len - ( p - str );
tmpbv.bv_val = (char *)p;
err = ldap_bv2rdn( &tmpbv, &newRDN, (char **) &p, flags ); err = ldap_bv2rdn( &tmpbv, &newRDN, (char **) &p, flags );
if ( err != LDAP_SUCCESS ) { if ( err != LDAP_SUCCESS ) {
...@@ -815,12 +818,13 @@ int ...@@ -815,12 +818,13 @@ int
ldap_str2rdn( LDAP_CONST char *str, LDAPRDN **rdn, ldap_str2rdn( LDAP_CONST char *str, LDAPRDN **rdn,
char **n_in, unsigned flags ) char **n_in, unsigned flags )
{ {
struct berval bv = { 0, (char *)str }; struct berval bv;
assert( str ); assert( str );
assert( str[ 0 ] != '\0' ); /* FIXME: is this required? */ assert( str[ 0 ] != '\0' ); /* FIXME: is this required? */
bv.bv_len = strlen( str ); bv.bv_len = strlen( str );
bv.bv_val = (char *) str;
return ldap_bv2rdn( &bv, rdn, n_in, flags ); return ldap_bv2rdn( &bv, rdn, n_in, flags );
} }
......
...@@ -845,10 +845,13 @@ acl_mask( ...@@ -845,10 +845,13 @@ acl_mask(
if ( b->a_group_pat.bv_len && op->o_ndn.bv_len ) { if ( b->a_group_pat.bv_len && op->o_ndn.bv_len ) {
char buf[1024]; char buf[1024];
struct berval bv = { sizeof(buf) - 1, buf }; struct berval bv;
struct berval ndn = { 0, NULL }; struct berval ndn = { 0, NULL };
int rc; int rc;
bv.bv_len = sizeof(buf) - 1;
bv.bv_val = buf;
/* b->a_group is an unexpanded entry name, expanded it should be an /* b->a_group is an unexpanded entry name, expanded it should be an
* entry with objectclass group* and we test to see if odn is one of * entry with objectclass group* and we test to see if odn is one of
* the values in the attribute group * the values in the attribute group
...@@ -1823,9 +1826,12 @@ regex_matches( ...@@ -1823,9 +1826,12 @@ regex_matches(
{ {
regex_t re; regex_t re;
char newbuf[512]; char newbuf[512];
struct berval bv = {sizeof(newbuf), newbuf}; struct berval bv;
int rc; int rc;
bv.bv_len = sizeof(newbuf);
bv.bv_val = newbuf;
if(str == NULL) str = ""; if(str == NULL) str = "";
string_expand(&bv, pat, buf, matches); string_expand(&bv, pat, buf, matches);
......
...@@ -296,8 +296,12 @@ glue_back_search ( ...@@ -296,8 +296,12 @@ glue_back_search (
long stoptime = 0; long stoptime = 0;
struct berval bv; struct berval bv;
glue_state gs = {0}; glue_state gs = {0};
slap_callback cb = {glue_back_response, glue_back_sresult, slap_callback cb;
glue_back_sendentry, &gs};
cb.sc_response = glue_back_response;
cb.sc_sresult = glue_back_sresult;
cb.sc_sendentry = glue_back_sendentry;
cb.sc_private = &gs;
gs.prevcb = op->o_callback; gs.prevcb = op->o_callback;
......
...@@ -590,7 +590,9 @@ int entry_decode(struct berval *bv, Entry **e) ...@@ -590,7 +590,9 @@ int entry_decode(struct berval *bv, Entry **e)
a = NULL; a = NULL;
while (i = entry_getlen(&ptr)) { while (i = entry_getlen(&ptr)) {
struct berval bv = { i, ptr }; struct berval bv;
bv.bv_len = i;
bv.bv_val = ptr;
if (a) { if (a) {
a->a_next = (Attribute *)bptr; a->a_next = (Attribute *)bptr;
} }
......
...@@ -119,9 +119,12 @@ set_chase (SLAP_SET_GATHER gatherer, ...@@ -119,9 +119,12 @@ set_chase (SLAP_SET_GATHER gatherer,
{ {
BerVarray vals, nset; BerVarray vals, nset;
char attrstr[32]; char attrstr[32];
struct berval bv = {attr->bv_len, attrstr}; struct berval bv;
int i; int i;
bv.bv_len = attr->bv_len;
bv.bv_val = attrstr;
if (set == NULL) if (set == NULL)
return(ch_calloc(1, sizeof(struct berval))); return(ch_calloc(1, sizeof(struct berval)));
......
...@@ -53,7 +53,10 @@ main( int argc, char **argv ) ...@@ -53,7 +53,10 @@ main( int argc, char **argv )
while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) { while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) {
Entry *e = str2entry( buf ); Entry *e = str2entry( buf );
struct berval bvtext = { textlen, textbuf }; struct berval bvtext;
bvtext.bv_len = textlen;
bvtext.bv_val = textbuf;
if( e == NULL ) { if( e == NULL ) {
fprintf( stderr, "%s: could not parse entry (line=%d)\n", fprintf( stderr, "%s: could not parse entry (line=%d)\n",
......
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