summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2002-01-15 19:25:55 +0000
committernectar <nectar@FreeBSD.org>2002-01-15 19:25:55 +0000
commit8d40c4c4ac90280188ef57d1133ff9a294aa2813 (patch)
tree1ea469f0e1ed869859adbac5c6399ca7862a25a3 /crypto
parent1ba2eb7fe92c58ce4857aa03773db05dc79feaba (diff)
parent8db4cdb3da4228a5d93635e43825e2e8a2f66db7 (diff)
downloadFreeBSD-src-8d40c4c4ac90280188ef57d1133ff9a294aa2813.zip
FreeBSD-src-8d40c4c4ac90280188ef57d1133ff9a294aa2813.tar.gz
This commit was generated by cvs2svn to compensate for changes in r89402,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/heimdal/appl/su/su.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/heimdal/appl/su/su.c b/crypto/heimdal/appl/su/su.c
index b43894b..7dc0c7a 100644
--- a/crypto/heimdal/appl/su/su.c
+++ b/crypto/heimdal/appl/su/su.c
@@ -138,7 +138,11 @@ krb5_verify(struct passwd *login_info, struct passwd *su_info,
#ifdef KRB5
krb5_error_code ret;
krb5_principal p;
+ char *login_name = NULL;
+#if defined(HAVE_GETLOGIN) && !defined(POSIX_GETLOGIN)
+ login_name = getlogin();
+#endif
ret = krb5_init_context (&context);
if (ret) {
#if 0
@@ -147,9 +151,11 @@ krb5_verify(struct passwd *login_info, struct passwd *su_info,
return 1;
}
+ if (login_name == NULL || strcmp (login_name, "root") == 0)
+ login_name = login_info->pw_name;
if (strcmp (su_info->pw_name, "root") == 0)
ret = krb5_make_principal(context, &p, NULL,
- login_info->pw_name,
+ login_name,
kerberos_instance,
NULL);
else
@@ -268,7 +274,6 @@ main(int argc, char **argv)
int i, optind = 0;
char *su_user;
struct passwd *su_info;
- char *login_user = NULL;
struct passwd *login_info;
struct passwd *pwd;
@@ -309,10 +314,6 @@ main(int argc, char **argv)
}
su_info = make_info(pwd);
-#if defined(HAVE_GETLOGIN) && !defined(POSIX_GETLOGIN)
- login_user = getlogin();
-#endif
- if(login_user == NULL || (pwd = getpwnam(login_user)) == NULL)
pwd = getpwuid(getuid());
if(pwd == NULL)
errx(1, "who are you?");
OpenPOWER on IntegriCloud