diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-09-26 11:00:16 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-09-26 22:34:40 +0200 |
commit | 3f5953b0cd6ad826141c62dd239efc675b351689 (patch) | |
tree | 1fb6d9523edcd8d57730a4d609bac12bfcf798ad /src/providers | |
parent | 682702ae60d32f04065d7415e1c948b1a8b15151 (diff) | |
download | sssd-3f5953b0cd6ad826141c62dd239efc675b351689.tar.gz sssd-3f5953b0cd6ad826141c62dd239efc675b351689.tar.bz2 sssd-3f5953b0cd6ad826141c62dd239efc675b351689.zip |
LDAP: Handle empty namingContexts values safely
Certain LDAP servers can return an empty string as the value of
namingContexts. We need to treat these as NULL so that we can fail
gracefully.
https://fedorahosted.org/sssd/ticket/1542
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ldap/sdap.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index 5c4a0055..cdc8b1f1 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -742,6 +742,14 @@ static char *get_naming_context(TALLOC_CTX *mem_ctx, } } + /* Some directory servers such as Novell eDirectory will return + * a zero-length namingContexts value in some situations. In this + * case, we should return it as NULL so things fail gracefully. + */ + if (naming_context[0] == '\0') { + talloc_zfree(naming_context); + } + return naming_context; } |