bug-bash
[Top][All Lists]
Advanced

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

a bug in restricted bash mode?


From: Dawid Gołuński
Subject: a bug in restricted bash mode?
Date: Mon, 14 May 2007 18:18:21 +0200

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:

   address@hidden:/$ /bin/bash -r
   bash: SHELL: readonly variable
   bash: PATH: readonly variable
   address@hidden:/$ cd
   bash: cd: restricted
   address@hidden:/$

It works fine when I run it as rbash too

   address@hidden:/# ln -s /bin/bash /bin/rbash
   address@hidden:/$ /bin/rbash
   address@hidden:/$ 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:address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]