[1156] in Kerberos-V5-bugs
krb5b4pl3: krlogin, krsh, krcp interpret kcmd return value wrong
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Tue Mar 14 11:04:03 1995
From: "Jonathan I. Kamens" <jik@cam.ov.com>
Date: Tue, 14 Mar 1995 11:06:44 -0500
To: krb5-bugs@MIT.EDU
The return value of kcmd() can be either -1 or an error code. Its
callers shouldn't try to interpret it as an error code when it's -1.
Patch:
--- appl/bsd/krlogin.c 1995/03/09 20:07:07 1.1
+++ appl/bsd/krlogin.c 1995/03/09 20:10:44 1.2
@@ -555,9 +555,11 @@
authopts);
if (status) {
/* should check for KDC_PR_UNKNOWN, NO_TKT_FILE here -- XXX */
- fprintf(stderr,
- "%s: kcmd to host %s failed - %s\n",orig_argv[0], host,
- error_message(status));
+ /* kcmd returns either -1 *or* a com_err code; ick */
+ if (status != -1)
+ fprintf(stderr,
+ "%s: kcmd to host %s failed - %s\n",orig_argv[0], host,
+ error_message(status));
try_normal(orig_argv);
}
rem = sock;
--- appl/bsd/krsh.c 1995/03/14 13:59:00 1.5
+++ appl/bsd/krsh.c 1995/03/14 16:02:58 1.6
@@ -320,10 +320,11 @@
(struct sockaddr_in *) 0,
authopts);
if (status) {
- /* check NO_TKT_FILE or equivalent... */
- fprintf(stderr,
- "%s: kcmd to host %s failed - %s\n",argv0[0], host,
- error_message(status));
+ if (status != -1)
+ /* check NO_TKT_FILE or equivalent... */
+ fprintf(stderr,
+ "%s: kcmd to host %s failed - %s\n",argv0[0], host,
+ error_message(status));
try_normal(argv0);
}
#else /* !KERBEROS */
--- appl/bsd/krcp.c 1995/03/13 00:07:39 1.2
+++ appl/bsd/krcp.c 1995/03/13 00:10:31 1.3
@@ -348,10 +348,11 @@
&foreign,
authopts);
if (status) {
- fprintf(stderr,
- "%s: kcmd to host %s failed - %s\n",
- orig_argv[0], host,
- error_message(status));
+ if (status != -1)
+ fprintf(stderr,
+ "%s: kcmd to host %s failed - %s\n",
+ orig_argv[0], host,
+ error_message(status));
try_normal(orig_argv);
}
else {