mirror of
				https://github.com/3proxy/3proxy.git
				synced 2025-11-04 07:42:39 +08:00 
			
		
		
		
	SOCKSTRACE fixed
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				C/C++ CI / ${{ matrix.target }} (macos-15) (push) Has been cancelled
				
			
		
			
				
	
				C/C++ CI / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
				
			
		
			
				
	
				C/C++ CI / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
				
			
		
			
				
	
				C/C++ CI / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	C/C++ CI / ${{ matrix.target }} (macos-15) (push) Has been cancelled
				
			C/C++ CI / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
				
			C/C++ CI / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
				
			C/C++ CI / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
				
			This commit is contained in:
		
							parent
							
								
									43d48adeb9
								
							
						
					
					
						commit
						7320094c11
					
				
							
								
								
									
										25
									
								
								src/socks.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/socks.c
									
									
									
									
									
								
							@ -15,6 +15,11 @@ unsigned char * commands[] = {(unsigned char *)"UNKNOWN", (unsigned char *)"CONN
 | 
				
			|||||||
#define BUFSIZE 1024
 | 
					#define BUFSIZE 1024
 | 
				
			||||||
#define LARGEBUFSIZE 67000
 | 
					#define LARGEBUFSIZE 67000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if SOCKSTRACE > 0
 | 
				
			||||||
 | 
					char tracebuf[256];
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void printcommand(unsigned char * buf, int command, struct clientparam *param){
 | 
					static void printcommand(unsigned char * buf, int command, struct clientparam *param){
 | 
				
			||||||
    sprintf((char *)buf, "%s ", commands[command]);
 | 
					    sprintf((char *)buf, "%s ", commands[command]);
 | 
				
			||||||
    if(param->hostname){
 | 
					    if(param->hostname){
 | 
				
			||||||
@ -234,7 +239,7 @@ void * sockschild(struct clientparam* param) {
 | 
				
			|||||||
		*SAPORT(¶m->sinsl) = 0;
 | 
							*SAPORT(¶m->sinsl) = 0;
 | 
				
			||||||
		if(param->srv->so._bind(param->sostate, param->remsock,(struct sockaddr *)¶m->sinsl,SASIZE(¶m->sinsl)))RETURN (12);
 | 
							if(param->srv->so._bind(param->sostate, param->remsock,(struct sockaddr *)¶m->sinsl,SASIZE(¶m->sinsl)))RETURN (12);
 | 
				
			||||||
#if SOCKSTRACE > 0
 | 
					#if SOCKSTRACE > 0
 | 
				
			||||||
fprintf(stderr, "%hu bound to communicate with server\n", *SAPORT(¶m->sins));
 | 
					fprintf(stderr, "%hu bound to communicate with server\n", *SAPORT(¶m->sinsl));
 | 
				
			||||||
fflush(stderr);
 | 
					fflush(stderr);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -271,11 +276,12 @@ CLEANRET:
 | 
				
			|||||||
	if(command != 3 && param->remsock != INVALID_SOCKET) param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)&sin,  &sasize);
 | 
						if(command != 3 && param->remsock != INVALID_SOCKET) param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)&sin,  &sasize);
 | 
				
			||||||
	else param->srv->so._getsockname(param->sostate, param->clisock, (struct sockaddr *)&sin,  &sasize);
 | 
						else param->srv->so._getsockname(param->sostate, param->clisock, (struct sockaddr *)&sin,  &sasize);
 | 
				
			||||||
#if SOCKSTRACE > 0
 | 
					#if SOCKSTRACE > 0
 | 
				
			||||||
 | 
					myinet_ntop(*SAFAMILY(&sin), &sin, tracebuf, SASIZE(&sin));
 | 
				
			||||||
fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
 | 
					fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
 | 
				
			||||||
			param->res,
 | 
								param->res,
 | 
				
			||||||
			commands[command],
 | 
								commands[command],
 | 
				
			||||||
			inet_ntoa(sin.sin_addr),
 | 
								tracebuf,
 | 
				
			||||||
			ntohs(sin.sin_port)
 | 
								ntohs(*SAPORT(&sin))
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
fflush(stderr);
 | 
					fflush(stderr);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -362,7 +368,7 @@ fflush(stderr);
 | 
				
			|||||||
fprintf(stderr, "Sending incoming connection to client with code %d for %s with %hu\n",
 | 
					fprintf(stderr, "Sending incoming connection to client with code %d for %s with %hu\n",
 | 
				
			||||||
			param->res,
 | 
								param->res,
 | 
				
			||||||
			commands[command],
 | 
								commands[command],
 | 
				
			||||||
			*SAPORT(param->sins);
 | 
								*SAPORT(¶m->sinsr)
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
fflush(stderr);
 | 
					fflush(stderr);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -445,15 +451,18 @@ fflush(stderr);
 | 
				
			|||||||
							param->statscli64+=(len - i);
 | 
												param->statscli64+=(len - i);
 | 
				
			||||||
							param->nwrites++;
 | 
												param->nwrites++;
 | 
				
			||||||
#if SOCKSTRACE > 1
 | 
					#if SOCKSTRACE > 1
 | 
				
			||||||
 | 
					myinet_ntop(*SAFAMILY(¶m->sinsr), ¶m->sinsr, tracebuf, SASIZE(¶m->sinsr));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fprintf(stderr, "UDP packet relayed from client to %s:%hu size %d, header %d\n",
 | 
					fprintf(stderr, "UDP packet relayed from client to %s:%hu size %d, header %d\n",
 | 
				
			||||||
			inet_ntoa(param->sins.sin_addr),
 | 
								tracebuf,
 | 
				
			||||||
			ntohs(param->sins.sin_port),
 | 
								ntohs(*SAPORT(¶m->sinsr)),
 | 
				
			||||||
			(len - i),
 | 
								(len - i),
 | 
				
			||||||
			i
 | 
								i
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					myinet_ntop(*SAFAMILY(&sin), &sin, tracebuf, SASIZE(&sin));
 | 
				
			||||||
fprintf(stderr, "client address is assumed to be %s:%hu\n",
 | 
					fprintf(stderr, "client address is assumed to be %s:%hu\n",
 | 
				
			||||||
			inet_ntoa(sin.sin_addr),
 | 
								tracebuf,
 | 
				
			||||||
			ntohs(sin.sin_port)
 | 
								ntohs(*SAPORT(&sin))
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
fflush(stderr);
 | 
					fflush(stderr);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user