- Use mode 0755 for unix domain socket directory to prevent write

access from users other than the owner (bin).

- Remove /tmp/.iroha_unix before cannaserver starts and after it
  is killed.
This commit is contained in:
Hiroki Sato 2008-11-08 08:49:01 +00:00
parent 634cfceb32
commit aa83bae006
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=222534
3 changed files with 26 additions and 7 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= canna
PORTVERSION= 3.7p3
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= japanese
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_JP}
MASTER_SITE_SUBDIR= canna/9565/

View file

@ -27,11 +27,12 @@ canna_flags=${canna_flags:-"-u bin"} # Flags to canna program
name="canna"
rcvar=`set_rcvar`
command="%%PREFIX%%/sbin/cannaserver"
start_precmd="canna_precmd"
stop_cmd="canna_stop"
start_precmd="canna_start_precmd"
stop_cmd="canna_stop_cmd"
canna_precmd() {
rm -f /tmp/.iroha_unix/IROHA
canna_start_precmd() {
rm -f /tmp/.iroha_unix/IROHA*
rmdir /tmp/.iroha_unix > /dev/null 2>&1 || true
touch /var/log/CANNA0msgs
mkdir -p -m 0775 \
%%PREFIX%%/share/canna/dic/user/user \
@ -42,9 +43,12 @@ canna_precmd() {
%%PREFIX%%/share/canna/dic/group
}
canna_stop() {
canna_stop_cmd() {
echo "Stopping ${name}."
%%PREFIX%%/sbin/cannakill
if %%PREFIX%%/sbin/cannakill; then
rm -f /tmp/.iroha_unix/IROHA*
rmdir /tmp/.iroha_unix > /dev/null 2>&1 || true
fi
}
load_rc_config $name

View file

@ -0,0 +1,15 @@
--- server/comm.c.orig 2004-04-27 06:48:37.000000000 +0900
+++ server/comm.c 2008-11-08 17:38:21.000000000 +0900
@@ -555,10 +555,11 @@
unaddr->sun_family = AF_UNIX;
oldUmask = umask (0);
- if ( mkdir( IR_UNIX_DIR, 0777 ) == -1 &&
+ if ( mkdir( IR_UNIX_DIR, 0755 ) == -1 &&
errno != EEXIST ) {
ir_debug( Dmsg(5, "Can't open %s error No. %d\n",IR_UNIX_DIR, errno));
}
+
if (RkiStrlcpy(unaddr->sun_path, IR_UNIX_PATH, sockpathmax) >= sockpathmax) {
ir_debug( Dmsg(5, "Path to socket is too long\n"));
goto last;