Commit Graph

579 Commits

Author SHA1 Message Date
pjd
1b62958b4e When pidptr was passed as NULL to pidfile_open(3), we were returning
EAGAIN/EWOULDBLOCK when another daemon was running and had the pidfile open.
We should return EEXIST in that case, fix it.

Reported by:	Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:	jhb, Dirk Engling <erdgeist@erdgeist.org>
MFC after:	1 week
2013-03-14 20:22:52 +00:00
db
97292df51d commit correct tested fix for gr_util.c
Approved by:	theraven
2013-03-09 13:30:06 +00:00
db
f96d697f81 Cleanup gr_add() so it does not leak mem
This is part of ongoing work on sbin/pw

M    libutil.h
M    gr_util.c

Approved by:	theraven
2013-03-07 19:00:00 +00:00
ru
7399e0afc2 Fixed documented prototype of kinfo_getproc(3). 2013-03-01 07:39:14 +00:00
mjg
89fb0f2543 libutil: fix typo in comment for gr_fini.
Submitted by:	Christoph Mallon <christoph.mallon gmx.de>
2013-01-13 22:08:18 +00:00
mjg
fecf48554c libutil: utilize strsep instead of strcat in a loop in gr_make
Submitted by:	Christoph Mallon <christoph.mallon gmx.de>
2013-01-13 21:28:47 +00:00
mjg
c942285112 libutil: move group_line_format into the scop of its only user.
Submitted by:	Christoph Mallon <christoph.mallon gmx.de>
2013-01-13 21:26:57 +00:00
mjg
15b9700547 libutil: eliminate 'found' variable in gr_equal
Submitted by:	Christoph Mallon <christoph.mallon gmx.de>
2013-01-13 21:25:43 +00:00
bapt
9db4d3200a Simplify pointing dst after the end of all the gr_mem pointers in newgr
Submitted by:	pjd
Reviewed by:	db
2012-12-28 20:44:10 +00:00
bapt
3c6bd22efe errno = ENOMEM was supposed to be removed not return (NULL);
Submitted by:	gcooper
2012-12-28 20:30:04 +00:00
bapt
83035e8984 malloc() sets errno to ENOMEM already.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2012-12-28 20:21:14 +00:00
bapt
b69ff2af2f Do not leave parts of the new group uninitialized in gr_dup().
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Reported by:	pjd
2012-12-28 20:19:54 +00:00
bapt
9708a96be5 avoid arithmetic on uintptr_t
Submitted by:	pjd
Reviewed by:	jilles
2012-12-27 20:47:34 +00:00
bapt
85f7f7664e cast to uintptr_t to properly calculate offset
Reported by:	mdf
Submitted by:	db
2012-12-27 20:31:12 +00:00
bapt
85a7bc8863 Add O_CLOEXEC to flopen
Requested by:	jilles
2012-12-27 20:24:44 +00:00
bapt
2f0af9e7e5 gr_dup: simplify duplication of group
Submitted by:	db
2012-12-27 19:33:43 +00:00
bapt
247c2a4086 - Clean up previous gr_add use malloc instead of calloc
- Fix tinderbox error

Submitted by:	db
2012-12-27 16:51:29 +00:00
bapt
b63557c001 New gr_add function to provide a clean and safe method to append a new member
into an existing group.

Submitted by:	db
2012-12-27 14:30:19 +00:00
bapt
925e83c0bd Use flopen(3) instead of open(2) + flock(2) 2012-12-27 14:09:50 +00:00
bapt
2ed31d29a1 only rename(2) after chmod(2) has succeed
report error if chmod(2) fails

Reported by:	jh
2012-11-20 14:03:09 +00:00
bapt
9acb3e40c2 change mode the group file to 0644 after a successfull rename(2) 2012-11-20 07:22:07 +00:00
bapt
dd4851eebf Fix typo 2012-11-03 00:30:22 +00:00
des
87941a0e19 Correct attribution. 2012-10-31 15:04:27 +00:00
joel
9ed42f5c06 Minor mdoc and language fixes. 2012-10-30 22:30:30 +00:00
bapt
1adb3efbd2 Removed unnecessary bits in the header that shows where I stole the template 2012-10-30 22:26:19 +00:00
bapt
4bbfc76333 Document the pw_util(3) functions
Reviewed by:	des, gjb
2012-10-30 22:18:08 +00:00
bapt
dabdba1306 backout r242319, racy and not done in the right place
Reported by:	Garrett Cooper  <yanegomi@gmail.com>
2012-10-29 18:06:09 +00:00
bapt
aa97290070 make pw_init and gr_init fail if the specified master password or group file is
a directory.

MFC after:	1 month
2012-10-29 17:19:43 +00:00
bapt
79c15f9ce3 Fix IEC / SI binary prefixes (Ki, Mi, Gi, etc) production by humanize_number(3)
PR:		bin/171487
Submitted by:	matthew
MFC after:	1 week
2012-09-12 11:41:03 +00:00
des
c1d3d1a5fd Switch the default password hash from md5 to sha512.
MFC after:	1 week
2012-06-19 14:46:18 +00:00
bapt
4d9f5b8227 Revert user comparison back to user names as some user can share uids (root/toor
for example)

