[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: secure_getenv + windows
From: |
Bruno Haible |
Subject: |
Re: secure_getenv + windows |
Date: |
Sun, 29 May 2016 13:10:37 +0200 |
User-agent: |
KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; ) |
Hi Nikos,
Thanks for the suggestion.
But we need to distinguish native Windows and Cygwin.
Native Windows does not have a setuid concept, but Cygwin has. [1]
Also, in the code, the "# ifdef _WIN32" conditional is wrong.
1) It is a compiler-dependent conditional. In order to treat the
GCC and MSVC compilers the same way, you need
#if (defined _WIN32 || defined __WIN32__)
2) On Cygwin, (defined _WIN32 || defined __WIN32__) evaluates to true
depending of GCC flags. Which is not what we want, because the
Cygwin setuid concept does not get eliminated by added some compiler
flags.
The right conditional for checking for native Windows is therefore
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
Also, Paul, why not add an implementation for Solaris, HP-UX, AIX, etc.
as well?
Find attached a proposed implementation for all platforms. For your review.
Bruno
[1]
http://pipeline.lbl.gov/code/3rd_party/licenses.win/cygwin-doc-1.4/cygwin-ug-net.html#ntsec-setuid
0001-secure_getenv-Port-to-many-more-platforms.patch
Description: Text Data