]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Remove unneeded code in krb5_ldap_put_principal
authorGreg Hudson <ghudson@mit.edu>
Sun, 18 Nov 2012 01:24:11 +0000 (20:24 -0500)
committerGreg Hudson <ghudson@mit.edu>
Thu, 20 Dec 2012 16:35:42 +0000 (11:35 -0500)
krb5_ldap_put_principal contained some conditionals for the case where
entry->princ is NULL, but only after entry->princ was dereferenced
unconditionally.  It's not necessary to handle this case, so don't.

src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c

index c386a9ea9fc5ef307c4d4ba275bb9a9cd592ce24..00fbce18486c36eb62ee7dfb29244c3324829b95 100644 (file)
@@ -531,15 +531,13 @@ krb5_ldap_put_principal(krb5_context context, krb5_db_entry *entry,
     }
 
     /* get the principal information to act on */
-    if (entry->princ) {
-        if (((st=krb5_unparse_name(context, entry->princ, &user)) != 0) ||
-            ((st=krb5_ldap_unparse_principal_name(user)) != 0))
-            goto cleanup;
-        filtuser = ldap_filter_correct(user);
-        if (filtuser == NULL) {
-            st = ENOMEM;
-            goto cleanup;
-        }
+    if (((st=krb5_unparse_name(context, entry->princ, &user)) != 0) ||
+        ((st=krb5_ldap_unparse_principal_name(user)) != 0))
+        goto cleanup;
+    filtuser = ldap_filter_correct(user);
+    if (filtuser == NULL) {
+        st = ENOMEM;
+        goto cleanup;
     }
 
     /* Identity the type of operation, it can be
@@ -570,14 +568,6 @@ krb5_ldap_put_principal(krb5_context context, krb5_db_entry *entry,
          *  krbprincipalname attribute is unique (only one object entry has
          *  a particular krbprincipalname attribute).
          */
-        if (user == NULL) {
-            /* must have principal name for search */
-            st = EINVAL;
-            krb5_set_error_message(context, st,
-                                   _("operation can not continue, principal "
-                                     "name not found"));
-            goto cleanup;
-        }
         if (asprintf(&filter, FILTER"%s))", filtuser) < 0) {
             filter = NULL;
             st = ENOMEM;