os: unexport Fopen(), Fclose(), Popen(), Pclose(), System()

These functions are just used for reading auth file or calling xkbcomp while
dropping privileges, in case the Xserver is started as unprivileged user
with suid-root. Thus, shouldn't be used (and aren't used) by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1370>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-23 20:33:52 +01:00 committed by Marge Bot
parent 15d3c1a6f1
commit 30b403b0f0
3 changed files with 19 additions and 22 deletions

View File

@ -327,27 +327,6 @@ extern _X_EXPORT void
OsAbort(void)
_X_NORETURN;
#if !defined(WIN32)
extern _X_EXPORT void *
Popen(const char *, const char *);
extern _X_EXPORT int
Pclose(void *);
extern _X_EXPORT void *
Fopen(const char *, const char *);
extern _X_EXPORT int
Fclose(void *);
#else
extern const char *
Win32TempDir(void);
extern int
System(const char *cmdline);
#define Fopen(a,b) fopen(a,b)
#define Fclose(a) fclose(a)
#endif
extern _X_EXPORT Bool
PrivsElevated(void);

View File

@ -144,6 +144,21 @@ struct utsname {
static inline void uname(struct utsname *uts) {
gethostname(uts->nodename, sizeof(uts->nodename));
}
const char *Win32TempDir(void);
int System(const char *cmdline);
static inline void Fclose(void *f) { fclose(f); }
static inline void *Fopen(const char *a, const char *b) { return fopen(a,b); }
#else /* WIN32 */
int System(const char *);
void *Popen(const char *, const char *);
void *Fopen(const char *, const char *);
int Fclose(void *f);
int Pclose(void *f);
#endif /* WIN32 */
void AutoResetServer(int sig);

View File

@ -37,12 +37,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xos.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XKM.h>
#include "os/osdep.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#define PRE_ERROR_MSG "\"The XKEYBOARD keymap compiler (xkbcomp) reports:\""
#define ERROR_PREFIX "\"> \""