Subject: bin/1292: rexecd setlogin fix
To: None <gnats-bugs@gnats.netbsd.org>
From: James Jegers <jimj@miller.cs.uwm.edu>
List: netbsd-bugs
Date: 07/28/1995 11:51:06
>Number:         1292
>Category:       bin
>Synopsis:       rexed should set the login name
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 28 13:05:01 1995
>Last-Modified:
>Originator:     James Jegers
>Organization:

>Release:        Current as of Jul 5<NetBSD-current source date>
>Environment:

System: NetBSD jimj.home.edu 1.0A NetBSD 1.0A (JIMJ) #4: Fri Jul 28 09:42:32 CDT 1995 jimj@jimj.home.edu:/usr/src/sys/arch/i386/compile/JIMJ i386

>Description:
	I run rexec from another machine to fire off an xterm on my screen.
	When I do this the xterm runs but my login id is not current.
	it comes up as root instead of me(the one who rexed'd in)
>How-To-Repeat:

>Fix:
	add the below line to rexecd/rexec.c similar to how it's done in rshd.
                                                                               
                                                                              
        if (*pwd->pw_shell == '\0')                                            
                pwd->pw_shell = _PATH_BSHELL;                                  
        if (f > 2)                                                             
                (void) close(f);                                               
-->     setlogin(pwd->pw_name);                                                
        (void) setgid((gid_t)pwd->pw_gid);                                     
        initgroups(pwd->pw_name, pwd->pw_gid);                                 
        (void) setuid((uid_t)pwd->pw_uid);                                     
        (void)strcat(path, _PATH_DEFPATH);                                     
                                                                               

>Audit-Trail:
>Unformatted: