mirror of
				https://github.com/3proxy/3proxy.git
				synced 2025-11-04 07:42:39 +08:00 
			
		
		
		
	Merge remote-tracking branch 'refs/remotes/origin/devel'
This commit is contained in:
		
						commit
						7b48714993
					
				@ -4,7 +4,7 @@
 | 
			
		||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
 | 
			
		||||
# libraries
 | 
			
		||||
#
 | 
			
		||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
 | 
			
		||||
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
 | 
			
		||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
 | 
			
		||||
 | 
			
		||||
BUILDDIR =
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@
 | 
			
		||||
 | 
			
		||||
BUILDDIR = ../bin/
 | 
			
		||||
CC = cl
 | 
			
		||||
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "MSVC" /D "WITH_STD_MALLOC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /c
 | 
			
		||||
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D"WATCOM" /D "MSVC" /D "WITH_STD_MALLOC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /c
 | 
			
		||||
COUT = /Fo
 | 
			
		||||
LN = link
 | 
			
		||||
LDFLAGS = /nologo /subsystem:console /incremental:no 
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										27
									
								
								src/auth.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								src/auth.c
									
									
									
									
									
								
							@ -190,11 +190,21 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, struct soc
 | 
			
		||||
			if(buf[1] != 0) {
 | 
			
		||||
				return 60 + (buf[1] % 10);
 | 
			
		||||
			}
 | 
			
		||||
			if(buf[3] != 1) {
 | 
			
		||||
				return 58;
 | 
			
		||||
			}
 | 
			
		||||
			if (redir->type != R_SOCKS5B && sockgetlinebuf(param, SERVER, buf, 6, EOF, conf.timeouts[CHAIN_TO]) != 6){
 | 
			
		||||
				return 59;
 | 
			
		||||
			switch (buf[3]) {
 | 
			
		||||
			case 1:
 | 
			
		||||
			    if (redir->type == R_SOCKS5B ||  sockgetlinebuf(param, SERVER, buf, 6, EOF, conf.timeouts[CHAIN_TO]) == 6)
 | 
			
		||||
				    break;
 | 
			
		||||
			    return 59;
 | 
			
		||||
			case 3:
 | 
			
		||||
			    if (sockgetlinebuf(param, SERVER, buf, 256, 0, conf.timeouts[CHAIN_TO]) > 1)
 | 
			
		||||
				    break;
 | 
			
		||||
			    return 59;
 | 
			
		||||
			case 4:
 | 
			
		||||
			    if (sockgetlinebuf(param, SERVER, buf, 18, EOF, conf.timeouts[CHAIN_TO]) == 18)
 | 
			
		||||
				    break;
 | 
			
		||||
			    return 59;
 | 
			
		||||
			default:
 | 
			
		||||
			    return 58;
 | 
			
		||||
			}
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
@ -1151,6 +1161,8 @@ unsigned long udpresolve(int af, unsigned char * name, unsigned char * value, un
 | 
			
		||||
		k += 4;
 | 
			
		||||
		if(na > 255) na = 255;			/* somebody is very evil */
 | 
			
		||||
		for (j = 0; j < na; j++) {		/* now there should be answers */
 | 
			
		||||
			while(buf[k] < 192 && buf[k] !=0 && (k+buf[k]+14) < len) k+= (buf[k] + 1);
 | 
			
		||||
			if(!buf[k]) k--;
 | 
			
		||||
			if((k+(af == AF_INET6?28:16)) > len) {
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
@ -1166,10 +1178,7 @@ unsigned long udpresolve(int af, unsigned char * name, unsigned char * value, un
 | 
			
		||||
				ttl = ntohl(*(unsigned long *)(buf + k + 6));
 | 
			
		||||
				memcpy(value, buf + k + 12, af == AF_INET6? 16:4);
 | 
			
		||||
				if(ttl < 60 || ttl > (3600*12)) ttl = 300;
 | 
			
		||||
				if(ttl){
 | 
			
		||||
					hashadd(af == AF_INET6?&dns6_table:&dns_table, name, value, conf.time+ttl);
 | 
			
		||||
 | 
			
		||||
				}
 | 
			
		||||
				hashadd(af == AF_INET6?&dns6_table:&dns_table, name, value, conf.time+ttl);
 | 
			
		||||
				if(retttl) *retttl = ttl;
 | 
			
		||||
				return 1;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -878,13 +878,13 @@ static struct commands file_commandhandlers[] = {
 | 
			
		||||
 | 
			
		||||
static int file_loaded=0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport)
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux file_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 int file_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
 PLUGINAPI int PLUGINCALL file_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv){
 | 
			
		||||
 | 
			
		||||
	if(!file_loaded){
 | 
			
		||||
 | 
			
		||||
@ -677,13 +677,18 @@ static struct commands lfm_commandhandlers[] = {
 | 
			
		||||
	{NULL,                  "lfm_format",  h_lfm_format, 2, 2}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport)
 | 
			
		||||
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux lfm_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
int lfm_plugin( struct pluginlink * pluginlink, int argc, char** argv )
 | 
			
		||||
 | 
			
		||||
PLUGINAPI int PLUGINCALL lfm_plugin( struct pluginlink * pluginlink, int argc, char** argv )
 | 
			
		||||
{
 | 
			
		||||
	pl = pluginlink;
 | 
			
		||||
	myOutputDebugStringA1( "lfm_plugin" );
 | 
			
		||||
 | 
			
		||||
@ -100,17 +100,7 @@ int savecouters(void)
 | 
			
		||||
 | 
			
		||||
 return (0); 
 | 
			
		||||
}
 | 
			
		||||
/*--------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport) int start(struct pluginlink * pluginlink, 
 | 
			
		||||
				 int argc, char** argv);
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
int start(struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------------------------*/
 | 
			
		||||
static int ldapfunc(struct clientparam *param)
 | 
			
		||||
@ -467,7 +457,16 @@ int h_dircount(int argc, unsigned char ** argv)
 | 
			
		||||
 | 
			
		||||
/*------------------------------- MAIN --------------------------------------
 | 
			
		||||
 start plugin init  */
 | 
			
		||||
int start(struct pluginlink * pluginlink, int argc, char** argv)
 | 
			
		||||
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux start "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -358,12 +358,15 @@ static struct symbol regexp_symbols[] = {
 | 
			
		||||
	{NULL, "pcre_free", NULL},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport)
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux pcre_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 int pcre_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv){
 | 
			
		||||
 | 
			
		||||
	struct filter *flt, *tmpflt;
 | 
			
		||||
	pl = pluginlink;
 | 
			
		||||
	pcre_options = 0;
 | 
			
		||||
 | 
			
		||||
@ -117,9 +117,15 @@ static int pamfunc(struct clientparam *param)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux start "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*------------------------------- MAIN --------------------------------------
 | 
			
		||||
 start plugin init  */
 | 
			
		||||
int start(struct pluginlink * pluginlink, int argc, unsigned char** argv)
 | 
			
		||||
PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink, int argc, unsigned char** argv)
 | 
			
		||||
{
 | 
			
		||||
  
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
@ -372,12 +372,15 @@ static struct commands ssl_commandhandlers[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport)
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux ssl_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 int ssl_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
PLUGINAPI int PLUGINCALL ssl_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv){
 | 
			
		||||
 | 
			
		||||
	pl = pluginlink;
 | 
			
		||||
	if(!ssl_loaded){
 | 
			
		||||
		ssl_loaded = 1;
 | 
			
		||||
 | 
			
		||||
@ -151,8 +151,6 @@ static int restore_old_table(void * v)
 | 
			
		||||
/*-------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport) int start(struct pluginlink * pluginlink, 
 | 
			
		||||
				 int argc, char** argv);
 | 
			
		||||
BOOL WINAPI DllMain( HINSTANCE hModule,
 | 
			
		||||
                       DWORD  ul_reason_for_call,
 | 
			
		||||
                       LPVOID lpReserved
 | 
			
		||||
@ -165,17 +163,17 @@ BOOL WINAPI DllMain( HINSTANCE hModule,
 | 
			
		||||
      }
 | 
			
		||||
     return TRUE;
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
int start(struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux start "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*---------------------- start plugin init ------------------------------ */
 | 
			
		||||
int start(struct pluginlink * pluginlink, int argc, char** argv)
 | 
			
		||||
PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink, 
 | 
			
		||||
				 int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
 FILE *f=NULL;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -266,11 +266,16 @@ BOOL WINAPI DllMain( HINSTANCE hModule,
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__declspec(dllexport) 
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
   int start(struct pluginlink * pluginlink, int argc, char** argv) {
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux start "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink, int argc, char** argv) {
 | 
			
		||||
 | 
			
		||||
	struct commands * starthandler;
 | 
			
		||||
	conf = pluginlink->conf;
 | 
			
		||||
	commandhandlers = pluginlink->commandhandlers;
 | 
			
		||||
 | 
			
		||||
@ -89,11 +89,13 @@ static struct filter transparent_filter = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
__declspec(dllexport)
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux transparent_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 int transparent_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
PLUGINAPI int PLUGINCALL transparent_plugin (struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv){
 | 
			
		||||
	pl = pluginlink;
 | 
			
		||||
	if(!transparent_loaded){
 | 
			
		||||
 | 
			
		||||
@ -15,10 +15,6 @@
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 __declspec(dllexport) int WindowsAuthentication(struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static struct auth alwaysauth;
 | 
			
		||||
 | 
			
		||||
static char sidbuf[4096];
 | 
			
		||||
@ -62,12 +58,13 @@ extern "C" {
 | 
			
		||||
	return 7;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux WindowsAuthentication "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int WindowsAuthentication(struct pluginlink * pluginlink, int argc, char** argv){
 | 
			
		||||
PLUGINAPI int PLUGINCALL WindowsAuthentication(struct pluginlink * pluginlink, int argc, char** argv){
 | 
			
		||||
	char tmpbuf[4096];
 | 
			
		||||
	DWORD dlen, sidlen;
 | 
			
		||||
	SID_NAME_USE snu;
 | 
			
		||||
@ -91,4 +88,7 @@ int WindowsAuthentication(struct pluginlink * pluginlink, int argc, char** argv)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,9 +14,6 @@
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 __declspec(dllexport) int utf8tocp1251(struct pluginlink * pluginlink, 
 | 
			
		||||
					 int argc, char** argv);
 | 
			
		||||
 | 
			
		||||
static struct auth alwaysauth;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -64,12 +61,14 @@ unsigned char * conv_utf8_to_cp1251(unsigned char *s){
 | 
			
		||||
	return 4;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef WATCOM
 | 
			
		||||
#pragma aux utf8tocp1251 "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
 | 
			
		||||
#undef PLUGINCALL
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int utf8tocp1251(struct pluginlink * pluginlink, int argc, char** argv){
 | 
			
		||||
PLUGINAPI int PLUGINCALL utf8tocp1251(struct pluginlink * pluginlink, int argc, char** argv){
 | 
			
		||||
	static int loaded = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -85,4 +84,7 @@ int utf8tocp1251(struct pluginlink * pluginlink, int argc, char** argv){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -336,10 +336,10 @@ for(;;){
 | 
			
		||||
	if(su) {
 | 
			
		||||
		su = (unsigned char *)mystrdup((char *)sb);
 | 
			
		||||
		decodeurl(su, 0);
 | 
			
		||||
		parseconnusername((char *)su, (struct clientparam *)param, 1, (unsigned short)((ftp)?21:80));
 | 
			
		||||
		if(parseconnusername((char *)su, (struct clientparam *)param, 1, (unsigned short)((ftp)?21:80))) RETURN (100);
 | 
			
		||||
		myfree(su);
 | 
			
		||||
	}
 | 
			
		||||
	else parsehostname((char *)sb, (struct clientparam *)param, (unsigned short)((ftp)? 21:80));
 | 
			
		||||
	else if(parsehostname((char *)sb, (struct clientparam *)param, (unsigned short)((ftp)? 21:80))) RETURN(100);
 | 
			
		||||
	if(!isconnect){
 | 
			
		||||
		if(se==sg)*se-- = ' ';
 | 
			
		||||
		*se = '/';
 | 
			
		||||
@ -460,7 +460,7 @@ for(;;){
 | 
			
		||||
			*se = 0;
 | 
			
		||||
		}
 | 
			
		||||
		if(!param->hostname){
 | 
			
		||||
			parsehostname((char *)sb, param, 80);
 | 
			
		||||
			if(parsehostname((char *)sb, param, 80)) RETURN(100);
 | 
			
		||||
		}
 | 
			
		||||
		newbuf = myalloc(strlen((char *)req) + strlen((char *)(buf+inbuf)) + 8);
 | 
			
		||||
		if(newbuf){
 | 
			
		||||
 | 
			
		||||
@ -162,7 +162,21 @@ typedef void (*TRAFCOUNTFUNC)(struct clientparam * param);
 | 
			
		||||
typedef void * (*EXTENDFUNC) (struct node *node);
 | 
			
		||||
typedef void (*CBFUNC)(void *cb, char * buf, int inbuf);
 | 
			
		||||
typedef void (*PRINTFUNC) (struct node *node, CBFUNC cbf, void*cb);
 | 
			
		||||
typedef int (*PLUGINFUNC) (struct pluginlink *pluginlink, int argc, char** argv);
 | 
			
		||||
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
 | 
			
		||||
#define PLUGINAPI __declspec(dllexport)
 | 
			
		||||
typedef int (__cdecl *PLUGINFUNC) (struct pluginlink *pluginlink, int argc, char** argv);
 | 
			
		||||
#define PLUGINCALL __cdecl
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
#define PLUGINCALL
 | 
			
		||||
#define PLUGINAPI
 | 
			
		||||
typedef int (*PLUGINFUNC)(struct pluginlink *pluginlink, int argc, char** argv);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct auth {
 | 
			
		||||
	struct auth *next;
 | 
			
		||||
@ -752,8 +766,6 @@ typedef enum {
 | 
			
		||||
	TYPE_SERVER
 | 
			
		||||
}DATA_TYPE;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user