Lines Matching refs:socksreq
290 unsigned char *socksreq = sx->buffer; in do_SOCKS4() local
317 socksreq[0] = 4; /* version (SOCKS4) */ in do_SOCKS4()
318 socksreq[1] = 1; /* connect */ in do_SOCKS4()
319 socksreq[2] = (unsigned char)((sx->remote_port >> 8) & 0xff); /* MSB */ in do_SOCKS4()
320 socksreq[3] = (unsigned char)(sx->remote_port & 0xff); /* LSB */ in do_SOCKS4()
384 socksreq[4] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[0]; in do_SOCKS4()
385 socksreq[5] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[1]; in do_SOCKS4()
386 socksreq[6] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[2]; in do_SOCKS4()
387 socksreq[7] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[3]; in do_SOCKS4()
409 socksreq[8] = 0; /* ensure empty userid is NUL-terminated */ in do_SOCKS4()
420 memcpy(socksreq + 8, sx->proxy_user, plen + 1); in do_SOCKS4()
428 strlen((char *)socksreq + 8); /* size including NUL */ in do_SOCKS4()
433 socksreq[4] = 0; in do_SOCKS4()
434 socksreq[5] = 0; in do_SOCKS4()
435 socksreq[6] = 0; in do_SOCKS4()
436 socksreq[7] = 1; in do_SOCKS4()
441 strcpy((char *)socksreq + packetsize, sx->hostname); in do_SOCKS4()
448 sx->outp = socksreq; in do_SOCKS4()
466 sx->outp = socksreq; in do_SOCKS4()
506 if(socksreq[0]) { in do_SOCKS4()
513 switch(socksreq[1]) { in do_SOCKS4()
521 socksreq[4], socksreq[5], socksreq[6], socksreq[7], in do_SOCKS4()
522 (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]), in do_SOCKS4()
523 (unsigned char)socksreq[1]); in do_SOCKS4()
530 socksreq[4], socksreq[5], socksreq[6], socksreq[7], in do_SOCKS4()
531 (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]), in do_SOCKS4()
532 (unsigned char)socksreq[1]); in do_SOCKS4()
539 socksreq[4], socksreq[5], socksreq[6], socksreq[7], in do_SOCKS4()
540 (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]), in do_SOCKS4()
541 (unsigned char)socksreq[1]); in do_SOCKS4()
547 socksreq[4], socksreq[5], socksreq[6], socksreq[7], in do_SOCKS4()
548 (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]), in do_SOCKS4()
549 (unsigned char)socksreq[1]); in do_SOCKS4()
581 unsigned char *socksreq = sx->buffer; in do_SOCKS5() local
620 socksreq[idx++] = 5; /* version */ in do_SOCKS5()
622 socksreq[idx++] = 0; /* no authentication */ in do_SOCKS5()
624 socksreq[idx++] = 1; /* GSS-API */ in do_SOCKS5()
626 socksreq[idx++] = 2; /* username/password */ in do_SOCKS5()
628 socksreq[1] = (unsigned char) (idx - 2); in do_SOCKS5()
630 sx->outp = socksreq; in do_SOCKS5()
656 sx->outp = socksreq; /* store it here */ in do_SOCKS5()
667 else if(socksreq[0] != 5) { in do_SOCKS5()
671 else if(socksreq[1] == 0) { in do_SOCKS5()
676 else if(socksreq[1] == 2) { in do_SOCKS5()
682 else if(allow_gssapi && (socksreq[1] == 1)) { in do_SOCKS5()
693 if(!allow_gssapi && (socksreq[1] == 1)) { in do_SOCKS5()
698 else if(socksreq[1] == 255) { in do_SOCKS5()
736 socksreq[len++] = 1; /* username/pw subnegotiation version */ in do_SOCKS5()
737 socksreq[len++] = (unsigned char) proxy_user_len; in do_SOCKS5()
744 memcpy(socksreq + len, sx->proxy_user, proxy_user_len); in do_SOCKS5()
747 socksreq[len++] = (unsigned char) proxy_password_len; in do_SOCKS5()
754 memcpy(socksreq + len, sx->proxy_password, proxy_password_len); in do_SOCKS5()
760 sx->outp = socksreq; in do_SOCKS5()
772 sx->outp = socksreq; in do_SOCKS5()
786 else if(socksreq[1]) { /* status */ in do_SOCKS5()
788 socksreq[0], socksreq[1]); in do_SOCKS5()
859 socksreq[len++] = 5; /* version (SOCKS5) */ in do_SOCKS5()
860 socksreq[len++] = 1; /* connect */ in do_SOCKS5()
861 socksreq[len++] = 0; /* must be zero */ in do_SOCKS5()
865 socksreq[len++] = 1; /* ATYP: IPv4 = 1 */ in do_SOCKS5()
869 socksreq[len++] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[i]; in do_SOCKS5()
879 socksreq[len++] = 4; /* ATYP: IPv6 = 4 */ in do_SOCKS5()
883 socksreq[len++] = in do_SOCKS5()
903 socksreq[len++] = 5; /* version (SOCKS5) */ in do_SOCKS5()
904 socksreq[len++] = 1; /* connect */ in do_SOCKS5()
905 socksreq[len++] = 0; /* must be zero */ in do_SOCKS5()
917 socksreq[len++] = 4; in do_SOCKS5()
918 memcpy(&socksreq[len], ip6, sizeof(ip6)); in do_SOCKS5()
924 socksreq[len++] = 1; in do_SOCKS5()
925 memcpy(&socksreq[len], ip4, sizeof(ip4)); in do_SOCKS5()
929 socksreq[len++] = 3; in do_SOCKS5()
930 socksreq[len++] = (unsigned char) hostname_len; /* one byte length */ in do_SOCKS5()
931 memcpy(&socksreq[len], sx->hostname, hostname_len); /* w/o NULL */ in do_SOCKS5()
942 socksreq[len++] = (unsigned char)((sx->remote_port >> 8) & 0xff); in do_SOCKS5()
944 socksreq[len++] = (unsigned char)(sx->remote_port & 0xff); in do_SOCKS5()
952 sx->outp = socksreq; in do_SOCKS5()
973 sx->outp = socksreq; in do_SOCKS5()
985 else if(socksreq[0] != 5) { /* version */ in do_SOCKS5()
990 else if(socksreq[1]) { /* Anything besides 0 is an error */ in do_SOCKS5()
992 int code = socksreq[1]; in do_SOCKS5()
994 sx->hostname, (unsigned char)socksreq[1]); in do_SOCKS5()
1030 if(socksreq[3] == 3) { in do_SOCKS5()
1032 int addrlen = (int) socksreq[4]; in do_SOCKS5()
1035 else if(socksreq[3] == 4) { in do_SOCKS5()
1039 else if(socksreq[3] == 1) { in do_SOCKS5()
1055 sx->outp = &socksreq[10]; in do_SOCKS5()