diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2005-02-19 20:42:39 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2005-02-19 20:42:39 +0000 |
commit | 9f5981cd69875f2d70c6dab97a5a15aa4788f09b (patch) | |
tree | c63265c4e36d9c511397b47789b2fe70580087b4 /dns/dhid | |
parent | 5732b6c095eec0d369be2acc818b6d6831dde641 (diff) |
Notes
Diffstat (limited to 'dns/dhid')
-rw-r--r-- | dns/dhid/Makefile | 65 | ||||
-rw-r--r-- | dns/dhid/distinfo | 6 | ||||
-rw-r--r-- | dns/dhid/files/dhid.sh | 3 | ||||
-rw-r--r-- | dns/dhid/files/patch-aa | 19 | ||||
-rw-r--r-- | dns/dhid/files/patch-ab | 31 | ||||
-rw-r--r-- | dns/dhid/files/patch-ac | 79 | ||||
-rw-r--r-- | dns/dhid/files/patch-ad | 63 | ||||
-rw-r--r-- | dns/dhid/files/patch-ae | 19 | ||||
-rw-r--r-- | dns/dhid/files/patch-af | 32 | ||||
-rw-r--r-- | dns/dhid/pkg-install | 37 | ||||
-rw-r--r-- | dns/dhid/pkg-message | 1 | ||||
-rw-r--r-- | dns/dhid/pkg-plist | 3 |
12 files changed, 318 insertions, 40 deletions
diff --git a/dns/dhid/Makefile b/dns/dhid/Makefile index 387ff9943e8e..9c70ae932d43 100644 --- a/dns/dhid/Makefile +++ b/dns/dhid/Makefile @@ -6,34 +6,69 @@ # PORTNAME= dhid -PORTVERSION= 4.0.2 +PORTVERSION= 5.2 CATEGORIES= dns MASTER_SITES= ftp://ftp.dhis.org/pub/dhis/ -DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ - ${PORTNAME}-3.1${EXTRACT_SUFX} MAINTAINER= oryx@ungulate.net COMMENT= DHIS client for updating dynamic DNS entries in dhisd DNS tables +LIB_DEPENDS= gmp.6:${PORTSDIR}/math/libgmp4 + +LDFLAGS+= -L${PREFIX}/lib +MAKE_ENV+= LDFLAGS="${LDFLAGS}" + +DOCFILES= AUTHORS CONTRIBUTORS COPYRIGHT INSTALL README WHATSNEW USE_REINPLACE= yes -OLDWRKSRC= ${WRKDIR}/${PORTNAME}-3.1 -MAN8= dhid.8 +DHID_USER= dhis +DHID_GROUP= dhis +DHID_PID_DIR= /var/run/dhis post-patch: - @${ECHO} "===> Patching dhid.h" - ${REINPLACE_CMD} -e "s^__PREFIX__^${PREFIX}^g" ${WRKSRC}/dhid.h + @${ECHO} "===> Patching dhid.h and Makefile" + @${REINPLACE_CMD} -e "s^__PREFIX__^${PREFIX}^g" ${WRKSRC}/dhid.h ${WRKSRC}/Makefile + +pre-install: + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL do-install: + @${ECHO_MSG} "===> Installing ${PREFIX}/sbin/dhid." ${INSTALL_PROGRAM} ${WRKSRC}/dhid ${PREFIX}/sbin - ${INSTALL_MAN} ${OLDWRKSRC}/dhid.8 ${PREFIX}/man/man8 - ${INSTALL} ${COPY} -o root -g wheel -m 600 ${OLDWRKSRC}/dhid.conf ${PREFIX}/etc/dhid.conf.sample - -post-install: - @if [ ! -f ${PREFIX}/etc/rc.d/dhid.sh ]; then \ - ${ECHO} "===> Installing ${PREFIX}/etc/rc.d/dhid.sh startup file."; \ - ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dhid.sh ${PREFIX}/etc/rc.d/dhid.sh; \ - fi; + @${ECHO_CMD} "sbin/dhid" >> ${TMPPLIST} + @${ECHO_MSG} "===> Installing ${PREFIX}/bin/genkeys." + ${INSTALL_PROGRAM} ${WRKSRC}/genkeys ${PREFIX}/bin + @${ECHO_CMD} "bin/genkeys" >> ${TMPPLIST} + @${ECHO_MSG} "===> Installing ${PREFIX}/etc/dhid.conf.sample." + ${INSTALL_DATA} ${WRKSRC}/dhid.conf.sample ${PREFIX}/etc/dhid.conf.sample + ${CHOWN} ${DHID_USER}:${DHID_GROUP} ${PREFIX}/etc/dhid.conf.sample + ${CHMOD} 0600 ${PREFIX}/etc/dhid.conf.sample + @${ECHO_CMD} "etc/dhid.conf.sample" >> ${TMPPLIST} + @${ECHO_CMD} "@exec ${CHOWN} ${DHID_USER}:${DHID_GROUP} %D/etc/dhid.conf.sample" >> ${TMPPLIST} + @${ECHO_CMD} "@exec ${CHMOD} 0600 %D/etc/dhid.conf.sample" >> ${TMPPLIST} + ${MKDIR} ${DHID_PID_DIR} + ${CHOWN} ${DHID_USER}:${DHID_GROUP} ${DHID_PID_DIR} + ${CHMOD} 0700 ${DHID_PID_DIR} + @${ECHO_CMD} "@exec ${MKDIR} ${DHID_PID_DIR}" >> ${TMPPLIST} + @${ECHO_CMD} "@exec ${CHOWN} ${DHID_USER}:${DHID_GROUP} ${DHID_PID_DIR}" >> ${TMPPLIST} + @${ECHO_CMD} "@exec ${CHMOD} 0700 ${DHID_PID_DIR}" >> ${TMPPLIST} + @${ECHO_CMD} "@unexec ${RM} -rf /${DHID_PID_DIR}" >> ${TMPPLIST} +.if !exists(${PREFIX}/etc/rc.d/dhid.sh) + @${ECHO_MSG} "===> Installing ${PREFIX}/etc/rc.d/dhid.sh.sample startup file." + ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dhid.sh ${PREFIX}/etc/rc.d/dhid.sh.sample +.endif + @${ECHO_CMD} "etc/rc.d/dhid.sh.sample" >> ${TMPPLIST} +.if !defined(NOPORTDOCS) + @${ECHO_MSG} "===> Installing documentation in ${DOCSDIR}" + ${MKDIR} ${DOCSDIR} + ${CHMOD} 755 ${DOCSDIR} +.for DOCFILE in ${DOCFILES} + ${INSTALL_DATA} ${WRKSRC}/${DOCFILE} ${DOCSDIR} + @${ECHO_CMD} "share/doc/${PORTNAME}/${DOCFILE}" >> ${TMPPLIST} +.endfor + @${ECHO_CMD} "@dirrm share/doc/${PORTNAME}" >> ${TMPPLIST} +.endif + @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${CAT} ${PKGMESSAGE} .include <bsd.port.mk> diff --git a/dns/dhid/distinfo b/dns/dhid/distinfo index 2cd9a18c043c..dd670a9049c1 100644 --- a/dns/dhid/distinfo +++ b/dns/dhid/distinfo @@ -1,4 +1,2 @@ -MD5 (dhid-4.0.2.tar.gz) = 16532ef68d89ed51a9e57ea9ac886268 -SIZE (dhid-4.0.2.tar.gz) = 12892 -MD5 (dhid-3.1.tar.gz) = f419031035f79936592c8ecf97fbe62c -SIZE (dhid-3.1.tar.gz) = 8776 +MD5 (dhid-5.2.tar.gz) = 781ba0f83dc2a32202c1cb2c3235f06f +SIZE (dhid-5.2.tar.gz) = 16485 diff --git a/dns/dhid/files/dhid.sh b/dns/dhid/files/dhid.sh index 510f4ab70d16..e9bfaab48b19 100644 --- a/dns/dhid/files/dhid.sh +++ b/dns/dhid/files/dhid.sh @@ -1,4 +1,5 @@ #!/bin/sh +PATH=/bin:/sbin:/usr/bin:/usr/sbin if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then echo "$0: Cannot determine the PREFIX" >&2 @@ -7,7 +8,7 @@ fi case "$1" in start) - [ -x "${PREFIX}/sbin/dhid" -a -f "${PREFIX}/etc/dhid.conf" ] && ${PREFIX}/sbin/dhid > /dev/null && echo -n ' dhid' + [ -x "${PREFIX}/sbin/dhid" -a -f "${PREFIX}/etc/dhid.conf" ] && su -m dhis -c ${PREFIX}/sbin/dhid > /dev/null && echo -n ' dhid' ;; stop) killall dhid && echo -n ' dhid' diff --git a/dns/dhid/files/patch-aa b/dns/dhid/files/patch-aa index ff0171d63d58..58a6413fc8c0 100644 --- a/dns/dhid/files/patch-aa +++ b/dns/dhid/files/patch-aa @@ -1,13 +1,22 @@ ---- dhid.h.orig Sun Jan 14 19:39:01 2001 -+++ dhid.h Sun Jan 14 19:41:37 2001 -@@ -73,8 +73,8 @@ - #define OFFLINE_REQ 0x00000451 +--- dhid.h.orig Thu Nov 20 21:02:38 2003 ++++ dhid.h Sat Feb 19 21:14:47 2005 +@@ -56,7 +56,7 @@ + + #define DHIS_VERSION 52 /* DHIS Version */ + +-#define MAX_HOSTNAME 64 ++#define MAX_HOSTNAME 256 + #define MAX_PASS 16 /* Characters in password */ + + /* Message opcodes */ +@@ -72,8 +72,8 @@ + #define OFFLINE_REQ 0x00000551 -#define DHID_CONF "/etc/dhid.conf" -#define DHID_PID "/etc/dhid.pid" +#define DHID_CONF "__PREFIX__/etc/dhid.conf" -+#define DHID_PID "/var/run/dhid.pid" ++#define DHID_PID "/var/run/dhis/dhid.pid" #define DEF_ISPORT 58800 #define FAIL_ALLOW 3 diff --git a/dns/dhid/files/patch-ab b/dns/dhid/files/patch-ab index a818e892bcfd..be0e9576fdec 100644 --- a/dns/dhid/files/patch-ab +++ b/dns/dhid/files/patch-ab @@ -1,17 +1,26 @@ ---- Makefile.orig Sun Jan 14 19:39:56 2001 -+++ Makefile Sun Jan 14 19:40:37 2001 -@@ -25,13 +25,10 @@ - # - # DHIS(c) Dynamic Host Information System Release 4.0 - --CC=cc -+CC?=cc +--- Makefile.orig Wed Sep 12 12:12:02 2001 ++++ Makefile Sat Feb 19 21:19:11 2005 +@@ -29,8 +29,8 @@ # Add -lnsl and -lsocket to LIBS in SysV systems # --CFLAGS=-I/usr/local/include -DQRC=1 +-CFLAGS=-I/usr/local/include -DQRC=1 -Wall -LFLAGS=-L/usr/local/lib --LIBS=-lgmp ++CFLAGS=-I__PREFIX__/include -DQRC=1 -Wall ++#LFLAGS=-L/usr/local/lib + LIBS=-lgmp # Use these and comment the above if you wish to compile dhid without - # secure public key authentication or don't have the GMP library +@@ -46,10 +46,10 @@ + all: dhid genkeys + + dhid: conf.o network.o main.o +- $(CC) $(LFLAGS) -o dhid conf.o network.o main.o $(LIBS) ++ $(CC) $(LDFLAGS) -o dhid conf.o network.o main.o $(LIBS) + + genkeys: genkeys.c +- $(CC) $(CFLAGS) $(LFLAGS) -o genkeys genkeys.c $(LIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o genkeys genkeys.c $(LIBS) + + main.o: dhid.h main.c + $(CC) $(CFLAGS) -c main.c diff --git a/dns/dhid/files/patch-ac b/dns/dhid/files/patch-ac new file mode 100644 index 000000000000..5994ae7827f1 --- /dev/null +++ b/dns/dhid/files/patch-ac @@ -0,0 +1,79 @@ +--- main.c.orig Thu Nov 20 22:11:59 2003 ++++ main.c Sat Feb 19 21:22:50 2005 +@@ -74,7 +74,7 @@ + unsigned char linecmd[512]; + struct in_addr sa; + sa.s_addr=cp->laddr; +- sprintf(linecmd,"%s %d %s %s",cp->off_cmd,cp->id, ++ snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->off_cmd,cp->id, + inet_ntoa((struct in_addr)sa) + ,cp->off_cmdp); + cmd_fork(linecmd); +@@ -106,7 +106,7 @@ + unsigned char linecmd[512]; + struct in_addr sa; + sa.s_addr=cp->laddr; +- sprintf(linecmd,"%s %d %s %s",cp->off_cmd,cp->id, ++ snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->off_cmd,cp->id, + inet_ntoa((struct in_addr)sa) + ,cp->off_cmdp); + cmd_fork(linecmd); +@@ -189,7 +189,7 @@ + unsigned char linecmd[512]; + struct in_addr sa; + sa.s_addr=cp->laddr; +- sprintf(linecmd,"%s %d %s %s",cp->on_cmd,cp->id, ++ snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->on_cmd,cp->id, + inet_ntoa((struct in_addr)sa) + ,cp->on_cmdp); + cmd_fork(linecmd); +@@ -223,8 +223,8 @@ + return; + cp->cserver=sp; + cp->stage=AUTH_STAGE; +- if(cp->atype==APASS) strcpy(m.pass,cp->pass); +- else memset(m.pass,0,16); ++ if(cp->atype==APASS) strlcpy(m.pass,cp->pass,sizeof(m.pass)); ++ else memset(m.pass,0,sizeof(m.pass)); + m.hdr.opcode=AUTH_REQ; + m.hdr.hostid=cp->id; + m.refresh=cp->refresh; +@@ -289,25 +289,19 @@ + int c; + extern char *optarg; + +- strcpy(conf_file,DHID_CONF); +- strcpy(pid_file,DHID_PID); ++ strlcpy(conf_file,DHID_CONF,sizeof(conf_file)); ++ strlcpy(pid_file,DHID_PID,sizeof(pid_file)); + + while((c=getopt(argc,argv,"hf:p:P:"))!=EOF) + switch(c) { + case('p'): rport=atoi(optarg); break; +- case('P'): strncpy(pid_file,optarg,sizeof(pid_file)); break; +- case('f'): strncpy(conf_file,optarg,sizeof(conf_file)); break; ++ case('P'): strlcpy(pid_file,optarg,sizeof(pid_file)); break; ++ case('f'): strlcpy(conf_file,optarg,sizeof(conf_file)); break; + case('h'): usage(argv); + default: usage(argv); + } + + +- if(getuid()) { +- syslog(LOG_ERR,"%s must be executed by root",argv[0]); +- exit(1); +- } +- +- + close(0); + close(1); + close(2); +@@ -376,7 +370,7 @@ + unsigned char linecmd[512]; + struct in_addr sa; + sa.s_addr=cp->laddr; +- sprintf(linecmd,"%s %d %s %s",cp->off_cmd,cp->id, ++ snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->off_cmd,cp->id, + inet_ntoa((struct in_addr)sa) + ,cp->off_cmdp); + cmd_fork(linecmd); diff --git a/dns/dhid/files/patch-ad b/dns/dhid/files/patch-ad new file mode 100644 index 000000000000..2bdf658d8808 --- /dev/null +++ b/dns/dhid/files/patch-ad @@ -0,0 +1,63 @@ +--- conf.c.orig Wed Sep 12 12:32:09 2001 ++++ conf.c Sat Feb 19 21:26:06 2005 +@@ -155,7 +155,7 @@ + cp->id=atoi(line_entry(2,line)); + + if(!strcmp(line_entry(1,line),"hostpass")) { +- strcpy(cp->pass,line_entry(2,line)); ++ strlcpy(cp->pass,line_entry(2,line),sizeof(cp->pass)); + cp->atype=APASS; + } + if(!strcmp(line_entry(1,line),"isaddr")) { +@@ -180,32 +180,32 @@ + sp->addr=0; + sp->hostname[0]='\0'; + +- strcpy(str2,line_entry(2,line)); ++ strlcpy(str2,line_entry(2,line),sizeof(str2)); + +- strcpy(str,dot_entry(1,str2)); +- strcpy(str3,dot_entry(2,str2)); ++ strlcpy(str,dot_entry(1,str2),sizeof(str)); ++ strlcpy(str3,dot_entry(2,str2),sizeof(str3)); + + if(isdigit(str[0])) sp->addr=inet_addr(str); +- else strcpy(sp->hostname,str); ++ else strlcpy(sp->hostname,str,sizeof(sp->hostname)); + if(str3[0]!='\0') sp->port=atoi(str3); + } + if(!strcmp(line_entry(1,line),"refresh")) { +- strcpy(str,line_entry(2,line)); ++ strlcpy(str,line_entry(2,line),sizeof(str)); + cp->refresh=atoi(str); + } + if(!strcmp(line_entry(1,line),"oncmd")) { +- strcpy(cp->on_cmd,line_entry(2,line)); +- strcpy(cp->on_cmdp,line_ptr(3,line)); ++ strlcpy(cp->on_cmd,line_entry(2,line),sizeof(cp->on_cmd)); ++ strlcpy(cp->on_cmdp,line_ptr(3,line),sizeof(cp->on_cmdp)); + } + if(!strcmp(line_entry(1,line),"offcmd")) { +- strcpy(cp->off_cmd,line_entry(2,line)); +- strcpy(cp->off_cmdp,line_ptr(3,line)); ++ strlcpy(cp->off_cmd,line_entry(2,line),sizeof(cp->off_cmd)); ++ strlcpy(cp->off_cmdp,line_ptr(3,line),sizeof(cp->off_cmdp)); + } + + + if(!strcmp(line_entry(1,line),"authp")) { + #ifdef QRC +- strcat(keyp,line_entry(2,line)); ++ strlcat(keyp,line_entry(2,line),sizeof(keyp)); + cp->atype=AQRC; + #else + syslog(LOG_ERR,"QRC authentication not available in this client" +@@ -216,7 +216,7 @@ + } + if(!strcmp(line_entry(1,line),"authq")) { + #ifdef QRC +- strcat(keyq,line_entry(2,line)); ++ strlcat(keyq,line_entry(2,line),sizeof(keyq)); + cp->atype=AQRC; + #else + syslog(LOG_ERR,"QRC authentication not available in this client" diff --git a/dns/dhid/files/patch-ae b/dns/dhid/files/patch-ae new file mode 100644 index 000000000000..cfdb5c27e90d --- /dev/null +++ b/dns/dhid/files/patch-ae @@ -0,0 +1,19 @@ +--- genkeys.c.orig Wed Sep 12 12:13:07 2001 ++++ genkeys.c Sat Feb 19 21:27:32 2005 +@@ -46,12 +46,12 @@ + static int seed=0; + + if(!seed) { seed++; srandom(time(NULL)); } +- memset(buff,0,256); +- memset(temp,0,128); ++ memset(buff,0,sizeof(buff)); ++ memset(temp,0,sizeof(temp)); + + do { +- sprintf(temp,"%lu",(unsigned long int)random()); +- strcat(buff,temp); ++ snprintf(temp,sizeof(temp),"%lu",(unsigned long int)random()); ++ strlcat(buff,temp,sizeof(buff)); + + } while(strlen(buff) < n); + buff[n]='\0'; diff --git a/dns/dhid/files/patch-af b/dns/dhid/files/patch-af new file mode 100644 index 000000000000..cad212e50d09 --- /dev/null +++ b/dns/dhid/files/patch-af @@ -0,0 +1,32 @@ +--- network.c.orig Wed Sep 12 12:13:18 2001 ++++ network.c Sat Feb 19 21:29:32 2005 +@@ -290,12 +290,12 @@ + static int seed=0; + + if(!seed) { seed++; srandom(time(NULL)); } +- memset(buff,0,256); +- memset(temp,0,128); ++ memset(buff,0,sizeof(buff)); ++ memset(temp,0,sizeof(temp)); + + do { +- sprintf(temp,"%u",(unsigned)random()); +- strcat(buff,temp); ++ snprintf(temp,sizeof(temp),"%u",(unsigned)random()); ++ strlcat(buff,temp,sizeof(buff)); + + } while(strlen(buff) < n); + buff[n]='\0'; +@@ -441,10 +441,10 @@ + if(j<0) return; + + buff[0]='\0'; +- for(i=0;i<j;i++) strcat(buff,"0"); /* Place 0's */ ++ for(i=0;i<j;i++) strlcat(buff,"0",sizeof(buff)); /* Place 0's */ + + mpz_get_str(buff2,10,x); /* Add x */ +- strcat(buff,buff2); ++ strlcat(buff,buff2,sizeof(buff)); + + /* Now copy n digits to str */ + cp1=str; diff --git a/dns/dhid/pkg-install b/dns/dhid/pkg-install new file mode 100644 index 000000000000..3d28af3e73d5 --- /dev/null +++ b/dns/dhid/pkg-install @@ -0,0 +1,37 @@ +#! /bin/sh + +# $FreeBSD: /tmp/pcvs/ports/dns/dhid/Attic/pkg-install,v 1.1 2005-02-19 20:42:39 pav Exp $ + +PATH=/bin:/usr/sbin + +case $2 in +PRE-INSTALL) + USER=dhis + GROUP=${USER} + + if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." + else + if pw groupadd ${GROUP} -g 114 -h -; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." + else + if pw useradd ${USER} -u 114 -g ${GROUP} -h - \ + -d /nonexistent -s /sbin/nologin \ + -c "DHIS Daemon" + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi + fi + ;; +esac diff --git a/dns/dhid/pkg-message b/dns/dhid/pkg-message index c5f73d7ca26a..3d27a9f9cd1e 100644 --- a/dns/dhid/pkg-message +++ b/dns/dhid/pkg-message @@ -2,4 +2,3 @@ Before dhid can run, you will need to register with a DHIS provider. See http://www.dhis.org/dhis/services/ for a list of providers. Enter the DHIS account information into the dhid.conf file. - diff --git a/dns/dhid/pkg-plist b/dns/dhid/pkg-plist deleted file mode 100644 index 179602d78992..000000000000 --- a/dns/dhid/pkg-plist +++ /dev/null @@ -1,3 +0,0 @@ -etc/dhid.conf.sample -etc/rc.d/dhid.sh -sbin/dhid |