* mkgroup.c (main): Fix test for duplicate domain/machine request.
* mkpasswd.c (main): Ditto.
This commit is contained in:
parent
f9519bcd1a
commit
f36c78a487
|
@ -1,3 +1,8 @@
|
||||||
|
2008-07-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* mkgroup.c (main): Fix test for duplicate domain/machine request.
|
||||||
|
* mkpasswd.c (main): Ditto.
|
||||||
|
|
||||||
2008-07-23 Corinna Vinschen <corinna@vinschen.de>
|
2008-07-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* mkgroup.c: Rework to allow per-domain/per-machine id_offset.
|
* mkgroup.c: Rework to allow per-domain/per-machine id_offset.
|
||||||
|
|
|
@ -750,12 +750,22 @@ main (int argc, char **argv)
|
||||||
"domains and machines.\n", __progname);
|
"domains and machines.\n", __progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
||||||
opt = optarg ?:
|
opt = optarg ?:
|
||||||
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
||||||
for (i = 0; i < print_domlist; ++i)
|
for (i = 0; i < print_domlist; ++i)
|
||||||
if ((!domlist[i].str && !opt)
|
if (domlist[i].domain == domlist[print_domlist].domain
|
||||||
|| (domlist[i].str && opt && !strcmp (domlist[i].str, opt)))
|
&& ((!domlist[i].str && !opt)
|
||||||
|
|| (domlist[i].str && opt
|
||||||
|
&& (off = strlen (domlist[i].str))
|
||||||
|
&& !strncmp (domlist[i].str, opt, off)
|
||||||
|
&& (!opt[off] || opt[off] == ','))))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n",
|
||||||
|
__progname, domlist[i].domain ? "domain" : "machine",
|
||||||
|
domlist[i].str);
|
||||||
goto skip;
|
goto skip;
|
||||||
|
}
|
||||||
if (!(domlist[print_domlist].str = opt))
|
if (!(domlist[print_domlist].str = opt))
|
||||||
print_system = 1;
|
print_system = 1;
|
||||||
domlist[print_domlist].id_offset = ULONG_MAX;
|
domlist[print_domlist].id_offset = ULONG_MAX;
|
||||||
|
@ -772,9 +782,8 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
|
||||||
domlist[print_domlist++].with_dom = (c == 'D' || c == 'L');
|
domlist[print_domlist++].with_dom = (c == 'D' || c == 'L');
|
||||||
skip:
|
skip:
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
sep_char = optarg;
|
sep_char = optarg;
|
||||||
|
|
|
@ -725,12 +725,22 @@ main (int argc, char **argv)
|
||||||
"domains and machines.\n", __progname);
|
"domains and machines.\n", __progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
||||||
opt = optarg ?:
|
opt = optarg ?:
|
||||||
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
||||||
for (i = 0; i < print_domlist; ++i)
|
for (i = 0; i < print_domlist; ++i)
|
||||||
if ((!domlist[i].str && !opt)
|
if (domlist[i].domain == domlist[print_domlist].domain
|
||||||
|| (domlist[i].str && opt && !strcmp (domlist[i].str, opt)))
|
&& ((!domlist[i].str && !opt)
|
||||||
|
|| (domlist[i].str && opt
|
||||||
|
&& (off = strlen (domlist[i].str))
|
||||||
|
&& !strncmp (domlist[i].str, opt, off)
|
||||||
|
&& (!opt[off] || opt[off] == ','))))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n",
|
||||||
|
__progname, domlist[i].domain ? "domain" : "machine",
|
||||||
|
domlist[i].str);
|
||||||
goto skip;
|
goto skip;
|
||||||
|
}
|
||||||
domlist[print_domlist].str = opt;
|
domlist[print_domlist].str = opt;
|
||||||
domlist[print_domlist].id_offset = ULONG_MAX;
|
domlist[print_domlist].id_offset = ULONG_MAX;
|
||||||
if (opt && (p = strchr (opt, ',')))
|
if (opt && (p = strchr (opt, ',')))
|
||||||
|
@ -746,7 +756,6 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
|
||||||
domlist[print_domlist++].with_dom = (c == 'D' || c == 'L');
|
domlist[print_domlist++].with_dom = (c == 'D' || c == 'L');
|
||||||
skip:
|
skip:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue