Privsep and AIX: patch take 2

Darren Tucker dtucker at zip.com.au
Tue Jun 25 23:23:42 EST 2002


Darren Tucker wrote:
> 
> Ben Lindstrom wrote:
> >
> > Would anyone object if we dropped the TTY setting in usrinfo()  move it up
> > after the irix_*() call in do_setusercontext() and handle the case when
> > someone whines?  Hopefully by than OSF group will have a patch that we can
> > tap off of.
> >
> > If not can one of you two pass me a patch to do it?
> 
> Yep, that works on my 4.2.1 box!

Further testing shows that calling usrinfo the second time when PrivSep
is off doesn't set the TTY anyway. I don't know why. (Maybe you can only
call usrinfo once?)

You can wrap the first inside a if (use_privsep) and the second inside
if (!use_privsep) and that does set TTY but I agree with Ben: put it
back if it's needed.

New patch attached.

		-Daz.
-------------- next part --------------
Index: session.c
===================================================================
RCS file: /cvs/openssh/session.c,v
retrieving revision 1.204
diff -u -r1.204 session.c
--- session.c	23 Jun 2002 21:48:29 -0000	1.204
+++ session.c	25 Jun 2002 13:08:09 -0000
@@ -1152,6 +1152,8 @@
 void
 do_setusercontext(struct passwd *pw)
 {
+	char tty='\0';
+
 #ifdef HAVE_CYGWIN
 	if (is_winnt) {
 #else /* HAVE_CYGWIN */
@@ -1196,6 +1198,9 @@
 # if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
 		irix_setusercontext(pw);
 #  endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
+# ifdef _AIX
+		aix_usrinfo(pw, &tty, -1);
+# endif /* _AIX */
 		/* Permanently switch to the desired uid. */
 		permanently_set_uid(pw);
 #endif
@@ -1258,9 +1263,6 @@
 			do_motd();
 #else /* HAVE_OSF_SIA */
 		do_nologin(pw);
-# ifdef _AIX
-		aix_usrinfo(pw, s->tty, s->ttyfd);
-# endif /* _AIX */
 		do_setusercontext(pw);
 #endif /* HAVE_OSF_SIA */
 	}


More information about the openssh-unix-dev mailing list