From 05e6f7b2b99740cfde722dfff2752585581d2257 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 6 May 2009 11:54:24 +0000 Subject: * 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. --- winsup/utils/ChangeLog | 10 ++++++++++ winsup/utils/mkgroup.c | 8 ++++---- winsup/utils/mkpasswd.c | 27 ++++++--------------------- winsup/utils/setfacl.c | 6 +++--- winsup/utils/ssp.c | 4 ++-- 5 files changed, 25 insertions(+), 30 deletions(-) (limited to 'winsup/utils') diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index fde801a79..b8f94cce4 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,13 @@ +2009-05-06 Corinna Vinschen + + * 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. + 2009-05-04 Corinna Vinschen * cygcheck.cc (usage): Fix option order and print. diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index 3a3376f97..74de36c21 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -1,7 +1,7 @@ /* mkgroup.c: Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008 Red Hat, Inc. + 2007, 2008, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -244,7 +244,7 @@ enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, for (gstr = strtok (grp_list, ","); gstr; gstr = strtok (NULL, ",")) { - if (!isdigit (gstr[0]) && gstr[0] != '-') + if (!isdigit ((unsigned char) gstr[0]) && gstr[0] != '-') { PWCHAR p = wcpcpy (grp, L"Unix Group\\"); ret = mbstowcs (p, gstr, GNLEN + 1); @@ -276,7 +276,7 @@ enum_unix_groups (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 group list entry '%s'. " @@ -807,7 +807,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)) { 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)) { diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c index 8dcce4a73..5e77c63d5 100644 --- a/winsup/utils/setfacl.c +++ b/winsup/utils/setfacl.c @@ -1,6 +1,6 @@ /* setfacl.c - Copyright 2000, 2001, 2002, 2003 Red Hat Inc. + Copyright 2000, 2001, 2002, 2003, 2006, 2008, 2009 Red Hat Inc. Written by Corinna Vinschen @@ -51,7 +51,7 @@ typedef enum { mode_t getperm (char *in) { - if (isdigit (*in) && !in[1]) + if (isdigit ((unsigned char) *in) && !in[1]) { int i = atoi (in); if (i < 0 || i > 7) @@ -127,7 +127,7 @@ getaclentry (action_t action, char *c, aclent_t *ace) if (action == Delete) return FALSE; } - else if (isdigit (*c)) + else if (isdigit ((unsigned char) *c)) { char *c3; diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c index c7370d94d..97f87cab6 100644 --- a/winsup/utils/ssp.c +++ b/winsup/utils/ssp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2002 Red Hat, Inc. + * Copyright (c) 2000, 2001, 2002, 2009 Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -596,7 +596,7 @@ run_program (char *cmdline) { dll_ptr = cp+1; } - *cp = tolower (*cp); + *cp = tolower ((unsigned char) *cp); } } } -- cgit v1.2.3