mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
Fix get_scheme to check length of scheme name
This commit is contained in:
parent
532da5699c
commit
4b07f91511
1 changed files with 11 additions and 1 deletions
|
|
@ -197,11 +197,21 @@ static const struct pw_scheme *get_scheme(
|
|||
const char* scheme )
|
||||
{
|
||||
struct pw_slist *pws;
|
||||
struct berval bv;
|
||||
|
||||
if (!pw_inited) lutil_passwd_init();
|
||||
|
||||
bv.bv_val = strchr( scheme, '}' );
|
||||
if ( !bv.bv_val )
|
||||
return NULL;
|
||||
|
||||
bv.bv_len = bv.bv_val - scheme + 1;
|
||||
bv.bv_val = scheme;
|
||||
|
||||
for( pws=pw_schemes; pws; pws=pws->next ) {
|
||||
if( strcasecmp(scheme, pws->s.name.bv_val ) == 0 ) {
|
||||
if( bv.bv_len != pws->s.name.bv_len )
|
||||
continue;
|
||||
if( strncasecmp(bv.bv_val, pws->s.name.bv_val, bv.bv_len ) == 0 ) {
|
||||
return &(pws->s);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue