summaryrefslogtreecommitdiffstats
path: root/winsup/utils/mkgroup.c
Commit message (Collapse)AuthorAgeFilesLines
* * mkpasswd.c: Properly define __progname as __declspec(dllimport).Christopher Faylor2009-10-021-1/+1
| | | | * mkgroup.c: Ditto.
* * mkgroup.c (enum_local_groups): Avoid error message if given groupCorinna Vinschen2009-08-111-3/+12
| | | | | | | name isn't found and return 0 to allow searching to proceed. Always return 0 or 1, not -1. (enum_groups): Avoid error message if given group name isn't found. * mkpasswd.c (enum_users): Ditto.
* * cygpath.cc (main): Only setlocale for LC_CTYPE category. FallbackCorinna Vinschen2009-05-151-0/+5
| | | | | | | | to UTF-8 if locale is "C". * ldd.cc (main): Ditto. * mkgroup.c (main): Ditto. * mkpasswd.c (main): Ditto. * passwd.c (main): Ditto.
* * mkpasswd.c (current_user): Don't use HOMEDRIVE/HOMEPATH to generateCorinna Vinschen2009-05-061-4/+4
| | | | | | | | | user's homedir. * mkgroup.c: Accommodate ctype changes. * mkpasswd.c: Ditto. * setfacl.c: Ditto. * ssp.c: Ditto.
* * mkgroup.c (enum_local_groups): Don't skip printing groups whenCorinna Vinschen2008-08-251-5/+3
| | | | | | | | | print_current is set and group SID is not curr_pgrp. (enum_groups): Ditto. (main): Fix condition when SYSTEM group gets printed. * mkpasswd.c (enum_users): Don't skip printing users when print_current is set and user SID is not curr_user. (main): Allow printing standard accounts even when print_current is set.
* * mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find outCorinna Vinschen2008-08-181-4/+3
| | | | if a group exists, rather than just allocating a buffer and going ahead.
* * mkgroup.c (enum_local_groups): Call print_win_error with GetLastErrorCorinna Vinschen2008-08-181-4/+4
| | | | | as argument when LookupAccountXXX failed. (enum_groups): Ditto.
* * mkgroup.c (enum_local_groups): Return failure if looking for a singleCorinna Vinschen2008-08-181-1/+4
| | | | group succeeded. Add comment.
* * mkgroup.c (main): Keep correctly track of optional arguments.Corinna Vinschen2008-08-181-1/+1
| | | | * mkpasswd.c (main): Ditto.
* * mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT.Corinna Vinschen2008-08-181-0/+5
| | | | | Keep track of optional argumnts and fix up optind afterwards. * mkpasswd.c (main): Ditto.
* * Makefile.in (ALL_LDFLAGS): Add --enable-auto-import option to quiet ldChristopher Faylor2008-08-171-60/+77
| | | | | | | | | | | | | | | | | | | warnings. * mkgroup.c: Change all global variables and most functions to static. (enum_local_groups): Add a print_current parameter to control whether entries for everything should be printed or just the current user. (enum_groups): Ditto. (main): Move call fetch_current_pgrp_sid earlier to avoid a NULL deference when no command line arguments are specified. Accommodate argument changes to above functions. Avoid printing SYSTEM account when print_current is specified. Issue error when extra stuff is found on the command line. * mkpasswd.c: Change all global variables and most functions to static. (enum_users): Add a print_current parameter to control whether entries for everything should be printed or just the current user. (main): Move call fetch_current_user_sid earlier to avoid a NULL deference when no command line arguments are specified. Accommodate argument change to above function. Avoid printing standard accounts when print_current is specified. Issue error when extra stuff is found on the command line.
* * mkgroup.c (fetch_current_pgrp_sid): New function to fetch primaryCorinna Vinschen2008-08-151-36/+58
| | | | | | | | | | | | | | | | | | group SID from user token. (current_group): Move up in file. Move fetching primary group SID to fetch_current_pgrp_sid. (enum_local_groups): Check if current SID is the same as current user's primary group SID. (enum_groups): Ditto. (main): Call fetch_current_pgrp_sid before enumerating groups. Call current_group only if current group hasn't been enumerated already. * mkpasswd.c (fetch_current_user_sid): New function to fetch current user SID from user token. (current_user): Move fetching current user SID to fetch_current_user_sid. (enum_users): Check if current SID is the same as current user's SID. (main): Call fetch_current_user_sid before enumerating users. Call current_user only if current user hasn't been enumerated already.
* * mkgroup.c (main): Fix test for duplicate domain/machine request.Corinna Vinschen2008-07-231-5/+14
| | | | * mkpasswd.c (main): Ditto.
* * mkgroup.c: Rework to allow per-domain/per-machine id_offset.Corinna Vinschen2008-07-231-82/+80
| | | | | | | | | Add -b option to skip builtin groups. (main): Simplify code. * mkpasswd.c: Rework to allow per-domain/per-machine id_offset. (main): Simplify code. * utils.sgml: Explain changed mkgroup/mkpasswd -d/-D/-l/-L options. Add mkgroup -b option.
* * mkgroup.c: Consolidate variable names.Corinna Vinschen2008-07-231-23/+142
| | | | | | | | | | | | | | | | | | (enum_unix_groups): New function. (print_special): Use LookupAccountSidW instead of LookupAccountSidA. (current_group): Ditto. (usage): Add -U option. (longopts): Add --unix option. (opts): Add -U option. (main): Handle -U option. Call enum_unix_groups if set. * mkpasswd.c: Consolidate variable names. (current_user): Use LookupAccountSidW instead of LookupAccountSidA. (enum_unix_users): New function. (usage): Add -U option. (longopts): Add --unix option. (opts): Add -U option. (main): Handle -U option. Call enum_unix_groups if set. * utils.sgml: Add -U option text to mkgroup and mkpasswd description.
* * mkgroup.c (enum_groups): Create full qualified groupname usingCorinna Vinschen2008-07-221-1/+2
| | | | | domain or servername, depending on printing domain or machine accounts. * mkpasswd.c (enum_users): Ditto for users.
* * mkgroup.c (main): Remove special root group code. Only printCorinna Vinschen2008-07-221-24/+17
| | | | SYSTEM group in case of printing local machine or local domain groups.
* * Makefile.in (cygcheck.exe): Link against ntdll.Corinna Vinschen2008-07-221-395/+400
| | | | | | | | | | | | | | | | | | | | * bloda.cc: Use statically linked functions throughout. * cygpath.cc: Drop 9x considerations. * mkgroup.c: Revamp. Redefine -l and -d options to take optional machine and domain parameters. Redefine -c to work always, using token information. Add -L, -D, -C to create unique groupnames in domain\group syntax. Add -S option to define domain\group separator char. Ignore -u and -s options. * mkpasswd.c: Revamp. Redefine -l and -d options to take optional machine and domain parameters. Redefine -c to work always, using token information. Add -L, -D, -C to create unique usernames in domain\user syntax. Add -S option to define domain\user separator char. Ignore -g and -s options. Prefer to take homedir from $HOME over $HOMEDRIVE/$HOMEPATH. * path.cc (oopts): Add "acl", "noacl", "posix=0" and "posix=1" options. (getmntent): Accomodate throughout. * ps.cc: Fix copyright dates. * utils.sgml: Fix text for mkgroup and mkpasswd.
* * mkgroup.c: Use statically linked functions throughout, except forCorinna Vinschen2008-07-091-216/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DsGetDcNameW. Reformat. Convert to use WCHAR for names throughout. Use defines instead of constants throughout. (MAX_SID_LEN): Define. (load_netapi): Just load DsGetDcNameW pointer. (psx_dir): Remove. (uni2ansi): Remove. (enum_local_users): Take server name and use in Net... call. (DBGSID): Define datastructure. (MAX_BUILTIN_SIDS): Define. (builtin_sid_list): Define global sid list. (builtin_sid_cnt): Define counter for global sid list. (enum_local_groups): Take server name and use in Net... and Lookup... calls. Take offset argument. Use MAX_PREFERRED_LENGTH in call to NetLocalGroupEnum. Check for duplicate builtin groups. (enum_users): Take server name and use in Net... call. (usage): Change text slightly. (print_version): Fix copyright. (main): Call enum_local_groups for domains as well. * mkpasswd.c: Use statically linked functions throughout, except for DsGetDcNameW. Reformat. Convert to use WCHAR for names throughout. Use defines instead of constants throughout. (MAX_SID_LEN): Define. (load_netapi): Just load DsGetDcNameW pointer. (uni2ansi): Use wcstombs. (current_user): Replace "unused_by_nt/2000/xp" by just "unused". (enum_users): Ditto. (print_version): Fix copyright.
* 2007-08-31 Dave Korn <dave.korn@artimi.com>Dave Korn2007-08-311-1/+1
| | | | | * mkgroup.c (enum_groups): Use MAX_PREFERRED_LENGTH in netgroupenum call so that it will automatically size returned buffer sufficiently.
* bad_keywordsChristopher Faylor2006-01-181-6/+6
|
* Align error message handling to mkpasswd's error messages throughout.Corinna Vinschen2005-09-211-50/+80
| | | | | | | | | | | | | | | | * mkgroup.c (print_win_error): Create macro calling ... (_print_win_error): ... this function created from former print_win_error. Move up in source. (PDOMAIN_CONTROLLER_INFOW): Define return type of DcGetDcNameW. (dsgetdcname): New function pointer for DcGetDcNameW. (load_netapi): Get DcGetDcNameW address. (main): If DcGetDcNameW is available, use it. * mkpasswd.c (PDOMAIN_CONTROLLER_INFOW): Define return type of DcGetDcNameW. (dsgetdcname): New function pointer for DcGetDcNameW. (load_netapi): Get DcGetDcNameW address. (main): If DcGetDcNameW is available, use it. Rename local variable domain_name_specified to domain_specified as in mkgroup.c.
* * mkgroup.cc (netapibufferallocate,netgroupgetinfo): New functionCorinna Vinschen2004-07-121-10/+52
| | | | | | | | | | | pointers. (load_netapi): Load NetApiBufferAllocate and NetGroupGetInfo. (enum_local_groups,enum_groups): Add disp_groupname parameter. Load info for disp_groupname if specified. (usage): Add description of "-g/--group" option. (longopts,opts): Add "-g/--group" option. (main): Process "-g/--group" option. * utils.sgml (mkgroup): Add description of "-g/--group" option
* * mkgroup.c (main): Print "root" group with local admins group sidCorinna Vinschen2003-11-261-0/+8
| | | | and gid 0.
* * mkgroup.c: Avoid compiler warnings throughout.Corinna Vinschen2003-11-141-7/+7
| | | | | * mkpasswd.c: Ditto. * passwd.c: Ditto.
* * cygcheck.cc (usage) Add description output.Joshua Daniel Franklin2003-04-261-2/+2
|
* 2003-04-10 Pierre Humblet <pierre.humblet@ieee.org>Pierre Humblet2003-04-101-40/+32
| | | | | | | | | | | | | * 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.
* 2003-03-01 Pierre Humblet <pierre.humblet@ieee.org>Pierre Humblet2003-03-011-1/+1
| | | | | | | | * mkpasswd.cc (main): On Win95, output both a default line and a line for the current user (if known) with a pseudorandom uid. If the -u switch is given, produce a line for the specified user. * mkgroup.cc (main): On Win95 change the group name from "unknown" to "all".
* * mkgroup.c: Fix copyright date.Corinna Vinschen2003-01-151-1/+1
| | | | | | | * mkpasswd.c: Ditto. * setfacl.c: Ditto. Fix ChangeLog typos.
* * mkpasswd.cc (current_user): Create.Corinna Vinschen2003-01-081-67/+141
| | | | | | | | | | | | | (usage): Reorganize to support Win95/98/ME. (main): Add option for -c. Reorganize to parse options for Win95/98/ME and to call current_user. Add username in gecos field on Win95/98/ME. * mkgroup.cc (enum_groups): Print gid with %u. (print_win_error): Create from passwd.cc. (current_group): Create. (usage): Reorganize to support Win95/98/ME. (main): Add option for -c. Reorganize to parse options for Win95/98/ME and to call current_group.
* * cygpath.cc (close_arg): Remove unused static.Christopher Faylor2002-09-301-2/+2
| | | | | | | * mkgroup.c (enum_local_users): Avoid compiler warning. (enum_users): Ditto. * mkpasswd.c: Ditto throughout. * ssp.c: Ditto throughout.
* Add final newlines to utilsJoshua Daniel Franklin2002-09-151-1/+2
|
* * mkgroup.c (main): Don't print an entry for "Everyone".Corinna Vinschen2002-08-021-0/+3
| | | | | * mkpasswd.c (print_special): Set pw_gid to 544 for SYSTEM user. (main): Don't print an entry for "Everyone".
* * mkgroup.c: Add function pointers for functions from advapi32.dll.Corinna Vinschen2002-07-021-4/+21
| | | | | | (load_netapi): Load used functions from advapi32.dll. (main): Use function pointers instead of statically linked functions from advapi32.dll.
* * mkgroup.c (main): Change call to exit() to a return statement.Corinna Vinschen2002-04-291-2/+2
| | | | | | | | | | | | * mkpasswd.c (main): Ditto. * mkpasswd.c (usage): Simplify usage output. Generalize to allow use for help. Correct '?' typo to 'h'. (longopts): Add version option. (opts): Add 'v' version option. (print_version): New function. (main): Accommodate new version option. Accommodate usage parameter changes.
* * mkgroup.c (usage): Use one just fprintf + string concatenation for outputChristopher Faylor2002-03-191-17/+18
| | | | | message. (print_version): Add void to function type and update copyright.
* * mkgroup.c (usage): Simplify usage output. Generalize to allow useCorinna Vinschen2002-03-191-20/+48
| | | | | | | | | for help. Correct '?' typo to 'h'. (longopts): Add version option. (opts): Add 'v' version option. (print_version): New function. (main): Accommodate new version option. Accommodate usage parameter changes. Use usage to output help message.
* 2002-03-15 Corinna Vinschen <corinna@vinschen.de>Corinna Vinschen2002-03-151-16/+44
| | | | | | | | | | * mkgroup.c (main): When generating group 513, check for computer's primary domain instead of current user's domain. 2002-03-14 Corinna Vinschen <corinna@vinschen.de> * mkgroup.c (main): When generating group 513, check for domain SID if computer name isn't mapped to a SID.
* * cygcheck.cc: Fix typo. Remove uid_t kludge. Rely on kludge in sys/cygwin.hChristopher Faylor2002-01-291-3/+6
| | | | | | | instead. * getfacl.c: Add include to remove warning. * mkgroup.c (main): Assign variables outside of parameter passing. This seems to eliminate some compiler warnings.
* * mkgroup.c: Avoid compiler warnings.Corinna Vinschen2001-10-201-95/+107
| | | | | | | | | | (print_special): New function. (main): Print special accounts by calling print_special(). * mkpasswd.c: Avoid compiler warnings. (enum_users): Print additional U-domain\username info in gecos field when SIDs are printed. (print_special): New function. (main): Print special accounts by calling print_special().
* * mkgroup.c: Add function pointers `netlocalgroupgetmembers' andCorinna Vinschen2001-04-161-12/+89
| | | | | | | | | | | | | | | | | `netgroupgetusers'. (load_netapi): Load function pointers `netlocalgroupgetmembers' and `netgroupgetusers'. (enum_local_users): New function. (enum_local_groups): Call `enum_local_users' for each group if `print_users' is set. (enum_users): New function. (enum_groups): Call `enum_users' for each group if `print_users' is set. (usage): Add usage text for `-u/--users'. (longopts): Add option `--users'. (opts): Add option character `u'. (main): Set `print_users' according to option `-u/--users'. Call `enum_local_groups' and `enum_groups' with additional parameter `print_users'.
* Patch by Kazuhiro Fujieda <fujieda@jaist.ac.jp>:Corinna Vinschen2001-04-151-11/+18
| | | | | | | | | | | | * mkgroup.c (enum_groups): Use RID + offset specified an additional argument as ID. (usage): Add description of -o option. (longopts, opts): Add specifications of -o/--id-offset option. (main): Add -o option. Invoke enum_groups with specified offset. * mkpasswd.c (enum_users): Just like mkgroup.c. (usage, longopts, opts): Ditto. (main): Add -o option. Invoke enum_users with specified offset only against domain accounts.
* * mkgroup.c (uni2ansi): Use native method to convert from UnicodeEgor Duda2001-04-111-6/+5
| | | | | | | | | to multi-byte strings. * mkpasswd.c (uni2ansi): Ditto. (enum_users): Pass buffer size when converting string. (enum_local_groups): Ditto. * mkgroup.c (enum_groups): Ditto. (enum_local_groups): Ditto.
* * mkgroup.c (load_netapi): New function to load netapi32.dll functionsCorinna Vinschen2000-11-081-46/+109
| | | | | | | | | | | | | | | | dynamically so that mkgroup works on 9x/ME as well. Use corresponding function pointers throughout. (usage): Change to `int'. Change text to be conformant to mkpasswd. (main): Use `getlongopt' to process options. Special handling to create a group entry on 9x/ME. * mkpasswd.c (load_netapi): New function to load netapi32.dll functions dynamically so that mkpasswd works on 9x/ME as well. Use corresponding function pointers throughout. (usage): Change to `int'. Change text to be conformant to mkgroup. (main): Use `getlongopt' to process options. Special handling to create a passwd entry on 9x/ME. Change conditional to create an entry for the local administrators group when appropriate.
* * Makefile.in: Eliminate WINSUP_DEPS.Christopher Faylor2000-05-181-1/+1
| | | | | | | | | * cygpath.cc: Reorganize includes to accomodate sys/cygwin.h changes. * mkgroup.c: Ditto. * mkpasswd.c: Ditto. * mount.cc: Ditto. Eliminate use of cygwin source specific includes. * ps.cc: Ditto. * cygwin.cc: Eliminate obsolete file.
* * mkpasswd.c (main): Use GetDCName instead of GetAnyDCName.Corinna Vinschen2000-04-151-7/+9
| | | | | | | | | | | Don't create extra passwd entry for administrators group if local_groups is set. (usage): Change usage text slightly. (enum_users): Loop while ERROR_MORE_DATA is returned. (enum_local_groups): Ditto. * mkgroup.c (enum_local_groups): Ditto. (enum_groups) Ditto. (usage): Change usage text slightly.
* import winsup-2000-02-17 snapshotChristopher Faylor2000-02-171-0/+410