From 2ee50d030178cede83eb9d0005fbc19f819d30fe Mon Sep 17 00:00:00 2001 From: Graham Inggs Date: Mon, 5 Feb 2018 14:48:51 +0200 Subject: Imported Upstream version 2.1.0 --- CRT.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'CRT.h') diff --git a/CRT.h b/CRT.h index fb82413..590fff6 100644 --- a/CRT.h +++ b/CRT.h @@ -9,7 +9,12 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ -#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) +#if HAVE_SETUID_ENABLED +#endif + +#define ColorIndex(i,j) ((7-i)*8+j) + +#define ColorPair(i,j) COLOR_PAIR(ColorIndex(i,j)) #define Black COLOR_BLACK #define Red COLOR_RED @@ -20,6 +25,8 @@ in the source distribution for its full text. #define Cyan COLOR_CYAN #define White COLOR_WHITE +#define ColorPairGrayBlack ColorPair(Magenta,Magenta) + #define KEY_WHEELUP KEY_F(20) #define KEY_WHEELDOWN KEY_F(21) #define KEY_RECLICK KEY_F(22) @@ -150,6 +157,25 @@ extern int CRT_colorScheme; void *backtraceArray[128]; +#if HAVE_SETUID_ENABLED + +#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0) + +void CRT_dropPrivileges(); + +void CRT_restorePrivileges(); + +#else + +/* Turn setuid operations into NOPs */ + +#ifndef CRT_dropPrivileges +#define CRT_dropPrivileges() +#define CRT_restorePrivileges() +#endif + +#endif + // TODO: pass an instance of Settings instead. void CRT_init(int delay, int colorScheme); -- cgit v1.2.3