diff options
author | markm <markm@FreeBSD.org> | 2000-01-09 08:31:47 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-01-09 08:31:47 +0000 |
commit | ca616c603d9e06e51c9e23fab7536acbdac58331 (patch) | |
tree | 20a735799ecd3b90df122d0a8042762dd62c6b0e /crypto/kerberosIV/appl/bsd | |
parent | fe83e8abf357ee11114856a5278bb38431a9517c (diff) | |
download | FreeBSD-src-ca616c603d9e06e51c9e23fab7536acbdac58331.zip FreeBSD-src-ca616c603d9e06e51c9e23fab7536acbdac58331.tar.gz |
Clean import of KTH Kerberos (eBones) v1.0.
Diffstat (limited to 'crypto/kerberosIV/appl/bsd')
-rw-r--r-- | crypto/kerberosIV/appl/bsd/bsd_locl.h | 9 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/forkpty.c | 15 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/klogin.c | 49 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/login.c | 14 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/login_fbtab.c | 6 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/osfc2.c | 9 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/rcmd_util.c | 15 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/rcp.c | 21 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/rlogin.c | 6 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/rlogind.c | 4 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/rsh.c | 6 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/rshd.c | 10 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/stty_default.c | 9 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/su.c | 21 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/tty.c | 9 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/bsd/utmp_login.c | 9 |
16 files changed, 85 insertions, 127 deletions
diff --git a/crypto/kerberosIV/appl/bsd/bsd_locl.h b/crypto/kerberosIV/appl/bsd/bsd_locl.h index 2731f03..e39bc36 100644 --- a/crypto/kerberosIV/appl/bsd/bsd_locl.h +++ b/crypto/kerberosIV/appl/bsd/bsd_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: bsd_locl.h,v 1.109.2.1 1999/07/22 03:13:49 assar Exp $ */ +/* $Id: bsd_locl.h,v 1.111 1999/12/02 16:58:28 joda Exp $ */ #define LOGALL #define KERBEROS diff --git a/crypto/kerberosIV/appl/bsd/forkpty.c b/crypto/kerberosIV/appl/bsd/forkpty.c index 0ab7ef2..891fb91 100644 --- a/crypto/kerberosIV/appl/bsd/forkpty.c +++ b/crypto/kerberosIV/appl/bsd/forkpty.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -40,7 +35,7 @@ #ifndef HAVE_FORKPTY -RCSID("$Id: forkpty.c,v 1.53.2.2 1999/08/19 13:37:16 assar Exp $"); +RCSID("$Id: forkpty.c,v 1.57 1999/12/02 16:58:28 joda Exp $"); /* Only CRAY is known to have problems with forkpty(). */ #if defined(CRAY) @@ -169,7 +164,7 @@ ptym_open_streams_flavor(char *pts_name, char *ptr1; if ((ptr1 = ptsname(fdm)) != NULL) /* Get slave's name */ /* Return name of slave */ - strcpy_truncate(pts_name, ptr1, pts_name_sz); + strlcpy(pts_name, ptr1, pts_name_sz); else { close(fdm); return(-4); @@ -268,7 +263,7 @@ ptym_open(char *pts_name, size_t pts_name_sz, int *streams_pty) char *p = _getpty(&fdm, O_RDWR, 0600, 1); if (p) { *streams_pty = 1; - strcpy_truncate (pts_name, p, pts_name_sz); + strlcpy (pts_name, p, pts_name_sz); return fdm; } } @@ -398,7 +393,7 @@ forkpty_truncate(int *ptrfdm, if (slave_name != NULL) /* Return name of slave */ - strcpy_truncate(slave_name, pts_name, slave_name_sz); + strlcpy(slave_name, pts_name, slave_name_sz); pid = fork(); if (pid < 0) diff --git a/crypto/kerberosIV/appl/bsd/klogin.c b/crypto/kerberosIV/appl/bsd/klogin.c index 41002dc..df21dbf 100644 --- a/crypto/kerberosIV/appl/bsd/klogin.c +++ b/crypto/kerberosIV/appl/bsd/klogin.c @@ -33,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: klogin.c,v 1.24 1999/03/15 13:34:12 bg Exp $"); +RCSID("$Id: klogin.c,v 1.27 1999/10/04 16:11:48 bg Exp $"); #ifdef KERBEROS @@ -53,52 +53,25 @@ multiple_get_tkt(char *name, int life, char *password) { + int ret; int n; char rlm[256]; -#define ERICSSON_COMPAT 1 -#ifdef ERICSSON_COMPAT - FILE *f; - f = fopen("/etc/krb.localrealms", "r"); - if (f != NULL) { - while (fgets(rlm, sizeof(rlm), f) != NULL) { - if (rlm[strlen(rlm) - 1] == '\n') - rlm[strlen(rlm) - 1] = '\0'; - - if (krb_get_pw_in_tkt(name, - instance, - rlm, - service, - realm, - life, - password) == KSUCCESS) { - fclose(f); - return KSUCCESS; - } - } - return krb_get_pw_in_tkt(name, - instance, - realm, - service, - realm, - life, - password); - } -#endif /* First try to verify against the supplied realm. */ - if (krb_get_pw_in_tkt(name, instance, realm, service, realm, life, password) - == KSUCCESS) + ret = krb_get_pw_in_tkt(name, instance, realm, service, realm, life, + password); + if(ret == KSUCCESS) return KSUCCESS; /* Verify all local realms, except the supplied realm. */ for (n = 1; krb_get_lrealm(rlm, n) == KSUCCESS; n++) - if (strcmp(rlm, realm) != 0) - if (krb_get_pw_in_tkt(name, instance, rlm,service, realm, life, password) - == KSUCCESS) + if (strcmp(rlm, realm) != 0) { + ret = krb_get_pw_in_tkt(name, instance, rlm,service, rlm,life, password); + if (ret == KSUCCESS) return KSUCCESS; + } - return KFAILURE; - + return ret; } /* @@ -194,7 +167,7 @@ klogin(struct passwd *pw, char *instance, char *localhost, char *password) if (chown(TKT_FILE, pw->pw_uid, pw->pw_gid) < 0) syslog(LOG_ERR, "chown tkfile (%s): %m", TKT_FILE); - strcpy_truncate(savehost, krb_get_phost(localhost), sizeof(savehost)); + strlcpy(savehost, krb_get_phost(localhost), sizeof(savehost)); #ifdef KLOGIN_PARANOID /* diff --git a/crypto/kerberosIV/appl/bsd/login.c b/crypto/kerberosIV/appl/bsd/login.c index 702c5ff..0d29ebe 100644 --- a/crypto/kerberosIV/appl/bsd/login.c +++ b/crypto/kerberosIV/appl/bsd/login.c @@ -45,7 +45,7 @@ #include <sys/capability.h> #endif -RCSID("$Id: login.c,v 1.120.2.2 1999/09/02 08:55:26 joda Exp $"); +RCSID("$Id: login.c,v 1.125 1999/11/30 19:24:01 bg Exp $"); #ifdef OTP #include <otp.h> @@ -225,7 +225,7 @@ main(int argc, char **argv) fflag = hflag = pflag = rflag = 0; uid = getuid(); - while ((ch = getopt(argc, argv, "a:d:fh:pr:")) != EOF) + while ((ch = getopt(argc, argv, "a:d:fh:pr:")) != -1) switch (ch) { case 'a': if (strcmp (optarg, "none") == 0) @@ -250,7 +250,7 @@ main(int argc, char **argv) if (uid) errx(1, "-h option: %s", strerror(EPERM)); hflag = 1; - strcpy_truncate(full_hostname, + strlcpy(full_hostname, optarg, sizeof(full_hostname)); if (domain && (p = strchr(optarg, '.')) && @@ -275,7 +275,7 @@ main(int argc, char **argv) exit(1); } rflag = 1; - strcpy_truncate(full_hostname, + strlcpy(full_hostname, optarg, sizeof(full_hostname)); if (domain && (p = strchr(optarg, '.')) && @@ -383,7 +383,7 @@ main(int argc, char **argv) badlogin(tbuf); failures = 0; } - strcpy_truncate(tbuf, username, sizeof(tbuf)); + strlcpy(tbuf, username, sizeof(tbuf)); pwd = paranoid_getpwnam (username); @@ -654,7 +654,7 @@ main(int argc, char **argv) * that LD_* and IFS are never preserved. */ if (term[0] == '\0') - strcpy_truncate(term, stypeof(tty), sizeof(term)); + strlcpy(term, stypeof(tty), sizeof(term)); /* set up a somewhat censored environment. */ sysv_newenv(argc, argv, pwd, term, pflag); #ifdef KERBEROS @@ -950,7 +950,7 @@ checknologin(void) static void dolastlog(int quiet) { -#if defined(HAVE_LASTLOG_H) || defined(HAVE_LOGIN_H) || defined(SYSV_SHADOW) +#if defined(HAVE_LASTLOG_H) || defined(HAVE_LOGIN_H) struct lastlog ll; int fd; diff --git a/crypto/kerberosIV/appl/bsd/login_fbtab.c b/crypto/kerberosIV/appl/bsd/login_fbtab.c index f831909..3aa5e4c 100644 --- a/crypto/kerberosIV/appl/bsd/login_fbtab.c +++ b/crypto/kerberosIV/appl/bsd/login_fbtab.c @@ -58,7 +58,7 @@ #include "bsd_locl.h" -RCSID("$Id: login_fbtab.c,v 1.13 1999/01/14 00:37:59 assar Exp $"); +RCSID("$Id: login_fbtab.c,v 1.14 1999/09/16 20:37:24 assar Exp $"); void login_protect (char *, char *, int, uid_t, gid_t); void login_fbtab (char *tty, uid_t uid, gid_t gid); @@ -126,7 +126,7 @@ login_protect(char *table, char *path, int mask, uid_t uid, gid_t gid) if (chown(path, uid, gid) && errno != ENOENT) syslog(LOG_ERR, "%s: chown(%s): %m", table, path); } else { - strcpy_truncate (buf, path, sizeof(buf)); + strlcpy (buf, path, sizeof(buf)); if (sizeof(buf) > pathlen) buf[pathlen - 2] = '\0'; /* Solaris evidently operates on the directory as well */ @@ -142,7 +142,7 @@ login_protect(char *table, char *path, int mask, uid_t uid, gid_t gid) while ((ent = readdir(dir)) != 0) { if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0) { - strcpy_truncate (buf + pathlen - 1, + strlcpy (buf + pathlen - 1, ent->d_name, sizeof(buf) - (pathlen + 1)); login_protect(table, buf, mask, uid, gid); diff --git a/crypto/kerberosIV/appl/bsd/osfc2.c b/crypto/kerberosIV/appl/bsd/osfc2.c index 78f2e6e..fbfd742 100644 --- a/crypto/kerberosIV/appl/bsd/osfc2.c +++ b/crypto/kerberosIV/appl/bsd/osfc2.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -37,7 +32,7 @@ */ #include "bsd_locl.h" -RCSID("$Id: osfc2.c,v 1.1 1998/09/28 11:47:36 joda Exp $"); +RCSID("$Id: osfc2.c,v 1.2 1999/12/02 16:58:28 joda Exp $"); int do_osfc2_magic(uid_t uid) diff --git a/crypto/kerberosIV/appl/bsd/rcmd_util.c b/crypto/kerberosIV/appl/bsd/rcmd_util.c index 1884133..1dfb46d 100644 --- a/crypto/kerberosIV/appl/bsd/rcmd_util.c +++ b/crypto/kerberosIV/appl/bsd/rcmd_util.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: rcmd_util.c,v 1.17 1997/09/24 21:14:23 assar Exp $"); +RCSID("$Id: rcmd_util.c,v 1.19 1999/12/02 16:58:28 joda Exp $"); int get_login_port(int kerberos, int encryption) @@ -130,9 +125,15 @@ static struct { int speed; int bps; } conv[] = { #ifdef B19200 {B19200, 19200}, #endif +#ifdef EXTA + {EXTA, 19200}, +#endif #ifdef B38400 {B38400, 38400}, #endif +#ifdef EXTB + {EXTB, 38400}, +#endif #ifdef B57600 {B57600, 57600}, #endif diff --git a/crypto/kerberosIV/appl/bsd/rcp.c b/crypto/kerberosIV/appl/bsd/rcp.c index 39fd36e..be87097 100644 --- a/crypto/kerberosIV/appl/bsd/rcp.c +++ b/crypto/kerberosIV/appl/bsd/rcp.c @@ -33,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: rcp.c,v 1.49 1999/07/06 03:17:58 assar Exp $"); +RCSID("$Id: rcp.c,v 1.52 1999/11/16 16:54:16 bg Exp $"); /* Globals */ static char dst_realm_buf[REALM_SZ]; @@ -41,7 +41,9 @@ static char *dest_realm = NULL; static int use_kerberos = 1; static int doencrypt = 0; -#define OPTIONS "dfKk:prtx" +#define OPTIONS "dfKk:prtxl:" + +static char *user_name = NULL; /* Given as -l option. */ static int errs, rem; static struct passwd *pwd; @@ -146,11 +148,11 @@ run_err(const char *fmt, ...) va_start(args, fmt); ++errs; #define RCPERR "\001rcp: " - strcpy_truncate (errbuf, RCPERR, sizeof(errbuf)); + strlcpy (errbuf, RCPERR, sizeof(errbuf)); vsnprintf (errbuf + strlen(errbuf), sizeof(errbuf) - strlen(errbuf), fmt, args); - strcat_truncate (errbuf, "\n", sizeof(errbuf)); + strlcat (errbuf, "\n", sizeof(errbuf)); des_write (rem, errbuf, strlen(errbuf)); if (!iamremote) vwarnx(fmt, args); @@ -490,7 +492,7 @@ toremote(char *targ, int argc, char **argv) exit(1); } else { thost = argv[argc - 1]; - tuser = NULL; + tuser = user_name; } for (i = 0; i < argc - 1; i++) { @@ -854,6 +856,8 @@ tolocal(int argc, char **argv) #else host = argv[i]; suser = pwd->pw_name; + if (user_name) + suser = user_name; #endif } else { *host++ = 0; @@ -937,14 +941,14 @@ main(int argc, char **argv) fflag = tflag = 0; - while ((ch = getopt(argc, argv, OPTIONS)) != EOF) + while ((ch = getopt(argc, argv, OPTIONS)) != -1) switch(ch) { /* User-visible flags. */ case 'K': use_kerberos = 0; break; case 'k': dest_realm = dst_realm_buf; - strcpy_truncate(dst_realm_buf, optarg, REALM_SZ); + strlcpy(dst_realm_buf, optarg, REALM_SZ); break; case 'x': doencrypt = 1; @@ -968,6 +972,9 @@ main(int argc, char **argv) iamremote = 1; tflag = 1; break; + case 'l': + user_name = optarg; + break; case '?': default: usage(); diff --git a/crypto/kerberosIV/appl/bsd/rlogin.c b/crypto/kerberosIV/appl/bsd/rlogin.c index 5bc6196..d057ede 100644 --- a/crypto/kerberosIV/appl/bsd/rlogin.c +++ b/crypto/kerberosIV/appl/bsd/rlogin.c @@ -36,7 +36,7 @@ */ #include "bsd_locl.h" -RCSID("$Id: rlogin.c,v 1.65 1999/03/13 21:13:54 assar Exp $"); +RCSID("$Id: rlogin.c,v 1.67 1999/11/13 06:13:02 assar Exp $"); CREDENTIALS cred; Key_schedule schedule; @@ -556,7 +556,7 @@ main(int argc, char **argv) } #define OPTIONS "8DEKLde:k:l:xp:" - while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != EOF) + while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1) switch(ch) { case '8': eight = 1; @@ -579,7 +579,7 @@ main(int argc, char **argv) break; case 'k': dest_realm = dst_realm_buf; - strcpy_truncate(dest_realm, optarg, REALM_SZ); + strlcpy(dest_realm, optarg, REALM_SZ); break; case 'l': user = optarg; diff --git a/crypto/kerberosIV/appl/bsd/rlogind.c b/crypto/kerberosIV/appl/bsd/rlogind.c index d36df92..927ffc5 100644 --- a/crypto/kerberosIV/appl/bsd/rlogind.c +++ b/crypto/kerberosIV/appl/bsd/rlogind.c @@ -42,7 +42,7 @@ #include "bsd_locl.h" -RCSID("$Id: rlogind.c,v 1.107.2.1 1999/07/22 03:14:39 assar Exp $"); +RCSID("$Id: rlogind.c,v 1.109 1999/11/25 05:27:38 assar Exp $"); extern int __check_rhosts_file; @@ -319,7 +319,7 @@ main(int argc, char **argv) openlog("rlogind", LOG_PID | LOG_CONS, LOG_AUTH); opterr = 0; - while ((ch = getopt(argc, argv, ARGSTR)) != EOF) + while ((ch = getopt(argc, argv, ARGSTR)) != -1) switch (ch) { case 'D': no_delay = 1; diff --git a/crypto/kerberosIV/appl/bsd/rsh.c b/crypto/kerberosIV/appl/bsd/rsh.c index be2dfea..87fe1fe 100644 --- a/crypto/kerberosIV/appl/bsd/rsh.c +++ b/crypto/kerberosIV/appl/bsd/rsh.c @@ -33,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: rsh.c,v 1.41 1999/06/17 18:49:18 assar Exp $"); +RCSID("$Id: rsh.c,v 1.43 1999/11/13 06:13:34 assar Exp $"); CREDENTIALS cred; Key_schedule schedule; @@ -205,7 +205,7 @@ main(int argc, char **argv) } #define OPTIONS "+8KLde:k:l:np:wx" - while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != EOF) + while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1) switch(ch) { case 'K': use_kerberos = 0; @@ -223,7 +223,7 @@ main(int argc, char **argv) break; case 'k': dest_realm = dst_realm_buf; - strcpy_truncate(dest_realm, optarg, REALM_SZ); + strlcpy(dest_realm, optarg, REALM_SZ); break; case 'n': nflag = nfork = 1; diff --git a/crypto/kerberosIV/appl/bsd/rshd.c b/crypto/kerberosIV/appl/bsd/rshd.c index 1a30793..ed91feb 100644 --- a/crypto/kerberosIV/appl/bsd/rshd.c +++ b/crypto/kerberosIV/appl/bsd/rshd.c @@ -42,7 +42,7 @@ #include "bsd_locl.h" -RCSID("$Id: rshd.c,v 1.58 1999/06/17 18:49:43 assar Exp $"); +RCSID("$Id: rshd.c,v 1.60 1999/11/13 06:13:53 assar Exp $"); extern char *__rcmd_errstr; /* syslog hook from libc/net/rcmd.c. */ extern int __check_rhosts_file; @@ -82,7 +82,7 @@ main(int argc, char *argv[]) openlog("rshd", LOG_PID | LOG_ODELAY, LOG_DAEMON); opterr = 0; - while ((ch = getopt(argc, argv, OPTIONS)) != EOF) + while ((ch = getopt(argc, argv, OPTIONS)) != -1) switch (ch) { case 'a': break; @@ -565,13 +565,13 @@ doit(struct sockaddr_in *fromp) setgid((gid_t)pwd->pw_gid); initgroups(pwd->pw_name, pwd->pw_gid); setuid((uid_t)pwd->pw_uid); - strcat_truncate(homedir, pwd->pw_dir, sizeof(homedir)); + strlcat(homedir, pwd->pw_dir, sizeof(homedir)); /* Need to prepend path with BINDIR (/usr/athena/bin) to find rcp */ snprintf(path, sizeof(path), "PATH=%s:%s", BINDIR, _PATH_DEFPATH); - strcat_truncate(shell, pwd->pw_shell, sizeof(shell)); - strcat_truncate(username, pwd->pw_name, sizeof(username)); + strlcat(shell, pwd->pw_shell, sizeof(shell)); + strlcat(username, pwd->pw_name, sizeof(username)); cp = strrchr(pwd->pw_shell, '/'); if (cp) cp++; diff --git a/crypto/kerberosIV/appl/bsd/stty_default.c b/crypto/kerberosIV/appl/bsd/stty_default.c index b7112c1..0135823 100644 --- a/crypto/kerberosIV/appl/bsd/stty_default.c +++ b/crypto/kerberosIV/appl/bsd/stty_default.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: stty_default.c,v 1.6 1997/04/01 08:17:17 joda Exp $"); +RCSID("$Id: stty_default.c,v 1.7 1999/12/02 16:58:28 joda Exp $"); #include <termios.h> diff --git a/crypto/kerberosIV/appl/bsd/su.c b/crypto/kerberosIV/appl/bsd/su.c index d0da21d..cb24591 100644 --- a/crypto/kerberosIV/appl/bsd/su.c +++ b/crypto/kerberosIV/appl/bsd/su.c @@ -33,7 +33,7 @@ #include "bsd_locl.h" -RCSID ("$Id: su.c,v 1.66 1999/03/11 13:57:58 joda Exp $"); +RCSID ("$Id: su.c,v 1.70 1999/11/13 06:14:11 assar Exp $"); #ifdef SYSV_SHADOW #include "sysv_shadow.h" @@ -46,8 +46,9 @@ static int koktologin (char *name, char *realm, char *toname); static int chshell (char *sh); /* Handle '-' option after all the getopt options */ -#define ARGSTR "Kflmi:" +#define ARGSTR "Kflmti:" +int destroy_tickets = 0; static int use_kerberos = 1; static char *root_inst = "root"; @@ -66,7 +67,7 @@ main (int argc, char **argv) set_progname (argv[0]); asme = asthem = fastlogin = 0; - while ((ch = getopt (argc, argv, ARGSTR)) != EOF) + while ((ch = getopt (argc, argv, ARGSTR)) != -1) switch ((char) ch) { case 'K': use_kerberos = 0; @@ -82,13 +83,16 @@ main (int argc, char **argv) asme = 1; asthem = 0; break; + case 't': + destroy_tickets = 1; + break; case 'i': root_inst = optarg; break; case '?': default: fprintf (stderr, - "usage: su [-Kflm] [-i root-instance] [-] [login]\n"); + "usage: su [-Kflmt] [-i root-instance] [-] [login]\n"); exit (1); } /* Don't handle '-' option with getopt */ @@ -127,7 +131,7 @@ main (int argc, char **argv) errx (1, "strdup: out of memory"); if (asme) { if (pwd->pw_shell && *pwd->pw_shell) { - strcpy_truncate (shellbuf, pwd->pw_shell, sizeof(shellbuf)); + strlcpy (shellbuf, pwd->pw_shell, sizeof(shellbuf)); shell = shellbuf; } else { shell = _PATH_BSHELL; @@ -282,6 +286,8 @@ main (int argc, char **argv) if (code != KSUCCESS && code != KDC_PR_UNKNOWN) warnx ("afsklog: %s", krb_get_err_text (code)); } + if (destroy_tickets) + dest_tkt (); execv (shell, np); warn ("execv(%s)", shell); if (getuid () == 0) { @@ -408,7 +414,7 @@ kerberos (char *username, char *user, int uid) dest_tkt (); return (1); } - strcpy_truncate (savehost, krb_get_phost (hostname), sizeof (savehost)); + strlcpy (savehost, krb_get_phost (hostname), sizeof (savehost)); kerno = krb_mk_req (&ticket, "rcmd", savehost, lrealm, 33); @@ -452,7 +458,8 @@ kerberos (char *username, char *user, int uid) return (1); } } - fprintf (stderr, "Don't forget to kdestroy before exiting the shell.\n"); + if (!destroy_tickets) + fprintf (stderr, "Don't forget to kdestroy before exiting the shell.\n"); return (0); } diff --git a/crypto/kerberosIV/appl/bsd/tty.c b/crypto/kerberosIV/appl/bsd/tty.c index 3192426..2a903db 100644 --- a/crypto/kerberosIV/appl/bsd/tty.c +++ b/crypto/kerberosIV/appl/bsd/tty.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: tty.c,v 1.2 1997/05/25 01:14:22 assar Exp $"); +RCSID("$Id: tty.c,v 1.3 1999/12/02 16:58:28 joda Exp $"); /* * Clean the tty name. Return a pointer to the cleaned version. diff --git a/crypto/kerberosIV/appl/bsd/utmp_login.c b/crypto/kerberosIV/appl/bsd/utmp_login.c index 8c1a2d3..d2879fe 100644 --- a/crypto/kerberosIV/appl/bsd/utmp_login.c +++ b/crypto/kerberosIV/appl/bsd/utmp_login.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "bsd_locl.h" -RCSID("$Id: utmp_login.c,v 1.15 1999/03/29 17:57:16 joda Exp $"); +RCSID("$Id: utmp_login.c,v 1.16 1999/12/02 16:58:29 joda Exp $"); #ifdef HAVE_UTMP_H void |