krb5 commit: Remove unneeded code in krb5_ldap_put_principal
Greg Hudson
ghudson at MIT.EDU
Thu Dec 20 11:35:54 EST 2012
https://github.com/krb5/krb5/commit/7ee7399056a201d20315c2ce6650330a7d5c9177
commit 7ee7399056a201d20315c2ce6650330a7d5c9177
Author: Greg Hudson <ghudson at mit.edu>
Date: Sat Nov 17 20:24:11 2012 -0500
Remove unneeded code in krb5_ldap_put_principal
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 | 24 +++++--------------
1 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
index c386a9e..00fbce1 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c
@@ -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;
More information about the cvs-krb5
mailing list