[Pkg-shadow-devel] [PATCH 3/5] Do not fail on missing files in /etc/, create them instead.

Dimitri John Ledkov dimitri.j.ledkov at intel.com
Mon Mar 30 09:54:06 UTC 2015


On 22 March 2015 at 06:06, Mike Frysinger <vapier at gentoo.org> wrote:
> On 20 Mar 2015 13:49, Dimitri John Ledkov wrote:
>> passwd, shadow, group, gshadow etc. can be managed via nss -
>> e.g. system default accounts can be specified using nss_altfiles,
>> rather than in /etc/. Thus despite having default accounts, these
>> files can be missing on disk and thus should be opened with O_CREATE
>> whenever they are attempted to be opened in O_RDWR modes.
> are there any cases after your change where pw_open is called w/O_RDWR and not
> O_CREAT ?  if not, might make sense to just change the API so O_RDWR implies
> file creation ...
> -mike

That seemed to be counter intuitive to me. Those flags are not defined
by shadow, but rather open(2) and O_RDWR without O_CREATE does not
create a file, if it does not exist.
We could define a macro SHADOW_O_RDWRCR (#) or some such, and use that
everywhere... imho specifying it explicitly is straight forward for
me, but maybe that's just me and some macro would be better.

(#) please suggest a better name



Open Source Technology Center
Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.

More information about the Pkg-shadow-devel mailing list