s4-kerberos Don't segfault if the password isn't specified in keytab generation
authorAndrew Bartlett <abartlet@samba.org>
Sun, 26 Sep 2010 02:34:58 +0000 (12:34 +1000)
committerAndrew Bartlett <abartlet@sn-devel-104.sn.samba.org>
Sun, 26 Sep 2010 03:29:34 +0000 (03:29 +0000)
Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Sun Sep 26 03:29:34 UTC 2010 on sn-devel-104

source4/auth/kerberos/kerberos_util.c

index 37a5ae6f39058f5fc85b3e5748c490a334e98553..76edf0d05aa8fed28e3e91f87c9eb4ad01f121a2 100644 (file)
@@ -597,6 +597,13 @@ static krb5_error_code create_keytab(TALLOC_CTX *parent_ctx,
 
        /* Finally, do the dance to get the password to put in the entry */
        password_s =  ldb_msg_find_attr_as_string(msg, "secret", NULL);
+
+       if (!password_s) {
+               /* There is no password here, so nothing to do */
+               talloc_free(mem_ctx);
+               return 0;
+       }
+
        if (add_old && kvno != 0) {
                old_secret = ldb_msg_find_attr_as_string(msg, "priorSecret", NULL);
        } else {