1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-09-21 15:01:41 +02:00

* srv.c (getsrv): Fix type-punning warning. (main): Allow testing any

SRV.
This commit is contained in:
David Shaw 2009-07-23 19:05:19 +00:00
parent 6d755a83b4
commit 63fb9d249a
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-07-23 David Shaw <dshaw@jabberwocky.com>
* srv.c (getsrv): Fix type-punning warning.
(main): Allow testing any SRV.
2009-07-21 Werner Koch <wk@g10code.com> 2009-07-21 Werner Koch <wk@g10code.com>
* ttyio.c (tty_printf): Replace vasprintf by xtryasprintf. * ttyio.c (tty_printf): Replace vasprintf by xtryasprintf.

View File

@ -58,6 +58,7 @@ getsrv(const char *name,struct srventry **list)
int r,srvcount=0; int r,srvcount=0;
unsigned char *pt,*emsg; unsigned char *pt,*emsg;
u16 count,dlen; u16 count,dlen;
HEADER *header=(HEADER *)answer;
*list=NULL; *list=NULL;
@ -65,8 +66,7 @@ getsrv(const char *name,struct srventry **list)
if(r<sizeof(HEADER) || r>2048) if(r<sizeof(HEADER) || r>2048)
return -1; return -1;
if((((HEADER *)answer)->rcode)==NOERROR && if(header->rcode==NOERROR && (count=ntohs(header->ancount)))
(count=ntohs(((HEADER *)answer)->ancount)))
{ {
int i,rc; int i,rc;
@ -234,7 +234,14 @@ main(int argc,char *argv[])
struct srventry *srv; struct srventry *srv;
int rc,i; int rc,i;
rc=getsrv("_hkp._tcp.wwwkeys.pgp.net",&srv); if(argc!=2)
{
fprintf(stderr,"%s {srv}\n",argv[0]);
fprintf(stderr," Try %s _hkp._tcp.wwwkeys.pgp.net\n",argv[0]);
return 1;
}
rc=getsrv(argv[1],&srv);
printf("Count=%d\n\n",rc); printf("Count=%d\n\n",rc);
for(i=0;i<rc;i++) for(i=0;i<rc;i++)
{ {