import from HEAD:
authorfcusack <fcusack>
Fri, 3 Mar 2006 00:58:31 +0000 (00:58 +0000)
committerfcusack <fcusack>
Fri, 3 Mar 2006 00:58:31 +0000 (00:58 +0000)
Make the site transform optional (leave undocumented!).
From Dave Mitchell.

src/modules/rlm_otp/otp.h
src/modules/rlm_otp/otp_cardops.c
src/modules/rlm_otp/otp_rlm.c

index 5cb3983..01e8d2a 100644 (file)
@@ -89,6 +89,7 @@ typedef struct otp_option_t {
   int ewindow_size;    /* sync mode event window size (right side value)  */
   int rwindow_size;    /* softfail override event window size             */
   int rwindow_delay;   /* softfail override max time delay                */
+  int site_transform;  /* apply site transform to challenge? (undoc)      */
   int debug;           /* print debug info?                               */
 #if defined(FREERADIUS)
   /* freeradius-specific items */
index b1c1dfc..ca675fd 100644 (file)
@@ -229,13 +229,17 @@ async_response:
     ssize_t chal_len;
 
     /* Perform any site-specific transforms of the challenge. */
-    if ((chal_len = otp_challenge_transform(username,
-                                            challenge, opt->chal_len)) < 0) {
-      otp_log(OTP_LOG_ERR, "%s: %s: challenge transform failed for [%s]",
-              log_prefix, __func__, username);
-      rc = OTP_RC_SERVICE_ERR;
-      goto auth_done_service_err;
-      /* NB: state not updated. */
+    if (opt->site_transform) {
+      if ((chal_len = otp_challenge_transform(username,
+                                              challenge, opt->chal_len)) < 0) {
+        otp_log(OTP_LOG_ERR, "%s: %s: challenge transform failed for [%s]",
+                log_prefix, __func__, username);
+        rc = OTP_RC_SERVICE_ERR;
+        goto auth_done_service_err;
+        /* NB: state not updated. */
+      }
+    } else {
+      chal_len = opt->chal_len;
     }
 
     /* Calculate the async response. */
index 6e1a1d3..7831d0f 100644 (file)
@@ -96,6 +96,8 @@ static const CONF_PARSER module_config[] = {
   { "mschap_mppe_bits", PW_TYPE_INTEGER,
     offsetof(otp_option_t, mschap_mppe_types), NULL, "2" },
 
+  { "site_transform", PW_TYPE_BOOLEAN, offsetof(otp_option_t, site_transform),
+    NULL, "yes" },
   { "debug", PW_TYPE_BOOLEAN, offsetof(otp_option_t, debug),
     NULL, "no" },