mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
Merge commit '5f03ed8a56d308af72db8a48ab66ed68667af2c6'
Conflicts: udev/udevd.c
This commit is contained in:
commit
2c7b88c4a5
3
NEWS
3
NEWS
@ -5,6 +5,9 @@ Bugfixes.
|
||||
The udevadm test command has no longer a --force option, nodes and symlinks
|
||||
are always updated with a test run now.
|
||||
|
||||
The udevd daemon can be started with --resolve-names=never to avoid all user
|
||||
and group lookups (e.g. in cut-down systems).
|
||||
|
||||
udev 136
|
||||
========
|
||||
Bugfixes.
|
||||
|
@ -1454,10 +1454,10 @@ static int add_rule(struct udev_rules *rules, char *line,
|
||||
uid = strtoul(value, &endptr, 10);
|
||||
if (endptr[0] == '\0') {
|
||||
rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid);
|
||||
} else if (rules->resolve_names && strchr("$%", value[0]) == NULL) {
|
||||
} else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) {
|
||||
uid = add_uid(rules, value);
|
||||
rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid);
|
||||
} else {
|
||||
} else if (rules->resolve_names == 0) {
|
||||
rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL);
|
||||
}
|
||||
rule_tmp.rule.rule.flags = 1;
|
||||
@ -1472,10 +1472,10 @@ static int add_rule(struct udev_rules *rules, char *line,
|
||||
gid = strtoul(value, &endptr, 10);
|
||||
if (endptr[0] == '\0') {
|
||||
rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid);
|
||||
} else if (rules->resolve_names && strchr("$%", value[0]) == NULL) {
|
||||
} else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) {
|
||||
gid = add_gid(rules, value);
|
||||
rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid);
|
||||
} else {
|
||||
} else if (rules->resolve_names == 0) {
|
||||
rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL);
|
||||
}
|
||||
rule_tmp.rule.rule.flags = 1;
|
||||
|
19
udev/udevd.c
19
udev/udevd.c
@ -645,12 +645,14 @@ int main(int argc, char *argv[])
|
||||
struct sigaction act;
|
||||
const char *value;
|
||||
int daemonize = 0;
|
||||
int resolve_names = 1;
|
||||
static const struct option options[] = {
|
||||
{ "daemon", no_argument, NULL, 'd' },
|
||||
{ "debug-trace", no_argument, NULL, 't' },
|
||||
{ "debug", no_argument, NULL, 'D' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "resolve-names", required_argument, NULL, 'N' },
|
||||
{}
|
||||
};
|
||||
int rc = 1;
|
||||
@ -683,8 +685,19 @@ int main(int argc, char *argv[])
|
||||
if (udev_get_log_priority(udev) < LOG_INFO)
|
||||
udev_set_log_priority(udev, LOG_INFO);
|
||||
break;
|
||||
case 'N':
|
||||
if (strcmp (optarg, "early") == 0) {
|
||||
resolve_names = 1;
|
||||
} else if (strcmp (optarg, "never") == 0) {
|
||||
resolve_names = -1;
|
||||
} else {
|
||||
fprintf(stderr, "resolve-names must be early or never\n");
|
||||
err(udev, "resolve-names must be early or never\n");
|
||||
goto exit;
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n");
|
||||
printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--resolve-names=early|never] [--version]\n");
|
||||
goto exit;
|
||||
case 'V':
|
||||
printf("%s\n", VERSION);
|
||||
@ -736,7 +749,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024);
|
||||
|
||||
rules = udev_rules_new(udev, 1);
|
||||
rules = udev_rules_new(udev, resolve_names);
|
||||
if (rules == NULL) {
|
||||
err(udev, "error reading rules\n");
|
||||
goto exit;
|
||||
@ -946,7 +959,7 @@ handle_signals:
|
||||
struct udev_rules *rules_new;
|
||||
|
||||
reload_config = 0;
|
||||
rules_new = udev_rules_new(udev, 1);
|
||||
rules_new = udev_rules_new(udev, resolve_names);
|
||||
if (rules_new != NULL) {
|
||||
udev_rules_unref(rules);
|
||||
rules = rules_new;
|
||||
|
@ -29,6 +29,7 @@
|
||||
<arg><option>--debug-trace</option></arg>
|
||||
<arg><option>--debug</option></arg>
|
||||
<arg><option>--version</option></arg>
|
||||
<arg><option>--resolve-names=early|never</option></arg>
|
||||
<arg><option>--help</option></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
@ -64,6 +65,16 @@
|
||||
<para>Print debug messages to stderr.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--resolve-names</option></term>
|
||||
<listitem>
|
||||
<para>Specify when udevd should resolve names of users and groups.
|
||||
When set to <option>early</option> (the default) names will be
|
||||
resolved when the rules are parsed.
|
||||
When set to <option>never</option> names will never be resolved
|
||||
and all devices will be owned by root.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem>
|
||||
|
Loading…
Reference in New Issue
Block a user