From e959d8c160d3e6729a2bb9bd7233bb06a597b294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 15 Dec 2014 16:12:29 +0000 Subject: [PATCH] Consistently use UINT_MAX, not -1, to indicate an invalid response. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@848 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- lib/liboath/oath_hotp.c | 7 ++++--- lib/liboath/oath_totp.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/liboath/oath_hotp.c b/lib/liboath/oath_hotp.c index 20f34ba..f22c83a 100644 --- a/lib/liboath/oath_hotp.c +++ b/lib/liboath/oath_hotp.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -98,11 +99,11 @@ oath_hotp_current(struct oath_key *k) unsigned int code; if (k == NULL) - return (-1); + return (UINT_MAX); if (k->mode != om_hotp) - return (-1); + return (UINT_MAX); if (k->counter == UINT64_MAX) - return (-1); + return (UINT_MAX); code = oath_hotp(k->key, k->keylen, k->counter, k->digits); k->counter += 1; return (code); diff --git a/lib/liboath/oath_totp.c b/lib/liboath/oath_totp.c index 14ede3e..baf81ef 100644 --- a/lib/liboath/oath_totp.c +++ b/lib/liboath/oath_totp.c @@ -33,6 +33,7 @@ # include "config.h" #endif +#include #include #include #include @@ -57,11 +58,11 @@ oath_totp_current(const struct oath_key *k) uint64_t seq; if (k == NULL) - return (-1); + return (UINT_MAX); if (k->mode != om_totp) - return (-1); + return (UINT_MAX); if (k->timestep == 0) - return (-1); + return (UINT_MAX); seq = time(NULL) / k->timestep; code = oath_hotp(k->key, k->keylen, seq, k->digits); return (code);