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

Re: Man gets to be su?



On Sun, Feb 20, 2000 at 09:42:42AM -0500, Ben Collins wrote:
> On Sun, Feb 20, 2000 at 03:37:33PM +0100, Fredrik Liljegren wrote:
> > I had an interresting experience today.  When requesting a manpage, it asked
> > me for my password!  Well, the man-command thought it was su!  Heres what
> > is:
> > ----------------------
> > eof@burrken:~$ man
> > What manual page do you want?
> > eof@burrken:~$ su
> > Password:
> > burrken:/home/eof# man
> > su: option requires an argument -- c
> 
> I just tried this exact thing and had no problem. Can I ask what version
> of kernel you are running? I had some weird similar problem running the
> latest 2.3.47-pre.

su here is a red herring, the problem occurs running man without an
argument as root.

The real problem is how the wrapper script handles an empty argument.

od:root:~# man
su: option requires an argument -- c
Usage: su [OPTS] [-] [username [ARGS]]
       -      make this a login shell
       -c, --commmand=<command>
              pass command to the invoked shell using its -c
              option
       -m, -p, --preserve-environment
              do not reset environment variables, and keep the
              same shell
       -s, --shell=<shell>
              use shell instead of the default in /etc/passwd
od:root:~# dpkg -l man-db | grep man-db
ii  man-db                  2.3.10-70               Display the on-line manual.
od:root:~# uname -a
Linux od 2.2.14 #1 Tue Jan 11 17:52:51 CST 2000 i486 unknown

od:root:~$ cat /usr/bin/man
#!/bin/sh -e
pgm=`basename $0`
edir=/usr/lib/man-db
cmd="${edir}/${pgm} ${1+$@}"
test -w /root && exec su nobody -c ${1+"$cmd"}
exec ${cmd}

od:root:~# su nobody -c
su: option requires an argument -- c
Usage: su [OPTS] [-] [username [ARGS]]
       -      make this a login shell
       -c, --commmand=<command>
              pass command to the invoked shell using its -c
              option
       -m, -p, --preserve-environment
              do not reset environment variables, and keep the
              same shell
       -s, --shell=<shell>
              use shell instead of the default in /etc/passwd

best,
Ron


Reply to: