* Makefile.in (ksu): Add $(KSU_LIBS) in case we need -lsecurity
authorTom Yu <tlyu@mit.edu>
Fri, 19 Feb 1999 03:31:52 +0000 (03:31 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 19 Feb 1999 03:31:52 +0000 (03:31 +0000)
* main.c (main): Add call to setluid() on systems that have it.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11186 dc483132-0cff-0310-8789-dd5450dbe970

src/clients/ksu/ChangeLog
src/clients/ksu/Makefile.in
src/clients/ksu/main.c

index e9a845487c07b9bccb31d53dc0a73a3e00c8b3ef..a18067bb6e1093fe97ddeaed82b0c8d2aea92fe7 100644 (file)
@@ -1,3 +1,9 @@
+Thu Feb 18 22:26:30 1999  Tom Yu  <tlyu@mit.edu>
+
+       * Makefile.in (ksu): Add $(KSU_LIBS) in case we need -lsecurity.
+
+       * main.c (main): Add call to setluid() on systems that have it.
+
 1998-11-13  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Makefile.in: Set the myfulldir and mydir variables (which are
index e8ab6d33ece31d9a758831fb608e216c1157b19b..b31a3f64138ef33d754fc3d10d466de367c11fb1 100644 (file)
@@ -8,6 +8,8 @@ CFLAGS = $(CCOPTS) $(DEFINES) $(DEFS) $(LOCALINCLUDE)
 PROG_LIBPATH=-L$(TOPLIBD)
 PROG_RPATH=$(KRB5_LIBDIR)
 
+KSU_LIBS=@KSU_LIBS@
+
 SRCS = \
        $(srcdir)/krb_auth_su.c \
        $(srcdir)/ccache.c \
@@ -24,7 +26,7 @@ OBJS = \
 all:: ksu
 
 ksu: $(OBJS) $(KRB5_BASE_DEPLIBS) $(UTIL_DEPLIB)
-       $(CC_LINK) -o $@ $(OBJS) $(UTIL_LIB) $(KRB5_BASE_LIBS)
+       $(CC_LINK) -o $@ $(OBJS) $(UTIL_LIB) $(KRB5_BASE_LIBS) $(KSU_LIBS)
 
 clean::
        $(RM) ksu
index 31a255cf3669821b680a330ce8c95967d4c9c63e..44c270350b6a06c2e912d04a4ac0247e74a781c5 100644 (file)
@@ -799,6 +799,18 @@ krb5_seteuid(0); /*So we have some chance of sweeping up*/
                                target_user, target_pwd->pw_uid); 
        }
 
+#ifdef HAVE_SETLUID
+       /*
+        * If we're on a system which keeps track of login uids, then
+        * set the login uid. If this fails this opens up a problem on DEC OSF
+        * with C2 enabled.
+        */
+       if (setluid((uid_t) pwd->pw_uid) < 0) {
+               perror("setuid");
+               sleepexit(1);
+       }
+#endif /* HAVE_SETLUID */
+
        if (setuid(target_pwd->pw_uid) < 0) {
                   perror("ksu: setuid");
                   sweep_up(ksu_context, use_source_cache, cc_target);