summaryrefslogtreecommitdiff
path: root/japanese/Canna/files/patch-ai
diff options
context:
space:
mode:
authorMasafumi Max NAKANE <max@FreeBSD.org>2001-11-20 03:15:58 +0000
committerMasafumi Max NAKANE <max@FreeBSD.org>2001-11-20 03:15:58 +0000
commit8899852d45b0a137f8a108dcba489e73e289e13b (patch)
tree71aff3385f1a809b32edf82dda6e41432af8a1b8 /japanese/Canna/files/patch-ai
parentNew port phex version 0.5.6: A Java multi platform and spyware free (diff)
Tweaks to make it usable on -current.
Due to changes to signal handling, invoked child process was not able to send SIGQUIT to the parent. So instead of installing the binary set{[gu]id(bin), setuid(bin) after successful invokation. Reported by: Takayuki Tamura <ttathome@remus.dti.ne.jp>
Notes
Notes: svn path=/head/; revision=50241
Diffstat (limited to '')
-rw-r--r--japanese/Canna/files/patch-ai41
1 files changed, 41 insertions, 0 deletions
diff --git a/japanese/Canna/files/patch-ai b/japanese/Canna/files/patch-ai
new file mode 100644
index 000000000000..ca24441c7a54
--- /dev/null
+++ b/japanese/Canna/files/patch-ai
@@ -0,0 +1,41 @@
+--- server/main.c.orig Wed Nov 27 01:26:42 1996
++++ server/main.c Mon Nov 19 20:49:24 2001
+@@ -57,6 +57,7 @@
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <signal.h>
++#include <pwd.h>
+
+ #include "IR.h"
+ #include "net.h"
+@@ -82,6 +83,8 @@
+ #ifdef USE_UNIX_SOCKET
+ extern struct sockaddr_un unsock;
+ #endif
++ struct passwd *pw;
++ uid_t binuid;
+
+ /* サーバを子プロセス(デーモン)として起動する */
+ parentid = BecomeDaemon(argc, argv);
+@@ -114,9 +117,21 @@
+ exit(2);
+ }
+
++ if ( (pw = getpwnam(cannaOwner)) == NULL ) {
++ fprintf(stderr, "User %s unknown\n", cannaOwner);
++ exit(1);
++ }
++
+ /* エラー出力の切り替え、TTYの切り離し */
+ if (parentid) kill(parentid, SIGTERM);
+ DetachTTY();
++
++ /* Drop root privilege. */
++ binuid = pw->pw_uid;
++ if ( setuid(binuid) < 0 ) {
++ fprintf(stderr, "Unable to setuid to %s(UID: %s).\n", cannaOwner, binuid);
++ exit(1);
++ }
+
+ /* ディスパッチループ */
+ Dispatch() ;