commit 5b56f4872c68b5a9403ac5c0d85c9160cce7857e
parent 12895cc3387a403903953e4de8618a18e949ac87
Author: hhvn <dev@hhvn.uk>
Date: Sat, 5 Jun 2021 22:50:56 +0100
handler.c: force return on error
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/handler.c b/handler.c
@@ -43,12 +43,16 @@ get_plan(int fd, char *user) {
} else {
dprintf(fd, "Server-side error: %s\n", strerror(serrno));
error("getpwnam(): %s\n", strerror(serrno));
+ return;
}
}
/* drop priviledges to user */
- if (setuid(udata->pw_uid) == -1)
+ if (setuid(udata->pw_uid) == -1) {
+ dprintf(fd, "Server-side error: cannot drop priviledges\n");
error("setuid(): %s\n", strerror(errno));
+ return;
+ }
snprintf(path, sizeof(path), "%s/%s", udata->pw_dir, planfile);
if (access(path, R_OK) == -1) {