On Wednesday 24 December 2008 12:46, Robert P. J. Day wrote:
> On Wed, 24 Dec 2008, Denys Vlasenko wrote:
> 
> > On Wednesday 24 December 2008 10:03, Alexander Kriegisch wrote:
> > > > Unlike bash, ash does not have anything like ~/.bashrc,
> > > > which could be useful here.
> > >
> > > My BusyBox version is 1.9.0 and in it Ash supports ~/.profile as well as
> > > /etc/profile. So unless this has been refactored out of BB, it should
> > > work. I use it every day.
> >
> > Yes, you use it as a LOGIN shell:
> >
> >         if (isloginsh) { <----------------------
> >                 state = 1;
> >                 read_profile("/etc/profile");
> >  state1:
> >                 state = 2;
> >                 read_profile(".profile");
> >         }
> >
> > And ash is a login shell if it has an -l or --login option
> > on its command line, or its argv[0] starts with dash.
> >
> > Neither of this is true in the case we discuss.
> >
> > I not only read the code, I also verified it with strace.
> 
>   ah, so when it's invoked with "telnetd -l /bin/sh", that's not a
> login shell.  and adding a "-" would solve the problem?

Nope. telnetd has no special code to remove that leading dash.
It will try to execve("-/bin/sh", { "-/bin/sh", ... }),
and that will fail.

You want to do execve("/bin/sh", { "-/bin/sh", ... })
instead.

But anyway, if you can change your telnetd command line and add that '-',
then you may as well run "ash -l" or even a script.sh along the lines of

#!/bin/sh
export PATH=....

exec /bin/sh -l "$@"


--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to