1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-22 21:16:07 +03:00

Remove a global variable and some warnings

This commit is contained in:
Erik Ekman 2009-06-14 16:01:14 +00:00 committed by Erik Ekman
parent de976d0558
commit f20b3c9511
2 changed files with 10 additions and 10 deletions

View File

@ -93,9 +93,6 @@ static struct encoder *b32;
* Defaults to Base32, can be changed after handshake */ * Defaults to Base32, can be changed after handshake */
static struct encoder *dataenc; static struct encoder *dataenc;
/* result of case preservation check done after login */
static int case_preserved;
#if !defined(BSD) && !defined(__GLIBC__) #if !defined(BSD) && !defined(__GLIBC__)
static char *__progname; static char *__progname;
#endif #endif
@ -124,7 +121,7 @@ send_query(int fd, char *hostname)
static void static void
send_raw(int fd, char *buf, int buflen, int cmd) send_raw(int fd, char *buf, int buflen, int cmd)
{ {
unsigned char packet[4096]; char packet[4096];
int len; int len;
len = MIN(sizeof(packet) - RAW_HDR_LEN, buflen); len = MIN(sizeof(packet) - RAW_HDR_LEN, buflen);
@ -765,7 +762,7 @@ handshake_raw_udp(int dns_fd, int seed)
return 1; return 1;
} }
static void static int
handshake_case_check(int dns_fd) handshake_case_check(int dns_fd)
{ {
struct timeval tv; struct timeval tv;
@ -774,6 +771,7 @@ handshake_case_check(int dns_fd)
int i; int i;
int r; int r;
int read; int read;
int case_preserved;
case_preserved = 0; case_preserved = 0;
for (i=0; running && i<5 ;i++) { for (i=0; running && i<5 ;i++) {
@ -794,7 +792,7 @@ handshake_case_check(int dns_fd)
if (in[0] == 'z' || in[0] == 'Z') { if (in[0] == 'z' || in[0] == 'Z') {
if (read < (27 * 2)) { if (read < (27 * 2)) {
fprintf(stderr, "Received short case check reply. Will use base32 encoder\n"); fprintf(stderr, "Received short case check reply. Will use base32 encoder\n");
return; return case_preserved;
} else { } else {
int k; int k;
@ -806,14 +804,14 @@ handshake_case_check(int dns_fd)
case_preserved = 0; case_preserved = 0;
} }
} }
return; return case_preserved;
} }
} else { } else {
fprintf(stderr, "Received bad case check reply\n"); fprintf(stderr, "Received bad case check reply\n");
} }
} else { } else {
fprintf(stderr, "Got error on case check, will use base32\n"); fprintf(stderr, "Got error on case check, will use base32\n");
return; return case_preserved;
} }
} }
@ -821,6 +819,7 @@ handshake_case_check(int dns_fd)
} }
fprintf(stderr, "No reply on case check, continuing\n"); fprintf(stderr, "No reply on case check, continuing\n");
return case_preserved;
} }
static void static void
@ -1002,6 +1001,7 @@ static int
handshake(int dns_fd, int autodetect_frag_size, int fragsize) handshake(int dns_fd, int autodetect_frag_size, int fragsize)
{ {
int seed; int seed;
int case_preserved;
int r; int r;
r = handshake_version(dns_fd, &seed); r = handshake_version(dns_fd, &seed);
@ -1016,7 +1016,7 @@ handshake(int dns_fd, int autodetect_frag_size, int fragsize)
handshake_raw_udp(dns_fd, seed); handshake_raw_udp(dns_fd, seed);
handshake_case_check(dns_fd); case_preserved = handshake_case_check(dns_fd);
if (case_preserved) { if (case_preserved) {
handshake_switch_codec(dns_fd); handshake_switch_codec(dns_fd);

View File

@ -841,7 +841,7 @@ tunnel(int tun_fd, int dns_fd, int bind_fd)
static void static void
send_raw(int fd, char *buf, int buflen, int cmd, struct query *q) send_raw(int fd, char *buf, int buflen, int cmd, struct query *q)
{ {
unsigned char packet[4096]; char packet[4096];
int len; int len;
len = MIN(sizeof(packet) - RAW_HDR_LEN, buflen); len = MIN(sizeof(packet) - RAW_HDR_LEN, buflen);