[cvs] bogofilter config.c,1.16,1.17

Matthias Andree matthias.andree at gmx.de
Sun Nov 10 14:27:23 CET 2002


relson at users.sourceforge.net writes:

> Update of /cvsroot/bogofilter/bogofilter
> In directory usw-pr-cvs1:/tmp/cvs-serv12647
>
> Modified Files:
> 	config.c 
> Log Message:
> Have read_config_file() return if environment variable HOME isn't defined.

No, sir. The system is in deep trouble if find_home(1) fails.

1. $HOME is defined at login time, see Single Unix Specification v2.
   So, if $HOME is missing, the environment is incomplete. Should not
   happen.

2. If $HOME is undefined, find_home(ANY) will fall back to retrieve
   information from the passwd data base (wherever the actual
   information is, is determined by nsswitch).


SuSE LINUX, ltrace, user information local:

$ ( unset HOME ; ltrace find_home.test 1 )
__libc_start_main(0x08048860, 2, 0xbffff304, 0x080485f4, 0x08048a90 <unfinished ...>
isdigit(49, 0x401f08e4, 0x40014ce4, 0xbffff304, 0xbffff2d8) = 2048
atoi(0xbffff4df, 0x401f08e4, 0x40014ce4, 0xbffff304, 0xbffff2d8) = 1
getenv("HOME")                                    = NULL
geteuid()                                         = 500
getpwuid(500, 0xbffff29c, 0x080488b8, 1, 0x401f08e4) = 0x401f2b90
puts("/home/emma"/home/emma
)                                = 11
exit(0 <unfinished ...>
+++ exited (status 0) +++


Solaris 8, sotruss, user information via NIS:

bash-2.05$ ( unset HOME ; sotruss ./find_home.test 1 )
find_home.test  ->       libc.so.1:*atexit(0xff3bc558, 0x0, 0x0)
find_home.test  ->       libc.so.1:*atexit(0x10d2c, 0xff0ba000, 0xff3bc558)
find_home.test  ->   libgcc_s.so.1:*__register_frame_info(0x20ff0, 0x20ff8, 0x4)
find_home.test  ->       libc.so.1:*isdigit(0x31, 0xffbefac1, 0xff0bc598)
find_home.test  ->       libc.so.1:*atoi(0xffbefac1, 0xffbefac1, 0xff0bc598)
find_home.test  ->       libc.so.1:*getenv(0x10da8, 0x0, 0x0)
find_home.test  ->       libc.so.1:*geteuid(0x0, 0xff0ba000, 0x0)
find_home.test  ->       libc.so.1:*getpwuid(0x219, 0x219, 0x0)
find_home.test  ->       libc.so.1:*puts(0x211c2, 0x1, 0x0)
/home/ma
find_home.test  ->       libc.so.1:*exit(0x0, 0xff0c118d, 0xff0c1184)
find_home.test  ->   libgcc_s.so.1:*__deregister_frame_info(0x20ff0, 0x8, 0x20fd4)


"It works."  So, if find_home fails, the program should exit right away,
because the user the software is running as has no passwd entry. The
entity who reported the "cannot find $HOME" problem should really check
their system. Again, something is hosed on the reporter's system;
bogofilter running under illicit user id or something.

I urge that we revert this change and put the exit(2) back in place, or
replace it by abort().

-- 
Matthias Andree



More information about the bogofilter-dev mailing list