=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/su/su.c,v retrieving revision 1.30 retrieving revision 1.31 diff -c -r1.30 -r1.31 *** src/usr.bin/su/su.c 1997/09/11 11:21:55 1.30 --- src/usr.bin/su/su.c 1998/03/25 21:27:27 1.31 *************** *** 1,4 **** ! /* $OpenBSD: su.c,v 1.30 1997/09/11 11:21:55 deraadt Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: su.c,v 1.31 1998/03/25 21:27:27 art Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. *************** *** 41,47 **** #ifndef lint /*static char sccsid[] = "from: @(#)su.c 5.26 (Berkeley) 7/6/91";*/ ! static char rcsid[] = "$OpenBSD: su.c,v 1.30 1997/09/11 11:21:55 deraadt Exp $"; #endif /* not lint */ #include --- 41,47 ---- #ifndef lint /*static char sccsid[] = "from: @(#)su.c 5.26 (Berkeley) 7/6/91";*/ ! static char rcsid[] = "$OpenBSD: su.c,v 1.31 1998/03/25 21:27:27 art Exp $"; #endif /* not lint */ #include *************** *** 95,101 **** uid_t ruid; int asme, ch, asthem, fastlogin, prio; enum { UNSET, YES, NO } iscsh = UNSET; ! char *user, *shell, *avshell, *username, **np; char shellbuf[MAXPATHLEN], avshellbuf[MAXPATHLEN]; asme = asthem = fastlogin = 0; --- 95,101 ---- uid_t ruid; int asme, ch, asthem, fastlogin, prio; enum { UNSET, YES, NO } iscsh = UNSET; ! char *user, *shell = NULL, *avshell, *username, **np; char shellbuf[MAXPATHLEN], avshellbuf[MAXPATHLEN]; asme = asthem = fastlogin = 0; *************** *** 144,150 **** errx(1, "who are you?"); if ((username = strdup(pwd->pw_name)) == NULL) err(1, "can't allocate memory"); ! if (asme) if (pwd->pw_shell && *pwd->pw_shell) { shell = strncpy(shellbuf, pwd->pw_shell, sizeof(shellbuf) - 1); shellbuf[sizeof(shellbuf) - 1] = '\0'; --- 144,150 ---- errx(1, "who are you?"); if ((username = strdup(pwd->pw_name)) == NULL) err(1, "can't allocate memory"); ! if (asme) { if (pwd->pw_shell && *pwd->pw_shell) { shell = strncpy(shellbuf, pwd->pw_shell, sizeof(shellbuf) - 1); shellbuf[sizeof(shellbuf) - 1] = '\0'; *************** *** 152,157 **** --- 152,158 ---- shell = _PATH_BSHELL; iscsh = NO; } + } /* get target login information, default to root */ user = *argv ? *argv : "root"; *************** *** 327,332 **** --- 328,335 ---- } #ifdef KERBEROS + int koktologin __P((char *, char *, char *)); + int kerberos(username, user, uid) char *username, *user; *************** *** 361,370 **** * the name of the person su'ing. Otherwise (non-root case), * we need to get a ticket for "yyy.", where yyy represents * the name of the person being su'd to, and the instance is null - * - * We should have a way to set the ticket lifetime, - * with a system default for root. */ kerno = krb_get_pw_in_tkt((uid == 0 ? username : user), (uid == 0 ? "root" : ""), lrealm, "krbtgt", lrealm, DEFAULT_TKT_LIFE, 0); --- 364,374 ---- * the name of the person su'ing. Otherwise (non-root case), * we need to get a ticket for "yyy.", where yyy represents * the name of the person being su'd to, and the instance is null */ + + printf("%s%s@%s's ", (uid == 0 ? username : user), + (uid == 0 ? ".root" : ""), lrealm); + fflush(stdout); kerno = krb_get_pw_in_tkt((uid == 0 ? username : user), (uid == 0 ? "root" : ""), lrealm, "krbtgt", lrealm, DEFAULT_TKT_LIFE, 0); *************** *** 436,441 **** --- 440,446 ---- return (0); } + int koktologin(name, realm, toname) char *name, *realm, *toname; {