summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins
diff options
context:
space:
mode:
authorNathaniel McCallum <npmccallum@redhat.com>2016-05-12 14:57:29 -0400
committerMartin Basti <mbasti@redhat.com>2016-05-26 18:47:05 +0200
commitcd9bc84240c99ed744e5ee44db18d925a5292ffd (patch)
treee83ddbd6b02f30ffec9e22de0caa6e9cbd301706 /daemons/ipa-slapi-plugins
parent25eed1c6cb1808dfa05ce7be23aa7dea4ae0f466 (diff)
downloadfreeipa-cd9bc84240c99ed744e5ee44db18d925a5292ffd.tar.gz
freeipa-cd9bc84240c99ed744e5ee44db18d925a5292ffd.tar.xz
freeipa-cd9bc84240c99ed744e5ee44db18d925a5292ffd.zip
Rename syncreq.[ch] to otpctrl.[ch]
This gives us a place to handle all OTP related controls. Also, genericize otpctrl_present() so that the OID can be specified as an argument to the function call. These changes are preparatory for the subsequent patches. https://fedorahosted.org/freeipa/ticket/433 Reviewed-By: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'daemons/ipa-slapi-plugins')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am2
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.c (renamed from daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c)8
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h (renamed from daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.h)10
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c6
4 files changed, 13 insertions, 13 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am
index 078ff9c84..46a649187 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am
@@ -47,7 +47,7 @@ libipa_pwd_extop_la_SOURCES = \
encoding.c \
prepost.c \
ipa_pwd_extop.c \
- syncreq.c \
+ otpctrl.c \
$(KRB5_UTIL_SRCS) \
$(NULL)
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.c
index 3a31529f7..ce26abeeb 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.c
@@ -38,19 +38,19 @@
* END COPYRIGHT BLOCK **/
#include "../libotp/otp_token.h"
-#include "syncreq.h"
+#include "otpctrl.h"
-bool sync_request_present(Slapi_PBlock *pb)
+bool otpctrl_present(Slapi_PBlock *pb, const char *oid)
{
LDAPControl **controls = NULL;
if (slapi_pblock_get(pb, SLAPI_REQCONTROLS, &controls) != 0)
return false;
- return ldap_control_find(OTP_SYNC_REQUEST_OID, controls, NULL) != NULL;
+ return ldap_control_find(oid, controls, NULL) != NULL;
}
-bool sync_request_handle(const struct otp_config *cfg, Slapi_PBlock *pb,
+bool otpctrl_sync_handle(const struct otp_config *cfg, Slapi_PBlock *pb,
const char *user_dn)
{
struct otp_token **tokens = NULL;
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.h b/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h
index 98a97c4c9..c38d4915a 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/syncreq.h
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/otpctrl.h
@@ -38,8 +38,8 @@
* END COPYRIGHT BLOCK **/
-#ifndef SYNCREQ_H_
-#define SYNCREQ_H_
+#ifndef OTPCTRL_H_
+#define OTPCTRL_H_
#include "../libotp/otp_config.h"
#include <stdbool.h>
@@ -55,9 +55,9 @@
*/
#define OTP_SYNC_REQUEST_OID "2.16.840.1.113730.3.8.10.6"
-bool sync_request_present(Slapi_PBlock *pb);
+bool otpctrl_present(Slapi_PBlock *pb, const char *oid);
-bool sync_request_handle(const struct otp_config *cfg, Slapi_PBlock *pb,
+bool otpctrl_sync_handle(const struct otp_config *cfg, Slapi_PBlock *pb,
const char *user_dn);
-#endif /* SYNCREQ_H_ */
+#endif /* OTPCTRL_H_ */
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c
index c1fc7fe33..f41b1ac9d 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c
@@ -62,7 +62,7 @@
#include "ipapwd.h"
#include "util.h"
-#include "syncreq.h"
+#include "otpctrl.h"
#define IPAPWD_OP_NULL 0
#define IPAPWD_OP_ADD 1
@@ -1450,7 +1450,7 @@ static int ipapwd_pre_bind(Slapi_PBlock *pb)
}
/* Try to do OTP first. */
- syncreq = sync_request_present(pb);
+ syncreq = otpctrl_present(pb, OTP_SYNC_REQUEST_OID);
if (!syncreq && !ipapwd_pre_bind_otp(dn, entry, credentials))
goto invalid_creds;
@@ -1466,7 +1466,7 @@ static int ipapwd_pre_bind(Slapi_PBlock *pb)
}
/* Attempt to handle a token synchronization request. */
- if (syncreq && !sync_request_handle(otp_config, pb, dn))
+ if (syncreq && !otpctrl_sync_handle(otp_config, pb, dn))
goto invalid_creds;
/* Attempt to write out kerberos keys for the user. */