[svn] GnuPG - r4977 - branches/STABLE-BRANCH-1-4/util
svn author dshaw
cvs at cvs.gnupg.org
Fri Apr 3 05:33:57 CEST 2009
Author: dshaw
Date: 2009-04-03 05:33:57 +0200 (Fri, 03 Apr 2009)
New Revision: 4977
Modified:
branches/STABLE-BRANCH-1-4/util/ChangeLog
branches/STABLE-BRANCH-1-4/util/Makefile.am
branches/STABLE-BRANCH-1-4/util/srv.c
Log:
* Makefile.am: Make srv.c part of libcompat instead of libutil.
* srv.c (getsrv): Raise maximum packet size to 2048, as PACKETSZ is
too small these days. Use libc malloc and free as we're part of
libcompat now which may not be linked to memory.c.
Modified: branches/STABLE-BRANCH-1-4/util/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ChangeLog 2009-04-02 07:20:35 UTC (rev 4976)
+++ branches/STABLE-BRANCH-1-4/util/ChangeLog 2009-04-03 03:33:57 UTC (rev 4977)
@@ -1,3 +1,11 @@
+2009-04-02 David Shaw <dshaw at jabberwocky.com>
+
+ * Makefile.am: Make srv.c part of libcompat instead of libutil.
+
+ * srv.c (getsrv): Raise maximum packet size to 2048, as PACKETSZ
+ is too small these days. Use libc malloc and free as we're part
+ of libcompat now which may not be linked to memory.c.
+
2009-03-20 David Shaw <dshaw at jabberwocky.com>
* iobuf.c (fd_cache_synchronize): New. fsync() a file in cache.
Modified: branches/STABLE-BRANCH-1-4/util/Makefile.am
===================================================================
--- branches/STABLE-BRANCH-1-4/util/Makefile.am 2009-04-02 07:20:35 UTC (rev 4976)
+++ branches/STABLE-BRANCH-1-4/util/Makefile.am 2009-04-03 03:33:57 UTC (rev 4977)
@@ -44,10 +44,6 @@
libutil_a_SOURCES+=regex.c
endif
-if USE_DNS_SRV
-libutil_a_SOURCES+=srv.c srv.h
-endif
-
# The internal regex code #includes these.
EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \
regex_internal.h
@@ -64,6 +60,10 @@
libcompat_a_DEPENDENCIES = @LIBOBJS@
libcompat_a_LIBADD = @LIBOBJS@
+if USE_DNS_SRV
+libcompat_a_SOURCES+=srv.c
+endif
+
http-test: http.c
$(CC) -DHAVE_CONFIG_H $(CFLAGS) -I. $(INCLUDES) $(LDFLAGS) -g -Wall \
-DTEST -o http-test http.c libutil.a @LIBINTL@ @DNSLIBS@ @CAPLIBS@
Modified: branches/STABLE-BRANCH-1-4/util/srv.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/srv.c 2009-04-02 07:20:35 UTC (rev 4976)
+++ branches/STABLE-BRANCH-1-4/util/srv.c 2009-04-03 03:33:57 UTC (rev 4977)
@@ -1,5 +1,5 @@
/* srv.c - DNS SRV code
- * Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
*
* This file is part of GNUPG.
*
@@ -31,8 +31,6 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "memory.h"
-#include "types.h"
#include "srv.h"
/* Not every installation has gotten around to supporting SRVs
@@ -56,15 +54,15 @@
int
getsrv(const char *name,struct srventry **list)
{
- unsigned char answer[PACKETSZ];
+ unsigned char answer[2048];
int r,srvcount=0;
unsigned char *pt,*emsg;
u16 count,dlen;
*list=NULL;
- r=res_query(name,C_IN,T_SRV,answer,PACKETSZ);
- if(r<sizeof(HEADER) || r>PACKETSZ)
+ r=res_query(name,C_IN,T_SRV,answer,2048);
+ if(r<sizeof(HEADER) || r>2048)
return -1;
if((((HEADER *)answer)->rcode)==NOERROR &&
@@ -88,7 +86,11 @@
struct srventry *srv=NULL;
u16 type,class;
- *list=xrealloc(*list,(srvcount+1)*sizeof(struct srventry));
+ srv=realloc(*list,(srvcount+1)*sizeof(struct srventry));
+ if(!srv)
+ goto fail;
+
+ *list=srv;
memset(&(*list)[srvcount],0,sizeof(struct srventry));
srv=&(*list)[srvcount];
srvcount++;
@@ -215,12 +217,12 @@
return srvcount;
noanswer:
- xfree(*list);
+ free(*list);
*list=NULL;
return 0;
fail:
- xfree(*list);
+ free(*list);
*list=NULL;
return -1;
}
@@ -243,7 +245,7 @@
printf("\n");
}
- xfree(srv);
+ free(srv);
return 0;
}
More information about the Gnupg-commits
mailing list