mkpasswd --path-to-home patch
Jason Tishler
jason@tishler.net
Sun Nov 4 21:05:00 GMT 2001
The attached implements the funtionality discussed in:
http://cygwin.com/ml/cygwin-developers/2001-12/msg00029.html
Thanks,
Jason
-------------- next part --------------
Index: mkpasswd.c
===================================================================
RCS file: /cvs/src/src/winsup/utils/mkpasswd.c,v
retrieving revision 1.17
diff -u -p -r1.17 mkpasswd.c
--- mkpasswd.c 2001/12/14 17:15:37 1.17
+++ mkpasswd.c 2001/12/14 18:58:27
@@ -171,15 +171,26 @@ enum_users (LPWSTR servername, int print
uni2ansi (buffer[i].usri3_name, username, sizeof (username));
uni2ansi (buffer[i].usri3_full_name, fullname, sizeof (fullname));
homedir_w32[0] = homedir_psx[0] = '\0';
- uni2ansi (buffer[i].usri3_home_dir, homedir_w32, sizeof (homedir_w32));
- if (print_cygpath)
- cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
+ if (passed_home_path[0] == '\0')
+ {
+ uni2ansi (buffer[i].usri3_home_dir, homedir_w32,
+ sizeof (homedir_w32));
+ if (homedir_w32[0] != '\0')
+ {
+ if (print_cygpath)
+ cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
+ else
+ psx_dir (homedir_w32, homedir_psx);
+ }
+ else
+ {
+ strcpy (homedir_psx, "/home/");
+ strcat (homedir_psx, username);
+ }
+ }
else
- psx_dir (homedir_w32, homedir_psx);
-
- if (homedir_psx[0] == '\0')
{
- strcat (homedir_psx, passed_home_path);
+ strcpy (homedir_psx, passed_home_path);
strcat (homedir_psx, username);
}
@@ -394,8 +405,7 @@ usage ()
fprintf (stderr, " -m,--no-mount don't use mount points for home dir\n");
fprintf (stderr, " -s,--no-sids don't print SIDs in GCOS field\n");
fprintf (stderr, " (this affects ntsec)\n");
- fprintf (stderr, " -p,--path-to-home path if user account has no home dir, use\n");
- fprintf (stderr, " path instead of /home/\n");
+ fprintf (stderr, " -p,--path-to-home path use specified path instead of user account home dir\n");
fprintf (stderr, " -u,--username username only return information for the specified user\n");
fprintf (stderr, " -?,--help displays this message\n\n");
fprintf (stderr, "One of `-l', `-d' or `-g' must be given on NT/W2K.\n");
@@ -504,9 +514,6 @@ main (int argc, char **argv)
}
}
}
-
- if (passed_home_path[0] == '\0')
- strcpy (passed_home_path, "/home/");
/* This takes Windows 9x/ME into account. */
if (GetVersion () >= 0x80000000)
-------------- next part --------------
Fri Dec 14 14:04:37 2001 Jason Tishler <jason@tishler.net>
* mkpasswd.c (enum_users): Change to unconditionally use
the --path-to-home option, if supplied by the user. Use default
--path-to-home option value, if appropriate.
(usage): Change usage statement to reflect new semantics.
(main): Remove defaulting of the --path-to-home option.
More information about the Cygwin-patches
mailing list