mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
parent
25eed1c6cb
commit
cd9bc84240
@ -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)
|
||||
|
||||
|
@ -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;
|
@ -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_ */
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user