patch for zvt on hp-ux: please test



so after some fun and exciting debugging, i've got a patch which makes
zvt work on hp-ux.

i would really appreciate it if people with hp-ux and other non-linux
systems could test this patch.

i'll commit it friday if nobody objects.

thanks,
jacob
-- 
"The people who made the Macintosh produced a miracle, but that
 doesn't mean their code was wonderful." -- Bob Cringely
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-libs/configure.in,v
retrieving revision 1.241.4.31
diff -u -r1.241.4.31 configure.in
--- configure.in	2001/01/24 20:49:07	1.241.4.31
+++ configure.in	2001/03/07 23:27:12
@@ -208,7 +208,7 @@
     ])
 
 AC_CHECK_FUNCS(grantpt utmpxname utmpname getutmpx getutent getttyent)
-AC_CHECK_FUNCS(updwtmpx updwtmp fcntl flock strrchr seteuid setreuid)
+AC_CHECK_FUNCS(updwtmpx updwtmp fcntl flock strrchr seteuid setreuid setresuid)
 
 AC_CHECK_HEADER(stropts.h, AC_DEFINE(HAVE_STROPTS_H))
 AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-libs/ChangeLog,v
retrieving revision 1.463.4.40
diff -u -r1.463.4.40 ChangeLog
--- ChangeLog	2001/02/04 21:53:41	1.463.4.40
+++ ChangeLog	2001/03/07 23:27:12
@@ -1,3 +1,7 @@
+2001-03-07  jacob berkman  <jacob ximian com>
+
+	* configure.in: add check for setresuid
+
 2001-02-04  Simos Xenitellis  <simos hellug gr>
 
 	* gnome-data/gtk-events.soundlist, 
Index: zvt/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-libs/zvt/ChangeLog,v
retrieving revision 1.262.4.27
diff -u -r1.262.4.27 ChangeLog
--- zvt/ChangeLog	2001/03/05 22:15:54	1.262.4.27
+++ zvt/ChangeLog	2001/03/07 23:27:12
@@ -1,3 +1,14 @@
+2001-03-07  jacob berkman  <jacob ximian com>
+
+	* gnome-pty-helper.c (open_ptys): use setresuid() instead of
+	setreuid() if available.  this fixes gnome-terminal on hp-ux.
+
+	the call to setreuid() was added for hp-ux, so maybe it should be
+	removed.
+
+	* subshell.c: use the file descriptor passing semantics for sgi
+	also for hp-ux.
+
 2001-03-05  Stanislav Brabec  <utx penguin cz>
 
 	* zvtterm.h, zvtterm.c: New bit del_is_del, new function
Index: zvt/subshell.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/zvt/subshell.c,v
retrieving revision 1.35.6.2
diff -u -r1.35.6.2 subshell.c
--- zvt/subshell.c	2000/05/20 04:36:33	1.35.6.2
+++ zvt/subshell.c	2001/03/07 23:27:12
@@ -135,7 +135,7 @@
 	return socketpair (AF_UNIX, SOCK_STREAM, 0, fd);
 }
 
-#elif defined(__sgi) && !defined(HAVE_SENDMSG)
+#elif (defined(__sgi) || defined(__hpux__)) && !defined(HAVE_SENDMSG)
 
 /* 
  * IRIX 6.2 is like 4.3BSD; it will not have HAVE_SENDMSG set, 
Index: zvt/gnome-pty-helper.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/zvt/gnome-pty-helper.c,v
retrieving revision 1.49.4.6
diff -u -r1.49.4.6 gnome-pty-helper.c
--- zvt/gnome-pty-helper.c	2000/02/14 03:09:01	1.49.4.6
+++ zvt/gnome-pty-helper.c	2001/03/07 23:27:12
@@ -158,7 +158,7 @@
 	return 0;
 }
 
-#elif defined(__sgi) && !defined(HAVE_SENDMSG)
+#elif (defined(__sgi) || defined(__hpux__)) && !defined(HAVE_SENDMSG)
 
 /* 
  * IRIX 6.2 is like 4.3BSD; it will not have HAVE_SENDMSG set, 
@@ -488,8 +488,8 @@
 	int status, master_pty, slave_pty;
 	pty_info *p;
 	int result;
-	uid_t savedUid;
-	gid_t savedGid;
+	uid_t saved_uid;
+	gid_t saved_gid;
 	struct group *group_info;
 	struct termios term;
 	
@@ -502,16 +502,19 @@
 	init_term_with_defaults(&term);
 
 	/* root priveleges */
-	savedUid = geteuid();
-	savedGid = getegid();
+	saved_uid = geteuid();
+	saved_gid = getegid();
 	
 	/* drop privileges to the user level */
 #if defined(HAVE_SETEUID)
 	seteuid (pwent->pw_uid);
 	setegid (pwent->pw_gid);
+#elif defined(HAVE_SETRESUID)
+	setresuid (-1, pwent->pw_uid, -1);
+	setresgid (-1, pwent->pw_gid, -1);
 #elif defined(HAVE_SETREUID)
-	setreuid (savedUid, pwent->pw_uid);
-	setregid (savedGid, pwent->pw_gid);
+	setreuid (saved_uid, pwent->pw_uid);
+	setregid (saved_gid, pwent->pw_gid);
 #else
 #error "No means to drop privileges! Huge security risk! Won't compile."
 #endif
@@ -519,12 +522,15 @@
 	status = openpty (&master_pty, &slave_pty, term_name, &term, NULL);
 
 	/* Restore saved priveleges to root */
-#ifdef HAVE_SETEUID
-	seteuid (savedUid);
-	setegid (savedGid);
+#if defined(HAVE_SETEUID)
+	seteuid (saved_uid);
+	setegid (saved_gid);
+#elif defined(HAVE_SETRESUID)
+	setresuid (-1, saved_uid, -1);
+	setresgid (-1, saved_gid, -1);
 #elif defined(HAVE_SETREUID)
-	setreuid (pwent->pw_uid, savedUid);
-	setregid (pwent->pw_gid, savedGid);
+	setreuid (pwent->pw_uid, saved_uid);
+	setregid (pwent->pw_gid, saved_gid);
 #else
 #error "No means to raise privileges! Huge security risk! Won't compile."
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]