Re: Bug #23053
Turbo Fredriksson <turbo@tripnet.se> writes:
> What if I do it the '{user|group}add' way when I change the files?
> (I haven't looked into it yet, but...). I prefer not to start doing
> systemcall's, exec's etc, if I can avoid it...
YOU DON'T! You *HAVE* to use the passwd provided interfaces to
/etc/{group,passwd,shadow} if your program is going to be in Debian.
a) Are you so sure of your programming ability and knowledge that you
think you can reproduce the safety and soundness of the passwd
tools? (BTW: if you only just thought of locking, the answer to
the question is a big fat no)
b) The principle that you don't muck with files not owned by your
directly is very important. It provides an abstraction layer.
(Completely unrelastic example, but it's realism is irrelevant):
The passwd file format could change and adduser wouldn't break.
Why? Because it calls useradd and useradd knows the format of the
passwd file. If it didn't adduser would have to be updated along
with passwd whenever the passwd file format changed. By bypassing
the provided interface you wreck that abstraction layer.
I don't know or care what you have against using system()[1], but you
really have no choice. Anything else is against Debian policy and
210% broken.
[1] It can hardly be speed. C vs perl? And any perl version of
useradd will have to do numerous spawn's anyway, I'd imagine. What
are the technical (as opposed to emotive) reasons?
--
James
~Yawn And Walk North~
--
To UNSUBSCRIBE, email to debian-mentors-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: