Skip to content
Snippets Groups Projects
client-handshake.c 26.9 KiB
Newer Older
  • Learn to ignore specific revisions
  • 			context->pt_serv_buf_size - len);
    		len += passwd_len;
    	}
    	else if (type == SOCKS_MSG_CONNECT) {
    		size_t len_index = 0;
    		short net_num = 0;
    		char *net_buf = (char*)&net_num;
    
    		/* socks version */
    		pt->serv_buf[len++] = SOCKS_VERSION_5;
    		/* socks command */
    		pt->serv_buf[len++] = SOCKS_COMMAND_CONNECT;
    		/* reserved */
    		pt->serv_buf[len++] = 0;
    		/* address type */
    		pt->serv_buf[len++] = SOCKS_ATYP_DOMAINNAME;
    		len_index = len;
    		len++;
    		/* the address we tell SOCKS proxy to connect to */
    		strncpy((char *)&(pt->serv_buf[len]), wsi->u.hdr.stash->address,
    			context->pt_serv_buf_size - len);
    		len += strlen(wsi->u.hdr.stash->address);
    		net_num = htons((short)wsi->c_port);
    		/* the port we tell SOCKS proxy to connect to */
    		pt->serv_buf[len++] = net_buf[0];
    		pt->serv_buf[len++] = net_buf[1];
    		/* the length of the address, excluding port */
    		pt->serv_buf[len_index] = strlen(wsi->u.hdr.stash->address);
    	}
    
    	*msg_len = len;
    }
    #endif