🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by ed Fri, 26 Sep 1986 18:30
tip doesn't set uid correctly in children
#1688
Author: ed
Date: Fri, 26 Sep 1986 18:30
70 lines
2183 bytes
From: ed@fred.MTXINU (Ed Gould)

Description:
	Tip does not set the uid correctly in the child process
	when it forks.
Repeat-By:
	Invoke tip and use ~s for a shell escape.  The shell will complain
	because the real end effective uid's are not the same.
Fix:
	Whenever tip forks, the real and effective uid and gid in the
	child should be set to the real id's from the time tip
	was invoked.  Apply the following diff to effect the fix.

	*** /usr/src/usr.bin/tip/cmds.c	Tue Aug 26 18:10:31 1986
	--- cmds.c.new			Fri Sep 26 10:21:36 1986
	***************
	*** 187,192 ****
	--- 187,194 ----
		} else {
			register int f;
	  
	+ 		setregid(gid, gid);
	+ 		setreuid(uid, uid);
			dup2(pdes[0], 0);
			close(pdes[0]);
			for (f = 3; f < 20; f++)
	***************
	*** 448,453 ****
	--- 450,457 ----
		} else {
			register int i;
	  
	+ 		setregid(gid, gid);
	+ 		setreuid(uid, uid);
			dup2(FD, 1);
			for (i = 3; i < 20; i++)
				close(i);
	***************
	*** 501,506 ****
	--- 505,512 ----
		} else {
			register int i;
	  
	+ 		setregid(gid, gid);
	+ 		setreuid(uid, uid);
			dup2(FD, 3);
			dup2(3, 4);
			for (i = 5; i < 20; i++)
	***************
	*** 541,546 ****
	--- 547,554 ----
			signal(SIGQUIT, SIG_DFL);
			return;
		} else {
	+ 		setregid(gid, gid);
	+ 		setreuid(uid, uid);
			signal(SIGQUIT, SIG_DFL);
			signal(SIGINT, SIG_DFL);
			if ((cp = rindex(value(SHELL), '/')) == NULL)
	***************
	*** 794,799 ****
	--- 802,809 ----
		}
		sprintf(cmdbuf, "echo %s", name);
		if ((pid = vfork()) == 0) {
	+ 		setregid(gid, gid);
	+ 		setreuid(uid, uid);
			Shell = value(SHELL);
			if (Shell == NOSTR)
				Shell = "/bin/sh";
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads