Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Scott <conrad.scott@dsl.pipex.com>2002-06-22 13:51:23 +0400
committerConrad Scott <conrad.scott@dsl.pipex.com>2002-06-22 13:51:23 +0400
commitfd197b01991d39c68476811a311074689be44b8a (patch)
tree4b9b1735f8b512f8960c8ec6a6ef0c589e30732f /winsup/cygwin
parentb049e075bbe930da09d5aafe73076032fae56cdc (diff)
Merged changes from HEAD
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog24
-rw-r--r--winsup/cygwin/Makefile.in2
-rw-r--r--winsup/cygwin/security.cc48
-rw-r--r--winsup/cygwin/syscalls.cc6
4 files changed, 60 insertions, 20 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1baab6479..53932a492 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 a9faa1e29..bb49ffb86 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 473e62ff9..60b5378f3 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 da42ee42b..a788c604b 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;
}
}