X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fcontrols.c;h=b609b7bc5660cd0c180fe2df01663248bda74c69;hb=8482d2b4889b32f70c51144ac73423dd4e8ddc14;hp=13a0b13a09776b81515ee6b1191dc3e5b06279c1;hpb=a53823a613a42bfa741385e862aca1bb3de0f628;p=openldap diff --git a/libraries/libldap/controls.c b/libraries/libldap/controls.c index 13a0b13a09..b609b7bc56 100644 --- a/libraries/libldap/controls.c +++ b/libraries/libldap/controls.c @@ -62,13 +62,13 @@ int ldap_int_put_controls( } /* Controls are encoded as a sequence of sequences */ - if( ber_printf( ber, "t{", LDAP_TAG_CONTROLS ) == -1 ) { + if( ber_printf( ber, "t{"/*}*/, LDAP_TAG_CONTROLS ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; return ld->ld_errno; } for( c = ctrls ; *c != NULL; c++ ) { - if ( ber_printf( ber, "{s", + if ( ber_printf( ber, "{s" /*}*/, (*c)->ldctl_oid ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; @@ -77,7 +77,7 @@ int ldap_int_put_controls( if( (*c)->ldctl_iscritical /* only if true */ && ( ber_printf( ber, "b", - (*c)->ldctl_iscritical ) == -1 ) ) + (ber_int_t) (*c)->ldctl_iscritical ) == -1 ) ) { ld->ld_errno = LDAP_ENCODING_ERROR; return ld->ld_errno; @@ -92,14 +92,14 @@ int ldap_int_put_controls( } - if( ber_printf( ber, "}" ) == -1 ) { + if( ber_printf( ber, /*{*/"}" ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; return ld->ld_errno; } } - if( ber_printf( ber, "}" ) == -1 ) { + if( ber_printf( ber, /*{*/"}" ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; return ld->ld_errno; } @@ -107,12 +107,13 @@ int ldap_int_put_controls( return LDAP_SUCCESS; } -int ldap_int_get_controls LDAP_P(( +int ldap_int_get_controls( BerElement *ber, - LDAPControl ***ctrls )) + LDAPControl ***ctrls ) { int nctrls; - unsigned long tag, len; + ber_tag_t tag; + ber_len_t len; char *opaque; assert( ber != NULL ); @@ -179,14 +180,16 @@ int ldap_int_get_controls LDAP_P(( tctrls[nctrls++] = tctrl; tctrls[nctrls] = NULL; - tag = ber_scanf( ber, "{a", &tctrl->ldctl_oid ); + tag = ber_scanf( ber, "{a" /*}*/, &tctrl->ldctl_oid ); if( tag != LBER_ERROR ) { tag = ber_peek_tag( ber, &len ); } if( tag == LBER_BOOLEAN ) { - tag = ber_scanf( ber, "b", &tctrl->ldctl_iscritical ); + ber_int_t crit; + tag = ber_scanf( ber, "b", &crit ); + tctrl->ldctl_iscritical = crit ? (char) 0 : (char) ~0; } if( tag != LBER_ERROR ) { @@ -218,6 +221,8 @@ int ldap_int_get_controls LDAP_P(( void ldap_control_free( LDAPControl *c ) { + assert( c != NULL ); + if ( c != NULL ) { if( c->ldctl_oid != NULL) { LDAP_FREE( c->ldctl_oid ); @@ -237,6 +242,8 @@ ldap_control_free( LDAPControl *c ) void ldap_controls_free( LDAPControl **controls ) { + assert( controls != NULL ); + if ( controls != NULL ) { LDAPControl *c; @@ -251,7 +258,7 @@ ldap_controls_free( LDAPControl **controls ) /* * Duplicate an array of LDAPControl */ -LDAPControl **ldap_controls_dup( const LDAPControl **controls ) +LDAPControl **ldap_controls_dup( LDAPControl **controls ) { LDAPControl **new; int i; @@ -293,7 +300,7 @@ LDAPControl **ldap_controls_dup( const LDAPControl **controls ) /* * Duplicate a LDAPControl */ -LDAPControl *ldap_control_dup( const LDAPControl *c ) +LDAPControl *ldap_control_dup( LDAPControl *c ) { LDAPControl *new;