mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
fix multiple generic control parsing
This commit is contained in:
parent
fdb6873b60
commit
5524873079
@ -139,7 +139,7 @@ usage( void )
|
|||||||
#ifdef LDAP_CONTROL_X_DEREF
|
#ifdef LDAP_CONTROL_X_DEREF
|
||||||
fprintf( stderr, _(" [!]deref=derefAttr:attr[,...][;derefAttr:attr[,...][;...]]\n"));
|
fprintf( stderr, _(" [!]deref=derefAttr:attr[,...][;derefAttr:attr[,...][;...]]\n"));
|
||||||
#endif
|
#endif
|
||||||
fprintf( stderr, _(" [!]<oid>=:<value> (generic control; no response handling)\n"));
|
fprintf( stderr, _(" [!]<oid>[=:<b64value>] (generic control; no response handling)\n"));
|
||||||
fprintf( stderr, _(" -f file read operations from `file'\n"));
|
fprintf( stderr, _(" -f file read operations from `file'\n"));
|
||||||
fprintf( stderr, _(" -F prefix URL prefix for files (default: %s)\n"), def_urlpre);
|
fprintf( stderr, _(" -F prefix URL prefix for files (default: %s)\n"), def_urlpre);
|
||||||
fprintf( stderr, _(" -l limit time limit (in seconds, or \"none\" or \"max\") for search\n"));
|
fprintf( stderr, _(" -l limit time limit (in seconds, or \"none\" or \"max\") for search\n"));
|
||||||
@ -625,7 +625,7 @@ handle_private_option( int i )
|
|||||||
} else if ( tool_is_oid( control ) ) {
|
} else if ( tool_is_oid( control ) ) {
|
||||||
if ( c != NULL ) {
|
if ( c != NULL ) {
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; c[ i ].ldctl_oid != NULL; i++ ) {
|
for ( i = 0; i < nctrls; i++ ) {
|
||||||
if ( strcmp( control, c[ i ].ldctl_oid ) == 0 ) {
|
if ( strcmp( control, c[ i ].ldctl_oid ) == 0 ) {
|
||||||
fprintf( stderr, "%s control previously specified\n", control );
|
fprintf( stderr, "%s control previously specified\n", control );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
@ -646,18 +646,20 @@ handle_private_option( int i )
|
|||||||
c[ nctrls - 1 ].ldctl_value.bv_len = 0;
|
c[ nctrls - 1 ].ldctl_value.bv_len = 0;
|
||||||
|
|
||||||
} else if ( cvalue[ 0 ] == ':' ) {
|
} else if ( cvalue[ 0 ] == ':' ) {
|
||||||
struct berval type;
|
struct berval type;
|
||||||
struct berval value;
|
struct berval value;
|
||||||
int freeval;
|
int freeval;
|
||||||
|
char save_c;
|
||||||
|
|
||||||
cvalue++;
|
cvalue++;
|
||||||
|
|
||||||
/* dummy type "x"
|
/* dummy type "x"
|
||||||
* to use ldif_parse_line2() */
|
* to use ldif_parse_line2() */
|
||||||
|
save_c = cvalue[ -2 ];
|
||||||
cvalue[ -2 ] = 'x';
|
cvalue[ -2 ] = 'x';
|
||||||
ldif_parse_line2( &cvalue[ -2 ], &type,
|
ldif_parse_line2( &cvalue[ -2 ], &type,
|
||||||
&value, &freeval );
|
&value, &freeval );
|
||||||
cvalue[ -2 ] = '\0';
|
cvalue[ -2 ] = save_c;
|
||||||
|
|
||||||
if ( freeval ) {
|
if ( freeval ) {
|
||||||
c[ nctrls - 1 ].ldctl_value = value;
|
c[ nctrls - 1 ].ldctl_value = value;
|
||||||
@ -665,6 +667,11 @@ handle_private_option( int i )
|
|||||||
} else {
|
} else {
|
||||||
ber_dupbv( &c[ nctrls - 1 ].ldctl_value, &value );
|
ber_dupbv( &c[ nctrls - 1 ].ldctl_value, &value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf( stderr, "unable to parse %s control value\n", control );
|
||||||
|
exit( EXIT_FAILURE );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* criticality */
|
/* criticality */
|
||||||
|
Loading…
Reference in New Issue
Block a user