Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2003-04-10 05:14:18 +0400
committerPierre Humblet <phumblet@phumblet.no-ip.org>2003-04-10 05:14:18 +0400
commit57efd527df09df6b82734afb33861a1d4ddab3cd (patch)
tree0b031e17546affa35bf30fe216abe34648e65782 /winsup/utils/mkgroup.c
parent6f48c0ae7a188b335facfb5b4adcb85bc7959bcf (diff)
2003-04-10 Pierre Humblet <pierre.humblet@ieee.org>
* mkpasswd.c (current_user): print uid and gid as unsigned. (enum_users): Ditto. Do not free servername. (usage): Update to allow several domains and improve -p. (main): On Win9x limit uids to 1000. Only print specials when -l is specified. Add a loop to allow several domains and free servername in the loop. * mkgroup.c (enum_groups): Do not free servername. (usage): Update to allow several domains. Change uid to gid. (main): Only print specials when -l is specified. Add a loop to allow several domains and free servername in the loop.
Diffstat (limited to 'winsup/utils/mkgroup.c')
-rw-r--r--winsup/utils/mkgroup.c72
1 files changed, 32 insertions, 40 deletions
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
index 2378e14b1..634ca2280 100644
--- a/winsup/utils/mkgroup.c
+++ b/winsup/utils/mkgroup.c
@@ -372,9 +372,6 @@ enum_groups (LPWSTR servername, int print_sids, int print_users, int id_offset)
}
while (rc == ERROR_MORE_DATA);
-
- if (servername)
- netapibufferfree (servername);
}
void
@@ -484,16 +481,15 @@ current_group (int print_sids, int print_users, int id_offset)
int
usage (FILE * stream, int isNT)
{
- fprintf (stream, "Usage: mkgroup [OPTION]... [domain]\n\n"
+ fprintf (stream, "Usage: mkgroup [OPTION]... [domain]...\n\n"
"This program prints a /etc/group file to stdout\n\n"
"Options:\n");
if (isNT)
fprintf (stream, " -l,--local print local group information\n"
" -c,--current print current group, if a domain account\n"
- " -d,--domain print global group information from the domain\n"
- " specified (or from the current domain if there is\n"
- " no domain specified)\n"
- " -o,--id-offset offset change the default offset (10000) added to uids\n"
+ " -d,--domain print global group information (from current\n"
+ " domain if no domains specified)\n"
+ " -o,--id-offset offset change the default offset (10000) added to gids\n"
" in domain accounts.\n"
" -s,--no-sids don't print SIDs in pwd field\n"
" (this affects ntsec)\n"
@@ -629,7 +625,6 @@ main (int argc, char **argv)
"when `-d' is given.\n", argv[0]);
return 1;
}
- mbstowcs (domain_name, argv[optind], (strlen (argv[optind]) + 1));
domain_specified = 1;
}
if (!load_netapi ())
@@ -639,22 +634,14 @@ main (int argc, char **argv)
return 1;
}
-#if 0
- /*
- * Get `Everyone' group
- */
- print_special (print_sids, &sid_world_auth, 1, SECURITY_WORLD_RID,
- 0, 0, 0, 0, 0, 0, 0);
-#endif
-
- /*
- * Get `system' group
- */
- print_special (print_sids, &sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
if (print_local)
{
/*
+ * Get `system' group
+ */
+ print_special (print_sids, &sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
+ 0, 0, 0, 0, 0, 0, 0);
+ /*
* Get `None' group
*/
len = 256;
@@ -696,27 +683,32 @@ main (int argc, char **argv)
0,
0,
0);
- }
-
- if (print_domain)
- {
- if (domain_specified)
- rc = netgetdcname (NULL, domain_name, (LPBYTE *) & servername);
-
- else
- rc = netgetdcname (NULL, NULL, (LPBYTE *) & servername);
- if (rc != ERROR_SUCCESS)
- {
- fprintf (stderr, "Cannot get PDC, code = %ld\n", rc);
- return 1;
- }
-
- enum_groups (servername, print_sids, print_users, id_offset);
+ enum_local_groups (print_sids, print_users);
}
- if (print_local)
- enum_local_groups (print_sids, print_users);
+ i = 1;
+ if (print_domain)
+ do
+ {
+ if (domain_specified)
+ {
+ mbstowcs (domain_name, argv[optind], (strlen (argv[optind]) + 1));
+ rc = netgetdcname (NULL, domain_name, (LPBYTE *) & servername);
+ }
+ else
+ rc = netgetdcname (NULL, NULL, (LPBYTE *) & servername);
+
+ if (rc != ERROR_SUCCESS)
+ {
+ fprintf (stderr, "Cannot get PDC, code = %ld\n", rc);
+ return 1;
+ }
+
+ enum_groups (servername, print_sids, print_users, id_offset * i++);
+ netapibufferfree (servername);
+ }
+ while (++optind < argc);
if (print_current && !print_domain)
current_group (print_sids, print_users, id_offset);