get the username information from old_pw structures to still allow renaming of a
user.

Reported by:	Claude Buisson <clbuisson@orange.fr>
Approved by:	des (mentor)
MFC after:	3 weeks
2012-06-19 11:39:56 +00:00
des
24379c8402 Finally nuke auth.conf, nine years after it was deprecated. The only
thing it was still used for was to set the "global default" password
hash.  Since the stock auth.conf contained nothing but comments, the
global default was actually the first algorithm in crypt(3)'s list,
which happens to be DES; I take the fact that nobody noticed as proof
that it was not used outside of crypt(3).

The only other use in our tree was in the Kerberos support code in
in tinyware's passwd(1).  I removed that code in an earlier commit;
it would not have compiled anyway, as it only supported Kerberos IV.

The auth_getval() function is now a stub that always returns NULL,
which has the same effect as a functional auth_getval() with an
empty auth.conf.

MFC after:	3 weeks
2012-06-12 17:02:53 +00:00
des
b7f9eb54a9 Document that we also support sha256 and sha512.
MFC after:	1 week
2012-06-08 12:36:08 +00:00
gjb
67d88d49d4 General mdoc(7) and typo fixes.
PR:		167804
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-12 15:08:22 +00:00
joel
bd3242adc9 mdoc: terminate quoted strings. 2012-03-30 12:34:34 +00:00
joel
f1a6c7f032 mandoc complains loudly when <TAB>s are misused in columnated lists. Fix
this syntax violation and while I'm here also convert <TAB> to Ta and adjust
quotation marks in order to prevent this problem in the future.
2012-03-29 16:02:40 +00:00
eadler
1ef5fe44d3 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
joel
56f5938296 mdoc: sort prologue macros. 2012-03-26 19:23:57 +00:00
joel
4ff32e1521 This string should be quoted.
Noticed by:	brueffer
2012-03-26 15:29:02 +00:00
joel
4234591b03 mdoc: terminate quoted strings.
Reviewed by:	brueffer
2012-03-26 15:18:14 +00:00
gjb
9761e3fdaf Fix various typos in manual pages.
Submitted by:	amdmi3
PR:		165431
MFC after:	1 week
2012-02-25 14:31:25 +00:00
ghelmer
ee9aa86ad6 Set the O_CLOEXEC flag when opening the pidfile to avoid leaking the
file descriptor via exec(3).

Now that daemon(8) has been fixed to resolve the issue noted by trociny,
the consensus is that this change should be OK.
2012-02-20 13:59:24 +00:00
ed
a03b3637dd Detect file modification properly by using tv_nsec.
POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond
precision to detect file modification.

MFC after:	2 weeks
2012-02-10 13:40:32 +00:00
eadler
c8d9c45343 Fix NULL ptr dereference in setusercontext if pwd is null,
LOGIN_SETPRIORITY is set, and setting the priority (rtprio or
setpriority) fails.

PR:		kern/164238
Submitted by:	Alexander Wittig <alexander@wittig.name>
Reviewed by:	des
Approved by:	cperciva
MFC after:	1 month
2012-02-09 21:06:47 +00:00
pjd
62f39c08bc Add a comment to the example that pidfile_* functions can handle pfh being NULL.
MFC after:	3 days
2012-02-08 08:49:30 +00:00
pjd
b87f041277 Note that calling pidfile_write(3) multiple times is fine.
MFC after:	3 days
2012-02-08 08:43:41 +00:00
ghelmer
10fb6673e8 Using the O_CLOEXEC flag on open(2) caused the pidfile lock to be lost
when the child process execs daemon's target program thanks to flock(2)
semantics. So, we apparently have to leak the open pidfile's file
descriptor to keep the lock for the pidfile(3) functions to work properly.

Test case demonstrated by trociny:

ref8-amd64:/home/trociny% uname -r
8.2-STABLE
ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10
ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10
daemon: process already running, pid: 19799

kopusha:~% uname -r
10.0-CURRENT
kopusha:~% daemon -p /tmp/sleep.pid sleep 10
kopusha:~% daemon -p /tmp/sleep.pid sleep 10
kopusha:~%
2012-02-06 14:11:24 +00:00
ghelmer
0c19567ee4 Consensus between bde and pjd seemed to be that if the function names
are lined up, then any * after a long type should appear after the
type instead of being in front of the function name on the following
line.
2012-01-26 20:40:22 +00:00
ghelmer
fd695d2710 Make the comments consistent (capitalization, punctuation, and
format).

Requested by bde
2012-01-26 20:35:01 +00:00
ghelmer
3e2a0771d8 Restore the parenthesis that are necessary around the constant values.
Requested by bde.
2012-01-26 20:33:08 +00:00