mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-09 00:14:25 -05:00
Add LDAP URL critical extension counter support. lud_crit_exts
is the number of critical extensions contained in lud_exts. As we currently do not support any extension, this flag is useful for determining whether or not we should attempt to use the URL. Added check of this counter to ldap_url_search and LDAPv3 chase referrals.
This commit is contained in:
parent
4411e0aa17
commit
7b9886e909
3 changed files with 20 additions and 0 deletions
|
|
@ -520,6 +520,7 @@ typedef struct ldap_url_desc {
|
|||
int lud_scope;
|
||||
char *lud_filter;
|
||||
char **lud_exts;
|
||||
int lud_crit_exts;
|
||||
} LDAPURLDesc;
|
||||
|
||||
#define LDAP_URL_SUCCESS 0x00 /* Success */
|
||||
|
|
|
|||
|
|
@ -634,6 +634,13 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
|
|||
goto done;
|
||||
}
|
||||
|
||||
if( srv->lud_crit_exts ) {
|
||||
/* we do not support any extensions */
|
||||
ld->ld_errno = LDAP_NOT_SUPPORTED;
|
||||
rc = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* treat ldap://hostpart and ldap://hostpart/ the same */
|
||||
if ( srv->lud_dn && srv->lud_dn[0] == '\0' ) {
|
||||
LDAP_FREE( srv->lud_dn );
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
|
|||
ludp->lud_filter = NULL;
|
||||
ludp->lud_scope = LDAP_SCOPE_BASE;
|
||||
ludp->lud_filter = NULL;
|
||||
ludp->lud_exts = NULL;
|
||||
|
||||
ludp->lud_scheme = LDAP_STRDUP( scheme );
|
||||
|
||||
|
|
@ -516,6 +517,11 @@ ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
|
|||
|
||||
for( i=0; ludp->lud_exts[i] != NULL; i++ ) {
|
||||
ldap_pvt_hex_unescape( ludp->lud_exts[i] );
|
||||
|
||||
if( *ludp->lud_exts[i] == '!' ) {
|
||||
/* count the number of critical extensions */
|
||||
ludp->lud_crit_exts++;
|
||||
}
|
||||
}
|
||||
|
||||
if( i == 0 ) {
|
||||
|
|
@ -885,6 +891,12 @@ ldap_url_search( LDAP *ld, LDAP_CONST char *url, int attrsonly )
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
if( ludp->lud_crit_exts ) {
|
||||
/* we don't support any extension (yet) */
|
||||
ld->ld_errno = LDAP_NOT_SUPPORTED;
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
ber = ldap_build_search_req( ld, ludp->lud_dn, ludp->lud_scope,
|
||||
ludp->lud_filter, ludp->lud_attrs, attrsonly, NULL, NULL,
|
||||
-1, -1 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue