From 8606f0058eb6615351b0174f057f78bf688677ec Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 14 Dec 2001 20:01:53 +0000 Subject: [PATCH] * 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. --- winsup/utils/ChangeLog | 8 ++++++++ winsup/utils/mkpasswd.c | 31 +++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 3cb8a3627..186a98dc4 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,11 @@ +Fri Dec 14 14:04:37 2001 Jason Tishler + + * 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. + Fri Dec 14 12:10:39 2001 Jason Tishler * mkpasswd.c (opts): Add indication that '-p' option requires an diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c index 413739e4a..ceab70fce 100644 --- a/winsup/utils/mkpasswd.c +++ b/winsup/utils/mkpasswd.c @@ -171,15 +171,26 @@ enum_users (LPWSTR servername, int print_sids, int print_cygpath, 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"); @@ -505,9 +515,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) { -- 2.43.5