aboutsummaryrefslogtreecommitdiff
path: root/www/c-icap
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2006-08-03 10:11:32 +0000
committerRong-En Fan <rafan@FreeBSD.org>2006-08-03 10:11:32 +0000
commit48054e5adfbd7a8202eda08acaaec22410f97764 (patch)
treea72fc701caa5fe819b0f8d5976b58c10671598ac /www/c-icap
parentbe5fd00daedd2e4f70e0daa5156a90b0bf8cf35d (diff)
downloadports-48054e5adfbd7a8202eda08acaaec22410f97764.tar.gz
ports-48054e5adfbd7a8202eda08acaaec22410f97764.zip
Notes
Diffstat (limited to 'www/c-icap')
-rw-r--r--www/c-icap/Makefile15
-rw-r--r--www/c-icap/files/c_icap.in (renamed from www/c-icap/files/c_icap.sh.in)4
-rw-r--r--www/c-icap/files/patch-filetype.c75
-rw-r--r--www/c-icap/files/pkg-install.in26
-rw-r--r--www/c-icap/pkg-descr3
-rw-r--r--www/c-icap/pkg-plist5
6 files changed, 113 insertions, 15 deletions
diff --git a/www/c-icap/Makefile b/www/c-icap/Makefile
index 07ddb793f48e..3366f0ff3070 100644
--- a/www/c-icap/Makefile
+++ b/www/c-icap/Makefile
@@ -7,7 +7,7 @@
PORTNAME= c-icap
PORTVERSION= 030606
-PORTREVISION= 1
+PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
@@ -20,7 +20,7 @@ COMMENT= An implementation of an ICAP server
GNU_CONFIGURE= yes
INSTALLS_SHLIB= yes
-USE_RC_SUBR= c_icap.sh
+USE_RC_SUBR= c_icap
USE_AUTOTOOLS= libtool:15
CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
LDCONFIG_DIRS= %%PREFIX%%/lib %%PREFIX%%/lib/c_icap
@@ -37,6 +37,14 @@ OPTIONS= CLAMAV "Build with srv_clamav service" on \
# Perl support not ready yet. Try to contact author or hack it by yourself.
WITHOUT_PERL= yes
+LOG_DIR= /var/log/c_icap
+TMP_DIR= /var/tmp
+RUN_DIR= /var/run
+PLIST_SUB+= LOG_DIR=${LOG_DIR} RUN_DIR=${RUN_DIR}
+
+SUB_FILES= pkg-install pkg-deinstall
+SUB_LIST= LOG_DIR=${LOG_DIR} TMP_DIR=${TMP_DIR} RUN_DIR=${RUN_DIR}
+
.if defined(WITH_PERL)
USE_PERL5= yes
PLIST_SUB+= PERL=""
@@ -77,6 +85,9 @@ post-extract:
post-patch:
@${REINPLACE_CMD} -e 's|User wwwrun|User cicap|g' \
-e 's|Group nobody|Group cicap|g' \
+ -e 's|/var/run|${RUN_DIR}|g' \
+ -e 's|/var/tmp|${TMP_DIR}|g' \
+ -e 's|/var/log/c_icap|${LOG_DIR}|g' \
${WRKSRC}/c-icap.conf.default ${WRKSRC}/c-icap.conf.default.in
@${REINPLACE_CMD} -e 's|-lpthread|${PTHREAD_LIBS}|g' \
-e 's|icap_stretch_CFLAGS = -Iinclude/|icap_stretch_CFLAGS = -Iinclude/ ${PTHREAD_CFLAGS}|g' \
diff --git a/www/c-icap/files/c_icap.sh.in b/www/c-icap/files/c_icap.in
index ac4d60ce036e..2911b0ec7692 100644
--- a/www/c-icap/files/c_icap.sh.in
+++ b/www/c-icap/files/c_icap.in
@@ -21,8 +21,8 @@ name="c_icap"
rcvar=`set_rcvar`
command="%%PREFIX%%/bin/c-icap"
-pidfile="/var/run/c-icap.pid"
-required_dirs="/var/tmp"
+pidfile="%%RUN_DIR%%/c-icap.pid"
+required_dirs="%%TMP_DIR%%"
required_files="%%PREFIX%%/etc/c-icap.conf"
stop_postcmd="rm -f $pidfile"
diff --git a/www/c-icap/files/patch-filetype.c b/www/c-icap/files/patch-filetype.c
new file mode 100644
index 000000000000..142b94409194
--- /dev/null
+++ b/www/c-icap/files/patch-filetype.c
@@ -0,0 +1,75 @@
+--- filetype.bak.c Sat May 13 22:51:32 2006
++++ filetype.c Thu Aug 3 09:23:35 2006
+@@ -66,8 +66,9 @@
+ }
+
+ #define CHECK_SIZE(db,array,type,size) if(db->array##_num >= db->array##_size){\
+- if((newdata=realloc(db->array,db->array##_size+size*sizeof(type)))==NULL)\
++ if((newdata=realloc(db->array,(db->array##_size+size)*sizeof(type)))==NULL)\
+ return -1;\
++ db->array##_size +=size; \
+ db->array =newdata;\
+ }
+
+@@ -80,7 +81,7 @@
+ struct ci_data_type *newdata;
+ int indx,i;
+
+- CHECK_SIZE(db,types,struct ci_data_type,50);
++ CHECK_SIZE(db,types,struct ci_data_type,50)
+
+ indx=db->types_num;
+ db->types_num++;
+@@ -113,7 +114,7 @@
+ int indx;
+
+ CHECK_SIZE(db,magics,struct ci_magic,50)
+-
++
+ indx=db->magics_num;
+ db->magics_num++;
+
+@@ -308,6 +309,10 @@
+ }
+ groups[i]=-1;
+ type=types_add(db,record.type,record.descr,groups);
++ if(type<0){
++ ret=-2;
++ break;
++ }
+ }
+
+ magics_add(db,record.offset,record.magic,record.len,type);
+@@ -459,10 +464,13 @@
+ int endian=0;
+ /*check for utf8 ........*/
+ for(i=0;i<buflen;i+=ret){
+- if(!(ret=isUTF8(buf+i,buflen-i)))
++ if((ret=isUTF8(buf+i,buflen-i)) <= 0)
+ break;
+ }
+
++ if(ret < 0 && i == 0)
++ ret=0;/*Not enough data to check*/
++
+ if(ret) /*Even if the last char is unknown ret!=0 mean is utf*/
+ return CI_UTF_DATA; /*... but what about if buflen is about 2 or 3 bytes long ?*/
+
+@@ -500,7 +508,7 @@
+
+ if((ret=check_magics(db,buf,buflen))>=0)
+ return ret;
+-
++
+ /*At the feature the check_ascii and check_unicode must be merged ....*/
+ if((ret=check_ascii((unsigned char *)buf,buflen))>0)
+ return ret;
+@@ -508,7 +516,7 @@
+ if((ret=check_unicode((unsigned char *)buf,buflen))>0){
+ return CI_UTF_DATA;
+ }
+-
++
+ return CI_BIN_DATA; /*binary data*/
+ }
+
diff --git a/www/c-icap/files/pkg-install.in b/www/c-icap/files/pkg-install.in
index 3c4dc5980f44..cfae02ee8292 100644
--- a/www/c-icap/files/pkg-install.in
+++ b/www/c-icap/files/pkg-install.in
@@ -1,13 +1,17 @@
#!/bin/sh
# $FreeBSD$
+DEST_DIR=${PKG_DESTDIR:-}
+
CICAP_USER=cicap
CICAP_GROUP=cicap
-LOG_PATH=/var/log/c_icap
+LOG_DIR=$DEST_DIR%%LOG_DIR%%
+TMP_DIR=$DEST_DIR%%TMP_DIR%%
+RUN_DIR=$DEST_DIR%%RUN_DIR%%
if [ "$2" = "PRE-INSTALL" ]; then
- if ! pw groupshow "$CICAP_USER" 2>/dev/null 1>&2; then
+ if ! pw groupshow "$CICAP_GROUP" 2>/dev/null 1>&2; then
if pw groupadd $CICAP_GROUP; then
echo "=> Added group \"$CICAP_GROUP\"."
else
@@ -28,9 +32,21 @@ if [ "$2" = "PRE-INSTALL" ]; then
fi
fi
elif [ "$2" = "POST-INSTALL" ]; then
- [ -d "$LOG_PATH" ] || mkdir -p "$LOG_PATH" || exit 1
- touch "$LOG_PATH/access.log" "$LOG_PATH/server.log" || exit 1
- chown -R "$CICAP_USER:$CICAP_GROUP" "$LOG_PATH" || exit 1
+ if [ ! -d "$LOG_DIR" ]; then
+ mkdir -p "$LOG_DIR" || exit 1
+ touch "$LOG_DIR/access.log" "$LOG_DIR/server.log" || exit 1
+ chown -R "$CICAP_USER:$CICAP_GROUP" "$LOG_DIR" || exit 1
+ fi
+
+ if [ ! -d "$TMP_DIR" ]; then
+ mkdir -p "$TMP_DIR" || exit 1
+ chown "$CICAP_USER:$CICAP_GROUP" "$TMP_DIR" || exit 1
+ fi
+
+ if [ ! -d "$RUN_DIR" ]; then
+ mkdir -p "$RUN_DIR" || exit 1
+ chown "$CICAP_USER:$CICAP_GROUP" "$RUN_DIR" || exit 1
+ fi
fi
exit 0
diff --git a/www/c-icap/pkg-descr b/www/c-icap/pkg-descr
index a33298e88bcc..da2d94e609ff 100644
--- a/www/c-icap/pkg-descr
+++ b/www/c-icap/pkg-descr
@@ -5,6 +5,3 @@ services. For instance, such modules can be loggers, authenticators and
authentication methods or access controlers.
WWW: http://www.chtsanti.net/c-icap
-
-- Elisey Savateev
-b3k@mail.ru
diff --git a/www/c-icap/pkg-plist b/www/c-icap/pkg-plist
index 999056537846..58f23f9b994d 100644
--- a/www/c-icap/pkg-plist
+++ b/www/c-icap/pkg-plist
@@ -8,7 +8,7 @@ etc/c-icap.conf.default
@unexec if cmp -s %D/etc/c-icap.magic %D/etc/c-icap.magic.default; then rm -f %D/etc/c-icap.magic; fi
etc/c-icap.magic.default
@exec [ -f %B/c-icap.magic ] || cp -p %%PREFIX%%/%F %B/c-icap.magic
-@unexec [ ! -f /var/run/c-icap.pid ] || %D/etc/rc.d/c_icap stop
+@unexec [ ! -f %%RUN_DIR%%/c-icap.pid ] || %D/etc/rc.d/c_icap stop
include/c_icap/access.h
include/c_icap/body.h
include/c_icap/c-icap.h
@@ -48,5 +48,4 @@ lib/libicapapi.a
lib/libicapapi.la
lib/libicapapi.so.0
lib/libicapapi.so
-@cwd /
-@dirrmtry var/log/c_icap
+@unexec rmdir %%LOG_DIR%% 2>/dev/null || true