mirror of
				https://github.com/rofl0r/proxychains-ng.git
				synced 2025-11-04 09:06:05 +00:00 
			
		
		
		
	remove superfluous DEBUG checks
This commit is contained in:
		
							
								
								
									
										25
									
								
								src/core.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/core.c
									
									
									
									
									
								
							@@ -249,12 +249,11 @@ static int timed_connect(int sock, const struct sockaddr *addr, socklen_t len) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define INVALID_INDEX 0xFFFFFFFFU
 | 
					#define INVALID_INDEX 0xFFFFFFFFU
 | 
				
			||||||
static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, char *user, char *pass) {
 | 
					static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, char *user, char *pass) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
	PDEBUG("tunnel_to()\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	char *dns_name = NULL;
 | 
						char *dns_name = NULL;
 | 
				
			||||||
	size_t dns_len = 0;
 | 
						size_t dns_len = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PDEBUG("tunnel_to()\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// we use ip addresses with 224.* to lookup their dns name in our table, to allow remote DNS resolution
 | 
						// we use ip addresses with 224.* to lookup their dns name in our table, to allow remote DNS resolution
 | 
				
			||||||
	// the range 224-255.* is reserved, and it won't go outside (unless the app does some other stuff with
 | 
						// the range 224-255.* is reserved, and it won't go outside (unless the app does some other stuff with
 | 
				
			||||||
	// the results returned from gethostbyname et al.)
 | 
						// the results returned from gethostbyname et al.)
 | 
				
			||||||
@@ -571,9 +570,9 @@ static unsigned int calc_alive(proxy_data * pd, unsigned int proxy_count) {
 | 
				
			|||||||
static int chain_step(int ns, proxy_data * pfrom, proxy_data * pto) {
 | 
					static int chain_step(int ns, proxy_data * pfrom, proxy_data * pto) {
 | 
				
			||||||
	int retcode = -1;
 | 
						int retcode = -1;
 | 
				
			||||||
	char *hostname;
 | 
						char *hostname;
 | 
				
			||||||
#ifdef DEBUG
 | 
					
 | 
				
			||||||
	PDEBUG("chain_step()\n");
 | 
						PDEBUG("chain_step()\n");
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
	if(pto->ip.octet[0] == remote_dns_subnet) {
 | 
						if(pto->ip.octet[0] == remote_dns_subnet) {
 | 
				
			||||||
		hostname = string_from_internal_ip(pto->ip);
 | 
							hostname = string_from_internal_ip(pto->ip);
 | 
				
			||||||
		if(!hostname)
 | 
							if(!hostname)
 | 
				
			||||||
@@ -614,9 +613,8 @@ int connect_proxy_chain(int sock, ip_type target_ip,
 | 
				
			|||||||
	unsigned int curr_len = 0;
 | 
						unsigned int curr_len = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p3 = &p4;
 | 
						p3 = &p4;
 | 
				
			||||||
#ifdef DEBUG
 | 
					
 | 
				
			||||||
	PDEBUG("connect_proxy_chain\n");
 | 
						PDEBUG("connect_proxy_chain\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	again:
 | 
						again:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -633,9 +631,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
 | 
				
			|||||||
				if(!p2)
 | 
									if(!p2)
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				if(SUCCESS != chain_step(ns, p1, p2)) {
 | 
									if(SUCCESS != chain_step(ns, p1, p2)) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
					PDEBUG("GOTO AGAIN 1\n");
 | 
										PDEBUG("GOTO AGAIN 1\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
					goto again;
 | 
										goto again;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				p1 = p2;
 | 
									p1 = p2;
 | 
				
			||||||
@@ -651,24 +647,18 @@ int connect_proxy_chain(int sock, ip_type target_ip,
 | 
				
			|||||||
			alive_count = calc_alive(pd, proxy_count);
 | 
								alive_count = calc_alive(pd, proxy_count);
 | 
				
			||||||
			offset = 0;
 | 
								offset = 0;
 | 
				
			||||||
			if(!(p1 = select_proxy(FIFOLY, pd, proxy_count, &offset))) {
 | 
								if(!(p1 = select_proxy(FIFOLY, pd, proxy_count, &offset))) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
				PDEBUG("select_proxy failed\n");
 | 
									PDEBUG("select_proxy failed\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
				goto error_strict;
 | 
									goto error_strict;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if(SUCCESS != start_chain(&ns, p1, ST)) {
 | 
								if(SUCCESS != start_chain(&ns, p1, ST)) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
				PDEBUG("start_chain failed\n");
 | 
									PDEBUG("start_chain failed\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
				goto error_strict;
 | 
									goto error_strict;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			while(offset < proxy_count) {
 | 
								while(offset < proxy_count) {
 | 
				
			||||||
				if(!(p2 = select_proxy(FIFOLY, pd, proxy_count, &offset)))
 | 
									if(!(p2 = select_proxy(FIFOLY, pd, proxy_count, &offset)))
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				if(SUCCESS != chain_step(ns, p1, p2)) {
 | 
									if(SUCCESS != chain_step(ns, p1, p2)) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
					PDEBUG("chain_step failed\n");
 | 
										PDEBUG("chain_step failed\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
					goto error_strict;
 | 
										goto error_strict;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				p1 = p2;
 | 
									p1 = p2;
 | 
				
			||||||
@@ -693,9 +683,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
 | 
				
			|||||||
				if(!(p2 = select_proxy(RANDOMLY, pd, proxy_count, &offset)))
 | 
									if(!(p2 = select_proxy(RANDOMLY, pd, proxy_count, &offset)))
 | 
				
			||||||
					goto error_more;
 | 
										goto error_more;
 | 
				
			||||||
				if(SUCCESS != chain_step(ns, p1, p2)) {
 | 
									if(SUCCESS != chain_step(ns, p1, p2)) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
					PDEBUG("GOTO AGAIN 2\n");
 | 
										PDEBUG("GOTO AGAIN 2\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
					goto again;
 | 
										goto again;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				p1 = p2;
 | 
									p1 = p2;
 | 
				
			||||||
@@ -721,9 +709,8 @@ int connect_proxy_chain(int sock, ip_type target_ip,
 | 
				
			|||||||
	error_more:
 | 
						error_more:
 | 
				
			||||||
	proxychains_write_log("\n!!!need more proxies!!!\n");
 | 
						proxychains_write_log("\n!!!need more proxies!!!\n");
 | 
				
			||||||
	error_strict:
 | 
						error_strict:
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
	PDEBUG("error\n");
 | 
						PDEBUG("error\n");
 | 
				
			||||||
#endif
 | 
						
 | 
				
			||||||
	release_all(pd, proxy_count);
 | 
						release_all(pd, proxy_count);
 | 
				
			||||||
	if(ns != -1)
 | 
						if(ns != -1)
 | 
				
			||||||
		close(ns);
 | 
							close(ns);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,14 +75,10 @@ static void init_lib(void) {
 | 
				
			|||||||
		fprintf(stderr, "Cannot load symbol 'connect' %s\n", dlerror());
 | 
							fprintf(stderr, "Cannot load symbol 'connect' %s\n", dlerror());
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("loaded symbol 'connect'" " real addr %p  wrapped addr %p\n", true_connect, connect);
 | 
							PDEBUG("loaded symbol 'connect'" " real addr %p  wrapped addr %p\n", true_connect, connect);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(connect == true_connect) {
 | 
						if(connect == true_connect) {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("circular reference detected, aborting!\n");
 | 
							PDEBUG("circular reference detected, aborting!\n");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
		abort();
 | 
							abort();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -93,10 +89,8 @@ static void init_lib(void) {
 | 
				
			|||||||
		fprintf(stderr, "Cannot load symbol 'gethostbyname' %s\n", dlerror());
 | 
							fprintf(stderr, "Cannot load symbol 'gethostbyname' %s\n", dlerror());
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("loaded symbol 'gethostbyname'"
 | 
							PDEBUG("loaded symbol 'gethostbyname'"
 | 
				
			||||||
		       " real addr %p  wrapped addr %p\n", true_gethostbyname, gethostbyname);
 | 
							       " real addr %p  wrapped addr %p\n", true_gethostbyname, gethostbyname);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	true_getaddrinfo = (getaddrinfo_t)
 | 
						true_getaddrinfo = (getaddrinfo_t)
 | 
				
			||||||
	    dlsym(RTLD_NEXT, "getaddrinfo");
 | 
						    dlsym(RTLD_NEXT, "getaddrinfo");
 | 
				
			||||||
@@ -105,9 +99,7 @@ static void init_lib(void) {
 | 
				
			|||||||
		fprintf(stderr, "Cannot load symbol 'getaddrinfo' %s\n", dlerror());
 | 
							fprintf(stderr, "Cannot load symbol 'getaddrinfo' %s\n", dlerror());
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("loaded symbol 'getaddrinfo'" " real addr %p  wrapped addr %p\n", true_getaddrinfo, getaddrinfo);
 | 
							PDEBUG("loaded symbol 'getaddrinfo'" " real addr %p  wrapped addr %p\n", true_getaddrinfo, getaddrinfo);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	true_freeaddrinfo = (freeaddrinfo_t)
 | 
						true_freeaddrinfo = (freeaddrinfo_t)
 | 
				
			||||||
	    dlsym(RTLD_NEXT, "freeaddrinfo");
 | 
						    dlsym(RTLD_NEXT, "freeaddrinfo");
 | 
				
			||||||
@@ -116,10 +108,8 @@ static void init_lib(void) {
 | 
				
			|||||||
		fprintf(stderr, "Cannot load symbol 'freeaddrinfo' %s\n", dlerror());
 | 
							fprintf(stderr, "Cannot load symbol 'freeaddrinfo' %s\n", dlerror());
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("loaded symbol 'freeaddrinfo'"
 | 
							PDEBUG("loaded symbol 'freeaddrinfo'"
 | 
				
			||||||
		       " real addr %p  wrapped addr %p\n", true_freeaddrinfo, freeaddrinfo);
 | 
							       " real addr %p  wrapped addr %p\n", true_freeaddrinfo, freeaddrinfo);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	true_gethostbyaddr = (gethostbyaddr_t)
 | 
						true_gethostbyaddr = (gethostbyaddr_t)
 | 
				
			||||||
	    dlsym(RTLD_NEXT, "gethostbyaddr");
 | 
						    dlsym(RTLD_NEXT, "gethostbyaddr");
 | 
				
			||||||
@@ -128,10 +118,8 @@ static void init_lib(void) {
 | 
				
			|||||||
		fprintf(stderr, "Cannot load symbol 'gethostbyaddr' %s\n", dlerror());
 | 
							fprintf(stderr, "Cannot load symbol 'gethostbyaddr' %s\n", dlerror());
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("loaded symbol 'gethostbyaddr'"
 | 
							PDEBUG("loaded symbol 'gethostbyaddr'"
 | 
				
			||||||
		       " real addr %p  wrapped addr %p\n", true_gethostbyaddr, gethostbyaddr);
 | 
							       " real addr %p  wrapped addr %p\n", true_gethostbyaddr, gethostbyaddr);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	true_getnameinfo = (getnameinfo_t)
 | 
						true_getnameinfo = (getnameinfo_t)
 | 
				
			||||||
	    dlsym(RTLD_NEXT, "getnameinfo");
 | 
						    dlsym(RTLD_NEXT, "getnameinfo");
 | 
				
			||||||
@@ -140,9 +128,7 @@ static void init_lib(void) {
 | 
				
			|||||||
		fprintf(stderr, "Cannot load symbol 'getnameinfo' %s\n", dlerror());
 | 
							fprintf(stderr, "Cannot load symbol 'getnameinfo' %s\n", dlerror());
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
#ifdef DEBUG
 | 
					 | 
				
			||||||
		PDEBUG("loaded symbol 'getnameinfo'" " real addr %p  wrapped addr %p\n", true_getnameinfo, getnameinfo);
 | 
							PDEBUG("loaded symbol 'getnameinfo'" " real addr %p  wrapped addr %p\n", true_getnameinfo, getnameinfo);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	init_l = 1;
 | 
						init_l = 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user