ports/103771: maintainer update: dns/mdnsd

Dan Pelleg daniel+mdnsd at pelleg.org
Thu Sep 28 19:10:35 UTC 2006


>Number:         103771
>Category:       ports
>Synopsis:       maintainer update: dns/mdnsd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 28 19:10:21 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Dan Pelleg
>Release:        6.1-RELEASE
>Organization:
>Environment:
	
>Description:

gcc -Wall cleanup patches, contributed by Pietro Cerutti.

>How-To-Repeat:
	
>Fix:

	


diff -ruN 0.7G/Makefile 0.7G_1/Makefile
--- 0.7G/Makefile	Mon Sep 25 21:49:38 2006
+++ 0.7G_1/Makefile	Wed Sep 27 21:55:11 2006
@@ -7,12 +7,16 @@
 
 PORTNAME=	mdnsd
 PORTVERSION=	0.7G
+PORTREVISION=	1
 CATEGORIES=	dns
 MASTER_SITES=	http://dotlocal.org/${PORTNAME}/ \
 		http://web.cs.cmu.edu/~dpelleg/download/
 
 MAINTAINER=	daniel+mdnsd at pelleg.org
 COMMENT=	Advertise a service via Rendezvous
+
+PLIST_FILES=	bin/mhttp\
+		bin/mquery
 
 do-install:
 	@${ECHO_MSG} "Installing files"
