Commit Diff
Diff:
0f588e3af3ee7a941b8c2ca4f21f9f72ad655200
352f5d30482a64fca0d0648b70d2e5b96a5690cc
Commit:
352f5d30482a64fca0d0648b70d2e5b96a5690cc
Tree:
0791d1374e1fd21c754d7ff745ffb822b162c1c8
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Sat Jun 23 05:03:04 2018 UTC
Message:
NetBSD 7.0.2 doesn't have setresuid() so fix it like done for for delphinusdnsd.c
blob - eba1accca2c8bff6057b4dcdae170d79b8788c22
blob + 43c8e36eb4e7b715a88b50e8d8c286d0f153949c
--- dddctl.c
+++ dddctl.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: dddctl.c,v 1.13 2018/05/12 05:59:40 pjp Exp $
+ * $Id: dddctl.c,v 1.14 2018/06/23 05:03:04 pjp Exp $
*/
#include "ddd-include.h"
@@ -7017,10 +7017,25 @@ start(int argc, char *argv[])
fprintf(stderr, "must be root\n");
exit(1);
}
+
+#if defined __OpenBSD__ || defined __FreeBSD__
if (setresuid(0,0,0) < 0) {
perror("setuid");
exit(1);
}
+#else
+ if (setgid(0) < 0) {
+ dolog(LOG_INFO, "setgid: %s\n", strerror(errno));
+ slave_shutdown();
+ exit(1);
+ }
+ if (setuid(0) < 0) {
+ dolog(LOG_INFO, "setuid: %s\n", strerror(errno));
+ slave_shutdown();
+ exit(1);
+ }
+#endif
+
fprintf(stderr, "starting delphinusdnsd\n");
repomaster@centroid.eu