import from HEAD:
authorfcusack <fcusack>
Tue, 9 May 2006 08:13:03 +0000 (08:13 +0000)
committerfcusack <fcusack>
Tue, 9 May 2006 08:13:03 +0000 (08:13 +0000)
update cardops keystring2keyblock method to take a card_info_t *
instead of some of its fields

src/modules/rlm_otp/cardops/cryptocard.c
src/modules/rlm_otp/cardops/cryptocard.h
src/modules/rlm_otp/otp_cardops.c
src/modules/rlm_otp/otp_cardops.h

index 8178d66..cc2341b 100644 (file)
@@ -14,7 +14,7 @@
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * Copyright 2005,2006 TRI-D Systems, Inc.
  */
@@ -79,14 +79,13 @@ cryptocard_name2fm(const char *name, uint32_t *featuremask)
  * Returns keylen on success, -1 otherwise.
  */
 static int
-cryptocard_keystring2keyblock(const char *keystring,
-                              unsigned char keyblock[OTP_MAX_KEY_LEN])
+cryptocard_keystring2keyblock(otp_card_info_t *card_info)
 {
   /* 64-bit DES key with optional line ending */
-  if ((strlen(keystring) & ~1) != 16)
+  if ((strlen(card_info->keystring) & ~1) != 16)
     return 1;
 
-  return otp_keystring2keyblock(keystring, keyblock);
+  return otp_keystring2keyblock(card_info->keystring, card_info->keyblock);
 }
 
 
index b264e04..b4a8a7a 100644 (file)
@@ -14,7 +14,7 @@
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * Copyright 2005,2006 TRI-D Systems, Inc.
  */
@@ -46,8 +46,7 @@
 #define CRYPTOCARD_DP_RS (CRYPTOCARD_DP_RC|CRYPTOCARD_DP_ES)
 
 static int cryptocard_name2fm(const char *, uint32_t *);
-static int cryptocard_keystring2keyblock(const char *,
-                                         unsigned char [OTP_MAX_KEY_LEN]);
+static int cryptocard_keystring2keyblock(otp_card_info_t *);
 static int cryptocard_nullstate(const otp_option_t *, const otp_card_info_t *,
                                 otp_user_state_t *, time_t, const char *);
 static int cryptocard_challenge(const otp_card_info_t *, otp_user_state_t *,
index ca675fd..6194c93 100644 (file)
@@ -16,7 +16,7 @@
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  *
  * Copyright 2002-2005  Google, Inc.
@@ -147,8 +147,7 @@ otp_pw_valid(const char *username, char *challenge, const char *passcode,
   }
 
   /* Convert keystring to a keyblock. */
-  if (card_info.cardops->keystring2keyblock(card_info.keystring,
-                                            card_info.keyblock) < 0) {
+  if (card_info.cardops->keystring2keyblock(&card_info) < 0) {
     otp_log(OTP_LOG_ERR, "%s: %s: invalid key '%s' for [%s]",
             log_prefix, __func__, card_info.keystring, username);
     rc = OTP_RC_SERVICE_ERR;
index 09d1db4..b508380 100644 (file)
@@ -14,7 +14,7 @@
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * Copyright 2005,2006 TRI-D Systems, Inc.
  */
@@ -74,7 +74,7 @@ typedef struct cardops_t {
   size_t prefix_len;   /* to avoid strlen(prefix) */
 
   int (*name2fm)(const char *, uint32_t *);
-  int (*keystring2keyblock)(const char *, unsigned char [OTP_MAX_KEY_LEN]);
+  int (*keystring2keyblock)(otp_card_info_t *);
   int (*nullstate)(const otp_option_t *, const otp_card_info_t *,
                    otp_user_state_t *, time_t, const char *);
   int (*challenge)(const otp_card_info_t *, otp_user_state_t *,