Blame SOURCES/sudo-1.8.19p2-sssd-double-free.patch
|
|
ce887b |
|
|
|
ce887b |
# HG changeset patch
|
|
|
ce887b |
# User Todd C. Miller <Todd.Miller@sudo.ws>
|
|
|
ce887b |
# Date 1511893724 25200
|
|
|
ce887b |
# Node ID 14dacdea331942a38d443a75d1b08f67eafaa5eb
|
|
|
ce887b |
# Parent b456101fe5091540e9f6429db7568fa32b6d4da8
|
|
|
ce887b |
Avoid a double free when ipa_hostname is set in sssd.conf and it
|
|
|
ce887b |
is an unqualified host name. From Daniel Kopecek.
|
|
|
ce887b |
|
|
|
ce887b |
Also move the "unable to allocate memory" warning into get_ipa_hostname()
|
|
|
ce887b |
itself to make it easier to see where the allocation failed in the
|
|
|
ce887b |
debug log.
|
|
|
ce887b |
|
|
|
ce887b |
diff -r b456101fe509 -r 14dacdea3319 plugins/sudoers/sssd.c
|
|
|
ce887b |
--- a/plugins/sudoers/sssd.c Tue Nov 28 09:48:43 2017 -0700
|
|
|
ce887b |
+++ b/plugins/sudoers/sssd.c Tue Nov 28 11:28:44 2017 -0700
|
|
|
ce887b |
@@ -349,6 +349,8 @@
|
|
|
ce887b |
*lhostp = lhost;
|
|
|
ce887b |
ret = true;
|
|
|
ce887b |
} else {
|
|
|
ce887b |
+ sudo_warnx(U_("%s: %s"), __func__,
|
|
|
ce887b |
+ U_("unable to allocate memory"));
|
|
|
ce887b |
free(shost);
|
|
|
ce887b |
free(lhost);
|
|
|
ce887b |
ret = -1;
|
|
|
ce887b |
@@ -456,7 +458,6 @@
|
|
|
ce887b |
*/
|
|
|
ce887b |
if (strcmp(user_runhost, user_host) == 0) {
|
|
|
ce887b |
if (get_ipa_hostname(&handle->ipa_shost, &handle->ipa_host) == -1) {
|
|
|
ce887b |
- sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
|
|
ce887b |
free(handle);
|
|
|
ce887b |
debug_return_int(ENOMEM);
|
|
|
ce887b |
}
|
|
|
ce887b |
@@ -478,7 +479,8 @@
|
|
|
ce887b |
handle = nss->handle;
|
|
|
ce887b |
sudo_dso_unload(handle->ssslib);
|
|
|
ce887b |
free(handle->ipa_host);
|
|
|
ce887b |
- free(handle->ipa_shost);
|
|
|
ce887b |
+ if (handle->ipa_host != handle->ipa_shost)
|
|
|
ce887b |
+ free(handle->ipa_shost);
|
|
|
ce887b |
free(handle);
|
|
|
ce887b |
nss->handle = NULL;
|
|
|
ce887b |
}
|
|
|
ce887b |
|