Hello bug-bash,

I've just come across a strange problem. It's connected with
restricted mode of bash program.
When I invoke bash like this: /bin/bash -r it runs correctly into
restricted mode:

   [EMAIL PROTECTED]:/$ /bin/bash -r
   bash: SHELL: readonly variable
   bash: PATH: readonly variable
   [EMAIL PROTECTED]:/$ cd
   bash: cd: restricted
   [EMAIL PROTECTED]:/$

It works fine when I run it as rbash too

   [EMAIL PROTECTED]:/# ln -s /bin/bash /bin/rbash
   [EMAIL PROTECTED]:/$ /bin/rbash
   [EMAIL PROTECTED]:/$ cd
   rbash: cd: restricted

   
The problem is, when I try to set /bin/rbash as shell for any system
user. You see, when this user logs in, he's not restricted by any
means and he can do everything as if he run a standard bash shell.

I think, the problem is connected with a bad argv[0] comparison. It is,
when rbash is called directly from bash level, the argv[0] equals
"rbash", and when rbash is called at login, argv[0] is
equal to "-rbash". So i thought maybe there was something like this:

if ( strcmp(argv[0],"rbash") != 0 ) enter_restricted_mode();

there, in the source code. That would explain why bash doesnt enter
restricted mode while run at the begining of a terminal session,
i.e "rbash" != "-rbash".


I've noticed this behavior on Slackware 9, and 11 systems. Bash
version:
GNU bash, version 2.05b.0(1)-release (i486-slackware-linux-gnu)



I'm looking forward to your response. Thanks in advance.



-- 
Best regards,
 Dawid Gołuński (sk0lman)                mailto:[EMAIL PROTECTED]



_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to