Skip to content

Commit

Permalink
Remove unneeded code in krb5_ldap_put_principal
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
greghudson committed Dec 20, 2012
1 parent cde9eaa commit 7ee7399
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7ee7399

Please sign in to comment.