Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/krb4 merge krb4-1.1



details:   https://anonhg.NetBSD.org/src/rev/fc2f94a571c6
branches:  trunk
changeset: 515134:fc2f94a571c6
user:      assar <assar%NetBSD.org@localhost>
date:      Mon Sep 17 12:21:41 2001 +0000

description:
merge krb4-1.1

diffstat:

 crypto/dist/krb4/appl/bsd/rlogind.c       |   25 +-
 crypto/dist/krb4/appl/bsd/su.c            |   24 +-
 crypto/dist/krb4/appl/kip/kipd.c          |   10 +-
 crypto/dist/krb4/lib/auth/pam/pam.c       |    4 +-
 crypto/dist/krb4/lib/kadm/kadm_cli_wrap.c |   24 +-
 crypto/dist/krb4/lib/kadm/kadm_locl.h     |    8 +-
 crypto/dist/krb4/lib/kdb/krb_kdb_utils.c  |    6 +-
 crypto/dist/krb4/lib/krb/decomp_ticket.c  |    4 +-
 crypto/dist/krb4/lib/krb/encrypt_ktext.c  |    4 +-
 crypto/dist/krb4/lib/krb/get_krbrlm.c     |    6 +-
 crypto/dist/krb4/lib/krb/krb-protos.h     |   46 +-
 crypto/dist/krb4/lib/krb/krb_locl.h       |   10 +-
 crypto/dist/krb4/lib/krb/logging.c        |    8 +-
 crypto/dist/krb4/lib/krb/rd_priv.c        |    4 +-
 crypto/dist/krb4/lib/krb/str2key.c        |    4 +-
 crypto/dist/krb4/lib/krb/tf_util.c        |  798 ++++++++++++++++-------------
 16 files changed, 547 insertions(+), 438 deletions(-)

diffs (truncated from 1612 to 300 lines):

diff -r 61baee91744d -r fc2f94a571c6 crypto/dist/krb4/appl/bsd/rlogind.c
--- a/crypto/dist/krb4/appl/bsd/rlogind.c       Mon Sep 17 12:09:38 2001 +0000
+++ b/crypto/dist/krb4/appl/bsd/rlogind.c       Mon Sep 17 12:21:41 2001 +0000
@@ -42,7 +42,7 @@
 
 #include "bsd_locl.h"
 
-RCSID("$Id: rlogind.c,v 1.2 2001/01/11 03:01:28 lukem Exp $");
+RCSID("$Id: rlogind.c,v 1.3 2001/09/17 12:21:41 assar Exp $");
 
 extern int __check_rhosts_file;
 
