[BUG] passwd file paths defined in multiple places

Tito farmatito at tiscali.it
Wed Jan 12 09:43:46 UTC 2011


On Wednesday 12 January 2011 09:51:57 walter harms wrote:
> 
> Am 11.01.2011 15:25, schrieb Tito:
> > form libbb.h
> > 
> > #define bb_path_passwd_file "/etc/passwd"
> > #define bb_path_shadow_file "/etc/shadow"
> > #define bb_path_gshadow_file "/etc/gshadow"
> > #define bb_path_group_file "/etc/group"
> > 
> > from pwd_grp.c
> > 
> > #ifndef _PATH_SHADOW
> > #define _PATH_SHADOW	"/etc/shadow"
> > #endif
> > #ifndef _PATH_PASSWD
> > #define _PATH_PASSWD	"/etc/passwd"
> > #endif
> > #ifndef _PATH_GROUP
> > #define _PATH_GROUP	"/etc/group"
> > #endif
> > 
> > 
> > the paths are defined in multiple places and 
> > with CONFIG_USE_BB_PWD_GRP=y
> > if you change them in libbb.h
> > the changes are not honoured in pwd_grp.c
> > SHould be consistent and defined in only one file
> > for example for testing purposes on local files like:
> > 
> > #ifdef DEBUG_PWD_GRP
> > #define bb_path_passwd_file "./passwd"
> > #define bb_path_shadow_file "./shadow"
> > #define bb_path_gshadow_file "./gshadow"
> > #define bb_path_group_file "./group"
> > #else
> > #define bb_path_passwd_file "/etc/passwd"
> > #define bb_path_shadow_file "/etc/shadow"
> > #define bb_path_gshadow_file "/etc/gshadow"
> > #define bb_path_group_file "/etc/group"
> > #endif
> > 
> > Denys what you think about that? 
> > 
> > Ciao,
> > Tito
> 
> Having path at two places this is clearly not clever. But since it
> will touch other tools too (crontab/crond come to my mind) it may be
> better to have one file for all.
> Unfortunately that means to replicate paths.h.
> 
> re,
>  wh
> 
> 
> 

Thinking more about it this makes sense only if we use  CONFIG_USE_BB_PWD_GRP=y
as when linking with a standard libc it will have it own definitions _PATH_SHADOW etc.
I think we should drop bb_path_*_file and use _PATH_*  instead and only define them
in case they are missing. Looks like a more consistent solution.

Ciao,
Tito


More information about the busybox mailing list