diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 5b4e4ed36..79e174396 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2003-11-08 Corinna Vinschen + + * external.cc (cygwin_internal): Add CW_GET_UID_FROM_SID and + CW_GET_GID_FROM_SID handling. + * include/cygwin/version.h: Bump API minor number. + * include/sys/cygwin.h (cygwin_getinfo_types): Add + CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID. + 2003-11-07 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::opendir): Reorganize to diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 8ab0c82d0..1e75dc176 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -26,6 +26,7 @@ details. */ #include "wincap.h" #include "heap.h" #include "cygthread.h" +#include "pwdgrp.h" static external_pinfo * fillout_pinfo (pid_t pid, int winpid) @@ -278,6 +279,20 @@ cygwin_internal (cygwin_getinfo_types t, ...) { return getshmlba (); } + case CW_GET_UID_FROM_SID: + { + PSID psid = va_arg (arg, PSID); + cygsid sid (psid); + struct passwd *pw = internal_getpwsid (sid); + return pw ? pw->pw_uid : (__uid32_t)-1; + } + case CW_GET_GID_FROM_SID: + { + PSID psid = va_arg (arg, PSID); + cygsid sid (psid); + struct __group32 *gr = internal_getgrsid (sid); + return gr ? gr->gr_gid : (__gid32_t)-1; + } default: return (DWORD) -1; } diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index d692a397e..3a39c2367 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -226,13 +226,14 @@ details. */ 99: CW_GET_POSIX_SECURITY_ATTRIBUTE addition to external.cc. 100: CW_GET_SHMLBA addition to external.cc. 101: Export err, errx, verr, verrx, warn, warnx, vwarn, vwarnx. + 102: CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID addition to external.cc. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 101 +#define CYGWIN_VERSION_API_MINOR 102 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index 6db5bb936..10b1b0823 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -75,7 +75,9 @@ typedef enum CW_CHECK_NTSEC, CW_GET_ERRNO_FROM_WINERROR, CW_GET_POSIX_SECURITY_ATTRIBUTE, - CW_GET_SHMLBA + CW_GET_SHMLBA, + CW_GET_UID_FROM_SID, + CW_GET_GID_FROM_SID } cygwin_getinfo_types; #define CW_NEXTPID 0x80000000 /* or with pid to get next one */