diff options
author | scottc <scottc> | 2002-06-22 09:51:21 +0000 |
---|---|---|
committer | scottc <scottc> | 2002-06-22 09:51:21 +0000 |
commit | ac7015d043fe4746725b07a31a6855c0d7105f80 (patch) | |
tree | 8dc63a620251c5c5b5b662ca6bd20e66b9496d6c | |
parent | 57dd1333b90dbabf70574aa9cfd7f515c02eddf4 (diff) | |
download | gdb-ac7015d043fe4746725b07a31a6855c0d7105f80.tar.gz |
Merged changes from HEAD
-rw-r--r-- | winsup/cygwin/ChangeLog | 24 | ||||
-rw-r--r-- | winsup/cygwin/Makefile.in | 2 | ||||
-rw-r--r-- | winsup/cygwin/security.cc | 48 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 6 |
4 files changed, 60 insertions, 20 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 1baab6479d8..53932a4924d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -401,6 +401,30 @@ 2002-06-21 Christopher Faylor <cgf@redhat.com> + * Makefile.in (cygrun.exe): Move -lgcc where it will do some good. + +2002-06-21 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (stat64_to_stat32): Correctly evaluate st_rdev. + (fstat64): Set st_rdev to same value as st_dev. + (stat_worker): Ditto. + +2002-06-21 Corinna Vinschen <corinna@vinschen.de> + + * security.cc (alloc_sd): Carefully check owner_sid again after trying + SIDs from cygheap. + +2002-06-21 Corinna Vinschen <corinna@vinschen.de> + + * security.cc (alloc_sd): Remove unnecessary retrieval of owner name. + Check uid for current user first and use SIDs from cygheap if so. + Set errno to EINVAL if user SID isn't retrievable. Just print user SID + as debug output. + Don't bail out if group SID isn't retrievable. Change debug output + appropriately. + +2002-06-21 Christopher Faylor <cgf@redhat.com> + * errno.cc: Change text description for EBADF throughout. 2002-06-20 Pierre Humblet <pierre.humblet@ieee.org> diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index a9faa1e2993..bb49ffb8684 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -305,7 +305,7 @@ winver_stamp: mkvers.sh include/cygwin/version.h winver.rc $(DLL_OFILES) cygrun.exe : cygrun.o $(LIB_NAME) $(w32api_lib)/libuser32.a \ $(w32api_lib)/libshell32.a $(w32api_lib)/libkernel32.a - $(CC) -nodefaultlibs -o $@ $^ + $(CC) -nodefaultlibs -o $@ -lgcc $^ cygserver_transport_outside.o: cygserver_transport.cc $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $< diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 473e62ff9a2..60b5378f35b 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1367,27 +1367,39 @@ alloc_sd (__uid32_t uid, __gid32_t gid, int attribute, return NULL; } - /* Get SID and name of new owner. */ - char owner[UNLEN + 1]; - cygsid owner_sid; - struct passwd *pw = getpwuid32 (uid); - strcpy (owner, pw ? pw->pw_name : getlogin ()); - if (!pw || !owner_sid.getfrompw (pw)) - return NULL; - debug_printf ("owner: %s [%d]", owner, - *GetSidSubAuthority (owner_sid, - *GetSidSubAuthorityCount (owner_sid) - 1)); + /* Get SID of owner. */ + cygsid owner_sid (NO_SID); + /* Check for current user first */ + if (uid == myself->uid) + owner_sid = cygheap->user.sid (); + else if (uid == cygheap->user.orig_uid) + owner_sid = cygheap->user.orig_sid (); + if (!owner_sid) + { + /* Otherwise retrieve user data from /etc/passwd */ + struct passwd *pw = getpwuid32 (uid); + if (!pw) + { + debug_printf ("no /etc/passwd entry for %d", uid); + set_errno (EINVAL); + return NULL; + } + else if (!owner_sid.getfrompw (pw)) + { + debug_printf ("no SID for user %d", uid); + set_errno (EINVAL); + return NULL; + } + } + owner_sid.debug_print ("alloc_sd: owner SID ="); - /* Get SID and name of new group. */ + /* Get SID of new group. */ cygsid group_sid (NO_SID); struct __group32 *grp = getgrgid32 (gid); - if (grp) - { - if (!grp || !group_sid.getfromgr (grp)) - return NULL; - } - else - debug_printf ("no group"); + if (!grp) + debug_printf ("no /etc/group entry for %d", gid); + else if (!group_sid.getfromgr (grp)) + debug_printf ("no SID for group %d", gid); /* Initialize local security descriptor. */ SECURITY_DESCRIPTOR sd; diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index da42ee42b15..a788c604bef 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -998,7 +998,7 @@ stat64_to_stat32 (struct __stat64 *src, struct __stat32 *dst) dst->st_nlink = src->st_nlink; dst->st_uid = src->st_uid; dst->st_gid = src->st_gid; - dst->st_rdev = src->st_rdev; + dst->st_rdev = ((src->st_rdev >> 8) & 0xff00) | (src->st_rdev & 0xff); dst->st_size = src->st_size; dst->st_atim = src->st_atim; dst->st_mtim = src->st_mtim; @@ -1027,6 +1027,8 @@ fstat64 (int fd, struct __stat64 *buf) buf->st_ino = hash_path_name (0, cfd->get_win32_name ()); if (!buf->st_dev) buf->st_dev = (cfd->get_device () << 16) | cfd->get_unit (); + if (!buf->st_rdev) + buf->st_rdev = buf->st_dev; } } @@ -1115,6 +1117,8 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow, buf->st_ino = hash_path_name (0, fh->get_win32_name ()); if (!buf->st_dev) buf->st_dev = (fh->get_device () << 16) | fh->get_unit (); + if (!buf->st_rdev) + buf->st_rdev = buf->st_dev; } } |