The branch, v4-2-test has been updated
       via  3af9006 s3: krb5: keytab - The done label can be jumped to with 
context == NULL.
      from  4759f64 smbd: Fix an assert

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit 3af9006f3d6cc1219885ca7ce33a8ec075af7070
Author: Jeremy Allison <[email protected]>
Date:   Wed Jun 8 14:50:59 2016 -0700

    s3: krb5: keytab - The done label can be jumped to with context == NULL.
    
    Ensure we don't crash in this case.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11959
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>
    
    Autobuild-User(master): Uri Simchoni <[email protected]>
    Autobuild-Date(master): Thu Jun  9 13:18:56 CEST 2016 on sn-devel-144
    
    (cherry picked from commit e46cb9b835eb8f2bd998def82baf6f07fda9fe5c)
    
    Autobuild-User(v4-2-test): Karolin Seeger <[email protected]>
    Autobuild-Date(v4-2-test): Wed Jun 15 14:26:39 CEST 2016 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/libads/kerberos_keytab.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index ae3d80e39..2068d03 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -742,26 +742,24 @@ done:
        TALLOC_FREE(oldEntries);
        TALLOC_FREE(frame);
 
-       {
+       if (context) {
                krb5_keytab_entry zero_kt_entry;
+               krb5_kt_cursor zero_csr;
+
                ZERO_STRUCT(zero_kt_entry);
+               ZERO_STRUCT(zero_csr);
+
                if (memcmp(&zero_kt_entry, &kt_entry,
                                sizeof(krb5_keytab_entry))) {
                        smb_krb5_kt_free_entry(context, &kt_entry);
                }
-       }
-       {
-               krb5_kt_cursor zero_csr;
-               ZERO_STRUCT(zero_csr);
                if ((memcmp(&cursor, &zero_csr,
                                sizeof(krb5_kt_cursor)) != 0) && keytab) {
                        krb5_kt_end_seq_get(context, keytab, &cursor);
                }
-       }
-       if (keytab) {
-               krb5_kt_close(context, keytab);
-       }
-       if (context) {
+               if (keytab) {
+                       krb5_kt_close(context, keytab);
+               }
                krb5_free_context(context);
        }
        return ret;


-- 
Samba Shared Repository

Reply via email to