Patches from Brad Thompson for building without krb4 compatibility
authorKen Raeburn <raeburn@mit.edu>
Mon, 2 Aug 1999 20:16:07 +0000 (20:16 +0000)
committerKen Raeburn <raeburn@mit.edu>
Mon, 2 Aug 1999 20:16:07 +0000 (20:16 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11612 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/bsd/ChangeLog
src/appl/bsd/kcmd.c
src/appl/bsd/krshd.c

index b0c1d4b2fef85883a5bff85355de77d0071f0064..1a941cd539cc5315678c1f11ff3473f1c366201c 100644 (file)
@@ -1,3 +1,15 @@
+1999-08-02  Ken Raeburn  <raeburn@mit.edu>
+       and Brad Thompson  <yak@mit.edu>
+
+       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  <raeburn@mit.edu>
 
        * login.c (main): Fix typo in computing strncpy length for shell
index 701606548706b87b144c79fffd427d762ed03fce..6b0eafcdeb53189aaa71a286c4ad455bd8e4760c 100644 (file)
@@ -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)
index a29d17a07a5a8cc19175a8906561c74ade305289..2a13917042a2e239c6838cf0eff52762706ed1a4 100644 (file)
@@ -89,7 +89,7 @@ char copyright[] =
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
-#ifndef KERBEROS
+#if !defined(KERBEROS) || !defined(KRB5_KRB4_COMPAT)
 /* Ultrix doesn't protect it vs multiple inclusion, and krb.h includes it */
 #include <sys/socket.h>
 #endif
@@ -120,7 +120,7 @@ char copyright[] =
 #endif
      
 #include <signal.h>
-#ifndef KERBEROS
+#if !defined(KERBEROS) || !defined(KRB5_KRB4_COMPAT)
 /* Ultrix doesn't protect it vs multiple inclusion, and krb.h includes it */
 #include <netdb.h>
 #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  */