From 45770d93d709fbeae92fc1ddb62e6da683280eeb Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 2 Aug 1999 20:16:07 +0000 Subject: [PATCH] Patches from Brad Thompson for building without krb4 compatibility git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11612 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 12 ++++++++++++ src/appl/bsd/kcmd.c | 2 +- src/appl/bsd/krshd.c | 22 +++++++++++++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index b0c1d4b2f..1a941cd53 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,15 @@ +1999-08-02 Ken Raeburn + and Brad Thompson + + Patches from Brad Thompson for building without krb4 + compatibility: + * krshd.c: Include sys/socket.h and netdb.h if KRB5_KRB4_COMPAT + isn't defined. + (doit): Cast pointer argument to getsockname. + (recvauth): Do krb4 stuff only if KRB5_KRB4_COMPAT is defined; + otherwise, skip it and call krb5_recvauth. + * kcmd.c (do_lencheck): Define even if !KRB5_KRB4_COMPAT. + 1999-07-26 Ken Raeburn * login.c (main): Fix typo in computing strncpy length for shell diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 701606548..6b0eafcde 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -130,8 +130,8 @@ static int v5_des_read(), v5_des_write(); static int v4_des_read(), v4_des_write(); static C_Block v4_session; static int right_justify; -static int do_lencheck; #endif +static int do_lencheck; kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, cred, seqno, server_seqno, laddr, faddr, authopts, anyport, suppress_err) diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c index a29d17a07..2a1391704 100644 --- a/src/appl/bsd/krshd.c +++ b/src/appl/bsd/krshd.c @@ -89,7 +89,7 @@ char copyright[] = #include #include #include -#ifndef KERBEROS +#if !defined(KERBEROS) || !defined(KRB5_KRB4_COMPAT) /* Ultrix doesn't protect it vs multiple inclusion, and krb.h includes it */ #include #endif @@ -120,7 +120,7 @@ char copyright[] = #endif #include -#ifndef KERBEROS +#if !defined(KERBEROS) || !defined(KRB5_KRB4_COMPAT) /* Ultrix doesn't protect it vs multiple inclusion, and krb.h includes it */ #include #endif @@ -639,7 +639,7 @@ void doit(f, fromp) { int sin_len = sizeof (struct sockaddr_in); - if (getsockname(f, &localaddr, &sin_len) < 0) { + if (getsockname(f, (struct sockaddr*)&localaddr, &sin_len) < 0) { perror("getsockname"); exit(1); } @@ -1771,8 +1771,10 @@ recvauth(netf, peersin, valid_checksum) char krb_vers[KRB_SENDAUTH_VLEN + 1]; int len; krb5_data inbuf; +#ifdef KRB5_KRB4_COMPAT char v4_instance[INST_SZ]; /* V4 Instance */ char v4_version[9]; +#endif krb5_authenticator *authenticator; krb5_ticket *ticket; krb5_rcache rcache; @@ -1792,7 +1794,9 @@ recvauth(netf, peersin, valid_checksum) #define SIZEOF_INADDR sizeof(struct in_addr) #endif +#ifdef KRB5_KRB4_COMPAT strcpy(v4_instance, "*"); +#endif if (status = krb5_auth_con_init(bsd_context, &auth_context)) return status; @@ -1821,6 +1825,7 @@ recvauth(netf, peersin, valid_checksum) if (status) return status; } +#ifdef KRB5_KRB4_COMPAT status = krb5_compat_recvauth(bsd_context, &auth_context, &netf, "KCMDV0.1", NULL, /* Specify daemon principal */ @@ -1836,6 +1841,15 @@ recvauth(netf, peersin, valid_checksum) &ticket, /* return ticket */ &auth_sys, /* which authentication system*/ &v4_kdata, 0, v4_version); +#else + status = krb5_recvauth(bsd_context, &auth_context, &netf, + "KCMDV0.1", + NULL, /* daemon principal */ + 0, /* no flags */ + keytab, /* normally NULL to use v5srvtab */ + &ticket); /* return ticket */ + auth_sys = KRB5_RECVAUTH_V5; +#endif if (status) { if (auth_sys == KRB5_RECVAUTH_V5) { @@ -1852,6 +1866,7 @@ recvauth(netf, peersin, valid_checksum) getstr(netf, locuser, sizeof(locuser), "locuser"); getstr(netf, cmdbuf, sizeof(cmdbuf), "command"); +#ifdef KRB5_KRB4_COMPAT if (auth_sys == KRB5_RECVAUTH_V4) { rcmd_stream_init_normal(); @@ -1870,6 +1885,7 @@ recvauth(netf, peersin, valid_checksum) return status; } +#endif /* KRB5_KRB4_COMPAT */ /* Must be V5 */ -- 2.26.2