mirror of
				https://github.com/3proxy/3proxy.git
				synced 2025-11-04 07:42:39 +08:00 
			
		
		
		
	fixed: use SASIZE() instead of sizeof() in connect() for FreeBSD compatibility
This commit is contained in:
		
							parent
							
								
									7a7cd9bc25
								
							
						
					
					
						commit
						fec0da52af
					
				@ -1067,13 +1067,13 @@ unsigned long udpresolve(int af, unsigned char * name, unsigned char * value, un
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if(makeauth && !SAISNULL(&authnserver.addr)){
 | 
			
		||||
			memcpy(sinsr, &authnserver.addr, sizeof(addr));
 | 
			
		||||
			memcpy(sinsr, &authnserver.addr, sizeof(authnserver.addr));
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			memcpy(sinsr, &nservers[i].addr, sizeof(addr));
 | 
			
		||||
			memcpy(sinsr, &nservers[i].addr, sizeof(nservers[i].addr));
 | 
			
		||||
		}
 | 
			
		||||
		if(usetcp){
 | 
			
		||||
			if(so._connect(sock,sinsr,sizeof(addr))) {
 | 
			
		||||
			if(so._connect(sock,sinsr,SASIZE(sinsr))) {
 | 
			
		||||
				so._shutdown(sock, SHUT_RDWR);
 | 
			
		||||
				so._closesocket(sock);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
@ -688,7 +688,7 @@ int doconnect(struct clientparam * param){
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
		unsigned long ul = 1;
 | 
			
		||||
#endif
 | 
			
		||||
		if(so._connect(param->remsock,(struct sockaddr *)¶m->sinsr,sizeof(param->sinsr))) {
 | 
			
		||||
		if(so._connect(param->remsock,(struct sockaddr *)¶m->sinsr,SASIZE(¶m->sinsr))) {
 | 
			
		||||
			return (13);
 | 
			
		||||
		}
 | 
			
		||||
		param->nconnects++;
 | 
			
		||||
 | 
			
		||||
@ -140,7 +140,7 @@ void * dnsprchild(struct clientparam* param) {
 | 
			
		||||
	}
 | 
			
		||||
	memcpy(¶m->sinsr, &nservers[0].addr, sizeof(param->sinsr));
 | 
			
		||||
	if(nservers[0].usetcp) {
 | 
			
		||||
		if(so._connect(param->remsock,(struct sockaddr *)¶m->sinsr,sizeof(param->sinsr))) RETURN(830);
 | 
			
		||||
		if(so._connect(param->remsock,(struct sockaddr *)¶m->sinsr,SASIZE(¶m->sinsr))) RETURN(830);
 | 
			
		||||
		buf-=2;
 | 
			
		||||
		*(unsigned short*)buf = htons(i);
 | 
			
		||||
		i+=2;
 | 
			
		||||
 | 
			
		||||
@ -119,11 +119,11 @@ void * ftpprchild(struct clientparam* param) {
 | 
			
		||||
			clidatasock = INVALID_SOCKET;
 | 
			
		||||
		}
 | 
			
		||||
		if ((clidatasock=socket(SASOCK(¶m->sincl), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);}
 | 
			
		||||
		sasize = sizeof(param->sincl);
 | 
			
		||||
		*SAPORT(¶m->sincl) = 0;
 | 
			
		||||
		if(so._bind(clidatasock, (struct sockaddr *)¶m->sincl, SASIZE(¶m->sincl))){RETURN(822);}
 | 
			
		||||
		if (pasv) {
 | 
			
		||||
			if(so._listen(clidatasock, 1)) {RETURN(823);}
 | 
			
		||||
			sasize = sizeof(param->sincl);
 | 
			
		||||
			if(so._getsockname(clidatasock, (struct sockaddr *)¶m->sincl, &sasize)){RETURN(824);}
 | 
			
		||||
			if(*SAFAMILY(¶m->sincl) == AF_INET)
 | 
			
		||||
				sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n",
 | 
			
		||||
@ -145,8 +145,7 @@ void * ftpprchild(struct clientparam* param) {
 | 
			
		||||
 | 
			
		||||
			if(sscanf((char *)buf+5, "%lu,%lu,%lu,%lu,%hu,%hu", &b1, &b2, &b3, &b4, &b5, &b6)!=6) {RETURN(828);}
 | 
			
		||||
			*SAPORT(¶m->sincr) = htons((unsigned short)((b5<<8)^b6));
 | 
			
		||||
			sasize = sizeof(param->sincr);
 | 
			
		||||
			if(so._connect(clidatasock, (struct sockaddr *)¶m->sincr, sasize)) {
 | 
			
		||||
			if(so._connect(clidatasock, (struct sockaddr *)¶m->sincr, SASIZE(¶m->sincr))) {
 | 
			
		||||
				so._closesocket(clidatasock);
 | 
			
		||||
				clidatasock = INVALID_SOCKET;
 | 
			
		||||
				RETURN(826);
 | 
			
		||||
 | 
			
		||||
@ -530,7 +530,7 @@ int MODULEMAINFUNC (int argc, char** argv){
 | 
			
		||||
			new_sock=so._socket(SASOCK(&defparam.sincr), SOCK_STREAM, IPPROTO_TCP);
 | 
			
		||||
			if(new_sock != INVALID_SOCKET){
 | 
			
		||||
				parsehost(srv.family, cbc_string, (struct sockaddr *)&defparam.sincr);
 | 
			
		||||
				if(so._connect(new_sock,(struct sockaddr *)&defparam.sincr,sizeof(defparam.sincr))) {
 | 
			
		||||
				if(so._connect(new_sock,(struct sockaddr *)&defparam.sincr,SASIZE(&defparam.sincr))) {
 | 
			
		||||
					so._closesocket(new_sock);
 | 
			
		||||
					new_sock = INVALID_SOCKET;
 | 
			
		||||
					usleep(SLEEPTIME);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user