summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-09-04 05:56:48 +0000
committerGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-09-04 05:56:48 +0000
commit23ba17e8085a4955780bb4eda8079bcee33f5f34 (patch)
tree051aa2fae7d5c849d2174037d2b9c8afa0130201
parent53d158cbd64c137c8b2ac141b8d78d15b3b51218 (diff)
Fix from lwvanels to set "last_authent_time" correctly if it was 0 or
if an error occurred.
-rw-r--r--lib/ZMkAuth.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/ZMkAuth.c b/lib/ZMkAuth.c
index b6911a8..0b20a39 100644
--- a/lib/ZMkAuth.c
+++ b/lib/ZMkAuth.c
@@ -20,13 +20,13 @@ static char rcsid_ZMakeAuthentication_c[] = "$Id$";
#include <zephyr/zephyr_internal.h>
#ifdef KERBEROS
#include "krb_err.h"
-static int last_authent_time = 0;
+static long last_authent_time = 0L;
static KTEXT_ST last_authent;
#endif
Code_t ZResetAuthentication () {
#ifdef KERBEROS
- last_authent_time = 0;
+ last_authent_time = 0L;
#endif
return ZERR_NONE;
}
@@ -38,15 +38,18 @@ Code_t ZMakeAuthentication(notice, buffer, buffer_len, len)
int *len;
{
#ifdef KERBEROS
- int retval, result, now;
+ int retval, result;
+ long now,time();
KTEXT_ST authent;
- if (last_authent_time == 0
- || (now = time(0), now - last_authent_time > 120)) {
+ now = time(0);
+ if (last_authent_time == 0 || (now - last_authent_time > 120)) {
result = krb_mk_req(&authent, SERVER_SERVICE,
SERVER_INSTANCE, __Zephyr_realm, 0);
- if (result != MK_AP_OK)
+ if (result != MK_AP_OK) {
+ last_authent_time = 0;
return (result+krb_err_base);
+ }
last_authent_time = now;
last_authent = authent;
}