pdb: Fix segfault in pdb_ldap for missing gecos
authorLuca Olivetti <luca@wetron.es>
Fri, 5 Feb 2016 11:02:51 +0000 (12:02 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 5 Feb 2016 15:47:00 +0000 (16:47 +0100)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11530
Signed-off-by: Luca Olivetti <luca@wetron.es>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Feb  5 16:47:00 CET 2016 on sn-devel-144

source3/passdb/pdb_ldap.c

index c65fb0877a1bcfbdf7e48161b5196b8d27a9b819..50ab3a7a03a1a95b51c3afb4517e04d50a568411 100644 (file)
@@ -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, "");
                }