Indeed and setgid happens here:

29977:  ksh93 -p /var/tmp/pcred/Test.ksh
 ffffffff7f0c80e8 setgid   (32)
 ffffffff7e635758 sh_argopts (1001025b0, ffffffff7fffeaa8, 0, ffffffff7e2ec388, 
ffffffff7e7a4b00, ffffffff7e7a0000) + a18
 ffffffff7e640914 sh_init (3, ffffffff7fffeaa8, 0, ffffffff7e7a3140, 10010aa00, 
ffffffff7e7a0000) + 654
 ffffffff7e657de8 sh_main (3, ffffffff7fffeaa8, 0, 18, 124900, 0) + 40
 0000000100000d58 main (3, ffffffff7fffeaa8, ffffffff7fffeac8, 1f3ee8, 1c80, 
10000) + 44
 0000000100000cfc _start (0, 0, 0, 0, 0, 0) + 17c

and not in sh_init() where SHOPT_P_SUID is tested.

I also found a different problem; when I start a set-gid shell script with


(ksh linked to ksh93)

#!/bin/ksh -p

It works.

But when I tryL

#!/bin/ksh93 -p

I get:

/usr/bin/ksh93: syntax error at line 1: `(' unexpected


And this is what truss says:

105:        *** SGID: rgid/egid/sgid = 0 / 320 / 320  ***
105:    execve("/usr/bin/ksh93", 0xFFBFEC8C, 0xFFBFEC9C)  argc = 3
105:     argv: /usr/bin/ksh93 -p /dev/fd/3
105:    execve("/usr/bin/sparcv9/ksh93", 0xFFBFEC8C, 0xFFBFEC9C)  argc = 3
105:     argv: /usr/bin/ksh93 -p /dev/fd/3
105:    execve("/bin/sh", 0xFFFFFFFF7FFFEAA8, 0xFFFFFFFF7FFFEAC8)  argc = 3
105:        *** SGID: rgid/egid/sgid = 320 / 320 / 320  ***
105:     argv: xterm /usr/bin/ksh93 /dev/fd/3

Where did that xterm came from and why is /bin/sh executed?

(the xterm was clearly taken from "_").


I see where this came from; my shell doesn't use $_ but the dtlogin 
shell does set it and it sets it to the last command (/.../xterm).  This
confuses ksh93 (unsetting it or setting it not to ksh)

        % env _=/usr/bin/ksh93 ./test    
        foo
    *** SGID: rgid/egid/sgid = 0 / 320 / 320  ***
execve("/usr/bin/ksh93", 0xFFBFFF34, 0xFFBFFF44)  argc = 3
 argv: /usr/bin/ksh93 -p /dev/fd/3
 envp: _=/bin/ksh93
execve("/usr/bin/sparcv9/ksh93", 0xFFBFFF34, 0xFFBFFF44)  argc = 3
 argv: /usr/bin/ksh93 -p /dev/fd/3
 envp: _=/bin/ksh93
foo

        % env - ./test
        /usr/bin/ksh93: syntax error at line 1: `(' unexpected
    *** SGID: rgid/egid/sgid = 0 / 320 / 320  ***
execve("/usr/bin/ksh93", 0xFFBFFF4C, 0xFFBFFF5C)  argc = 3
 argv: /usr/bin/ksh93 -p /dev/fd/3
 envp:
execve("/usr/bin/sparcv9/ksh93", 0xFFBFFF4C, 0xFFBFFF5C)  argc = 3
 argv: /usr/bin/ksh93 -p /dev/fd/3
 envp:
execve("/bin/sh", 0xFFFFFFFF7FFFFEB8, 0xFFFFFFFF7FFFFED8)  argc = 3
    *** SGID: rgid/egid/sgid = 320 / 320 / 320  ***
 argv: ksh93 /usr/bin/ksh93 /dev/fd/3
 envp:
/usr/bin/ksh93: syntax error at line 1: `(' unexpected


Perhaps someone can explain what happens here?

Casper


Reply via email to