diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-18 09:44:20 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-18 10:01:10 -0400 |
commit | 8d5bacbccbcc099c314c359ec3bd87f9421a5244 (patch) | |
tree | 8196e7c0e66b7939310ca36a9043a0f63237ea81 | |
parent | 65aeabcbc4a88c4db8f9766b8e3a576bea274d97 (diff) | |
download | sssd-8d5bacbccbcc099c314c359ec3bd87f9421a5244.tar.gz sssd-8d5bacbccbcc099c314c359ec3bd87f9421a5244.tar.xz sssd-8d5bacbccbcc099c314c359ec3bd87f9421a5244.zip |
Protect against segfault in remove_ldap_connection_callbacks
If sdap_mark_offline() is called before a live connection is
established, sdap_fd_events could be NULL, causing a segfault when
remove_ldap_connection_callbacks() attempts to free the
sdap_fd_events->conncb
https://fedorahosted.org/sssd/ticket/545
-rw-r--r-- | src/providers/ldap/sdap_fd_events.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/providers/ldap/sdap_fd_events.c b/src/providers/ldap/sdap_fd_events.c index 45c5bedc4..347cf8b81 100644 --- a/src/providers/ldap/sdap_fd_events.c +++ b/src/providers/ldap/sdap_fd_events.c @@ -50,7 +50,12 @@ int get_fd_from_ldap(LDAP *ldap, int *fd) int remove_ldap_connection_callbacks(struct sdap_handle *sh) { #ifdef HAVE_LDAP_CONNCB - talloc_zfree(sh->sdap_fd_events->conncb); + /* sdap_fd_events might be NULL here if sdap_mark_offline() + * was called before a connection was established. + */ + if (sh->sdap_fd_events) { + talloc_zfree(sh->sdap_fd_events->conncb); + } #endif return EOK; } |