Index: slang-2.3.2/autoconf/configure.ac =================================================================== --- slang-2.3.2.orig/autoconf/configure.ac +++ slang-2.3.2/autoconf/configure.ac @@ -177,9 +177,18 @@ sys/socket.h \ netinet/in.h \ arpa/inet.h \ sys/un.h \ +sys/fsuid.h \ sys/resource.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 Index: slang-2.3.2/src/config.hin =================================================================== --- slang-2.3.2.orig/src/config.hin +++ slang-2.3.2/src/config.hin @@ -201,6 +201,8 @@ #undef HAVE_SYS_UN_H #undef socklen_t +#undef HAVE_SYS_FSUID_H +#undef HAVE_SETFSUID #undef HAVE_CONFSTR #undef HAVE_SYSCONF #undef HAVE_PATHCONF Index: slang-2.3.2/src/slinclud.h =================================================================== --- slang-2.3.2.orig/src/slinclud.h +++ slang-2.3.2/src/slinclud.h @@ -30,4 +30,8 @@ # include #endif +#ifdef HAVE_SYS_FSUID_H +# include +#endif + #endif /* _SLANG_INCLUDE_H_ */ Index: slang-2.3.2/src/sltermin.c =================================================================== --- slang-2.3.2.orig/src/sltermin.c +++ slang-2.3.2/src/sltermin.c @@ -23,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suit USA. */ +#include +#include + #include "slinclud.h" #include "slang.h" @@ -142,7 +145,32 @@ static FILE *open_terminfo (char *file, * 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))