Cygwin: add secure_getenv

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
Yaakov Selkowitz 2019-02-18 23:06:11 -06:00
parent dd415f1a8c
commit 850705f92e
5 changed files with 17 additions and 1 deletions

View File

@ -94,6 +94,9 @@ void exit (int __status) _ATTRIBUTE ((__noreturn__));
void free (void *) _NOTHROW; void free (void *) _NOTHROW;
char * getenv (const char *__string); char * getenv (const char *__string);
char * _getenv_r (struct _reent *, const char *__string); char * _getenv_r (struct _reent *, const char *__string);
#if __GNU_VISIBLE
char * secure_getenv (const char *__string);
#endif
char * _findenv (const char *, int *); char * _findenv (const char *, int *);
char * _findenv_r (struct _reent *, const char *, int *); char * _findenv_r (struct _reent *, const char *, int *);
#if __POSIX_VISIBLE >= 200809 #if __POSIX_VISIBLE >= 200809

View File

@ -1255,6 +1255,7 @@ sched_rr_get_interval SIGFE
sched_setparam SIGFE sched_setparam SIGFE
sched_setscheduler SIGFE sched_setscheduler SIGFE
sched_yield SIGFE sched_yield SIGFE
secure_getenv NOSIGFE
seed48 NOSIGFE seed48 NOSIGFE
seekdir SIGFE seekdir SIGFE
select = cygwin_select SIGFE select = cygwin_select SIGFE

View File

@ -549,6 +549,16 @@ _getenv_r (struct _reent *, const char *name)
return findenv_func (name, &offset); return findenv_func (name, &offset);
} }
/* Like getenv, but returns NULL if effective and real UID/GIDs do not match */
extern "C" char *
secure_getenv (const char *name)
{
int offset;
if (cygheap->user.issetuid ())
return NULL;
return findenv_func (name, &offset);
}
/* Return number of environment entries, including terminating NULL. */ /* Return number of environment entries, including terminating NULL. */
static int __stdcall static int __stdcall
envsize (const char * const *in_envp) envsize (const char * const *in_envp)

View File

@ -508,12 +508,13 @@ details. */
335: Change size of utsname, change uname output. 335: Change size of utsname, change uname output.
336: New Cygwin PID algorithm (yeah, not really an API change) 336: New Cygwin PID algorithm (yeah, not really an API change)
337: MOUNT_BINARY -> MOUNT_TEXT 337: MOUNT_BINARY -> MOUNT_TEXT
338: Export secure_getenv.
Note that we forgot to bump the api for ualarm, strtoll, strtoull, Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */ sigaltstack, sethostname. */
#define CYGWIN_VERSION_API_MAJOR 0 #define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 337 #define CYGWIN_VERSION_API_MINOR 338
/* There is also a compatibity version number associated with the shared memory /* There is also a compatibity version number associated with the shared memory
regions. It is incremented when incompatible changes are made to the shared regions. It is incremented when incompatible changes are made to the shared

View File

@ -1377,6 +1377,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
removexattr removexattr
scandirat scandirat
sched_getcpu sched_getcpu
secure_getenv
setxattr setxattr
signalfd signalfd
sincos sincos