Change internal gid datatype from __gid16_t to __gid32_t
throughout. * cygwin.din: Export new symbols chown32, fchown32, getegid32, getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32, setgid32, setegid32, getgrent32. * grp.cc (grp32togrp16): New static function. (getgrgid32): New function. (getgrnam32): Ditto. (getgrent32): Ditto. (getgroups32): Change name of internal function from getgroups. (getgroups32): New function. (initgroups32): Ditto. * syscalls.cc (chown32): Ditto. (lchown32): Ditto. (fchown32): Ditto. (setegid32): Ditto. (setgid32): Ditto. * uinfo.cc (getgid32): Ditto. (getegid32): Ditto. * include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam(). Declare getgrgid32() and getgrnam32() instead. Declare getgid32().
This commit is contained in:
		| @@ -1,3 +1,27 @@ | |||||||
|  | 2002-05-28  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	Change internal gid datatype from __gid16_t to __gid32_t | ||||||
|  | 	throughout. | ||||||
|  | 	* cygwin.din: Export new symbols chown32, fchown32, getegid32, | ||||||
|  | 	getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32, | ||||||
|  | 	setgid32, setegid32, getgrent32. | ||||||
|  | 	* grp.cc (grp32togrp16): New static function. | ||||||
|  | 	(getgrgid32): New function. | ||||||
|  | 	(getgrnam32): Ditto. | ||||||
|  | 	(getgrent32): Ditto. | ||||||
|  | 	(getgroups32): Change name of internal function from getgroups. | ||||||
|  | 	(getgroups32): New function. | ||||||
|  | 	(initgroups32): Ditto. | ||||||
|  | 	* syscalls.cc (chown32): Ditto. | ||||||
|  | 	(lchown32): Ditto. | ||||||
|  | 	(fchown32): Ditto. | ||||||
|  | 	(setegid32): Ditto. | ||||||
|  | 	(setgid32): Ditto. | ||||||
|  | 	* uinfo.cc (getgid32): Ditto. | ||||||
|  | 	(getegid32): Ditto. | ||||||
|  | 	* include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam(). | ||||||
|  | 	Declare getgrgid32() and getgrnam32() instead.  Declare getgid32(). | ||||||
|  |  | ||||||
| 2002-05-27  Christopher Faylor  <cgf@redhat.com> | 2002-05-27  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* autoload.cc (noload): Properly mask low order word for determining | 	* autoload.cc (noload): Properly mask low order word for determining | ||||||
|   | |||||||
| @@ -97,9 +97,9 @@ class cygheap_user | |||||||
|   PSID   orig_psid;     /* Remains intact even after impersonation */ |   PSID   orig_psid;     /* Remains intact even after impersonation */ | ||||||
| public: | public: | ||||||
|   __uid16_t orig_uid;      /* Remains intact even after impersonation */ |   __uid16_t orig_uid;      /* Remains intact even after impersonation */ | ||||||
|   __uid16_t orig_gid;      /* Ditto */ |   __gid32_t orig_gid;      /* Ditto */ | ||||||
|   __uid16_t real_uid;      /* Remains intact on seteuid, replaced by setuid */ |   __uid16_t real_uid;      /* Remains intact on seteuid, replaced by setuid */ | ||||||
|   __gid16_t real_gid;      /* Ditto */ |   __gid32_t real_gid;      /* Ditto */ | ||||||
|  |  | ||||||
|   /* token is needed if set(e)uid should be called. It can be set by a call |   /* token is needed if set(e)uid should be called. It can be set by a call | ||||||
|      to `set_impersonation_token()'. */ |      to `set_impersonation_token()'. */ | ||||||
|   | |||||||
| @@ -100,6 +100,7 @@ chmod | |||||||
| _chmod = chmod | _chmod = chmod | ||||||
| chown | chown | ||||||
| _chown = chown | _chown = chown | ||||||
|  | chown32 | ||||||
| cleanup_glue | cleanup_glue | ||||||
| clearerr | clearerr | ||||||
| _clearerr = clearerr | _clearerr = clearerr | ||||||
| @@ -205,6 +206,7 @@ fchmod | |||||||
| _fchmod = fchmod | _fchmod = fchmod | ||||||
| fchown | fchown | ||||||
| _fchown = fchown | _fchown = fchown | ||||||
|  | fchown32 | ||||||
| fclose | fclose | ||||||
| _fclose = fclose | _fclose = fclose | ||||||
| fcntl | fcntl | ||||||
| @@ -344,16 +346,21 @@ getdtablesize | |||||||
| _getdtablesize = getdtablesize | _getdtablesize = getdtablesize | ||||||
| getegid | getegid | ||||||
| _getegid = getegid | _getegid = getegid | ||||||
|  | getegid32 | ||||||
| geteuid | geteuid | ||||||
| _geteuid = geteuid | _geteuid = geteuid | ||||||
| getgid | getgid | ||||||
| _getgid = getgid | _getgid = getgid | ||||||
|  | getgid32 | ||||||
| getgrgid | getgrgid | ||||||
| _getgrgid = getgrgid | _getgrgid = getgrgid | ||||||
|  | getgrgid32 | ||||||
| getgrnam | getgrnam | ||||||
| _getgrnam = getgrnam | _getgrnam = getgrnam | ||||||
|  | getgrnam32 | ||||||
| getgroups | getgroups | ||||||
| _getgroups = getgroups | _getgroups = getgroups | ||||||
|  | getgroups32 | ||||||
| gethostname = cygwin_gethostname | gethostname = cygwin_gethostname | ||||||
| _gethostname = cygwin_gethostname | _gethostname = cygwin_gethostname | ||||||
| getlogin | getlogin | ||||||
| @@ -412,6 +419,7 @@ _infinity = infinity | |||||||
| infinityf | infinityf | ||||||
| _infinityf = infinityf | _infinityf = infinityf | ||||||
| initgroups | initgroups | ||||||
|  | initgroups32 | ||||||
| ioctl | ioctl | ||||||
| _ioctl = ioctl | _ioctl = ioctl | ||||||
| iprintf | iprintf | ||||||
| @@ -468,6 +476,7 @@ labs | |||||||
| _labs = labs | _labs = labs | ||||||
| lchown | lchown | ||||||
| _lchown = lchown | _lchown = lchown | ||||||
|  | lchown32 | ||||||
| ldexp | ldexp | ||||||
| _ldexp = ldexp | _ldexp = ldexp | ||||||
| ldexpf | ldexpf | ||||||
| @@ -658,6 +667,7 @@ setdtablesize | |||||||
| _setdtablesize = setdtablesize | _setdtablesize = setdtablesize | ||||||
| setgid | setgid | ||||||
| _setgid = setgid | _setgid = setgid | ||||||
|  | setgid32 | ||||||
| setjmp | setjmp | ||||||
| _setjmp = setjmp | _setjmp = setjmp | ||||||
| setlocale | setlocale | ||||||
| @@ -674,6 +684,7 @@ seteuid | |||||||
| _seteuid = seteuid | _seteuid = seteuid | ||||||
| setegid | setegid | ||||||
| _setegid = setegid | _setegid = setegid | ||||||
|  | setegid32 | ||||||
| setuid | setuid | ||||||
| _setuid = setuid | _setuid = setuid | ||||||
| setutent | setutent | ||||||
| @@ -1013,6 +1024,7 @@ getpgrp | |||||||
| _getpgrp = getpgrp | _getpgrp = getpgrp | ||||||
| getgrent | getgrent | ||||||
| _getgrent = getgrent | _getgrent = getgrent | ||||||
|  | getgrent32 | ||||||
| ntohl | ntohl | ||||||
| _ntohl = ntohl | _ntohl = ntohl | ||||||
| htonl | htonl | ||||||
|   | |||||||
| @@ -127,7 +127,7 @@ fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc) | |||||||
|   int res = -1; |   int res = -1; | ||||||
|   int oret; |   int oret; | ||||||
|   __uid16_t uid; |   __uid16_t uid; | ||||||
|   __gid16_t gid; |   __gid32_t gid; | ||||||
|   int open_flags = O_RDONLY | O_BINARY | O_DIROPEN; |   int open_flags = O_RDONLY | O_BINARY | O_DIROPEN; | ||||||
|   bool query_open_already; |   bool query_open_already; | ||||||
|  |  | ||||||
| @@ -238,7 +238,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, | |||||||
|     buf->st_mode = S_IFSOCK; |     buf->st_mode = S_IFSOCK; | ||||||
|  |  | ||||||
|   __uid16_t uid; |   __uid16_t uid; | ||||||
|   __gid16_t gid; |   __gid32_t gid; | ||||||
|   if (get_file_attribute (pc->has_acls (), get_win32_name (), &buf->st_mode, |   if (get_file_attribute (pc->has_acls (), get_win32_name (), &buf->st_mode, | ||||||
| 			  &uid, &gid) == 0) | 			  &uid, &gid) == 0) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ details. */ | |||||||
|    on the first call that needs information from it. */ |    on the first call that needs information from it. */ | ||||||
|  |  | ||||||
| static const char *etc_group NO_COPY = "/etc/group"; | static const char *etc_group NO_COPY = "/etc/group"; | ||||||
| static struct __group16 *group_buf;		/* group contents in memory */ | static struct __group32 *group_buf;		/* group contents in memory */ | ||||||
| static int curr_lines; | static int curr_lines; | ||||||
| static int max_lines; | static int max_lines; | ||||||
|  |  | ||||||
| @@ -45,7 +45,7 @@ static int grp_pos = 0; | |||||||
| static pwdgrp_check group_state; | static pwdgrp_check group_state; | ||||||
|  |  | ||||||
| static int | static int | ||||||
| parse_grp (struct __group16 &grp, const char *line) | parse_grp (struct __group32 &grp, const char *line) | ||||||
| { | { | ||||||
|   int len = strlen(line); |   int len = strlen(line); | ||||||
|   char *newline = (char *) malloc (len + 1); |   char *newline = (char *) malloc (len + 1); | ||||||
| @@ -110,7 +110,7 @@ add_grp_line (const char *line) | |||||||
|     if (curr_lines == max_lines) |     if (curr_lines == max_lines) | ||||||
|     { |     { | ||||||
| 	max_lines += 10; | 	max_lines += 10; | ||||||
| 	group_buf = (struct __group16 *) realloc (group_buf, max_lines * sizeof (struct __group16)); | 	group_buf = (struct __group32 *) realloc (group_buf, max_lines * sizeof (struct __group32)); | ||||||
|     } |     } | ||||||
|     if (parse_grp (group_buf[curr_lines], line)) |     if (parse_grp (group_buf[curr_lines], line)) | ||||||
|       curr_lines++; |       curr_lines++; | ||||||
| @@ -210,11 +210,28 @@ read_etc_group () | |||||||
|   return; |   return; | ||||||
| } | } | ||||||
|  |  | ||||||
| extern "C" | static | ||||||
| struct __group16 * | struct __group16 * | ||||||
| getgrgid (__gid16_t gid) | grp32togrp16 (struct __group16 *gp16, struct __group32 *gp32) | ||||||
| { | { | ||||||
|   struct __group16 * default_grp = NULL; |   if (!gp16 || !gp32) | ||||||
|  |     return NULL; | ||||||
|  |  | ||||||
|  |   /* Copying the pointers is actually unnecessary.  Just having the correct | ||||||
|  |      return type is important. */ | ||||||
|  |   gp16->gr_name = gp32->gr_name; | ||||||
|  |   gp16->gr_passwd = gp32->gr_passwd; | ||||||
|  |   gp16->gr_gid = (__gid16_t) gp32->gr_gid;		/* Not loss-free */ | ||||||
|  |   gp16->gr_mem = gp32->gr_mem; | ||||||
|  |  | ||||||
|  |   return gp16; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern "C" | ||||||
|  | struct __group32 * | ||||||
|  | getgrgid32 (__gid32_t gid) | ||||||
|  | { | ||||||
|  |   struct __group32 * default_grp = NULL; | ||||||
|   if (group_state  <= initializing) |   if (group_state  <= initializing) | ||||||
|     read_etc_group(); |     read_etc_group(); | ||||||
|  |  | ||||||
| @@ -231,7 +248,16 @@ getgrgid (__gid16_t gid) | |||||||
|  |  | ||||||
| extern "C" | extern "C" | ||||||
| struct __group16 * | struct __group16 * | ||||||
| getgrnam (const char *name) | getgrgid (__gid16_t gid) | ||||||
|  | { | ||||||
|  |   static struct __group16 g16; | ||||||
|  |  | ||||||
|  |   return grp32togrp16 (&g16, getgrgid32 ((__gid32_t) gid)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern "C" | ||||||
|  | struct __group32 * | ||||||
|  | getgrnam32 (const char *name) | ||||||
| { | { | ||||||
|   if (group_state  <= initializing) |   if (group_state  <= initializing) | ||||||
|     read_etc_group(); |     read_etc_group(); | ||||||
| @@ -244,6 +270,15 @@ getgrnam (const char *name) | |||||||
|   return NULL; |   return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" | ||||||
|  | struct __group16 * | ||||||
|  | getgrnam (const char *name) | ||||||
|  | { | ||||||
|  |   static struct __group16 g16; | ||||||
|  |  | ||||||
|  |   return grp32togrp16 (&g16, getgrnam32 (name)); | ||||||
|  | } | ||||||
|  |  | ||||||
| extern "C" | extern "C" | ||||||
| void | void | ||||||
| endgrent() | endgrent() | ||||||
| @@ -252,8 +287,8 @@ endgrent() | |||||||
| } | } | ||||||
|  |  | ||||||
| extern "C" | extern "C" | ||||||
| struct __group16 * | struct __group32 * | ||||||
| getgrent() | getgrent32() | ||||||
| { | { | ||||||
|   if (group_state  <= initializing) |   if (group_state  <= initializing) | ||||||
|     read_etc_group(); |     read_etc_group(); | ||||||
| @@ -264,6 +299,15 @@ getgrent() | |||||||
|   return NULL; |   return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" | ||||||
|  | struct __group16 * | ||||||
|  | getgrent() | ||||||
|  | { | ||||||
|  |   static struct __group16 g16; | ||||||
|  |  | ||||||
|  |   return grp32togrp16 (&g16, getgrent32 ()); | ||||||
|  | } | ||||||
|  |  | ||||||
| extern "C" | extern "C" | ||||||
| void | void | ||||||
| setgrent () | setgrent () | ||||||
| @@ -272,7 +316,7 @@ setgrent () | |||||||
| } | } | ||||||
|  |  | ||||||
| /* Internal function. ONLY USE THIS INTERNALLY, NEVER `getgrent'!!! */ | /* Internal function. ONLY USE THIS INTERNALLY, NEVER `getgrent'!!! */ | ||||||
| struct __group16 * | struct __group32 * | ||||||
| internal_getgrent (int pos) | internal_getgrent (int pos) | ||||||
| { | { | ||||||
|   if (group_state  <= initializing) |   if (group_state  <= initializing) | ||||||
| @@ -284,12 +328,13 @@ internal_getgrent (int pos) | |||||||
| } | } | ||||||
|  |  | ||||||
| int | int | ||||||
| getgroups (int gidsetsize, __gid16_t *grouplist, __gid16_t gid, const char *username) | getgroups32 (int gidsetsize, __gid32_t *grouplist, __gid32_t gid, | ||||||
|  | 	     const char *username) | ||||||
| { | { | ||||||
|   HANDLE hToken = NULL; |   HANDLE hToken = NULL; | ||||||
|   DWORD size; |   DWORD size; | ||||||
|   int cnt = 0; |   int cnt = 0; | ||||||
|   struct __group16 *gr; |   struct __group32 *gr; | ||||||
|  |  | ||||||
|   if (group_state  <= initializing) |   if (group_state  <= initializing) | ||||||
|     read_etc_group(); |     read_etc_group(); | ||||||
| @@ -357,11 +402,43 @@ error: | |||||||
|   return -1; |   return -1; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" | ||||||
|  | int | ||||||
|  | getgroups32 (int gidsetsize, __gid32_t *grouplist) | ||||||
|  | { | ||||||
|  |   return getgroups32 (gidsetsize, grouplist, myself->gid, | ||||||
|  | 		      cygheap->user.name ()); | ||||||
|  | } | ||||||
|  |  | ||||||
| extern "C" | extern "C" | ||||||
| int | int | ||||||
| getgroups (int gidsetsize, __gid16_t *grouplist) | getgroups (int gidsetsize, __gid16_t *grouplist) | ||||||
| { | { | ||||||
|   return getgroups (gidsetsize, grouplist, myself->gid, cygheap->user.name ()); |   __gid32_t *grouplist32 = NULL; | ||||||
|  |  | ||||||
|  |   if (gidsetsize < 0) | ||||||
|  |     { | ||||||
|  |       set_errno (EINVAL); | ||||||
|  |       return -1; | ||||||
|  |     } | ||||||
|  |   if (gidsetsize > 0 && grouplist) | ||||||
|  |     grouplist32 = (__gid32_t *) alloca (gidsetsize * sizeof (__gid32_t)); | ||||||
|  |  | ||||||
|  |   int ret = getgroups32 (gidsetsize, grouplist32, myself->gid, | ||||||
|  | 			 cygheap->user.name ()); | ||||||
|  |  | ||||||
|  |   if (gidsetsize > 0 && grouplist) | ||||||
|  |     for (int i = 0; i < ret; ++ i) | ||||||
|  |       grouplist[i] = grouplist32[i]; | ||||||
|  |  | ||||||
|  |   return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern "C" | ||||||
|  | int | ||||||
|  | initgroups32 (const char *, __gid32_t) | ||||||
|  | { | ||||||
|  |   return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| extern "C" | extern "C" | ||||||
|   | |||||||
| @@ -35,8 +35,9 @@ struct __group32 | |||||||
|   char **gr_mem; |   char **gr_mem; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| struct __group16 * getgrgid (__gid16_t gid); | struct __group32 * getgrgid32 (__gid32_t gid); | ||||||
| struct __group16 * getgrnam (const char *name); | struct __group32 * getgrnam32 (const char *name); | ||||||
|  | __gid32_t getgid32 (); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
|   | |||||||
| @@ -65,8 +65,8 @@ public: | |||||||
|      if not found.  This data resides in the shared data area (allowing |      if not found.  This data resides in the shared data area (allowing | ||||||
|      tasks to store whatever they want here) so it's for informational |      tasks to store whatever they want here) so it's for informational | ||||||
|      purposes only. */ |      purposes only. */ | ||||||
|   __uid16_t uid;		/* User ID */ |   __uid32_t uid;	/* User ID */ | ||||||
|   __gid16_t gid;		/* Group ID */ |   __gid32_t gid;	/* Group ID */ | ||||||
|   pid_t pgid;		/* Process group ID */ |   pid_t pgid;		/* Process group ID */ | ||||||
|   pid_t sid;		/* Session ID */ |   pid_t sid;		/* Session ID */ | ||||||
|   int ctty;		/* Control tty */ |   int ctty;		/* Control tty */ | ||||||
|   | |||||||
| @@ -107,7 +107,7 @@ setacl (const char *file, int nentries, __aclent16_t *aclbufp) | |||||||
|  |  | ||||||
|   cygsid sid; |   cygsid sid; | ||||||
|   struct passwd *pw; |   struct passwd *pw; | ||||||
|   struct __group16 *gr; |   struct __group32 *gr; | ||||||
|   int pos; |   int pos; | ||||||
|  |  | ||||||
|   if (!InitializeAcl (acl, 3072, ACL_REVISION)) |   if (!InitializeAcl (acl, 3072, ACL_REVISION)) | ||||||
| @@ -172,7 +172,7 @@ setacl (const char *file, int nentries, __aclent16_t *aclbufp) | |||||||
| 	  break; | 	  break; | ||||||
| 	case GROUP: | 	case GROUP: | ||||||
| 	case DEF_GROUP: | 	case DEF_GROUP: | ||||||
| 	  if (!(gr = getgrgid (aclbufp[i].a_id)) | 	  if (!(gr = getgrgid32 (aclbufp[i].a_id)) | ||||||
| 	      || !sid.getfromgr (gr) | 	      || !sid.getfromgr (gr) | ||||||
| 	      || !add_access_allowed_ace (acl, ace_off++, allow, | 	      || !add_access_allowed_ace (acl, ace_off++, allow, | ||||||
| 					   sid, acl_len, inheritance)) | 					   sid, acl_len, inheritance)) | ||||||
| @@ -256,7 +256,7 @@ getacl (const char *file, DWORD attr, int nentries, __aclent16_t *aclbufp) | |||||||
|   PSID group_sid; |   PSID group_sid; | ||||||
|   BOOL dummy; |   BOOL dummy; | ||||||
|   __uid16_t uid; |   __uid16_t uid; | ||||||
|   __gid16_t gid; |   __gid32_t gid; | ||||||
|  |  | ||||||
|   if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy)) |   if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy)) | ||||||
|     { |     { | ||||||
| @@ -424,7 +424,7 @@ acl_access (const char *path, int flags) | |||||||
| 	      cygsid owner; | 	      cygsid owner; | ||||||
| 	      cygsid group; | 	      cygsid group; | ||||||
| 	      struct passwd *pw; | 	      struct passwd *pw; | ||||||
| 	      struct __group16 *gr = NULL; | 	      struct __group32 *gr = NULL; | ||||||
|  |  | ||||||
| 	      if ((pw = getpwuid (acls[i].a_id)) != NULL | 	      if ((pw = getpwuid (acls[i].a_id)) != NULL | ||||||
| 		  && owner.getfrompw (pw)) | 		  && owner.getfrompw (pw)) | ||||||
| @@ -994,7 +994,7 @@ aclfromtext (char *acltextp, int *) | |||||||
| 	      c += 5; | 	      c += 5; | ||||||
| 	      if (isalpha (*c)) | 	      if (isalpha (*c)) | ||||||
| 		{ | 		{ | ||||||
| 		  struct __group16 *gr = getgrnam (c); | 		  struct __group32 *gr = getgrnam32 (c); | ||||||
| 		  if (!gr) | 		  if (!gr) | ||||||
| 		    { | 		    { | ||||||
| 		      set_errno (EINVAL); | 		      set_errno (EINVAL); | ||||||
|   | |||||||
| @@ -127,7 +127,7 @@ cygsid::getfrompw (const struct passwd *pw) | |||||||
| } | } | ||||||
|  |  | ||||||
| BOOL | BOOL | ||||||
| cygsid::getfromgr (const struct __group16 *gr) | cygsid::getfromgr (const struct __group32 *gr) | ||||||
| { | { | ||||||
|   char *sp = (gr && gr->gr_passwd) ? gr->gr_passwd : NULL; |   char *sp = (gr && gr->gr_passwd) ? gr->gr_passwd : NULL; | ||||||
|   return (*this = sp ?: "") != NULL; |   return (*this = sp ?: "") != NULL; | ||||||
| @@ -174,7 +174,7 @@ cygsid::get_id (BOOL search_grp, int *type) | |||||||
| 	} | 	} | ||||||
|       if (search_grp || type) |       if (search_grp || type) | ||||||
| 	{ | 	{ | ||||||
| 	  struct __group16 *gr; | 	  struct __group32 *gr; | ||||||
| 	  for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) | 	  for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) | ||||||
| 	    { | 	    { | ||||||
| 	      if (sid.getfromgr (gr) && sid == psid) | 	      if (sid.getfromgr (gr) && sid == psid) | ||||||
| @@ -224,7 +224,7 @@ cygsid::get_id (BOOL search_grp, int *type) | |||||||
| 	      *type = GROUP; | 	      *type = GROUP; | ||||||
| 	    if (id == -1) | 	    if (id == -1) | ||||||
| 	      { | 	      { | ||||||
| 		struct __group16 *gr = getgrnam (account); | 		struct __group32 *gr = getgrnam32 (account); | ||||||
| 		if (gr) | 		if (gr) | ||||||
| 		  id = gr->gr_gid; | 		  id = gr->gr_gid; | ||||||
| 	      } | 	      } | ||||||
| @@ -249,16 +249,16 @@ cygsid::get_id (BOOL search_grp, int *type) | |||||||
| } | } | ||||||
|  |  | ||||||
| BOOL | BOOL | ||||||
| is_grp_member (__uid16_t uid, __gid16_t gid) | is_grp_member (__uid32_t uid, __gid32_t gid) | ||||||
| { | { | ||||||
|   extern int getgroups (int, __gid16_t *, __gid16_t, const char *); |   extern int getgroups32 (int, __gid32_t *, __gid32_t, const char *); | ||||||
|   BOOL grp_member = TRUE; |   BOOL grp_member = TRUE; | ||||||
|  |  | ||||||
|   struct passwd *pw = getpwuid (uid); |   struct passwd *pw = getpwuid (uid); | ||||||
|   __gid16_t grps[NGROUPS_MAX]; |   __gid32_t grps[NGROUPS_MAX]; | ||||||
|   int cnt = getgroups (NGROUPS_MAX, grps, |   int cnt = getgroups32 (NGROUPS_MAX, grps, | ||||||
| 		       pw ? pw->pw_gid : myself->gid, | 			 pw ? pw->pw_gid : myself->gid, | ||||||
| 		       pw ? pw->pw_name : cygheap->user.name ()); | 			 pw ? pw->pw_name : cygheap->user.name ()); | ||||||
|   int i; |   int i; | ||||||
|   for (i = 0; i < cnt; ++i) |   for (i = 0; i < cnt; ++i) | ||||||
|     if (grps[i] == gid) |     if (grps[i] == gid) | ||||||
|   | |||||||
| @@ -456,7 +456,7 @@ get_user_primary_group (WCHAR *wlogonserver, const char *user, | |||||||
| static int | static int | ||||||
| get_supplementary_group_sidlist (const char *username, cygsidlist &grp_list) | get_supplementary_group_sidlist (const char *username, cygsidlist &grp_list) | ||||||
| { | { | ||||||
|   struct __group16 *gr; |   struct __group32 *gr; | ||||||
|   int cnt = 0; |   int cnt = 0; | ||||||
|  |  | ||||||
|   for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) |   for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) | ||||||
| @@ -1130,7 +1130,7 @@ write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size) | |||||||
|  |  | ||||||
| static int | static int | ||||||
| get_nt_attribute (const char *file, int *attribute, | get_nt_attribute (const char *file, int *attribute, | ||||||
| 		  __uid16_t *uidret, __gid16_t *gidret) | 		  __uid16_t *uidret, __gid32_t *gidret) | ||||||
| { | { | ||||||
|   if (!wincap.has_security ()) |   if (!wincap.has_security ()) | ||||||
|     return 0; |     return 0; | ||||||
| @@ -1169,7 +1169,7 @@ get_nt_attribute (const char *file, int *attribute, | |||||||
|     } |     } | ||||||
|  |  | ||||||
|   __uid16_t uid = cygsid(owner_sid).get_uid (); |   __uid16_t uid = cygsid(owner_sid).get_uid (); | ||||||
|   __gid16_t gid = cygsid(group_sid).get_gid (); |   __gid32_t gid = cygsid(group_sid).get_gid (); | ||||||
|   if (uidret) |   if (uidret) | ||||||
|     *uidret = uid; |     *uidret = uid; | ||||||
|   if (gidret) |   if (gidret) | ||||||
| @@ -1279,7 +1279,7 @@ get_nt_attribute (const char *file, int *attribute, | |||||||
|  |  | ||||||
| int | int | ||||||
| get_file_attribute (int use_ntsec, const char *file, | get_file_attribute (int use_ntsec, const char *file, | ||||||
| 		    int *attribute, __uid16_t *uidret, __gid16_t *gidret) | 		    int *attribute, __uid16_t *uidret, __gid32_t *gidret) | ||||||
| { | { | ||||||
|   int res; |   int res; | ||||||
|  |  | ||||||
| @@ -1294,7 +1294,7 @@ get_file_attribute (int use_ntsec, const char *file, | |||||||
|   if (uidret) |   if (uidret) | ||||||
|     *uidret = getuid (); |     *uidret = getuid (); | ||||||
|   if (gidret) |   if (gidret) | ||||||
|     *gidret = getgid (); |     *gidret = getgid32 (); | ||||||
|  |  | ||||||
|   if (!attribute) |   if (!attribute) | ||||||
|     return 0; |     return 0; | ||||||
| @@ -1350,7 +1350,7 @@ add_access_denied_ace (PACL acl, int offset, DWORD attributes, | |||||||
| } | } | ||||||
|  |  | ||||||
| PSECURITY_DESCRIPTOR | PSECURITY_DESCRIPTOR | ||||||
| alloc_sd (__uid16_t uid, __gid16_t gid, const char *logsrv, int attribute, | alloc_sd (__uid16_t uid, __gid32_t gid, const char *logsrv, int attribute, | ||||||
| 	  PSECURITY_DESCRIPTOR sd_ret, DWORD *sd_size_ret) | 	  PSECURITY_DESCRIPTOR sd_ret, DWORD *sd_size_ret) | ||||||
| { | { | ||||||
|   BOOL dummy; |   BOOL dummy; | ||||||
| @@ -1378,7 +1378,7 @@ alloc_sd (__uid16_t uid, __gid16_t gid, const char *logsrv, int attribute, | |||||||
|  |  | ||||||
|   /* Get SID and name of new group. */ |   /* Get SID and name of new group. */ | ||||||
|   cygsid group_sid (NO_SID); |   cygsid group_sid (NO_SID); | ||||||
|   struct __group16 *grp = getgrgid (gid); |   struct __group32 *grp = getgrgid32 (gid); | ||||||
|   if (grp) |   if (grp) | ||||||
|     { |     { | ||||||
|       if ((!grp || !group_sid.getfromgr (grp)) |       if ((!grp || !group_sid.getfromgr (grp)) | ||||||
| @@ -1619,7 +1619,7 @@ set_security_attribute (int attribute, PSECURITY_ATTRIBUTES psa, | |||||||
| } | } | ||||||
|  |  | ||||||
| static int | static int | ||||||
| set_nt_attribute (const char *file, __uid16_t uid, __gid16_t gid, | set_nt_attribute (const char *file, __uid16_t uid, __gid32_t gid, | ||||||
| 		  const char *logsrv, int attribute) | 		  const char *logsrv, int attribute) | ||||||
| { | { | ||||||
|   if (!wincap.has_security ()) |   if (!wincap.has_security ()) | ||||||
| @@ -1645,7 +1645,7 @@ set_nt_attribute (const char *file, __uid16_t uid, __gid16_t gid, | |||||||
|  |  | ||||||
| int | int | ||||||
| set_file_attribute (int use_ntsec, const char *file, | set_file_attribute (int use_ntsec, const char *file, | ||||||
| 		    __uid16_t uid, __gid16_t gid, | 		    __uid16_t uid, __gid32_t gid, | ||||||
| 		    int attribute, const char *logsrv) | 		    int attribute, const char *logsrv) | ||||||
| { | { | ||||||
|   int ret = 0; |   int ret = 0; | ||||||
|   | |||||||
| @@ -57,7 +57,7 @@ public: | |||||||
|   inline PSID set () { return psid = (PSID) sbuf; } |   inline PSID set () { return psid = (PSID) sbuf; } | ||||||
|  |  | ||||||
|   BOOL getfrompw (const struct passwd *pw); |   BOOL getfrompw (const struct passwd *pw); | ||||||
|   BOOL getfromgr (const struct __group16 *gr); |   BOOL getfromgr (const struct __group32 *gr); | ||||||
|  |  | ||||||
|   int get_id (BOOL search_grp, int *type = NULL); |   int get_id (BOOL search_grp, int *type = NULL); | ||||||
|   inline int get_uid () { return get_id (FALSE); } |   inline int get_uid () { return get_id (FALSE); } | ||||||
| @@ -161,14 +161,14 @@ extern BOOL allow_smbntsec; | |||||||
|    and group lists so they are somehow security related. Besides that |    and group lists so they are somehow security related. Besides that | ||||||
|    I didn't find a better place to declare them. */ |    I didn't find a better place to declare them. */ | ||||||
| extern struct passwd *internal_getpwent (int); | extern struct passwd *internal_getpwent (int); | ||||||
| extern struct __group16 *internal_getgrent (int); | extern struct __group32 *internal_getgrent (int); | ||||||
|  |  | ||||||
| /* File manipulation */ | /* File manipulation */ | ||||||
| int __stdcall set_process_privileges (); | int __stdcall set_process_privileges (); | ||||||
| int __stdcall get_file_attribute (int, const char *, int *, | int __stdcall get_file_attribute (int, const char *, int *, | ||||||
| 				  __uid16_t * = NULL, __gid16_t * = NULL); | 				  __uid16_t * = NULL, __gid32_t * = NULL); | ||||||
| int __stdcall set_file_attribute (int, const char *, int); | int __stdcall set_file_attribute (int, const char *, int); | ||||||
| int __stdcall set_file_attribute (int, const char *, __uid16_t, __gid16_t, int, const char *); | int __stdcall set_file_attribute (int, const char *, __uid16_t, __gid32_t, int, const char *); | ||||||
| LONG __stdcall read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size); | LONG __stdcall read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size); | ||||||
| LONG __stdcall write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size); | LONG __stdcall write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size); | ||||||
| BOOL __stdcall add_access_allowed_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit); | BOOL __stdcall add_access_allowed_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit); | ||||||
| @@ -190,7 +190,7 @@ void extract_nt_dom_user (const struct passwd *pw, char *domain, char *user); | |||||||
| BOOL get_logon_server_and_user_domain (char *logonserver, char *domain); | BOOL get_logon_server_and_user_domain (char *logonserver, char *domain); | ||||||
|  |  | ||||||
| /* sec_helper.cc: Security helper functions. */ | /* sec_helper.cc: Security helper functions. */ | ||||||
| BOOL __stdcall is_grp_member (__uid16_t uid, __gid16_t gid); | BOOL __stdcall is_grp_member (__uid32_t uid, __gid32_t gid); | ||||||
| /* `lookup_name' should be called instead of LookupAccountName. | /* `lookup_name' should be called instead of LookupAccountName. | ||||||
|  * logsrv may be NULL, in this case only the local system is used for lookup. |  * logsrv may be NULL, in this case only the local system is used for lookup. | ||||||
|  * The buffer for ret_sid (40 Bytes) has to be allocated by the caller! */ |  * The buffer for ret_sid (40 Bytes) has to be allocated by the caller! */ | ||||||
| @@ -209,7 +209,7 @@ extern BOOL sec_acl (PACL acl, BOOL admins, PSID sid1 = NO_SID, PSID sid2 = NO_S | |||||||
|  |  | ||||||
| int __stdcall NTReadEA (const char *file, const char *attrname, char *buf, int len); | int __stdcall NTReadEA (const char *file, const char *attrname, char *buf, int len); | ||||||
| BOOL __stdcall NTWriteEA (const char *file, const char *attrname, const char *buf, int len); | BOOL __stdcall NTWriteEA (const char *file, const char *attrname, const char *buf, int len); | ||||||
| PSECURITY_DESCRIPTOR alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute, | PSECURITY_DESCRIPTOR alloc_sd (__uid16_t uid, __gid32_t gid, const char *logsrv, int attribute, | ||||||
|           PSECURITY_DESCRIPTOR sd_ret, DWORD *sd_size_ret); |           PSECURITY_DESCRIPTOR sd_ret, DWORD *sd_size_ret); | ||||||
|  |  | ||||||
| extern inline SECURITY_ATTRIBUTES * | extern inline SECURITY_ATTRIBUTES * | ||||||
|   | |||||||
| @@ -442,7 +442,7 @@ shmctl (int shmid, int cmd, struct shmid_ds *buf) | |||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* FIXME: evaluate getuid() and getgid() against the requested mode. Then | /* FIXME: evaluate getuid() and getgid32() against the requested mode. Then | ||||||
|  * choose PAGE_READWRITE | PAGE_READONLY and FILE_MAP_WRITE  |  FILE_MAP_READ |  * choose PAGE_READWRITE | PAGE_READONLY and FILE_MAP_WRITE  |  FILE_MAP_READ | ||||||
|  * appropriately |  * appropriately | ||||||
|  */ |  */ | ||||||
| @@ -461,7 +461,7 @@ shmget (key_t key, size_t size, int shmflg) | |||||||
|   /* create a sd for our open requests based on shmflag & 0x01ff */ |   /* create a sd for our open requests based on shmflag & 0x01ff */ | ||||||
|   InitializeSecurityDescriptor (psd, |   InitializeSecurityDescriptor (psd, | ||||||
| 				    SECURITY_DESCRIPTOR_REVISION); | 				    SECURITY_DESCRIPTOR_REVISION); | ||||||
|   psd = alloc_sd (getuid (), getgid (), cygheap->user.logsrv (), |   psd = alloc_sd (getuid (), getgid32 (), cygheap->user.logsrv (), | ||||||
| 		  shmflg & 0x01ff, psd, &sd_size); | 		  shmflg & 0x01ff, psd, &sd_size); | ||||||
|  |  | ||||||
|   if (key == (key_t) - 1) |   if (key == (key_t) - 1) | ||||||
| @@ -540,7 +540,7 @@ shmget (key_t key, size_t size, int shmflg) | |||||||
|   /* fill out the node data */ |   /* fill out the node data */ | ||||||
|   shmtemp->shm_perm.cuid = getuid (); |   shmtemp->shm_perm.cuid = getuid (); | ||||||
|   shmtemp->shm_perm.uid = shmtemp->shm_perm.cuid; |   shmtemp->shm_perm.uid = shmtemp->shm_perm.cuid; | ||||||
|   shmtemp->shm_perm.cgid = getgid (); |   shmtemp->shm_perm.cgid = getgid32 (); | ||||||
|   shmtemp->shm_perm.gid = shmtemp->shm_perm.cgid; |   shmtemp->shm_perm.gid = shmtemp->shm_perm.cgid; | ||||||
|   shmtemp->shm_perm.mode = shmflg & 0x01ff; |   shmtemp->shm_perm.mode = shmflg & 0x01ff; | ||||||
|   shmtemp->shm_lpid = 0; |   shmtemp->shm_lpid = 0; | ||||||
|   | |||||||
| @@ -750,11 +750,11 @@ done: | |||||||
|  * systems, it is only a stub that always returns zero. |  * systems, it is only a stub that always returns zero. | ||||||
|  */ |  */ | ||||||
| static int | static int | ||||||
| chown_worker (const char *name, unsigned fmode, __uid16_t uid, __gid16_t gid) | chown_worker (const char *name, unsigned fmode, __uid16_t uid, __gid32_t gid) | ||||||
| { | { | ||||||
|   int res; |   int res; | ||||||
|   __uid16_t old_uid; |   __uid16_t old_uid; | ||||||
|   __gid16_t old_gid; |   __gid32_t old_gid; | ||||||
|  |  | ||||||
|   if (check_null_empty_str_errno (name)) |   if (check_null_empty_str_errno (name)) | ||||||
|     return -1; |     return -1; | ||||||
| @@ -815,21 +815,35 @@ done: | |||||||
| } | } | ||||||
|  |  | ||||||
| extern "C" int | extern "C" int | ||||||
| chown (const char * name, __uid16_t uid, __gid16_t gid) | chown32 (const char * name, __uid16_t uid, __gid32_t gid) | ||||||
| { | { | ||||||
|   sigframe thisframe (mainthread); |   sigframe thisframe (mainthread); | ||||||
|   return chown_worker (name, PC_SYM_FOLLOW, uid, gid); |   return chown_worker (name, PC_SYM_FOLLOW, uid, gid); | ||||||
| } | } | ||||||
|  |  | ||||||
| extern "C" int | extern "C" int | ||||||
| lchown (const char * name, __uid16_t uid, __gid16_t gid) | chown (const char * name, __uid16_t uid, __gid16_t gid) | ||||||
|  | { | ||||||
|  |   sigframe thisframe (mainthread); | ||||||
|  |   return chown_worker (name, PC_SYM_FOLLOW, uid, (__gid32_t) gid); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern "C" int | ||||||
|  | lchown32 (const char * name, __uid16_t uid, __gid32_t gid) | ||||||
| { | { | ||||||
|   sigframe thisframe (mainthread); |   sigframe thisframe (mainthread); | ||||||
|   return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid); |   return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid); | ||||||
| } | } | ||||||
|  |  | ||||||
| extern "C" int | extern "C" int | ||||||
| fchown (int fd, __uid16_t uid, __gid16_t gid) | lchown (const char * name, __uid16_t uid, __gid16_t gid) | ||||||
|  | { | ||||||
|  |   sigframe thisframe (mainthread); | ||||||
|  |   return chown_worker (name, PC_SYM_NOFOLLOW, uid, (__gid32_t) gid); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern "C" int | ||||||
|  | fchown32 (int fd, __uid16_t uid, __gid32_t gid) | ||||||
| { | { | ||||||
|   sigframe thisframe (mainthread); |   sigframe thisframe (mainthread); | ||||||
|   cygheap_fdget cfd (fd); |   cygheap_fdget cfd (fd); | ||||||
| @@ -853,6 +867,12 @@ fchown (int fd, __uid16_t uid, __gid16_t gid) | |||||||
|   return chown_worker (path, PC_SYM_FOLLOW, uid, gid); |   return chown_worker (path, PC_SYM_FOLLOW, uid, gid); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" int | ||||||
|  | fchown (int fd, __uid16_t uid, __gid16_t gid) | ||||||
|  | { | ||||||
|  |   return fchown32 (fd, uid, (__gid32_t) gid); | ||||||
|  | } | ||||||
|  |  | ||||||
| /* umask: POSIX 5.3.3.1 */ | /* umask: POSIX 5.3.3.1 */ | ||||||
| extern "C" mode_t | extern "C" mode_t | ||||||
| umask (mode_t mask) | umask (mode_t mask) | ||||||
| @@ -895,7 +915,7 @@ chmod (const char *path, mode_t mode) | |||||||
|       SetFileAttributes (win32_path, (DWORD) win32_path & ~FILE_ATTRIBUTE_READONLY); |       SetFileAttributes (win32_path, (DWORD) win32_path & ~FILE_ATTRIBUTE_READONLY); | ||||||
|  |  | ||||||
|       __uid16_t uid; |       __uid16_t uid; | ||||||
|       __gid16_t gid; |       __gid32_t gid; | ||||||
|  |  | ||||||
|       if (win32_path.isdir ()) |       if (win32_path.isdir ()) | ||||||
| 	mode |= S_IFDIR; | 	mode |= S_IFDIR; | ||||||
| @@ -1912,16 +1932,6 @@ mkfifo (const char *_path, mode_t mode) | |||||||
|   return -1; |   return -1; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* setgid: POSIX 4.2.2.1 */ |  | ||||||
| extern "C" int |  | ||||||
| setgid (__gid16_t gid) |  | ||||||
| { |  | ||||||
|   int ret = setegid (gid); |  | ||||||
|   if (!ret) |  | ||||||
|     cygheap->user.real_gid = myself->gid; |  | ||||||
|   return ret; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* setuid: POSIX 4.2.2.1 */ | /* setuid: POSIX 4.2.2.1 */ | ||||||
| extern "C" int | extern "C" int | ||||||
| setuid (__uid16_t uid) | setuid (__uid16_t uid) | ||||||
| @@ -1966,7 +1976,7 @@ seteuid (__uid16_t uid) | |||||||
|  |  | ||||||
|   pw_new = getpwuid (uid); |   pw_new = getpwuid (uid); | ||||||
|   if (!usersid.getfrompw (pw_new) || |   if (!usersid.getfrompw (pw_new) || | ||||||
|       (!pgrpsid.getfromgr (getgrgid (myself->gid)))) |       (!pgrpsid.getfromgr (getgrgid32 (myself->gid)))) | ||||||
|     { |     { | ||||||
|       set_errno (EINVAL); |       set_errno (EINVAL); | ||||||
|       return -1; |       return -1; | ||||||
| @@ -2137,7 +2147,7 @@ seteuid (__uid16_t uid) | |||||||
|  |  | ||||||
| /* setegid: from System V.  */ | /* setegid: from System V.  */ | ||||||
| extern "C" int | extern "C" int | ||||||
| setegid (__gid16_t gid) | setegid32 (__gid32_t gid) | ||||||
| { | { | ||||||
|   if ((!wincap.has_security ()) || |   if ((!wincap.has_security ()) || | ||||||
|       (gid == ILLEGAL_GID)) |       (gid == ILLEGAL_GID)) | ||||||
| @@ -2147,7 +2157,7 @@ setegid (__gid16_t gid) | |||||||
|   cygsid gsid; |   cygsid gsid; | ||||||
|   HANDLE ptok; |   HANDLE ptok; | ||||||
|  |  | ||||||
|   if (!(gsid.getfromgr (getgrgid (gid)))) |   if (!(gsid.getfromgr (getgrgid32 (gid)))) | ||||||
|     { |     { | ||||||
|       set_errno (EINVAL); |       set_errno (EINVAL); | ||||||
|       return -1; |       return -1; | ||||||
| @@ -2184,6 +2194,31 @@ setegid (__gid16_t gid) | |||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" int | ||||||
|  | setegid (__gid16_t gid) | ||||||
|  | { | ||||||
|  |   return setegid32 ((__gid32_t) gid); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* setgid: POSIX 4.2.2.1 */ | ||||||
|  | extern "C" int | ||||||
|  | setgid32 (__gid32_t gid) | ||||||
|  | { | ||||||
|  |   int ret = setegid32 (gid); | ||||||
|  |   if (!ret) | ||||||
|  |     cygheap->user.real_gid = myself->gid; | ||||||
|  |   return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | extern "C" int | ||||||
|  | setgid (__gid16_t gid) | ||||||
|  | { | ||||||
|  |   int ret = setegid32 ((__gid32_t) gid); | ||||||
|  |   if (!ret) | ||||||
|  |     cygheap->user.real_gid = myself->gid; | ||||||
|  |   return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
| /* chroot: privileged Unix system call.  */ | /* chroot: privileged Unix system call.  */ | ||||||
| /* FIXME: Not privileged here. How should this be done? */ | /* FIXME: Not privileged here. How should this be done? */ | ||||||
| extern "C" int | extern "C" int | ||||||
|   | |||||||
| @@ -173,7 +173,7 @@ internal_getlogin (cygheap_user &user) | |||||||
| 	    if (psid.getfrompw (pw) && EqualSid (user.sid (), psid)) | 	    if (psid.getfrompw (pw) && EqualSid (user.sid (), psid)) | ||||||
| 	      { | 	      { | ||||||
| 		user.set_name (pw->pw_name); | 		user.set_name (pw->pw_name); | ||||||
| 		struct __group16 *gr = getgrgid (pw->pw_gid); | 		struct __group32 *gr = getgrgid32 (pw->pw_gid); | ||||||
| 		if (gr) | 		if (gr) | ||||||
| 		  if (!gsid.getfromgr (gr)) | 		  if (!gsid.getfromgr (gr)) | ||||||
| 		      gsid = NO_SID; | 		      gsid = NO_SID; | ||||||
| @@ -288,6 +288,12 @@ getuid (void) | |||||||
|   return cygheap->user.real_uid; |   return cygheap->user.real_uid; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" __gid32_t | ||||||
|  | getgid32 (void) | ||||||
|  | { | ||||||
|  |   return cygheap->user.real_gid; | ||||||
|  | } | ||||||
|  |  | ||||||
| extern "C" __gid16_t | extern "C" __gid16_t | ||||||
| getgid (void) | getgid (void) | ||||||
| { | { | ||||||
| @@ -300,6 +306,12 @@ geteuid (void) | |||||||
|   return myself->uid; |   return myself->uid; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | extern "C" __gid32_t | ||||||
|  | getegid32 (void) | ||||||
|  | { | ||||||
|  |   return myself->gid; | ||||||
|  | } | ||||||
|  |  | ||||||
| extern "C" __gid16_t | extern "C" __gid16_t | ||||||
| getegid (void) | getegid (void) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -148,7 +148,7 @@ extern "C" void __stdcall do_exit (int) __attribute__ ((noreturn)); | |||||||
| void uinfo_init (void); | void uinfo_init (void); | ||||||
|  |  | ||||||
| #define ILLEGAL_UID ((__uid16_t)-1) | #define ILLEGAL_UID ((__uid16_t)-1) | ||||||
| #define ILLEGAL_GID ((__gid16_t)-1) | #define ILLEGAL_GID ((__gid32_t)-1) | ||||||
| #define ILLEGAL_SEEK ((__off64_t)-1) | #define ILLEGAL_SEEK ((__off64_t)-1) | ||||||
|  |  | ||||||
| /* various events */ | /* various events */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user