diff -ruN 0.7G/files/patch-aa 0.7G_1/files/patch-aa
--- 0.7G/files/patch-aa	Thu Jan  1 02:00:00 1970
+++ 0.7G_1/files/patch-aa	Wed Sep 27 21:47:49 2006
@@ -0,0 +1,318 @@
+diff -ruN 1035.c.orig 1035.c
+--- 1035.c.orig	Tue Feb 18 08:54:33 2003
++++ 1035.c	Mon Sep 25 22:11:14 2006
+@@ -1,4 +1,5 @@
+ #include "1035.h"
++#include <stdio.h>
+ #include <string.h> 
+ 
+ unsigned short int net2short(unsigned char **bufp)
+@@ -241,7 +242,7 @@
+     if(packet == 0 || m == 0) return;
+ 
+     // keep all our mem in one (aligned) block for easy freeing
+-    #define my(x,y) while(m->_len&7) m->_len++; (void*)x = (void*)(m->_packet + m->_len); m->_len += y;
++    #define my(x,y) x = (void *) x; while(m->_len&7) m->_len++; x = (void*)(m->_packet + m->_len); m->_len += y;
+ 
+     // header stuff bit crap
+     m->_buf = buf = packet;
+diff -ruN Makefile.orig Makefile
+--- Makefile.orig	Tue Feb 18 09:00:04 2003
++++ Makefile	Mon Sep 25 22:11:16 2006
+@@ -1,10 +1,10 @@
+ all: mquery mhttp
+ 
+ mhttp: mhttp.c
+-	gcc -g -o mhttp mhttp.c mdnsd.c 1035.c sdtxt.c xht.c
++	gcc -Wall -g -o mhttp mhttp.c mdnsd.c 1035.c sdtxt.c xht.c
+ 
+ mquery: mquery.c
+-	gcc -g -o mquery mquery.c mdnsd.c 1035.c
++	gcc -Wall -g -o mquery mquery.c mdnsd.c 1035.c
+ 
+ clean:
+ 	rm -f mquery mhttp
+diff -ruN mdnsd.c.orig mdnsd.c
+--- mdnsd.c.orig	Tue Feb 18 08:54:46 2003
++++ mdnsd.c	Mon Sep 25 22:11:17 2006
+@@ -1,5 +1,7 @@
+ #include "mdnsd.h"
++#include <arpa/inet.h>
+ #include <string.h>
++#include <stdlib.h>
+ 
+ // size of query/publish hashes
+ #define SPRIME 108
+@@ -198,7 +200,7 @@
+     struct cached *cur = 0;
+     q->nexttry = 0;
+     q->tries = 0;
+-    while(cur = _c_next(d,cur,q->name,q->type))
++    while( (cur = _c_next(d,cur,q->name,q->type)) )
+         if(q->nexttry == 0 || cur->rr.ttl - 7 < q->nexttry) q->nexttry = cur->rr.ttl - 7;
+     if(q->nexttry != 0 && q->nexttry < d->checkqlist) d->checkqlist = q->nexttry;
+ }
+@@ -208,7 +210,7 @@
+     struct cached *c = 0;
+     struct query *cur;
+     int i = _namehash(q->name) % LPRIME;
+-    while(c = _c_next(d,c,q->name,q->type)) c->q = 0;
++    while( (c = _c_next(d,c,q->name,q->type)) ) c->q = 0;
+     if(d->qlist == q) d->qlist = q->list;
+     else {
+         for(cur=d->qlist;cur->list != q;cur = cur->list);
+@@ -288,13 +290,13 @@
+ 
+     if(r->class == 32768 + d->class)
+     { // cache flush
+-        while(c = _c_next(d,c,r->name,r->type)) c->rr.ttl = 0;
++        while( (c = _c_next(d,c,r->name,r->type)) ) c->rr.ttl = 0;
+         _c_expire(d,&d->cache[i]);
+     }
+     
+     if(r->ttl == 0)
+     { // process deletes
+-        while(c = _c_next(d,c,r->name,r->type))
++        while( (c = _c_next(d,c,r->name,r->type)) )
+             if(_a_match(r,&c->rr))
+             {
+                 c->rr.ttl = 0;
+@@ -330,7 +332,7 @@
+     }
+     c->next = d->cache[i];
+     d->cache[i] = c;
+-    if(c->q = _q_next(d, 0, r->name, r->type))
++    if( (c->q = _q_next(d, 0, r->name, r->type)) )
+         _q_answer(d,c);
+ }
+ 
+@@ -344,7 +346,11 @@
+ 
+ int _r_out(mdnsd d, struct message *m, mdnsdr *list)
+ { // copy a published record into an outgoing message
+-    mdnsdr r, next;
++    /*
++     * Unused
++     * mdnsdr next;
++     */
++    mdnsdr r;
+     int ret = 0;
+     while((r = *list) != 0 && message_packet_len(m) + _rr_len(&r->rr) < d->frame)
+     {
+@@ -363,7 +369,10 @@
+ 
+ mdnsd mdnsd_new(int class, int frame)
+ {
+-    int i;
++    /*
++    * Unused
++    * int i;
++    */
+     mdnsd d;
+     d = (mdnsd)malloc(sizeof(struct mdnsd_struct));
+     bzero(d,sizeof(struct mdnsd_struct));
+@@ -401,7 +410,10 @@
+ 
+ void mdnsd_free(mdnsd d)
+ {
+-    int i;
++    /*
++     * Unused
++     * int i;
++     */
+     // loop through all hashes, free everything
+     // free answers if any
+     free(d);
+@@ -611,8 +623,11 @@
+ 
+ struct timeval *mdnsd_sleep(mdnsd d)
+ {
++    /*
++     * Unused
++     * mdnsdr r;
++     */
+     int sec, usec;
+-    mdnsdr r;
+     d->sleep.tv_sec = d->sleep.tv_usec = 0;
+     #define RET while(d->sleep.tv_usec > 1000000) {d->sleep.tv_sec++;d->sleep.tv_usec -= 1000000;} return &d->sleep;
+ 
+@@ -665,7 +680,7 @@
+         q->next = d->queries[i];
+         q->list = d->qlist;
+         d->qlist = d->queries[i] = q;
+-        while(cur = _c_next(d,cur,q->name,q->type))
++        while( (cur = _c_next(d,cur,q->name,q->type)) )
+             cur->q = q; // any cached entries should be associated
+         _q_reset(d,q);
+         q->nexttry = d->checkqlist = d->now.tv_sec; // new questin, immediately send out
+diff -ruN mhttp.c.orig mhttp.c
+--- mhttp.c.orig	Tue Feb 18 08:54:56 2003
++++ mhttp.c	Mon Sep 25 22:11:17 2006
+@@ -1,9 +1,16 @@
++#include <arpa/inet.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
++#include <sys/uio.h>
+ #include <netinet/in.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <signal.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <strings.h>
++#include <unistd.h>
+ 
+ #include "mdnsd.h"
+ #include "sdtxt.h"
+@@ -64,7 +71,8 @@
+     mdnsd d;
+     mdnsdr r;
+     struct message m;
+-    unsigned long int ip;
++    //unsigned long int ip;
++    struct in_addr ip;
+     unsigned short int port;
+     struct timeval *tv;
+     int bsize, ssize = sizeof(struct sockaddr_in);
+@@ -76,9 +84,9 @@
+     int len = 0;
+     xht h;
+ 
+-    if(argc < 4) { printf("usage: mhttp 'unique name' 12.34.56.78 80 '/optionalpath'\n"); return; }
++    if(argc < 4) { printf("usage: mhttp 'unique name' 12.34.56.78 80 '/optionalpath'\n"); return 0; }
+ 
+-    ip = inet_addr(argv[2]);
++    ip.s_addr = inet_addr(argv[2]);
+     port = atoi(argv[3]);
+     printf("Announcing .local site named '%s' to %s:%d and extra path '%s'\n",argv[1],inet_ntoa(ip),port,argv[4]);
+ 
+@@ -127,12 +135,12 @@
+             }
+             if(bsize < 0 && errno != EAGAIN) { printf("can't read from socket %d: %s\n",errno,strerror(errno)); return 1; }
+         }
+-        while(mdnsd_out(d,&m,&ip,&port))
++        while(mdnsd_out(d,&m,(unsigned long int *)&(ip.s_addr),&port))
+         {
+             bzero(&to, sizeof(to));
+             to.sin_family = AF_INET;
+             to.sin_port = port;
+-            to.sin_addr.s_addr = ip;
++            to.sin_addr.s_addr = ip.s_addr;
+             if(sendto(s,message_packet(&m),message_packet_len(&m),0,(struct sockaddr *)&to,sizeof(struct sockaddr_in)) != message_packet_len(&m))  { printf("can't write to socket: %s\n",strerror(errno)); return 1; }
+         }
+         if(_shutdown) break;
+diff -ruN mquery.c.orig mquery.c
+--- mquery.c.orig	Tue Feb 18 08:59:49 2003
++++ mquery.c	Mon Sep 25 22:11:18 2006
+@@ -1,21 +1,29 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
++#include <stdio.h>
+ #include <netinet/in.h>
++#include <arpa/inet.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#include <stdlib.h>
++#include <string.h>
++#include <strings.h>
++#include <unistd.h>
+ 
+ #include "mdnsd.h"
+ 
+ // print an answer
+ int ans(mdnsda a, void *arg)
+ {
++    struct in_addr ip;
+     int now;
++    ip.s_addr = a->ip;
+     if(a->ttl == 0) now = 0;
+     else now = a->ttl - time(0);
+     switch(a->type)
+     {
+     case QTYPE_A:
+-        printf("A %s for %d seconds to ip %s\n",a->name,now,inet_ntoa(a->ip));
++        printf("A %s for %d seconds to ip %s\n",a->name,now,inet_ntoa(ip));
+         break;
+     case QTYPE_PTR:
+         printf("PTR %s for %d seconds to %s\n",a->name,now,a->rdname);
+@@ -26,6 +34,7 @@
+     default:
+         printf("%d %s for %d seconds with %d data\n",a->type,a->name,now,a->rdlen);
+     }
++    return 0;
+ }
+ 
+ // create multicast 224.0.0.251:5353 socket
+@@ -74,7 +83,7 @@
+     fd_set fds;
+     int s;
+ 
+-    if(argc != 3) { printf("usage: mquery 12 _http._tcp.local.\n"); return; }
++    if(argc != 3) { printf("usage: mquery 12 _http._tcp.local.\n"); return 0; }
+ 
+     d = mdnsd_new(1,1000);
+     if((s = msock()) == 0) { printf("can't create socket: %s\n",strerror(errno)); return 1; }
+diff -ruN sdtxt.c.orig sdtxt.c
+--- sdtxt.c.orig	Tue Feb 18 08:55:19 2003
++++ sdtxt.c	Mon Sep 25 22:11:19 2006
+@@ -1,5 +1,5 @@
+ #include "sdtxt.h"
+-
++#include <stdlib.h>
+ #include <string.h>
+ 
+ // the universe is bound in equal parts by arrogance and altruism, any attempt to alter this would be suicide
+@@ -21,10 +21,14 @@
+ 
+ void _sd2txt_write(xht h, const char *key, void *val, void *arg)
+ {
++    /*
++     * Unused
++     * int len;
++     */
+     unsigned char **txtp = (unsigned char **)arg;
+     char *cval = (char*)val;
+-    int len;
+-
++    
++   
+     // copy in lengths, then strings
+     **txtp = _sd2txt_len(key,(char*)val);
+     (*txtp)++;
+diff -ruN xht.c.orig xht.c
+--- xht.c.orig	Tue Feb 18 08:57:07 2003
++++ xht.c	Mon Sep 25 22:11:20 2006
+@@ -1,4 +1,6 @@
+ #include "xht.h"
++#include <stdlib.h>
++#include <string.h>
+ 
+ typedef struct xhn_struct
+ {
+@@ -83,13 +85,15 @@
+     /* when flag is set, we manage their mem and free em first */
+     if(n->flag)
+     {
+-        free(n->key);
++        free((void *)n->key);
+         free(n->val);
+     }
+ 
+     n->flag = flag;
+     n->key = key;
+     n->val = val;
++
++    return NULL;
+ }
+ 
+ void xht_set(xht h, const char *key, void *val)
+@@ -140,7 +144,7 @@
+             f = n->next;
+             if(n->flag)
+             {
+-                free(n->key);
++                free((void *)n->key);
+                 free(n->val);
+             }
+             free(n);
diff -ruN 0.7G/pkg-plist 0.7G_1/pkg-plist
--- 0.7G/pkg-plist	Mon Sep 25 21:49:38 2006
+++ 0.7G_1/pkg-plist	Thu Jan  1 02:00:00 1970
@@ -1,2 +0,0 @@
-bin/mhttp
-bin/mquery
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list