mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-27 07:59:41 +08:00
initial import to git
This commit is contained in:
commit
a060376f1e
217 files changed
+64253
No files matched your search
@@ -0,0 +1 @@
|
||||
D
|
||||
@@ -0,0 +1 @@
|
||||
3proxy-0.5a/src/plugins/utf8tocp1251
|
||||
@@ -0,0 +1 @@
|
||||
/cygdrive/m/MEDIA/H/CVS
|
||||
@@ -0,0 +1 @@
|
||||
include Makefile.var
|
||||
@@ -0,0 +1,8 @@
|
||||
all: $(BUILDDIR)utf8tocp1251$(DLSUFFICS)
|
||||
|
||||
utf8tocp1251$(OBJSUFFICS): utf8tocp1251.c
|
||||
$(CC) $(DCFLAGS) $(CFLAGS) utf8tocp1251.c
|
||||
|
||||
$(BUILDDIR)utf8tocp1251$(DLSUFFICS): utf8tocp1251$(OBJSUFFICS)
|
||||
$(LN) $(LNOUT)../../$(BUILDDIR)utf8tocp1251$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) utf8tocp1251$(OBJSUFFICS) $(LIBS)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
VERFILE = version.obj ../3proxy.RES
|
||||
#$Id: Makefile.msvc,v 1.17 2010-11-11 14:44:11 v.dubrovin Exp $
|
||||
#
|
||||
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
||||
#
|
||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
||||
# libraries
|
||||
#
|
||||
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
||||
|
||||
BUILDDIR = ../bin/
|
||||
CC = cl
|
||||
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c
|
||||
COUT = /Fo
|
||||
LN = link
|
||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
||||
DLFLAGS = /DLL
|
||||
DLSUFFICS = .dll
|
||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
|
||||
LIBEXT = .lib
|
||||
LNOUT = /out:
|
||||
EXESUFFICS = .exe
|
||||
OBJSUFFICS = .obj
|
||||
DEFINEOPTION = /D
|
||||
COMPFILES = *.pch *.idb
|
||||
REMOVECOMMAND = del 2>NUL >NUL
|
||||
TYPECOMMAND = type
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.msvc
|
||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin lastFripper FilePlugin
|
||||
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
allplugins:
|
||||
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
3APA3A simpliest proxy server
|
||||
(c) 2007-2008 by ZARAZA <3APA3A@security.nnov.ru>
|
||||
|
||||
please read License Agreement
|
||||
|
||||
$Id: utf8tocp1251.c,v 1.9 2009/09/03 05:32:56 v.dubrovin Exp $
|
||||
*/
|
||||
|
||||
#include "../../structures.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) int utf8tocp1251(struct pluginlink * pluginlink,
|
||||
int argc, char** argv);
|
||||
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static struct auth alwaysauth;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
unsigned char * conv_utf8_to_cp1251(unsigned char *s){
|
||||
int i, j=0, n=(int)strlen(s);
|
||||
int byte2 = 0;
|
||||
int c1, new_c1, new_c2, new_i;
|
||||
for(i = 0; i < n; i++){
|
||||
if(byte2 && s[i]>=128 && s[i]<=192){
|
||||
new_c2=(c1&3)*64+(s[i]&63);
|
||||
new_c1=(c1>>2)&5;
|
||||
new_i=(new_c1*256)+new_c2;
|
||||
if(new_i == 1025) s[j++] = 168;
|
||||
else if (new_i==1105) s[j++] = 184;
|
||||
else if (new_i < (192 + 848) || new_i > (255 + 848)){
|
||||
return s;
|
||||
}
|
||||
else s[j++] = new_i - 848;
|
||||
byte2 = 0;
|
||||
}
|
||||
else if(byte2){
|
||||
return s;
|
||||
}
|
||||
else if((s[i]>>5)==6){
|
||||
c1 = s[i];
|
||||
byte2 = 1;
|
||||
}
|
||||
else if(s[i] < 128) s[j++] = s[i];
|
||||
else return s;
|
||||
}
|
||||
s[j] = 0;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
static int aufunc(struct clientparam *param){
|
||||
if(!param->username || !param->password || param->pwtype != 0) return 4;
|
||||
conv_utf8_to_cp1251(param->username);
|
||||
conv_utf8_to_cp1251(param->password);
|
||||
return 4;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int utf8tocp1251(struct pluginlink * pluginlink, int argc, char** argv){
|
||||
static int loaded = 0;
|
||||
|
||||
|
||||
if(!loaded){
|
||||
alwaysauth.authenticate = aufunc;
|
||||
alwaysauth.authorize = pluginlink->checkACL;
|
||||
alwaysauth.desc = "utf8tocp1251";
|
||||
alwaysauth.next = pluginlink->authfuncs->next;
|
||||
pluginlink->authfuncs->next = &alwaysauth;
|
||||
loaded = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user