@@ -310,11 +310,12 @@
 main(int argc, char **argv)
 {
     struct sockaddr_in from;
-    int ch, fromlen, on;
+    socklen_t fromlen;
+    int ch, on;
     int interactive = 0;
     int portnum = 0;
 
-    set_progname(argv[0]);
+    setprogname(argv[0]);
 
     openlog("rlogind", LOG_PID, LOG_AUTH);
 
@@ -423,7 +424,9 @@
        fatal(f, "Remote host requires Kerberos authentication", 0);
 
     alarm(0);
-    inaddr2str (fromp->sin_addr, hostname, sizeof(hostname));
+    getnameinfo_verified ((struct sockaddr *)fromp, sizeof(*fromp),
+                         hostname, sizeof(hostname),
+                         NULL, 0, 0);
 
     if (use_kerberos) {
        retval = do_krb_login(fromp);
@@ -452,7 +455,7 @@
     }
 #ifndef NOENCRYPTION
     if (doencrypt)
-       des_enc_write(f, SECURE_MESSAGE,
+       bsd_des_enc_write(f, SECURE_MESSAGE,
                      strlen(SECURE_MESSAGE),
                      schedule, &kdata->session);
     else
@@ -669,7 +672,7 @@
        if (FD_ISSET(f, &ibits)) {
 #ifndef NOENCRYPTION
            if (doencrypt)
-               fcc = des_enc_read(f, fibuf,
+               fcc = bsd_des_enc_read(f, fibuf,
                                   sizeof(fibuf),
                                   schedule, &kdata->session);
            else
@@ -735,7 +738,7 @@
        if ((FD_ISSET(f, &obits)) && pcc > 0) {
 #ifndef NOENCRYPTION
            if (doencrypt)
-               cc = des_enc_write(f, pbp, pcc, schedule, &kdata->session);
+               cc = bsd_des_enc_write(f, pbp, pcc, schedule, &kdata->session);
            else
 #endif
                cc = write(f, pbp, pcc);
@@ -808,7 +811,7 @@
     len = strlen(bp);
 #ifndef NOENCRYPTION
     if (doencrypt)
-       des_enc_write(f, buf, bp + len - buf, schedule, &kdata->session);
+       bsd_des_enc_write(f, buf, bp + len - buf, schedule, &kdata->session);
     else
 #endif
        write(f, buf, bp + len - buf);
@@ -919,8 +922,10 @@
     k_getsockinst(0, instance, sizeof(instance));
 
     if (doencrypt) {
-       rc = sizeof(faddr);
-       if (getsockname(0, (struct sockaddr *)&faddr, &rc))
+       socklen_t faddr_len;
+
+       faddr_len = sizeof(faddr);
+       if (getsockname(0, (struct sockaddr *)&faddr, &faddr_len))
            return (-1);
        authopts = KOPT_DO_MUTUAL;
        rc = krb_recvauth(
diff -r 61baee91744d -r fc2f94a571c6 crypto/dist/krb4/appl/bsd/su.c
--- a/crypto/dist/krb4/appl/bsd/su.c    Mon Sep 17 12:09:38 2001 +0000
+++ b/crypto/dist/krb4/appl/bsd/su.c    Mon Sep 17 12:21:41 2001 +0000
@@ -33,7 +33,7 @@
 
 #include "bsd_locl.h"
 
-RCSID ("$Id: su.c,v 1.2 2001/01/11 03:01:28 lukem Exp $");
+RCSID ("$Id: su.c,v 1.3 2001/09/17 12:21:41 assar Exp $");
 
 #ifdef SYSV_SHADOW
 #include "sysv_shadow.h"
@@ -65,7 +65,7 @@
     char shellbuf[MaxPathLen], avshellbuf[MaxPathLen];
     char *realm = NULL;
 
-    set_progname (argv[0]);
+    setprogname (argv[0]);
 
     if (getuid() == 0)
        use_kerberos = 0;
@@ -260,18 +260,18 @@
            if (environ == NULL)
                err (1, "malloc");
            environ[0] = NULL;
-           setenv ("PATH", _PATH_DEFPATH, 1);
+           esetenv ("PATH", _PATH_DEFPATH, 1);
            if (t)
-               setenv ("TERM", t, 1);
+               esetenv ("TERM", t, 1);
            if (k)
-               setenv ("KRBTKFILE", k, 1);
+               esetenv ("KRBTKFILE", k, 1);
            if (chdir (pwd->pw_dir) < 0)
                errx (1, "no directory");
        }
        if (asthem || pwd->pw_uid)
-           setenv ("USER", pwd->pw_name, 1);
-       setenv ("HOME", pwd->pw_dir, 1);
-       setenv ("SHELL", shell, 1);
+           esetenv ("USER", pwd->pw_name, 1);
+       esetenv ("HOME", pwd->pw_dir, 1);
+       esetenv ("SHELL", shell, 1);
     }
     if (iscsh == YES) {
        if (fastlogin)
@@ -356,8 +356,12 @@
     if (lrealm != NULL) {
        allowed = koktologin (username, lrealm, user) == 0;
     } else {
-       for (n = 1; !allowed && krb_get_lrealm (tmp_realm, n) == KSUCCESS; ++n)
+       for (n = 1;
+            !allowed && (kerno = krb_get_lrealm (tmp_realm, n)) == KSUCCESS;
+            ++n)
            allowed = koktologin (username, tmp_realm, user) == 0;
+       if (kerno != KSUCCESS)
+           return (1);
        lrealm = tmp_realm;
     }
     if (!allowed && !uid) {
@@ -370,7 +374,7 @@
              "%s_%s_to_%s_%u", TKT_ROOT, username, user,
             (unsigned) getpid ());
 
-    setenv ("KRBTKFILE", krbtkfile, 1);
+    esetenv ("KRBTKFILE", krbtkfile, 1);
     krb_set_tkt_string (krbtkfile);
     /*
      * Set real as well as effective ID to 0 for the moment,
diff -r 61baee91744d -r fc2f94a571c6 crypto/dist/krb4/appl/kip/kipd.c
--- a/crypto/dist/krb4/appl/kip/kipd.c  Mon Sep 17 12:09:38 2001 +0000
+++ b/crypto/dist/krb4/appl/kip/kipd.c  Mon Sep 17 12:21:41 2001 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
  * All rights reserved.
  * 
@@ -33,7 +33,7 @@
 
 #include "kip.h"
 
-RCSID("$Id: kipd.c,v 1.2 2001/01/11 03:01:29 lukem Exp $");
+RCSID("$Id: kipd.c,v 1.3 2001/09/17 12:21:41 assar Exp $");
 
 static int
 recv_conn (int sock, des_cblock *key, des_key_schedule schedule,
@@ -44,7 +44,7 @@
      AUTH_DAT auth;
      char instance[INST_SZ];
      struct sockaddr_in thisaddr, thataddr;
-     int addrlen;
+     socklen_t addrlen;
      char version[KRB_SENDAUTH_VLEN + 1];
      u_char ok = 0;
      struct passwd *passwd;
@@ -162,8 +162,8 @@
     int port;
     int optind = 0;
 
-    set_progname (argv[0]);
-    roken_openlog(__progname, LOG_PID, LOG_DAEMON);
+    setprogname (argv[0]);
+    roken_openlog(getprogname(), LOG_PID, LOG_DAEMON);
 
     if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
                &optind))
diff -r 61baee91744d -r fc2f94a571c6 crypto/dist/krb4/lib/auth/pam/pam.c
--- a/crypto/dist/krb4/lib/auth/pam/pam.c       Mon Sep 17 12:09:38 2001 +0000
+++ b/crypto/dist/krb4/lib/auth/pam/pam.c       Mon Sep 17 12:21:41 2001 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
  * All rights reserved.
  * 
@@ -33,7 +33,7 @@
 
 #ifdef HAVE_CONFIG_H
 #include<config.h>
-RCSID("$Id: pam.c,v 1.2 2001/01/11 03:00:31 lukem Exp $");
+RCSID("$Id: pam.c,v 1.3 2001/09/17 12:21:41 assar Exp $");
 #endif
 
 #include <stdio.h>
diff -r 61baee91744d -r fc2f94a571c6 crypto/dist/krb4/lib/kadm/kadm_cli_wrap.c
--- a/crypto/dist/krb4/lib/kadm/kadm_cli_wrap.c Mon Sep 17 12:09:38 2001 +0000
+++ b/crypto/dist/krb4/lib/kadm/kadm_cli_wrap.c Mon Sep 17 12:21:41 2001 +0000
@@ -29,7 +29,7 @@
 
 #include "kadm_locl.h"
 
-RCSID("$Id: kadm_cli_wrap.c,v 1.2 2000/12/29 02:52:35 assar Exp $");
+RCSID("$Id: kadm_cli_wrap.c,v 1.3 2001/09/17 12:21:41 assar Exp $");
 
 static Kadm_Client client_parm;
 
@@ -165,6 +165,8 @@
        int retval;
        char tmp[4];
 
+       *ret_dat = NULL;
+       *ret_siz = 0;
        dlen = (u_int16_t) dat_len;
 
        if (dat_len != (int)dlen)
@@ -193,6 +195,8 @@
 
        if ((retval = krb_net_read(client_parm.admin_fd,  *ret_dat,
                                   dlen) != dlen)) {
+           free(*ret_dat);
+           *ret_dat = NULL;
            if (retval < 0)
                return(errno);          /* XXX */
            else
@@ -238,6 +242,9 @@
        int tmp;
        void *tmp_ptr;
 
+       *ret_dat = NULL;
+       *ret_siz = 0;
+
        act_st = malloc(KADM_VERSIZE); /* verstr stored first */
        if (act_st == NULL) {
            clear_secrets ();
@@ -276,9 +283,7 @@
 #ifdef NOENCRYPTION
        cksum = 0;
 #else
-       cksum = des_quad_cksum(priv_pak,
-                              0, priv_len, 0,
-                              &sess_key);
+       cksum = des_quad_cksum(priv_pak, 0, priv_len, 0, &sess_key);
 #endif
        
        retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
@@ -309,7 +314,7 @@
            clear_secrets();
            return retdat;
        }
-#define RET_N_FREE2(r) {free(*ret_dat); clear_secrets(); return(r);}
+#define RET_N_FREE2(r) {free(*ret_dat); *ret_dat = NULL; clear_secrets(); return(r);}
 
        /* first see if it's a YOULOUSE */
        if ((*ret_siz >= KADM_VERSIZE) &&
@@ -410,8 +415,6 @@
            msg[0]=0;
          *pw_msg=msg;
        }
-
-       if (ret_st)
            free(ret_st);
        
        kadm_cli_disconn();
@@ -481,8 +484,8 @@
            /* ret_st has vals */
            if (stream_to_vals(ret_st, vals, ret_sz) < 0)
                retc = KADM_LENGTH_ERROR;
-           free(ret_st);
        }
+       free(ret_st);
        kadm_cli_disconn();
        return(retc);
 }
@@ -539,8 +542,8 @@
            /* ret_st has vals */
            if (stream_to_vals(ret_st, vals2, ret_sz) < 0)
                retc = KADM_LENGTH_ERROR;
-           free(ret_st);
        }
+       free(ret_st);



Home | Main Index | Thread Index | Old Index