blob: c7c38c756e3744ee41dcebc8def6abc5c59c8c6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
--- autoconf/configure.in.setfsuid 2002-09-13 15:30:56.000000000 +0200
+++ autoconf/configure.in 2002-09-13 15:35:56.000000000 +0200
@@ -94,8 +94,17 @@
sys/wait.h \
sys/utsname.h \
sys/times.h \
+sys/fsuid.h \
)
+AC_CHECK_FUNCS(setfsuid setfsgid)
+
+if test "${ac_cv_func_setfsuid}" != "yes" || test "${ac_cv_func_setfsgid}" != "yes"; then
+ AC_MSG_ERROR([
+*** setfsguid and setfsgid cannot be found!!!
+ These are needed to support setuid/setgid applications ***])
+fi
+
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_UID_T
--- src.old/slinclud.h 2002-09-13 14:17:04.000000000 +0200
+++ src/slinclud.h 2002-09-13 15:39:38.000000000 +0200
@@ -30,4 +30,8 @@
#include <wchar.h>
#include <limits.h>
+#ifdef HAVE_SYS_FSUID_H
+# include <sys/fsuid.h>
+#endif
+
#endif /* _SLANG_INCLUDE_H_ */
--- src/sltermin.c
+++ src/sltermin.c
@@ -105,7 +105,32 @@
* I will also look into the use of setreuid, seteuid and setregid, setegid.
* FIXME: Priority=medium
*/
+ /* If your system lacks setfsuid/getfsuid either write
+ equivalent support or dont use slang to build setuid/setgid
+ apps like Mutt */
+
+ if(setfsuid(getuid())==-1)
+ {
+ perror("setfsuid");
+ return NULL;
+ }
+ if(setfsgid(getgid())==-1)
+ {
+ perror("setfsgid");
+ return NULL;
+ }
fp = fopen (file, "rb");
+ if(setfsuid(geteuid())==-1)
+ {
+ perror("setfsuid");
+ return NULL;
+ }
+ if(setfsgid(getegid())==-1)
+ {
+ perror("setfsgid");
+ return NULL;
+ }
+
if (fp == NULL) return NULL;
if ((12 == fread ((char *) buf, 1, 12, fp) && (MAGIC == make_integer (buf))))
|