[PATCH] pdb: Fix segfault in pdb_ldap for missing gecos

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Feb 5 11:43:42 UTC 2016


Hi!

This is the patch from
https://bugzilla.samba.org/show_bug.cgi?id=11530 which to me looks
entirely correct. I've taken the liberty to add the signed-off-by the
original author. Not sure this is right, feel free to remove that
again. Anyway, it's got my review.

Second review appreciated!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 691feb51483ceb1803a25ea1dac5c155b3b5506a Mon Sep 17 00:00:00 2001
From: Luca Olivetti <luca at wetron.es>
Date: Fri, 5 Feb 2016 12:02:51 +0100
Subject: [PATCH] pdb: Fix segfault in pdb_ldap for missing gecos

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11530
Signed-off-by: Luca Olivetti <luca at wetron.es>
Reviewed-by: Volker Lendecke <vl at samba.org>
---
 source3/passdb/pdb_ldap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index c65fb08..50ab3a7 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1005,7 +1005,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
 				entry,
 				"gecos",
 				ctx);
-		if (unix_pw.pw_gecos) {
+		if (unix_pw.pw_gecos == NULL) {
 			unix_pw.pw_gecos = fullname;
 		}
 		unix_pw.pw_dir = smbldap_talloc_single_attribute(
@@ -1013,7 +1013,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
 				entry,
 				"homeDirectory",
 				ctx);
-		if (unix_pw.pw_dir) {
+		if (unix_pw.pw_dir == NULL) {
 			unix_pw.pw_dir = discard_const_p(char, "");
 		}
 		unix_pw.pw_shell = smbldap_talloc_single_attribute(
@@ -1021,7 +1021,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
 				entry,
 				"loginShell",
 				ctx);
-		if (unix_pw.pw_shell) {
+		if (unix_pw.pw_shell == NULL) {
 			unix_pw.pw_shell = discard_const_p(char, "");
 		}
 
-- 
2.1.4



More information about the samba-technical mailing list