krb5 commit: Remove some dead code

Benjamin Kaduk kaduk at mit.edu
Mon Dec 15 15:03:35 EST 2014


https://github.com/krb5/krb5/commit/fb0827e065763821ed1c6c205f15189b1c70bc2a
commit fb0827e065763821ed1c6c205f15189b1c70bc2a
Author: Ben Kaduk <kaduk at mit.edu>
Date:   Wed Nov 19 12:09:55 2014 -0500

    Remove some dead code
    
    The secretkey variable is initialized to NULL and compared against
    NULL, but never actually set to anything after initialization.
    
    Remove the variable and all code that would have executed if it
    was non-NULL.

 src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
index b562970..6a06f55 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
@@ -237,7 +237,6 @@ krb5_ldap_delete_principal(krb5_context context,
     int                       j=0, ptype=0, pcount=0, attrsetmask=0;
     krb5_error_code           st=0;
     krb5_boolean              singleentry=FALSE;
-    KEY                       *secretkey=NULL;
     kdb5_dal_handle           *dal_handle=NULL;
     krb5_ldap_context         *ldap_context=NULL;
     krb5_ldap_server_handle   *ldap_server_handle=NULL;
@@ -283,13 +282,7 @@ krb5_ldap_delete_principal(krb5_context context,
             goto cleanup;
 
         singleentry = (pcount == 1) ? TRUE: FALSE;
-        if (singleentry == FALSE) {
-            if (secretkey != NULL) {
-                if ((st=krb5_add_ber_mem_ldap_mod(&mods, "krbprincipalkey", LDAP_MOD_DELETE | LDAP_MOD_BVALUES,
-                                                  secretkey->keys)) != 0)
-                    goto cleanup;
-            }
-        } else {
+        if (singleentry == TRUE) {
             /*
              * If the Kerberos user principal to be deleted happens to be the last one associated
              * with the directory user object, then it is time to delete the other kerberos
@@ -343,17 +336,6 @@ cleanup:
     if (DN)
         free (DN);
 
-    if (secretkey != NULL) {
-        int i=0;
-        while (i < secretkey->nkey) {
-            free (secretkey->keys[i]->bv_val);
-            free (secretkey->keys[i]);
-            ++i;
-        }
-        free (secretkey->keys);
-        free (secretkey);
-    }
-
     krb5_ldap_free_principal(context, entry);
 
     ldap_mods_free(mods, 1);


More information about the cvs-krb5 mailing list