diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-05-06 15:54:24 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-05-06 15:54:24 +0400 |
commit | 05e6f7b2b99740cfde722dfff2752585581d2257 (patch) | |
tree | 1cdc59d28911808c97ca05aa736a43e3229db7d7 /winsup/utils/mkpasswd.c | |
parent | 764d88e4a75f244b9c92af0ea27cb4bb86f14d4d (diff) |
* mkpasswd.c (current_user): Don't use HOMEDRIVE/HOMEPATH to generate
user's homedir.
* mkgroup.c: Accommodate ctype changes.
* mkpasswd.c: Ditto.
* setfacl.c: Ditto.
* ssp.c: Ditto.
Diffstat (limited to 'winsup/utils/mkpasswd.c')
-rw-r--r-- | winsup/utils/mkpasswd.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c index b341b64c3..0ba88bf75 100644 --- a/winsup/utils/mkpasswd.c +++ b/winsup/utils/mkpasswd.c @@ -1,7 +1,7 @@ /* mkpasswd.c: Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, - 2008 Red Hat, Inc. + 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -146,7 +146,7 @@ put_sid (PSID sid) static void psx_dir (char *in, char *out) { - if (isalpha (in[0]) && in[1] == ':') + if (isalpha ((unsigned char) in[0]) && in[1] == ':') { sprintf (out, "/cygdrive/%c", in[0]); in += 2; @@ -212,7 +212,7 @@ current_user (int print_cygpath, const char *sep, const char *passed_home_path, DWORD dlen = MAX_DOMAIN_NAME_LEN + 1; SID_NAME_USE acc_type; int uid, gid; - char homedir_psx[PATH_MAX] = {0}, homedir_w32[MAX_PATH] = {0}; + char homedir_psx[PATH_MAX] = {0}; if (!curr_user.psid || !curr_pgrp.psid || !LookupAccountSidW (NULL, curr_user.psid, user, &ulen, dom, &dlen, @@ -229,8 +229,6 @@ current_user (int print_cygpath, const char *sep, const char *passed_home_path, if (passed_home_path[0] == '\0') { char *envhome = getenv ("HOME"); - char *envhomedrive = getenv ("HOMEDRIVE"); - char *envhomepath = getenv ("HOMEPATH"); if (envhome && envhome[0]) { @@ -240,19 +238,6 @@ current_user (int print_cygpath, const char *sep, const char *passed_home_path, else psx_dir (envhome, homedir_psx); } - else if (envhomepath && envhomepath[0]) - { - if (envhomedrive) - strlcpy (homedir_w32, envhomedrive, sizeof (homedir_w32)); - if (envhomepath[0] != '\\') - strlcat (homedir_w32, "\\", sizeof (homedir_w32)); - strlcat (homedir_w32, envhomepath, sizeof (homedir_w32)); - if (print_cygpath) - cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, homedir_w32, - homedir_psx, PATH_MAX); - else - psx_dir (homedir_w32, homedir_psx); - } else { wcstombs (stpncpy (homedir_psx, "/home/", sizeof (homedir_psx)), @@ -319,7 +304,7 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, for (ustr = strtok (user_list, ","); ustr; ustr = strtok (NULL, ",")) { - if (!isdigit (ustr[0]) && ustr[0] != '-') + if (!isdigit ((unsigned char) ustr[0]) && ustr[0] != '-') { PWCHAR p = wcpcpy (user, L"Unix User\\"); ret = mbstowcs (p, ustr, UNLEN + 1); @@ -351,7 +336,7 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, start = strtol (p, &p, 10); if (!*p) stop = start; - else if (*p++ != '-' || !isdigit (*p) + else if (*p++ != '-' || !isdigit ((unsigned char) *p) || (stop = strtol (p, &p, 10)) < start || *p) { fprintf (stderr, "%s: Malformed unix user list entry '%s'. " @@ -776,7 +761,7 @@ main (int argc, char **argv) if (opt && (p = strchr (opt, ','))) { if (p == opt - || !isdigit (p[1]) + || !isdigit ((unsigned char) p[1]) || (domlist[print_domlist].id_offset = strtol (p + 1, &ep, 10) , *ep)) { |