From f1eee1d37f0cb7ed53497063f37b1c3fc3eef5a3 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Fri, 26 Mar 1999 04:15:57 +0000 Subject: [PATCH] * ftpd.c (login): Check that the luid is not the uid we want to change to prior to calling setluid() so that we can run as non-root. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11316 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftpd/ChangeLog | 6 ++++++ src/appl/gssftp/ftpd/ftpd.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 3c7727883..c84e77028 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 25 23:13:56 1999 Tom Yu + + * ftpd.c (login): Check that the luid is not the uid we want to + change to prior to calling setluid() so that we can run as + non-root. + Wed Mar 24 17:11:32 1999 Tom Yu * ftpcmd.y (urgsafe_getc): New function; like getc() except it diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index f880734a5..d4987affc 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -1093,7 +1093,8 @@ login(passwd) * set the login uid. If this fails this opens up a problem on DEC OSF * with C2 enabled. */ - if (setluid((uid_t)pw->pw_uid) < 0) { + if (((uid_t)getluid() != pw->pw_uid) + && setluid((uid_t)pw->pw_uid) < 0) { reply(550, "Can't set luid."); goto bad; } -- 2.26.2