diff options
author | Nathaniel McCallum <npmccallum@redhat.com> | 2014-02-06 10:56:46 -0500 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-02-14 16:03:24 +0100 |
commit | fd55da9a27f76611b01c38c2741c13652d6a3e60 (patch) | |
tree | 4808a6b12a668fef703213578256ecd2a8245d7c /daemons/ipa-kdb/ipa_kdb.c | |
parent | a91c0972b992dbd15e78f2ba6982768ac958e4bd (diff) | |
download | freeipa-fd55da9a27f76611b01c38c2741c13652d6a3e60.tar.gz freeipa-fd55da9a27f76611b01c38c2741c13652d6a3e60.tar.xz freeipa-fd55da9a27f76611b01c38c2741c13652d6a3e60.zip |
ipa-kdb: validate that an OTP user has tokens
This handles the case where a user is configured for OTP in ipaUserAuthType,
but the user has not yet created any tokens. Until the user creates tokens,
the user should still be able to log in via password. This logic already
exists in LDAP, but ipa-kdb needs to perform the same validation to know
what data to return to the KDC.
https://fedorahosted.org/freeipa/ticket/4154
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Diffstat (limited to 'daemons/ipa-kdb/ipa_kdb.c')
-rw-r--r-- | daemons/ipa-kdb/ipa_kdb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c index c807bbcfa..0f3996cdf 100644 --- a/daemons/ipa-kdb/ipa_kdb.c +++ b/daemons/ipa-kdb/ipa_kdb.c @@ -186,13 +186,13 @@ static const struct { { } }; -void ipadb_get_user_auth(LDAP *lcontext, LDAPMessage *le, - enum ipadb_user_auth *userauth) +void ipadb_parse_user_auth(LDAP *lcontext, LDAPMessage *le, + enum ipadb_user_auth *userauth) { struct berval **vals; int i, j; - *userauth = IPADB_USER_AUTH_EMPTY; + *userauth = IPADB_USER_AUTH_NONE; vals = ldap_get_values_len(lcontext, le, IPA_USER_AUTH_TYPE); if (!vals) return; @@ -205,6 +205,8 @@ void ipadb_get_user_auth(LDAP *lcontext, LDAPMessage *le, } } } + + ldap_value_free_len(vals); } int ipadb_get_global_configs(struct ipadb_context *ipactx) @@ -239,7 +241,7 @@ int ipadb_get_global_configs(struct ipadb_context *ipactx) } /* Check for permitted authentication types. */ - ipadb_get_user_auth(ipactx->lcontext, res, &ipactx->user_auth); + ipadb_parse_user_auth(ipactx->lcontext, res, &ipactx->user_auth); vals = ldap_get_values_len(ipactx->lcontext, first, "ipaConfigString"); |