From 41479f6dd011265d988228b20449ff25c5e382ae Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 12 Mar 2001 15:17:40 +0000 Subject: [PATCH] * defines.h: Add prototypes for rcmd_stream_init_normal(), rcmd_stream_init_krb4(), strsave() and rd_and_store_for_creds() * Makefile.in: Add dependency of forward.o on defines.h * forward.c: Include defines.h for prototypes. * kcmd.c, krcp.c, krlogin.c, krlogind.c, krsh.c: Provide full prototype for local functions and move include of kerberosIV/krb.h before defines.h. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13077 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 13 ++++++++ src/appl/bsd/Makefile.in | 2 +- src/appl/bsd/defines.h | 23 +++++++++++++ src/appl/bsd/forward.c | 3 ++ src/appl/bsd/kcmd.c | 72 +++++++++++++++++++++------------------- src/appl/bsd/krcp.c | 22 ++++++++---- src/appl/bsd/krlogin.c | 54 ++++++++++++++++++++---------- src/appl/bsd/krlogind.c | 19 ++++++----- src/appl/bsd/krsh.c | 4 +-- src/appl/bsd/krshd.c | 54 +++++++++++++++++------------- 10 files changed, 173 insertions(+), 93 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 95032af37..1e5a1edbb 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,16 @@ +2001-03-12 Ezra Peisach + + * defines.h: Add prototypes for rcmd_stream_init_normal(), + rcmd_stream_init_krb4(), strsave() and rd_and_store_for_creds() + + * Makefile.in: Add dependency of forward.o on defines.h + + * forward.c: Include defines.h for prototypes. + + * kcmd.c, krcp.c, krlogin.c, krlogind.c, krsh.c: Provide full prototype + for local functions and move include of kerberosIV/krb.h before + defines.h. + 2001-01-26 Tom Yu * krshd.c: Get path for NOLOGIN file from paths.h if present, diff --git a/src/appl/bsd/Makefile.in b/src/appl/bsd/Makefile.in index 167373959..d95bfcdbe 100644 --- a/src/appl/bsd/Makefile.in +++ b/src/appl/bsd/Makefile.in @@ -91,4 +91,4 @@ install:: getdtablesize.o: $(srcdir)/getdtablesize.c -kcmd.o krcp.o krlogin.o krlogind.o krsh.o krshd.o : defines.h +kcmd.o krcp.o krlogin.o krlogind.o krsh.o krshd.o forward.o: defines.h diff --git a/src/appl/bsd/defines.h b/src/appl/bsd/defines.h index 6365d2cbe..94b880f3d 100644 --- a/src/appl/bsd/defines.h +++ b/src/appl/bsd/defines.h @@ -41,3 +41,26 @@ extern int getport (int *); extern void rcmd_stream_init_krb5 (krb5_keyblock *in_keyblock, int encrypt_flag, int lencheck, int am_client, enum kcmd_proto protonum); + +extern void rcmd_stream_init_normal(void); + +#if defined(KRB5_KRB4_COMPAT) && !defined(SKIP_V4_PROTO) +extern void rcmd_stream_init_krb4(C_Block, int, int, int); + +extern int k4cmd(int *sock, char **ahost, u_short rport, char *locuser, + char *remuser, char *cmd, int *fd2p, KTEXT ticket, + char *service, char *realm, CREDENTIALS *cred, + Key_schedule schedule, MSG_DAT *msg_data, + struct sockaddr_in *laddr, struct sockaddr_in *faddr, + long authopts, int anyport); +#endif + +#ifndef HAVE_STRSAVE +extern char *strsave(const char *sp); +#endif + +krb5_error_code rd_and_store_for_creds(krb5_context context, + krb5_auth_context auth_context, + krb5_data *inbuf, krb5_ticket *ticket, + krb5_ccache *ccache); + diff --git a/src/appl/bsd/forward.c b/src/appl/bsd/forward.c index e47b8ff16..e266b2579 100644 --- a/src/appl/bsd/forward.c +++ b/src/appl/bsd/forward.c @@ -27,6 +27,9 @@ #include "k5-int.h" +#define SKIP_V4_PROTO /* To skip the krb4 prototypes */ +#include "defines.h" + /* Decode, decrypt and store the forwarded creds in the local ccache. */ krb5_error_code rd_and_store_for_creds(context, auth_context, inbuf, ticket, ccache) diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 568675fca..0a8e6128f 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -129,9 +129,11 @@ static char storage[2*RCMD_BUFSIZ]; /* storage for the decryption */ static int nstored = 0; static char *store_ptr = storage; static int twrite(int, char *, int, int); -static int v5_des_read(), v5_des_write(); +static int v5_des_read(int, char *, int, int), + v5_des_write(int, char *, int, int); #ifdef KRB5_KRB4_COMPAT -static int v4_des_read(), v4_des_write(); +static int v4_des_read(int, char *, int, int), + v4_des_write(int, char *, int, int); static C_Block v4_session; static int right_justify; #endif @@ -183,7 +185,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, #else long oldmask; #endif - struct sockaddr_in sin, from, local_laddr; + struct sockaddr_in sockin, from, local_laddr; krb5_creds *get_cred, *ret_cred = 0; char c; int lport; @@ -242,10 +244,10 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, #endif /* POSIX_SIGNALS */ return (-1); } - sin.sin_family = hp->h_addrtype; - memcpy((caddr_t)&sin.sin_addr,hp->h_addr, sizeof(sin.sin_addr)); - sin.sin_port = rport; - if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0) + sockin.sin_family = hp->h_addrtype; + memcpy((caddr_t)&sockin.sin_addr,hp->h_addr, sizeof(sockin.sin_addr)); + sockin.sin_port = rport; + if (connect(s, (struct sockaddr *)&sockin, sizeof (sockin)) >= 0) break; (void) close(s); if (errno == EADDRINUSE) @@ -256,14 +258,14 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, int oerrno = errno; fprintf(stderr, - "connect to address %s: ", inet_ntoa(sin.sin_addr)); + "connect to address %s: ", inet_ntoa(sockin.sin_addr)); errno = oerrno; perror(0); hp->h_addr_list++; - memcpy((caddr_t)&sin.sin_addr,hp->h_addr_list[0], - sizeof(sin.sin_addr)); + memcpy((caddr_t)&sockin.sin_addr,hp->h_addr_list[0], + sizeof(sockin.sin_addr)); fprintf(stderr, "Trying %s...\n", - inet_ntoa(sin.sin_addr)); + inet_ntoa(sockin.sin_addr)); continue; } #endif /* !(defined(ultrix) || defined(sun)) */ @@ -346,9 +348,9 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, } if (!laddr) laddr = &local_laddr; - if (!faddr) faddr = &sin; + if (!faddr) faddr = &sockin; else - memcpy(faddr,&sin,sizeof(sin)); + memcpy(faddr,&sockin,sizeof(sockin)); sin_len = sizeof (struct sockaddr_in); if (getsockname(s, (struct sockaddr *)laddr, &sin_len) < 0) { @@ -544,7 +546,7 @@ k4cmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, ticket, service, realm, #else sigmasktype oldmask; #endif - struct sockaddr_in sin, from; + struct sockaddr_in sockin, from; char c; int lport = START_PORT; struct hostent *hp; @@ -583,10 +585,10 @@ k4cmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, ticket, service, realm, #endif /* POSIX_SIGNALS */ return (-1); } - sin.sin_family = hp->h_addrtype; - memcpy((caddr_t)&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr)); - sin.sin_port = rport; - if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0) + sockin.sin_family = hp->h_addrtype; + memcpy((caddr_t)&sockin.sin_addr, hp->h_addr, sizeof(sockin.sin_addr)); + sockin.sin_port = rport; + if (connect(s, (struct sockaddr *)&sockin, sizeof (sockin)) >= 0) break; (void) close(s); if (errno == EADDRINUSE) { @@ -598,13 +600,13 @@ k4cmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, ticket, service, realm, int oerrno = errno; fprintf(stderr, - "connect to address %s: ", inet_ntoa(sin.sin_addr)); + "connect to address %s: ", inet_ntoa(sockin.sin_addr)); errno = oerrno; perror(0); hp->h_addr_list++; - memcpy((caddr_t)&sin.sin_addr, hp->h_addr_list[0], - sizeof(sin.sin_addr)); - fprintf(stderr, "Trying %s...\n", inet_ntoa(sin.sin_addr)); + memcpy((caddr_t)&sockin.sin_addr, hp->h_addr_list[0], + sizeof(sockin.sin_addr)); + fprintf(stderr, "Trying %s...\n", inet_ntoa(sockin.sin_addr)); continue; } #endif /* !(defined(ultrix) || defined(sun)) */ @@ -662,7 +664,7 @@ k4cmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, ticket, service, realm, } /* set up the needed stuff for mutual auth */ - *faddr = sin; + *faddr = sockin; sin_len = sizeof (struct sockaddr_in); if (getsockname(s, (struct sockaddr *)laddr, &sin_len) < 0) { perror("getsockname"); @@ -762,25 +764,25 @@ int getport(alport) int *alport; { - struct sockaddr_in sin; + struct sockaddr_in sockin; int s; - int len = sizeof(sin); + int len = sizeof(sockin); s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) return (-1); - memset((char *) &sin, 0,sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; + memset((char *) &sockin, 0,sizeof(sockin)); + sockin.sin_family = AF_INET; + sockin.sin_addr.s_addr = INADDR_ANY; - if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0) { + if (bind(s, (struct sockaddr *)&sockin, sizeof (sockin)) >= 0) { if (alport) { - if (getsockname(s, (struct sockaddr *)&sin, &len) < 0) { + if (getsockname(s, (struct sockaddr *)&sockin, &len) < 0) { (void) close(s); return -1; } else { - *alport = ntohs(sin.sin_port); + *alport = ntohs(sockin.sin_port); } } return s; @@ -1072,10 +1074,11 @@ static int v5_des_write(fd, buf, len, secondary) #ifdef KRB5_KRB4_COMPAT static int -v4_des_read(fd, buf, len) +v4_des_read(fd, buf, len, secondary) int fd; char *buf; int len; +int secondary; { int nreturned = 0; krb5_ui_4 net_len, rd_len; @@ -1165,10 +1168,11 @@ int len; } static int -v4_des_write(fd, buf, len) +v4_des_write(fd, buf, len, secondary) int fd; char *buf; int len; +int secondary; { static char garbage_buf[8]; unsigned char *len_buf = (unsigned char *) des_outpkt; @@ -1224,7 +1228,7 @@ int len; char * strsave(sp) -char *sp; +const char *sp; { register char *ret; diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index 2b0ab7835..21651057c 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -71,6 +71,10 @@ char copyright[] = #include #include +#ifdef KRB5_KRB4_COMPAT +#include +#endif + #include "defines.h" #define RCP_BUFSIZ 4096 @@ -84,21 +88,23 @@ krb5_encrypt_block eblock; /* eblock for encrypt/decrypt */ krb5_context bsd_context; #ifdef KRB5_KRB4_COMPAT -#include Key_schedule v4_schedule; CREDENTIALS v4_cred; KTEXT_ST v4_ticket; MSG_DAT v4_msg_data; #endif -void v4_send_auth(), try_normal(); -char **save_argv(); +void v4_send_auth(char *, char *), try_normal(char **); +char **save_argv(int, char **); #ifndef HAVE_STRSAVE char *strsave(); #endif int rcmd_stream_write(), rcmd_stream_read(); -void usage(), sink(), source(), rsource(), verifydir(), answer_auth(); -int response(), hosteq(), okname(), susystem(); +void usage(void), sink(int, char **), + source(int, char **), rsource(char *, struct stat *), verifydir(char *), + answer_auth(char *, char *); +int response(void), hosteq(char *, char *), okname(char *), + susystem(char *); int encryptflag = 0; #ifndef UCB_RCP @@ -108,7 +114,7 @@ int encryptflag = 0; #endif /* KERBEROS */ int rem; -char *colon(); +char *colon(char *); int errs; krb5_sigtype lostconn(); int iamremote, targetshouldbedirectory; @@ -122,7 +128,9 @@ int port = 0; struct buffer { int cnt; char *buf; -} *allocbuf(); +}; + +struct buffer *allocbuf(struct buffer *, int, int); #define NULLBUF (struct buffer *) 0 diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index f1b70f68c..722163987 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -157,10 +157,10 @@ char copyright[] = #ifdef KERBEROS #include #include -#include "defines.h" #ifdef KRB5_KRB4_COMPAT #include #endif +#include "defines.h" #define RLOGIN_BUFSIZ 5120 @@ -264,6 +264,22 @@ krb5_sigtype lostpeer KRB5_PROTOTYPE((int)); #if __STDC__ int setsignal(int sig, krb5_sigtype (*act)()); #endif +static int read_wrapper(int fd, char *buf, int size, int *got_esc); +void try_normal(char **); +static void mode(int); +#ifdef POSIX_SIGNALS +static int reader(sigset_t *); +static void doit(sigset_t *); +#else +static int reader(int); +static void doit(int); +#endif +static int control(unsigned char *, int); +static void sendwindow(void); +static void stop(char), echo(char); +static void writer(void), done(int); +static int confirm_death (void); + /* to allow exits from signal handlers, without conflicting declarations */ static krb5_sigtype exit_handler() { @@ -739,7 +755,7 @@ main(argc, argv) -int confirm_death () +static int confirm_death () { char hostname[33]; char input; @@ -811,9 +827,11 @@ struct tchars deftc; struct tchars notc = { -1, -1, -1, -1, -1, -1 }; #endif -doit(oldmask) +static void doit(oldmask) #ifdef POSIX_SIGNALS sigset_t *oldmask; +#else + int oldmask; #endif { #ifdef POSIX_SIGNALS @@ -956,7 +974,7 @@ setsignal(sig, act) -done(status) +void done(status) int status; { #ifdef POSIX_SIGNALS @@ -1063,7 +1081,7 @@ int signo; * ~^Z suspend rlogin process. * ~^Y suspend rlogin process, but leave reader alone. */ -writer() +static void writer() { int n_read; char buf[1024]; @@ -1198,7 +1216,7 @@ writer() was a read error (other than EINTR) and errno is set appropriately. */ -int read_wrapper(fd,buf,size,got_esc) +static int read_wrapper(fd,buf,size,got_esc) int fd; char *buf; int size; @@ -1258,7 +1276,7 @@ int read_wrapper(fd,buf,size,got_esc) return return_length; } -echo(c) +static void echo(c) register char c; { char buf[8]; @@ -1281,7 +1299,7 @@ echo(c) -stop(cmdc) +static void stop(cmdc) char cmdc; { #ifdef POSIX_SIGNALS @@ -1337,7 +1355,7 @@ int signo; /* * Send the window size to the server via the magic escape */ -sendwindow() +static void sendwindow() { char obuf[4 + sizeof (struct winsize)]; struct winsize *wp = (struct winsize *)(obuf+4); @@ -1479,7 +1497,7 @@ void oob() quote rule so that binary data from the server does not confuse the client. */ -int control(cp, n) +static int control(cp, n) unsigned char *cp; int n; { @@ -1500,6 +1518,7 @@ int control(cp, n) /* * reader: read from remote: line -> 1 */ +static int reader(oldmask) #ifdef POSIX_SIGNALS sigset_t *oldmask; @@ -1612,7 +1631,8 @@ error: -mode(f) +static void mode(f) +int f; { #ifdef POSIX_TERMIOS struct termios newtty; @@ -1784,7 +1804,7 @@ prf(f, a1, a2, a3, a4, a5) void try_normal(argv) char **argv; { - register char *host; + register char *nhost; #ifdef POSIX_SIGNALS struct sigaction sa; sigset_t mask; @@ -1798,12 +1818,12 @@ void try_normal(argv) UCB_RLOGIN); fflush(stderr); - host = strrchr(argv[0], '/'); - if (host) - host++; + nhost = strrchr(argv[0], '/'); + if (nhost) + nhost++; else - host = argv[0]; - if (!strcmp(host, "rlogin")) + nhost = argv[0]; + if (!strcmp(nhost, "rlogin")) argv++; #ifdef POSIX_SIGNALS diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 88446b3b3..3c3b29a35 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -317,11 +317,11 @@ static int Pfd; #define VHANG_LAST /* vhangup must occur on close, not open */ #endif -void fatal(), fatalperror(), doit(), usage(), do_krb_login(), getstr(); -void protocol(); -int princ_maps_to_lname(), default_realm(); +void fatal(int, const char *), fatalperror(int, const char *), doit(int, struct sockaddr_in *), usage(void), do_krb_login(char *, char *), getstr(int, char *, int, char *); +void protocol(int, int); +int princ_maps_to_lname(krb5_principal, char *), default_realm(krb5_principal); krb5_sigtype cleanup(); -krb5_error_code recvauth(); +krb5_error_code recvauth(int *); /* There are two authentication related masks: * auth_ok and auth_sent. @@ -558,9 +558,9 @@ int main(argc, argv) if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) { syslog(LOG_ERR,"Can't get peer name of remote host: %m"); #ifdef STDERR_FILENO - fatal(STDERR_FILENO, "Can't get peer name of remote host", 1); + fatal(STDERR_FILENO, "Can't get peer name of remote host"); #else - fatal(2, "Can't get peer name of remote host", 1); + fatal(2, "Can't get peer name of remote host"); #endif } fd = 0; @@ -906,6 +906,7 @@ unsigned char oobdata[] = {TIOCPKT_WINDOW}; char oobdata[] = {0}; #endif +static int sendoob(fd, byte) int fd; char *byte; @@ -936,7 +937,7 @@ int sendoob(fd, byte) * in the data stream. For now, we are only willing to handle * window size changes. */ -int control(pty, cp, n) +static int control(pty, cp, n) int pty; unsigned char *cp; int n; @@ -1151,7 +1152,7 @@ krb5_sigtype cleanup() void fatal(f, msg) int f; - char *msg; + const char *msg; { char buf[512]; int out = 1 ; /* Output queue of f */ @@ -1190,7 +1191,7 @@ void fatal(f, msg) void fatalperror(f, msg) int f; - char *msg; + const char *msg; { char buf[512]; diff --git a/src/appl/bsd/krsh.c b/src/appl/bsd/krsh.c index c1741d856..c804a9535 100644 --- a/src/appl/bsd/krsh.c +++ b/src/appl/bsd/krsh.c @@ -64,10 +64,10 @@ char copyright[] = #ifdef KERBEROS #include #include -#include "defines.h" #ifdef KRB5_KRB4_COMPAT #include #endif +#include "defines.h" #endif /* KERBEROS */ #ifdef KRB5_KRB4_COMPAT @@ -103,7 +103,7 @@ CREDENTIALS v4_cred; int encrypt_flag = 0; char *krb_realm = (char *)0; -void try_normal(); +void try_normal(char **); #endif /* KERBEROS */ diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c index 2742066a7..d5b41e687 100644 --- a/src/appl/bsd/krshd.c +++ b/src/appl/bsd/krshd.c @@ -191,7 +191,10 @@ krb5_context bsd_context; char *srvtab = NULL; krb5_keytab keytab = NULL; krb5_ccache ccache = NULL; -void fatal(); +int default_realm(krb5_principal principal); +static int princ_maps_to_lname(krb5_principal principal, char *luser); + +void fatal(int, const char *); int require_encrypt = 0; int do_encrypt = 0; @@ -202,11 +205,15 @@ int maxhostlen = 0; int stripdomain = 1; int always_ip = 0; +static krb5_error_code recvauth(int netfd, struct sockaddr_in peersin, + int *valid_checksum); + #else /* !KERBEROS */ #define ARGSTR "RD:?" #endif /* KERBEROS */ + #ifndef HAVE_KILLPG #define killpg(pid, sig) kill(-(pid), (sig)) @@ -242,7 +249,8 @@ extern /*VARARGS1*/ void error(); -void usage(), getstr(), doit(); +void usage(void), getstr(int, char *, int, char *), + doit(int, struct sockaddr_in *); #ifdef __SCO__ /* sco has getgroups and setgroups but no initgroups */ @@ -1726,7 +1734,7 @@ void usage() -int princ_maps_to_lname(principal, luser) +static int princ_maps_to_lname(principal, luser) krb5_principal principal; char *luser; { @@ -1772,9 +1780,9 @@ int default_realm(principal) #define KRB_SENDAUTH_VERS "AUTHV0.1" /* MUST be KRB_SENDAUTH_VLEN chars */ -krb5_error_code -recvauth(netf, peersin, valid_checksum) - int netf; +static krb5_error_code +recvauth(netfd, peersin, valid_checksum) + int netfd; struct sockaddr_in peersin; int *valid_checksum; { @@ -1798,7 +1806,7 @@ recvauth(netf, peersin, valid_checksum) *valid_checksum = 0; len = sizeof(laddr); - if (getsockname(netf, (struct sockaddr *)&laddr, &len)) { + if (getsockname(netfd, (struct sockaddr *)&laddr, &len)) { exit(1); } @@ -1815,7 +1823,7 @@ recvauth(netf, peersin, valid_checksum) if (status = krb5_auth_con_init(bsd_context, &auth_context)) return status; - if (status = krb5_auth_con_genaddrs(bsd_context, auth_context, netf, + if (status = krb5_auth_con_genaddrs(bsd_context, auth_context, netfd, KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR)) return status; @@ -1840,7 +1848,7 @@ recvauth(netf, peersin, valid_checksum) } #ifdef KRB5_KRB4_COMPAT - status = krb5_compat_recvauth_version(bsd_context, &auth_context, &netf, + status = krb5_compat_recvauth_version(bsd_context, &auth_context, &netfd, NULL, /* Specify daemon principal */ 0, /* no flags */ keytab, /* normally NULL to use v5srvtab */ @@ -1855,7 +1863,7 @@ recvauth(netf, peersin, valid_checksum) &auth_sys, /* which authentication system*/ &v4_kdata, 0, &version); #else - status = krb5_recvauth_version(bsd_context, &auth_context, &netf, + status = krb5_recvauth_version(bsd_context, &auth_context, &netfd, NULL, /* daemon principal */ 0, /* no flags */ keytab, /* normally NULL to use v5srvtab */ @@ -1869,15 +1877,15 @@ recvauth(netf, peersin, valid_checksum) /* * clean up before exiting */ - getstr(netf, locuser, sizeof(locuser), "locuser"); - getstr(netf, cmdbuf, sizeof(cmdbuf), "command"); - getstr(netf, remuser, sizeof(locuser), "remuser"); + getstr(netfd, locuser, sizeof(locuser), "locuser"); + getstr(netfd, cmdbuf, sizeof(cmdbuf), "command"); + getstr(netfd, remuser, sizeof(locuser), "remuser"); } return status; } - getstr(netf, locuser, sizeof(locuser), "locuser"); - getstr(netf, cmdbuf, sizeof(cmdbuf), "command"); + getstr(netfd, locuser, sizeof(locuser), "locuser"); + getstr(netfd, cmdbuf, sizeof(cmdbuf), "command"); #ifdef KRB5_KRB4_COMPAT if (auth_sys == KRB5_RECVAUTH_V4) { @@ -1904,13 +1912,13 @@ recvauth(netf, peersin, valid_checksum) kcmd_proto = KCMD_UNKNOWN_PROTOCOL; if (version.length != 9) - fatal (netf, "bad application version length"); + fatal (netfd, "bad application version length"); if (!memcmp (version.data, "KCMDV0.1", 9)) kcmd_proto = KCMD_OLD_PROTOCOL; if (!memcmp (version.data, "KCMDV0.2", 9)) kcmd_proto = KCMD_NEW_PROTOCOL; - getstr(netf, remuser, sizeof(locuser), "remuser"); + getstr(netfd, remuser, sizeof(locuser), "remuser"); if ((status = krb5_unparse_name(bsd_context, ticket->enc_part2->client, &kremuser))) @@ -1930,7 +1938,7 @@ recvauth(netf, peersin, valid_checksum) if (chksumbuf == 0) goto error_cleanup; - if (getsockname(netf, (struct sockaddr *) &adr, &adr_length) != 0) + if (getsockname(netfd, (struct sockaddr *) &adr, &adr_length) != 0) goto error_cleanup; sprintf(chksumbuf,"%u:", ntohs(adr.sin_port)); @@ -1964,14 +1972,14 @@ recvauth(netf, peersin, valid_checksum) status = krb5_auth_con_getremotesubkey (bsd_context, auth_context, &key); if (status) - fatal (netf, "Server can't get session subkey"); + fatal (netfd, "Server can't get session subkey"); if (!key && do_encrypt && kcmd_proto == KCMD_NEW_PROTOCOL) - fatal (netf, "No session subkey sent"); + fatal (netfd, "No session subkey sent"); if (key && kcmd_proto == KCMD_OLD_PROTOCOL) { #ifdef HEIMDAL_FRIENDLY key = 0; #else - fatal (netf, "Session subkey not allowed in old kcmd protocol"); + fatal (netfd, "Session subkey not allowed in old kcmd protocol"); #endif } if (key == 0) @@ -1983,7 +1991,7 @@ recvauth(netf, peersin, valid_checksum) * key here, and we do not want krb5_free_ticket() to destroy it. */ ticket->enc_part2->session = 0; - if ((status = krb5_read_message(bsd_context, (krb5_pointer)&netf, + if ((status = krb5_read_message(bsd_context, (krb5_pointer)&netfd, &inbuf))) { error("Error reading message: %s\n", error_message(status)); exit(1); @@ -2018,7 +2026,7 @@ recvauth(netf, peersin, valid_checksum) void fatal(f, msg) int f; - char *msg; + const char *msg; { char buf[512]; #ifndef POSIX_TERMIOS -- 2.26.2