Changeset View
Changeset View
Standalone View
Standalone View
gnupg-1.4.0.patched/keyserver/gpgkeys_hkp.c
Context not available. | |||||
static int verbose=0,include_revoked=0,include_disabled=0; | static int verbose=0,include_revoked=0,include_disabled=0; | ||||
static unsigned int http_flags=0; | static unsigned int http_flags=0; | ||||
static char host[80]={'\0'},proxy[80]={'\0'},port[10]={'\0'}; | static char host[80]={'\0'},proxy[80]={'\0'},port[10]={'\0'},path[1024]={'\0'}; | ||||
static FILE *input=NULL,*output=NULL,*console=NULL; | static FILE *input=NULL,*output=NULL,*console=NULL; | ||||
#define BEGIN "-----BEGIN PGP PUBLIC KEY BLOCK-----" | #define BEGIN "-----BEGIN PGP PUBLIC KEY BLOCK-----" | ||||
Context not available. | |||||
memset(&hd,0,sizeof(hd)); | memset(&hd,0,sizeof(hd)); | ||||
request=malloc(strlen(host)+100); | request=malloc(3+3+strlen(host)+1+strlen(port)+strlen(path)+100); | ||||
if(!request) | if(!request) | ||||
{ | { | ||||
fprintf(console,"gpgkeys: out of memory\n"); | fprintf(console,"gpgkeys: out of memory\n"); | ||||
Context not available. | |||||
iobuf_flush_temp(temp); | iobuf_flush_temp(temp); | ||||
sprintf(request,"hkp://%s%s%s/pks/add",host,port[0]?":":"",port[0]?port:""); | sprintf(request,"hkp://%s%s%s%s/pks/add", | ||||
host,port[0]?":":"",port[0]?port:"",path); | |||||
if(verbose>2) | if(verbose>2) | ||||
fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); | fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); | ||||
Context not available. | |||||
fprintf(output,"KEY 0x%s BEGIN\n",getkey); | fprintf(output,"KEY 0x%s BEGIN\n",getkey); | ||||
request=malloc(strlen(host)+100); | request=malloc(3+3+strlen(host)+1+strlen(port)+strlen(path)+100+strlen(search)); | ||||
if(!request) | if(!request) | ||||
{ | { | ||||
fprintf(console,"gpgkeys: out of memory\n"); | fprintf(console,"gpgkeys: out of memory\n"); | ||||
return KEYSERVER_NO_MEMORY; | return KEYSERVER_NO_MEMORY; | ||||
} | } | ||||
sprintf(request,"hkp://%s%s%s/pks/lookup?op=get&options=mr&search=%s", | sprintf(request,"hkp://%s%s%s%s/pks/lookup?op=get&options=mr&search=%s", | ||||
host,port[0]?":":"",port[0]?port:"", search); | host,port[0]?":":"",port[0]?port:"",path,search); | ||||
if(verbose>2) | if(verbose>2) | ||||
fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); | fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); | ||||
Context not available. | |||||
search[len]='\0'; | search[len]='\0'; | ||||
request=malloc(strlen(host)+100+strlen(search)); | request=malloc(3+3+strlen(host)+1+strlen(port)+strlen(path)+100+strlen(search)); | ||||
if(!request) | if(!request) | ||||
{ | { | ||||
fprintf(console,"gpgkeys: out of memory\n"); | fprintf(console,"gpgkeys: out of memory\n"); | ||||
Context not available. | |||||
goto fail; | goto fail; | ||||
} | } | ||||
sprintf(request,"hkp://%s%s%s/pks/lookup?op=index&options=mr&search=%s", | sprintf(request,"hkp://%s%s%s%s/pks/lookup?op=index&options=mr&search=%s", | ||||
host,port[0]?":":"",port[0]?port:"",search); | host,port[0]?":":"",port[0]?port:"",path,search); | ||||
if(verbose>2) | if(verbose>2) | ||||
fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); | fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); | ||||
Context not available. | |||||
continue; | continue; | ||||
} | } | ||||
if(sscanf(line,"PATH %1023s\n",path)==1) | |||||
{ | |||||
path[1023]='\0'; | |||||
continue; | |||||
} | |||||
if(sscanf(line,"VERSION %d\n",&version)==1) | if(sscanf(line,"VERSION %d\n",&version)==1) | ||||
{ | { | ||||
if(version!=KEYSERVER_PROTO_VERSION) | if(version!=KEYSERVER_PROTO_VERSION) | ||||
Context not available. | |||||
fprintf(console,"Host:\t\t%s\n",host); | fprintf(console,"Host:\t\t%s\n",host); | ||||
if(port[0]) | if(port[0]) | ||||
fprintf(console,"Port:\t\t%s\n",port); | fprintf(console,"Port:\t\t%s\n",port); | ||||
if(path[0]) | |||||
fprintf(console,"Path:\t\t%s\n",path); | |||||
fprintf(console,"Command:\t%s\n",action==GET?"GET": | fprintf(console,"Command:\t%s\n",action==GET?"GET": | ||||
action==SEND?"SEND":"SEARCH"); | action==SEND?"SEND":"SEARCH"); | ||||
} | } | ||||
Context not available. |