summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parabolaweb-changepassword.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/parabolaweb-changepassword.c b/parabolaweb-changepassword.c
index 14ada37..29637da 100644
--- a/parabolaweb-changepassword.c
+++ b/parabolaweb-changepassword.c
@@ -20,7 +20,7 @@
#include <error.h> /* for error(3) */
#include <pwd.h> /* for getpwuid(3) */
#include <stdlib.h> /* for free(3) and environment functions */
-#include <unistd.h> /* for getuid(3), geteuid(3), execl(3) */
+#include <unistd.h> /* for getuid(3), geteuid(3), setreuid(3), execl(3) */
#include <stdio.h> /* for asprintf(3) in atoi() */
void
@@ -84,7 +84,8 @@ sanitize_environment()
mysetenv("SUID_UID" , a=itoa(user->pw_uid)); xfree(a);
mysetenv("SUID_GID" , a=itoa(user->pw_gid)); xfree(a);
- setreuid(geteuid(), -1);
+ if (setreuid(geteuid(), -1) != 0)
+ error(127, errno, "setreuid");
user = getpwuid(geteuid());
mysetenv("USER" , user->pw_name);