diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-02-23 15:15:50 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-02-23 15:15:50 +0000 |
commit | a76877e977ff264e44c4d9278920fe511fc73dd4 (patch) | |
tree | 77a3e569e9e5a248cf845f89d7e8eb6ba6193f2f /winsup/cygwin/grp.cc | |
parent | 9fa43ff6c61626df04f9b87c09f5233ba07a608d (diff) | |
download | cygnal-a76877e977ff264e44c4d9278920fe511fc73dd4.tar.gz cygnal-a76877e977ff264e44c4d9278920fe511fc73dd4.tar.bz2 cygnal-a76877e977ff264e44c4d9278920fe511fc73dd4.zip |
Throughout remove all usage of wincap.has_security.
* environ.cc (environ_init): Drop setting allow_ntsec here.
* grp.cc (initgroups32): Drop usage of label "out".
* security.cc (allow_ntsec): Set to true by default.
* syscalls.cc (seteuid32): Remove label success_9x.
* wincap.cc: Remove has_security throughout.
* wincap.h: Ditto.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r-- | winsup/cygwin/grp.cc | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index fafef7587..edec62439 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -1,7 +1,7 @@ /* grp.cc - Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005 - Red Hat, Inc. + Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Red Hat, Inc. Original stubs by Jason Molenda of Cygnus Support, crash@cygnus.com First implementation by Gunther Ebert, gunther.ebert@ixos-leipzig.de @@ -84,15 +84,11 @@ pwdgrp::read_group () static char linebuf [200]; char group_name [UNLEN + 1] = "mkgroup"; char strbuf[128] = ""; + struct __group32 *gr; - if (wincap.has_security ()) - { - struct __group32 *gr; - - cygheap->user.groups.pgsid.string (strbuf); - if ((gr = internal_getgrsid (cygheap->user.groups.pgsid))) - strlcpy (group_name, gr->gr_name, sizeof (group_name)); - } + cygheap->user.groups.pgsid.string (strbuf); + if ((gr = internal_getgrsid (cygheap->user.groups.pgsid))) + strlcpy (group_name, gr->gr_name, sizeof (group_name)); if (myself->uid == UNKNOWN_UID) strcpy (group_name, "mkpasswd"); /* Feedback... */ snprintf (linebuf, sizeof (linebuf), "%s:%s:%lu:%s", @@ -101,8 +97,7 @@ pwdgrp::read_group () add_line (linebuf); } static char NO_COPY pretty_ls[] = "????????::-1:"; - if (wincap.has_security ()) - add_line (pretty_ls); + add_line (pretty_ls); } muto NO_COPY pwdgrp::pglock; @@ -467,34 +462,29 @@ getgroups (int gidsetsize, __gid16_t *grouplist) extern "C" int initgroups32 (const char *name, __gid32_t gid) { - int ret; - if (wincap.has_security ()) + int ret = -1; + + cygheap->user.deimpersonate (); + struct passwd *pw = internal_getpwnam (name); + struct __group32 *gr = internal_getgrgid (gid); + cygsid usersid, grpsid; + if (!usersid.getfrompw (pw) || !grpsid.getfromgr (gr)) + set_errno (EINVAL); + else { - ret = -1; - cygheap->user.deimpersonate (); - struct passwd *pw = internal_getpwnam (name); - struct __group32 *gr = internal_getgrgid (gid); - cygsid usersid, grpsid; - if (!usersid.getfrompw (pw) || !grpsid.getfromgr (gr)) + cygsidlist tmp_gsids (cygsidlist_auto, 12); + if (get_server_groups (tmp_gsids, usersid, pw)) { - set_errno (EINVAL); - goto out; + tmp_gsids += grpsid; + cygsidlist new_gsids (cygsidlist_alloc, tmp_gsids.count ()); + for (int i = 0; i < tmp_gsids.count (); i++) + new_gsids.sids[i] = tmp_gsids.sids[i]; + new_gsids.count (tmp_gsids.count ()); + cygheap->user.groups.update_supp (new_gsids); + ret = 0; } - cygsidlist tmp_gsids (cygsidlist_auto, 12); - if (!get_server_groups (tmp_gsids, usersid, pw)) - goto out; - tmp_gsids += grpsid; - cygsidlist new_gsids (cygsidlist_alloc, tmp_gsids.count ()); - for (int i = 0; i < tmp_gsids.count (); i++) - new_gsids.sids[i] = tmp_gsids.sids[i]; - new_gsids.count (tmp_gsids.count ()); - cygheap->user.groups.update_supp (new_gsids); } - ret = 0; - - out: - if (wincap.has_security ()) - cygheap->user.reimpersonate (); + cygheap->user.reimpersonate (); syscall_printf ( "%d = initgroups (%s, %u)", ret, name, gid); return ret; } @@ -516,9 +506,6 @@ setgroups32 (int ngroups, const __gid32_t *grouplist) return -1; } - if (!wincap.has_security ()) - return 0; - cygsidlist gsids (cygsidlist_alloc, ngroups); struct __group32 *gr; |