ipa-kdb: Read ipaKrbAuthzData with other principal data

The ipaKrbAuthzData LDAP attribute is read together with the other data
of the requestedprincipal and the read value(s) are stored in the e-data
of the entry for later use.

https://fedorahosted.org/freeipa/ticket/2960
This commit is contained in:
Sumit Bose 2013-02-12 09:44:32 +01:00 committed by Martin Kosek
parent d5216d5428
commit 3eb64f0a5c
2 changed files with 18 additions and 0 deletions

View File

@ -105,6 +105,7 @@ struct ipadb_e_data {
char **pw_history; char **pw_history;
struct ipapwd_policy *pol; struct ipapwd_policy *pol;
time_t last_admin_unlock; time_t last_admin_unlock;
char **authz_data;
}; };
struct ipadb_context *ipadb_get_context(krb5_context kcontext); struct ipadb_context *ipadb_get_context(krb5_context kcontext);

View File

@ -63,6 +63,7 @@ static char *std_principal_attrs[] = {
/* IPA SPECIFIC ATTRIBUTES */ /* IPA SPECIFIC ATTRIBUTES */
"nsaccountlock", "nsaccountlock",
"passwordHistory", "passwordHistory",
IPA_KRB_AUTHZ_DATA_ATTR,
"objectClass", "objectClass",
NULL NULL
@ -237,6 +238,7 @@ static krb5_error_code ipadb_parse_ldap_entry(krb5_context kcontext,
krb5_kvno mkvno = 0; krb5_kvno mkvno = 0;
char **restrlist; char **restrlist;
char *restring; char *restring;
char **authz_data_list;
krb5_timestamp restime; krb5_timestamp restime;
bool resbool; bool resbool;
int result; int result;
@ -503,6 +505,17 @@ static krb5_error_code ipadb_parse_ldap_entry(krb5_context kcontext,
ied->last_admin_unlock = restime; ied->last_admin_unlock = restime;
} }
ret = ipadb_ldap_attr_to_strlist(lcontext, lentry,
IPA_KRB_AUTHZ_DATA_ATTR, &authz_data_list);
if (ret != 0 && ret != ENOENT) {
kerr = KRB5_KDB_INTERNAL_ERROR;
goto done;
}
if (ret == 0) {
ied->authz_data = authz_data_list;
}
kerr = 0; kerr = 0;
done: done:
@ -831,6 +844,10 @@ void ipadb_free_principal(krb5_context kcontext, krb5_db_entry *entry)
free(ied->pw_history[i]); free(ied->pw_history[i]);
} }
free(ied->pw_history); free(ied->pw_history);
for (i = 0; ied->authz_data && ied->authz_data[i]; i++) {
free(ied->authz_data[i]);
}
free(ied->authz_data);
free(ied->pol); free(ied->pol);
free(ied); free(ied);
} }