diff options
author | Theodore Y. Ts'o <tytso@mit.edu> | 1990-08-16 17:25:07 +0000 |
---|---|---|
committer | Theodore Y. Ts'o <tytso@mit.edu> | 1990-08-16 17:25:07 +0000 |
commit | 88452efca5ec64de75f1653cfe823a204a63b0c6 (patch) | |
tree | 57526986880bef304633fe8cf8a9819c3c2a327c /server | |
parent | 851e35b408ec06a62a8ec4d538894a6c9b21e999 (diff) |
Checked in changes made by Ken (Audited by Ted) which fix brokenness in
how error codes are returned by SendKerberosData() and used by
bdump_send() and bdump_get(). Kerberos codes are now returned as
Kerberos error plus kerberos error base, instead of just the
Kerberos error number.
Diffstat (limited to 'server')
-rw-r--r-- | server/bdump.c | 42 | ||||
-rw-r--r-- | server/kstuff.c | 15 |
2 files changed, 32 insertions, 25 deletions
diff --git a/server/bdump.c b/server/bdump.c index 85d31c8..65b9d24 100644 --- a/server/bdump.c +++ b/server/bdump.c @@ -243,9 +243,9 @@ bdump_send() cleanup(server, omask); return; } - if ((retval = SendKerberosData(live_socket, &ticket, "zephyr", "zephyr")) - != KSUCCESS) { - syslog(LOG_ERR,"bdump_send: %s",krb_err_txt[retval]); + retval = SendKerberosData(live_socket, &ticket, "zephyr", "zephyr"); + if (retval) { + syslog(LOG_ERR,"bdump_send: %s", error_message (retval)); cleanup(server, omask); return; } @@ -386,9 +386,10 @@ ZServerDesc_t *server; cleanup(server, omask); return; } - if ((retval = SendKerberosData(live_socket, &ticket, "zephyr", "zephyr")) - != KSUCCESS) { - syslog(LOG_ERR,"bdump_send: %s",krb_err_txt[retval]); + retval = SendKerberosData(live_socket, &ticket, "zephyr", "zephyr"); + if (retval){ + syslog(LOG_ERR,"bdump_send: %s", + error_message (retval)); cleanup(server, omask); return; } @@ -533,7 +534,12 @@ int omask; #ifdef KERBEROS #define TKTLIFETIME 96 -static long tkt_lifetime(); +static long +tkt_lifetime(val) +int val; +{ + return((long) val * 5L * 60L); +} static int get_tgt() @@ -548,15 +554,22 @@ get_tgt() } /* have they expired ? */ if (ticket_time < NOW - tkt_lifetime(TKTLIFETIME) + 15L) { + /* + * XXX krb_get_svc_in_tkt wants this argument writable + * and at least this long. + */ + static char buf[INST_SZ] = "zephyr"; + /* +15 for leeway */ zdbug((LOG_DEBUG,"get new tickets: %d %d %d", ticket_time, NOW, NOW - tkt_lifetime(TKTLIFETIME) + 15L)); (void) dest_tkt(); - if ((retval = - krb_get_svc_in_tkt("zephyr", "zephyr", my_realm, - "zephyr", "zephyr", - TKTLIFETIME, ZEPHYR_SRVTAB)) != KSUCCESS) { + + retval = krb_get_svc_in_tkt ("zephyr", buf/*XXX*/, my_realm, + "zephyr", "zephyr", + TKTLIFETIME, ZEPHYR_SRVTAB); + if (retval != KSUCCESS) { syslog(LOG_ERR,"get_tkt: %s", krb_err_txt[retval]); ticket_time = 0L; @@ -566,13 +579,6 @@ get_tgt() } return(0); } - -static long -tkt_lifetime(val) -int val; -{ - return((long) val * 5L * 60L); -} #endif /* KERBEROS */ static Code_t diff --git a/server/kstuff.c b/server/kstuff.c index 7c55468..1c12328 100644 --- a/server/kstuff.c +++ b/server/kstuff.c @@ -18,6 +18,7 @@ static char rcsid_kstuff_c[] = "$Header$"; #endif lint #include "zserver.h" +#include <zephyr/krb_err.h> #include <ctype.h> #include <netdb.h> @@ -85,7 +86,7 @@ GetKerberosData(fd, haddr, kdata, service, srvtab) * SendKerberosData * * create and transmit a ticket over the file descriptor for service.host - * return Kerberos failure codes if appropriate, or KSUCCESS if we + * return failure codes if appropriate, or 0 if we * get the ticket and write it to the file descriptor */ @@ -103,25 +104,25 @@ char *service, *host; /* service name, foreign host */ rem = krb_get_lrealm(krb_realm,1); if (rem != KSUCCESS) - return(rem); + return rem + ERROR_TABLE_BASE_krb; rem = krb_mk_req( ticket, service, host, krb_realm, (u_long)0 ); if (rem != KSUCCESS) - return(rem); + return rem + ERROR_TABLE_BASE_krb; (void) sprintf(p,"%d ",ticket->length); if ((written = write(fd, p, strlen(p))) != strlen(p)) if (written < 0) - return(written); + return errno; else return(ZSRV_PKSHORT); if ((written = write(fd, (caddr_t) (ticket->dat), ticket->length)) != ticket->length) if (written < 0) - return(written); + return errno; else return(ZSRV_PKSHORT); - - return(rem); + + return 0; } static char tkt_file[] = ZEPHYR_TKFILE; |