aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
authorLAN-TW <lantw44@sonytest.tfcis.org>2012-11-12 12:22:12 +0800
committerLAN-TW <lantw44@sonytest.tfcis.org>2012-11-12 12:22:12 +0800
commitd7f706956e0c4914879d2d08c24227ba0bb6ef0f (patch)
tree4ca7a46f180ebbf13d26aa32f643d3867b45bbb1 /src/common.h
parentcfa4b4203be3761bf37ec8cf7d394028ebd24e82 (diff)
downloadsctjudge-d7f706956e0c4914879d2d08c24227ba0bb6ef0f.tar.gz
sctjudge-d7f706956e0c4914879d2d08c24227ba0bb6ef0f.tar.zst
sctjudge-d7f706956e0c4914879d2d08c24227ba0bb6ef0f.zip
修正在 #undef _POSIX_SAVED_IDS 的環境下發生的問題
原先使用 getuid() 判斷 UID 會導致在 disable_setuid() 後 real UID 有誤,導致只 有 root 可以強制執行這支程式。
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index a5317ba..ca1f5f2 100644
--- a/src/common.h
+++ b/src/common.h
@@ -17,5 +17,11 @@ void disable_setuid(void);
void enable_setuid(void);
#endif
+#ifndef _POSIX_SAVED_IDS
+/* 避免 disable_setuid() 之後 getuid() 得到錯誤的值,所以用這個變數來取代 */
+extern uid_t procrealuid;
+extern uid_t proceffuid;
+#endif
+
#endif