diff options
author | Andreas Schneider <asn@samba.org> | 2015-10-30 13:37:11 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-11-05 09:23:15 +0100 |
commit | 656f0db652969bd0cd8faf145479e78356fc7252 (patch) | |
tree | 368258ddc35b937ed28e45440481ba5f96f8d927 | |
parent | aad7019e2db23521772542cc2da2b1d8bc863024 (diff) | |
download | samba-656f0db652969bd0cd8faf145479e78356fc7252.tar.gz |
uwrap: Fix a possible null pointer dereference
If uid_wrapper is loaded but not enabled (UID_WRAPPER environment
variable not set), then we dereference a NULL pointer while forking.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | lib/uid_wrapper/uid_wrapper.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/uid_wrapper/uid_wrapper.c b/lib/uid_wrapper/uid_wrapper.c index 3f9ce98f439..60477d2b78e 100644 --- a/lib/uid_wrapper/uid_wrapper.c +++ b/lib/uid_wrapper/uid_wrapper.c @@ -812,6 +812,11 @@ static void uwrap_thread_prepare(void) { struct uwrap_thread *id = uwrap_tls_id; + /* uid_wrapper is loaded but not enabled */ + if (id == NULL) { + return; + } + UWRAP_LOCK_ALL; /* @@ -826,6 +831,12 @@ static void uwrap_thread_prepare(void) static void uwrap_thread_parent(void) { struct uwrap_thread *id = uwrap_tls_id; + + /* uid_wrapper is loaded but not enabled */ + if (id == NULL) { + return; + } + id->enabled = true; UWRAP_UNLOCK_ALL; @@ -836,6 +847,11 @@ static void uwrap_thread_child(void) struct uwrap_thread *id = uwrap_tls_id; struct uwrap_thread *u = uwrap.ids; + /* uid_wrapper is loaded but not enabled */ + if (id == NULL) { + return; + } + /* * "Garbage collector" - Inspired by DESTRUCTOR. * All threads (except one which called fork()) are dead now.. Dave |