Index: mkpasswd.c =================================================================== RCS file: /cvs/src/src/winsup/utils/mkpasswd.c,v retrieving revision 1.28 diff -u -p -r1.28 mkpasswd.c --- mkpasswd.c 15 Jan 2003 10:08:37 -0000 1.28 +++ mkpasswd.c 25 Feb 2003 02:16:43 -0000 @@ -491,8 +491,8 @@ usage (FILE * stream, int isNT) "This program prints a /etc/passwd file to stdout\n\n" "Options:\n"); if (isNT) - fprintf (stream, " -l,--local print local user accounts\n" - " -c,--current print current account, if a domain account\n" + fprintf (stream, " -l,--local print local user accounts and the current\n" + " account, if a domain account and -d is absent\n" " -d,--domain print domain accounts (from current domain\n" " if no domain specified)\n" " -o,--id-offset offset change the default offset (10000) added to uids\n" @@ -632,21 +632,32 @@ main (int argc, char **argv) if (!isNT) { /* This takes Windows 9x/ME into account. */ + unsigned long uid = 0; + int i; + + if (passed_home_path[0] == '\0') + strcpy (passed_home_path, "/home/"); if (!disp_username) { + printf ("Administrator:*:%lu:%lu:Administrator:%sAdministrator:/bin/bash\n", + DOMAIN_USER_RID_ADMIN, + DOMAIN_ALIAS_RID_ADMINS, + passed_home_path); if (GetUserName (name, (len = 256, &len))) disp_username = name; else /* Same behaviour as in cygwin/shared.cc (memory_init). */ disp_username = (char *) "unknown"; } - - if (passed_home_path[0] == '\0') - strcpy (passed_home_path, "/home/"); - - printf ("%s:*:%ld:%ld:%s:%s%s:/bin/bash\n", disp_username, - DOMAIN_USER_RID_ADMIN, - DOMAIN_ALIAS_RID_ADMINS, + /* Create a pseudo random uid */ + for (i = 0; disp_username[i]; i++) + uid += tolower (disp_username[i]) << ((7 * i) % 25); + uid = (uid % (65535 - DOMAIN_USER_RID_ADMIN - 1)) + + DOMAIN_USER_RID_ADMIN + 1; + + printf ("%s:*:%lu:%lu:%s:%s%s:/bin/bash\n", disp_username, + uid, + DOMAIN_ALIAS_RID_ADMINS, disp_username, passed_home_path, disp_username); @@ -721,7 +732,7 @@ main (int argc, char **argv) enum_users (NULL, print_sids, print_cygpath, passed_home_path, 0, disp_username); - if (print_current && !print_domain) + if (print_local && !print_domain) current_user(print_sids, print_cygpath, passed_home_path, id_offset, disp_username); Index: mkgroup.c =================================================================== RCS file: /cvs/src/src/winsup/utils/mkgroup.c,v retrieving revision 1.19 diff -u -p -r1.19 mkgroup.c --- mkgroup.c 15 Jan 2003 10:08:37 -0000 1.19 +++ mkgroup.c 25 Feb 2003 02:27:01 -0000 @@ -488,8 +488,8 @@ usage (FILE * stream, int isNT) "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" + fprintf (stream, " -l,--local print local group information and the group of the\n" + " current account, if a domain account and -d is absent\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" @@ -612,7 +612,7 @@ main (int argc, char **argv) /* This takes Windows 9x/ME into account. */ if (!isNT) { - printf ("unknown::%ld:\n", DOMAIN_ALIAS_RID_ADMINS); + printf ("all::%ld:\n", DOMAIN_ALIAS_RID_ADMINS); return 0; } @@ -718,7 +718,7 @@ main (int argc, char **argv) if (print_local) enum_local_groups (print_sids, print_users); - if (print_current && !print_domain) + if (print_local && !print_domain) current_group (print_sids, print_users, id_offset); return 0;