diff options
author | Nathaniel McCallum <npmccallum@redhat.com> | 2014-11-10 20:58:20 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2014-12-03 08:48:56 +0100 |
commit | bdccb0c721283f17a48423ab562ab5515ecd7f8e (patch) | |
tree | 9c6777b366777120ef5ec186b797e4d2094e4467 /daemons/ipa-slapi-plugins/ipa-pwd-extop | |
parent | faec4ef9de431a1b72423be8ce6cea28a7221531 (diff) | |
download | freeipa-bdccb0c721283f17a48423ab562ab5515ecd7f8e.tar.gz freeipa-bdccb0c721283f17a48423ab562ab5515ecd7f8e.tar.xz freeipa-bdccb0c721283f17a48423ab562ab5515ecd7f8e.zip |
Preliminary refactoring of libotp files
There are no major changes in this commit other than changing filenames
and symbols to have consistent namespaces. This prepares for larger
changes to come in subsequent commits.
Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-pwd-extop')
4 files changed, 12 insertions, 14 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am index 77beca2da..eeb352611 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am @@ -11,7 +11,6 @@ ASN1_UTIL_DIR=../../../asn1 AM_CPPFLAGS = \ -I. \ -I$(srcdir) \ - -I$(srcdir)/../libotp \ -I$(PLUGIN_COMMON_DIR) \ -I$(KRB5_UTIL_DIR) \ -I$(ASN1_UTIL_DIR) \ diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h index f8851122b..2e9d4fe86 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h @@ -41,7 +41,7 @@ # include <config.h> #endif -#include <libotp.h> +#include "../libotp/otp_token.h" #include <stdio.h> #include <string.h> diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c index 1f595d01d..1dff6db1a 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c @@ -1140,11 +1140,11 @@ done: static bool ipapwd_do_otp_auth(const char *dn, Slapi_Entry *bind_entry, struct berval *creds) { - struct otptoken **tokens = NULL; + struct otp_token **tokens = NULL; bool success = false; /* Find all of the user's active tokens. */ - tokens = otptoken_find(ipapwd_plugin_id, dn, NULL, true, NULL); + tokens = otp_token_find(ipapwd_plugin_id, dn, NULL, true, NULL); if (tokens == NULL) { slapi_log_error(SLAPI_LOG_FATAL, IPAPWD_PLUGIN_NAME, "%s: can't find tokens for '%s'.\n", __func__, dn); @@ -1157,12 +1157,12 @@ static bool ipapwd_do_otp_auth(const char *dn, Slapi_Entry *bind_entry, /* Loop through each token. */ for (int i = 0; tokens[i] && !success; i++) { /* Attempt authentication. */ - success = otptoken_validate_berval(tokens[i], OTP_VALIDATE_STEPS, + success = otp_token_validate_berval(tokens[i], OTP_VALIDATE_STEPS, creds, true); /* Truncate the password to remove the OTP code at the end. */ if (success) { - creds->bv_len -= otptoken_get_digits(tokens[i]); + creds->bv_len -= otp_token_get_digits(tokens[i]); creds->bv_val[creds->bv_len] = '\0'; } @@ -1170,10 +1170,10 @@ static bool ipapwd_do_otp_auth(const char *dn, Slapi_Entry *bind_entry, "%s: token authentication %s " "(user: '%s', token: '%s\').\n", __func__, success ? "succeeded" : "failed", dn, - slapi_sdn_get_ndn(otptoken_get_sdn(tokens[i]))); + slapi_sdn_get_ndn(otp_token_get_sdn(tokens[i]))); } - otptoken_free_array(tokens); + otp_token_free_array(tokens); return success; } diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c index cbb4536e7..10c49b724 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c @@ -37,8 +37,7 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ - -#include <libotp.h> +#include "../libotp/otp_token.h" #include "syncreq.h" #define OTP_SYNC_MAX_STEPS 25 @@ -56,7 +55,7 @@ bool sync_request_present(Slapi_PBlock *pb) bool sync_request_handle(Slapi_ComponentId *plugin_id, Slapi_PBlock *pb, const char *user_dn) { - struct otptoken **tokens = NULL; + struct otp_token **tokens = NULL; LDAPControl **controls = NULL; struct berval *second = NULL; struct berval *first = NULL; @@ -91,10 +90,10 @@ bool sync_request_handle(Slapi_ComponentId *plugin_id, Slapi_PBlock *pb, /* Process the synchronization. */ success = false; if (ber_scanf(ber, "}") != LBER_ERROR) { - tokens = otptoken_find(plugin_id, user_dn, token_dn, true, NULL); + tokens = otp_token_find(plugin_id, user_dn, token_dn, true, NULL); if (tokens != NULL) { - success = otptoken_sync_berval(tokens, OTP_SYNC_MAX_STEPS, first, second); - otptoken_free_array(tokens); + success = otp_token_sync_berval(tokens, OTP_SYNC_MAX_STEPS, first, second); + otp_token_free_array(tokens); } } |