From: Kurt Zeilenga Date: Thu, 26 Oct 2000 06:17:14 +0000 (+0000) Subject: Add LDAP URL critical extension counter support. lud_crit_exts X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1676 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7b9886e9099809c1644876ea1bad01d1bb760447;p=openldap 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. --- diff --git a/include/ldap.h b/include/ldap.h index 4aa439fc75..4b77324e55 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -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 */ diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 1def978bf5..d174308191 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -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 ); diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 8da394051d..cac3d31ed4 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -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 );