This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Here is the patch. Its my first one; so, please let me know if there is a problem. Thanks again for all of your help, J --- Dan Kegel <dank@kegel.com> wrote: > EJS wrote: > >>http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+login > >>says that USER isn't in the initial environment. > >>Maybe chrootshell should set it using > >>getpwuid(getuid()) > > > > > > getpwuid(getuid()) did the trick! Thanks Dan. > > Can you submit a patch? > - Dan > > > -- > Trying to get a job as a c++ developer? See > http://kegel.com/academy/getting-hired.html > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--- chrootshell.c.orig 2005-03-07 19:34:32.000000000 -0500
+++ chrootshell.c 2005-08-26 17:00:46.000000000 -0400
@@ -126,16 +126,11 @@
#ifdef DEBUG_PRINTS
fp = fopen("/var/log/chrootshell.log", "a");
#endif
- user = getenv("USER");
- if (!user)
- die("USER not set?!");
- logname = getenv("LOGNAME");
- if (logname && *logname && strcmp(user, logname))
- die("USER does not match LOGNAME\n");
- /* Look up user in outer /etc/passwd */
- pw = getpwnam(user);
+ pw = getpwuid(getuid());
if (!pw)
- die2("no such user %s\n", user);
+ die2("no such user id %s\n",(char *)getuid());
+ user = pw->pw_name;
+ logname = pw->pw_name;
shell = strrchr(pw->pw_shell, '/');
if (!shell)
die("shell contains no / ?");
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |