1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-14 15:21:37 +03:00
Commit Graph

19 Commits

Author SHA1 Message Date
Scott James Remnant
49c3a01d44 util_run_program: *really* restore signal mask before executing event RUN commands
The previous patch was almost, but not quite, correct.  Rather than
restoring the signal mask it actually tried to make an even more
restrictive signal mask (had SIGALRM been blocked when udevd started,
anyway).

Fix it harder.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-09-22 14:39:23 -07:00
Florian Zumbiehl
04d4a6f858 util_run_program(): fix possible buffer overflow #2
I'm not sure how likely it is for UTIL_PATH_SIZE to have an odd value
(maybe it has right now? :-), but I guess making this universally correct
doesn't hurt ...
2009-09-08 21:42:21 +02:00
Kay Sievers
f55083ce34 util_run_program(): skip multiple spaces in argv creation 2009-09-07 12:13:50 +02:00
Jeremy Kerr
d412a68573 util_run_program: restore signal mask before executing event RUN commands
External programs triggered by events (via RUN=) will inherit udev's
signal mask, which is set to block all but SIGALRM. For most utilities,
this is OK, but if we start daemons from RUN=, we run into trouble
(especially as SIGCHLD is blocked).

This change saves the original sigmask when udev starts, and restores it
just before we exec() the external command.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
2009-09-07 12:13:50 +02:00
Florian Zumbiehl
4c21b7156d util_create_path(): fix possible out of bounds array access 2009-08-30 21:40:13 +02:00
Florian Zumbiehl
b0de6a6327 util_delete_path(): handle multiple leading slashes 2009-08-29 16:50:43 +02:00
Kay Sievers
28da1a6186 util_create_path(): fix errno usage
Based on a patch from: Florian Zumbiehl <florz@florz.de>
2009-08-29 16:38:01 +02:00
Florian Zumbiehl
72c0373f79 util_lookup_group(): fix memory leak if realloc() fails 2009-08-29 16:25:47 +02:00
Florian Zumbiehl
f46b9c2628 util_delete_path(): use util_strscpy() 2009-08-29 16:17:54 +02:00
Kay Sievers
39087d3bdd util_unlink_secure(): chmod() before chown()
Suggested by Florian Zumbiehl <florz@florz.de>.
2009-08-29 16:10:24 +02:00
Kay Sievers
4851d131d6 assign errno for getgrnam_r()/getpwnam_r()
On Mon, Aug 24, 2009 at 19:50, Lennart Poettering<lennart@poettering.net> wrote:
> One little comment here: on POSIX getrnam_r() doesn't touch
> errno. Instead it returns the error value as return value.
2009-08-25 21:09:22 +02:00
Alan Jenkins
214a6c791c fix spelling
Fix spelling in docbook comments, code comments, and a local variable
name.  Thanks to "ispell -h" for docbook HTML and "scspell" for source
code.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-08 15:42:05 +02:00
Kay Sievers
fc206fbe3e update a few years of copyright 2009-08-01 09:39:18 -04:00
Eric W. Biederman
504a553e78 fix util_lookup_group to handle large groups
I have recently been getting the above message on fc11 and
I have traced it down to a bug in util_lookup_group.

As of 145 util_lookup_group reads:

gid_t util_lookup_group(struct udev *udev, const char *group)
{
	char *endptr;
	int buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
	char buf[buflen];
	struct group grbuf;
	struct group *gr;
	gid_t gid = 0;

	if (strcmp(group, "root") == 0)
		return 0;
	gid = strtoul(group, &endptr, 10);
	if (endptr[0] == '\0')
		return gid;

	errno = 0;
	getgrnam_r(group, &grbuf, buf, buflen, &gr);
	if (gr != NULL)
		return gr->gr_gid;
	if (errno == 0 || errno == ENOENT || errno == ESRCH)
		err(udev, "specified group '%s' unknown\n", group);
	else
		err(udev, "error resolving group '%s': %m\n", group);
	return 0;
}

The errno value from getgrnam_r here is ERANGE which is documented as
"Insufficient buffer space supplied".

When I call get getgrnam_r with a large enough buffer everything
works.  Indicating that the problem is that sysconf is returning
a value too small.

A quick google search tells me that sysconf(_S_GETGR_R_SIZE_MAX)
is documented as:

> sysconf(_S_GETGR_R_SIZE_MAX) returns either -1 or a good
> suggested starting value for buflen.  It does not return the
> worst case possible for buflen.

In my case I have a group with about 50 users in /etc/group
and that is what triggered the problem in udev and caused
all of the udevs group lookups to fail.

The following patch which dynamically allocates the group member buffer
should fix this problem.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2009-08-01 09:23:50 -04:00
Kay Sievers
820fc48f24 udevd: add timestamp to --debug output 2009-07-17 13:26:46 +02:00
Kay Sievers
adda4c682a udevd: make sure a worker finishes event handling before exiting
Persistent network rules write out new rules files. When rules change,
we need to kill all workers to update the in-memory copy of the rules.
We need to make sure, that a worker finshes its work for all device
messages it has accepted, before it exits after a SIGTERM from the main
process.
2009-07-11 18:21:26 +02:00
Kay Sievers
257bb4cdac use MIN() MAX() from param.h 2009-07-07 19:30:19 +02:00
Kay Sievers
6133f3432f cleanup ./configure installation directory options 2009-06-17 02:25:07 +02:00
Kay Sievers
44b49d3736 move common stuff from udev/ to private parts of libudev/ 2009-06-09 23:05:25 +02:00