61 |
WORD default_keyserver_port = 0; |
WORD default_keyserver_port = 0; |
62 |
|
|
63 |
/* Default socket timeout. */ |
/* Default socket timeout. */ |
64 |
static int default_socket_timeout = 10; |
static int default_socket_timeout = 6; |
65 |
|
|
66 |
/* Basic64 encode the input @inbuf to @outbuf. */ |
/* Basic64 encode the input @inbuf to @outbuf. */ |
67 |
static void |
static void |
211 |
DWORD nread; |
DWORD nread; |
212 |
int nleft = buflen; |
int nleft = buflen; |
213 |
int rc, n = 0; |
int rc, n = 0; |
214 |
|
|
215 |
|
if (nbytes) |
216 |
|
*nbytes = 0; |
217 |
while (nleft > 0) { |
while (nleft > 0) { |
218 |
if (n >= default_socket_timeout) |
if (n >= default_socket_timeout) |
219 |
return WPTERR_WINSOCK_TIMEOUT; |
return WPTERR_WINSOCK_TIMEOUT; |
776 |
if (!port) |
if (!port) |
777 |
port = HKP_PORT; |
port = HKP_PORT; |
778 |
reqlen = 512 + strlen (hostname) + 2*strlen (pubkey); |
reqlen = 512 + strlen (hostname) + 2*strlen (pubkey); |
779 |
|
if (proxy.proto == PROXY_PROTO_HTTP && proxy.base64_user) |
780 |
|
reqlen += strlen (proxy.base64_user) + 1; |
781 |
request = new char[reqlen]; |
request = new char[reqlen]; |
782 |
if (!request) |
if (!request) |
783 |
BUG (0); |
BUG (0); |
798 |
"Content-length: %d\r\n" |
"Content-length: %d\r\n" |
799 |
"\r\n" |
"\r\n" |
800 |
"keytext=%s" |
"keytext=%s" |
801 |
"\n", |
"\r\n", |
802 |
skip_type_prefix (hostname), port, hostname, port, |
skip_type_prefix (hostname), port, hostname, port, |
803 |
proxy.base64_user, enc_octets+9, enc_pubkey); |
proxy.base64_user, enc_octets+9, enc_pubkey); |
804 |
} |
} |
812 |
"Content-length: %d\r\n" |
"Content-length: %d\r\n" |
813 |
"\r\n" |
"\r\n" |
814 |
"keytext=%s" |
"keytext=%s" |
815 |
"\n", |
"\r\n", |
816 |
skip_type_prefix (hostname), port, |
skip_type_prefix (hostname), port, |
817 |
enc_octets+9, enc_pubkey); |
enc_octets+9, enc_pubkey); |
818 |
} |
} |
916 |
kserver_sendkey (const char *hostname, WORD port, const char *pubkey, int len ) |
kserver_sendkey (const char *hostname, WORD port, const char *pubkey, int len ) |
917 |
{ |
{ |
918 |
char *request = NULL; |
char *request = NULL; |
919 |
char log[2048]; |
char log[2048] = {0}; |
920 |
int conn_fd, n; |
int conn_fd, n; |
921 |
int rc; |
int rc; |
922 |
|
|
943 |
goto leave; |
goto leave; |
944 |
} |
} |
945 |
|
|
946 |
log_debug ("kserver_sendkey:\r\n%s\r\n", log); |
log_debug ("kserver_sendkey: read %d bytes\r\n%s\r\n", n, log); |
947 |
rc = check_hkp_response (log, 0); |
rc = check_hkp_response (log, 0); |
948 |
if (rc) |
if (rc) |
949 |
goto leave; |
goto leave; |