Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 2014 22:35:17 GMT
From:      Lukasz Wasikowski <lukasz@wasikowski.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/187774: sysutils/uptimed fix config path, prevent from config overwrite
Message-ID:  <201403192235.s2JMZH9A043970@cgiserv.freebsd.org>
Resent-Message-ID: <201403192240.s2JMe09P079438@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         187774
>Category:       ports
>Synopsis:       sysutils/uptimed fix config path, prevent from config overwrite
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 19 22:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Lukasz Wasikowski
>Release:        FreeBSD 9.2-RELEASE
>Organization:
>Environment:
FreeBSD jinx.wasikowski.net 9.2-RELEASE FreeBSD 9.2-RELEASE #5 r255962: Tue Oct  1 10:09:33 CEST 2013     root@jinx.wasikowski.net:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
1) uptimed has hardcoded links to /etc/uprecords-cgi/ for config, footer and header files,

2) uptimed port installs uptimed.conf, uptimed.footer and uptimed.header files in cgi-bin directory regardles if those files were modified by user.

>How-To-Repeat:
Install sysutils/uptimed, modify PREFIX/www/cgi-bin config or header/footer files. Those modifications will be ignored because of hardcoded link to /etc/uprecords-cgi/

Reinstall sysutils/uptimed and check if your modifications of config or header/footer files are still there.
>Fix:
Patch is attached.

Patch attached with submission follows:

diff -ruN sysutils/uptimed.orig/Makefile sysutils/uptimed/Makefile
--- sysutils/uptimed.orig/Makefile	2014-02-01 19:24:35.000000000 +0100
+++ sysutils/uptimed/Makefile	2014-03-19 23:19:46.115056828 +0100
@@ -27,13 +27,20 @@
 		's|/usr/lib/sendmail|/usr/sbin/sendmail| ; \
 		 s|/var/run/uptimed|/var/run/uptimed.pid|' \
 		${WRKSRC}/etc/uptimed.conf-dist
+	 @${REINPLACE_CMD} -e \
+	 	's|/etc/uprecords-cgi/|${PREFIX}/www/cgi-bin/|' \
+	 	${WRKSRC}/src/uprecords.c
 
 post-install:
 	@${MKDIR} ${STAGEDIR}${PREFIX}/www/cgi-bin
 	${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/uprecords \
 		${STAGEDIR}${PREFIX}/www/cgi-bin/uprecords.cgi
-	${INSTALL_DATA} ${WRKSRC}/sample-cgi/* \
-		${STAGEDIR}${PREFIX}/www/cgi-bin
+	${INSTALL_DATA} ${WRKSRC}/sample-cgi/uprecords.conf \
+		${STAGEDIR}${PREFIX}/www/cgi-bin/uprecords.conf.sample
+	${INSTALL_DATA} ${WRKSRC}/sample-cgi/uprecords.header \
+		${STAGEDIR}${PREFIX}/www/cgi-bin/uprecords.header.sample
+	${INSTALL_DATA} ${WRKSRC}/sample-cgi/uprecords.footer \
+		${STAGEDIR}${PREFIX}/www/cgi-bin/uprecords.footer.sample
 	@${MKDIR} ${STAGEDIR}/var/spool/uptimed
 
 .include <bsd.port.mk>
diff -ruN sysutils/uptimed.orig/pkg-plist sysutils/uptimed/pkg-plist
--- sysutils/uptimed.orig/pkg-plist	2014-02-01 19:24:35.000000000 +0100
+++ sysutils/uptimed/pkg-plist	2014-03-19 23:19:59.118583753 +0100
@@ -9,8 +9,8 @@
 man/man8/uptimed.8.gz
 sbin/uptimed
 www/cgi-bin/uprecords.cgi
-www/cgi-bin/uprecords.conf
-www/cgi-bin/uprecords.footer
-www/cgi-bin/uprecords.header
+www/cgi-bin/uprecords.conf.sample
+www/cgi-bin/uprecords.footer.sample
+www/cgi-bin/uprecords.header.sample
 @dirrmtry www/cgi-bin
 @unexec rmdir /var/spool/uptimed 2>/dev/null || true


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403192235.s2JMZH9A043970>