mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23: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,2 @@
|
||||
/TrafficPlugin.c/1.4/Mon Mar 19 10:24:40 2007//
|
||||
D
|
||||
@@ -0,0 +1 @@
|
||||
3proxy-0.5a/src/plugins/TrafficPlugin
|
||||
@@ -0,0 +1 @@
|
||||
/cygdrive/m/MEDIA/H/CVS
|
||||
@@ -0,0 +1 @@
|
||||
include Makefile.var
|
||||
@@ -0,0 +1,7 @@
|
||||
all: $(BUILDDIR)StringsPlugin$(DLSUFFICS)
|
||||
|
||||
StringsPlugin$(OBJSUFFICS): StringsPlugin.c
|
||||
$(CC) $(DCFLAGS) $(CFLAGS) StringsPlugin.c
|
||||
|
||||
$(BUILDDIR)StringsPlugin$(DLSUFFICS): StringsPlugin$(OBJSUFFICS)
|
||||
$(LN) $(LNOUT)../../$(BUILDDIR)StringsPlugin$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) StringsPlugin$(OBJSUFFICS)
|
||||
@@ -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,63 @@
|
||||
-------------------------windows-1251------------------------
|
||||
Плагин подменяющий строки в сервере 3proxу (ОС windows,unix)
|
||||
(c) Lopuchov Kirill lopuchov@mail.ru
|
||||
|
||||
1. Краткое описание описание
|
||||
|
||||
Используется для руссификации сообщений выдаваемых 3proxy.
|
||||
Для корректной работы требуется последняя 0.6 версия 3proxy (в интерфейсе
|
||||
plugin api которой появился job schedule ). Все сообщения были взяты из
|
||||
дистрибутива 3proxy и вынесенны в отдельный файл. Пример файла rus-win1251.3ps.
|
||||
Для каждого сервиса существуют свои блоки сообщений. Начало и конец блока
|
||||
разделены , на пример для сервиса ADMIN начало "[--admin--]" конец [/--admin--].
|
||||
Сами сообщения отделены между собой строкой "[end]", новая строка определяется
|
||||
строкой "\n" .
|
||||
От версии к версии количество сообщений в 3proxy может менятся.
|
||||
В этом случае необходимо либо добавить самостоятельно новые строки в
|
||||
соответсвеющие блоки rus-win1251.3ps, или ждать обновления :)
|
||||
|
||||
|
||||
Для компиляции и тестирования под ОС Windows использовался пакет Dev-C++
|
||||
http://www.bloodshed.net/dev/
|
||||
Для компиляции и тестирования под unix подобными использовался gcc
|
||||
|
||||
|
||||
Настройка 3proxy
|
||||
---------------------
|
||||
|
||||
plugin "string.dll" start c:\3proxy\rus-win1251.3ps
|
||||
|
||||
-------------------------windows-1251------------------------
|
||||
|
||||
---------------------------KOI8-R---------------------------
|
||||
рМБЗЙО РПДНЕОСАЭЙК УФТПЛЙ Ч УЕТЧЕТЕ 3proxХ (пу windows,unix)
|
||||
(c) Lopuchov Kirill lopuchov@mail.ru
|
||||
|
||||
1. лТБФЛПЕ ПРЙУБОЙЕ ПРЙУБОЙЕ
|
||||
|
||||
йУРПМШЪХЕФУС ДМС ТХУУЙЖЙЛБГЙЙ УППВЭЕОЙК ЧЩДБЧБЕНЩИ 3proxy.
|
||||
дМС ЛПТТЕЛФОПК ТБВПФЩ ФТЕВХЕФУС РПУМЕДОСС 0.6 ЧЕТУЙС 3proxy (Ч ЙОФЕТЖЕКУЕ
|
||||
plugin api ЛПФПТПК РПСЧЙМУС job schedule ). чУЕ УППВЭЕОЙС ВЩМЙ ЧЪСФЩ ЙЪ
|
||||
ДЙУФТЙВХФЙЧБ 3proxy Й ЧЩОЕУЕООЩ Ч ПФДЕМШОЩК ЖБКМ. рТЙНЕТ ЖБКМБ rus-win1251.3ps.
|
||||
дМС ЛБЦДПЗП УЕТЧЙУБ УХЭЕУФЧХАФ УЧПЙ ВМПЛЙ УППВЭЕОЙК. оБЮБМП Й ЛПОЕГ ВМПЛБ
|
||||
ТБЪДЕМЕОЩ , ОБ РТЙНЕТ ДМС УЕТЧЙУБ ADMIN ОБЮБМП "[--admin--]" ЛПОЕГ [/--admin--].
|
||||
уБНЙ УППВЭЕОЙС ПФДЕМЕОЩ НЕЦДХ УПВПК УФТПЛПК "[end]", ОПЧБС УФТПЛБ ПРТЕДЕМСЕФУС
|
||||
УФТПЛПК "\n" .
|
||||
пФ ЧЕТУЙЙ Л ЧЕТУЙЙ ЛПМЙЮЕУФЧП УППВЭЕОЙК Ч 3proxy НПЦЕФ НЕОСФУС.
|
||||
ч ЬФПН УМХЮБЕ ОЕПВИПДЙНП МЙВП ДПВБЧЙФШ УБНПУФПСФЕМШОП ОПЧЩЕ УФТПЛЙ Ч
|
||||
УППФЧЕФУЧЕАЭЙЕ ВМПЛЙ rus-win1251.3ps, ЙМЙ ЦДБФШ ПВОПЧМЕОЙС :)
|
||||
|
||||
|
||||
дМС ЛПНРЙМСГЙЙ Й ФЕУФЙТПЧБОЙС РПД пу Windows ЙУРПМШЪПЧБМУС РБЛЕФ Dev-C++
|
||||
http://www.bloodshed.net/dev/
|
||||
дМС ЛПНРЙМСГЙЙ Й ФЕУФЙТПЧБОЙС РПД unix РПДПВОЩНЙ ЙУРПМШЪПЧБМУС gcc
|
||||
|
||||
|
||||
оБУФТПКЛБ 3proxy
|
||||
---------------------
|
||||
|
||||
plugin "string.dll" start c:\3proxy\rus-win1251.3ps
|
||||
|
||||
---------------------------KOI8-R---------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
#include "../../structures.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct pluginlink * mypl;
|
||||
int count_load_str_proxy_from_file=0,count_load_str_admin_from_file=0;
|
||||
int count_str_proxy_in_3proxy=0,count_str_admin_in_3proxy=0;
|
||||
char ** old_proxy_table=NULL;
|
||||
char ** old_admin_table=NULL;
|
||||
struct schedule myschedule;
|
||||
|
||||
|
||||
char **load_string(FILE *f,int max_count_str, int *countloadstr,
|
||||
char *start,char *stop,char **table_3proxy)
|
||||
{
|
||||
int cstr=0,i=0;
|
||||
char tmpbuf1[1024],*rstr,*pt=NULL,*p=NULL;
|
||||
char **old_table;
|
||||
|
||||
tmpbuf1[0]='\0';
|
||||
|
||||
fseek(f,0,SEEK_SET);
|
||||
|
||||
/*find start service section*/
|
||||
while(!feof(f))
|
||||
{
|
||||
fgets(tmpbuf1, 1023,f);
|
||||
if ((strstr(tmpbuf1,start))!=NULL) { i++; break; }
|
||||
tmpbuf1[0]='\0';
|
||||
}
|
||||
|
||||
if (i==0){
|
||||
fprintf(stderr,"Error StringsPlugin: No start section %s strings! \n",start);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*create table for old strings */
|
||||
old_table=(char **)mypl->myalloc(max_count_str*sizeof(char *));
|
||||
memset(old_table,0,max_count_str*sizeof(char *));
|
||||
|
||||
/*load from file new strings */
|
||||
i=0;
|
||||
while ( !feof(f) || i< max_count_str)
|
||||
{
|
||||
fgets(tmpbuf1, 1023,f);
|
||||
|
||||
if ((strstr(tmpbuf1,stop))!=NULL) { break; }
|
||||
|
||||
if (strstr(tmpbuf1,"[end]")==NULL)
|
||||
{
|
||||
/* find and replace \n \r*/
|
||||
rstr = tmpbuf1;
|
||||
while (*rstr!='\0')
|
||||
{
|
||||
if (*rstr=='\r' || *rstr=='\n' )
|
||||
{ *rstr='\0'; rstr++; }
|
||||
rstr++;
|
||||
}
|
||||
|
||||
while ((rstr=strstr(tmpbuf1,"\\n")))
|
||||
{
|
||||
if (rstr!=NULL){ *rstr='\r'; rstr++; *rstr='\n'; }
|
||||
}
|
||||
|
||||
|
||||
/* add string */
|
||||
if (pt!=NULL) { cstr=cstr+(int)strlen(pt); }
|
||||
|
||||
cstr=cstr+(int)strlen(tmpbuf1)+1;
|
||||
|
||||
p = (char *)mypl->myalloc(cstr);
|
||||
|
||||
if (pt!=NULL)
|
||||
{
|
||||
strcpy(p, pt);
|
||||
strcat(p, tmpbuf1);
|
||||
mypl->myfree(pt);
|
||||
}
|
||||
else
|
||||
{ strcpy(p, tmpbuf1); }
|
||||
|
||||
pt=p; cstr=0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* save old string */
|
||||
old_table[i]=table_3proxy[i];
|
||||
/* replace string */
|
||||
table_3proxy[i]=pt;
|
||||
pt=NULL; i++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(pt)mypl->myfree(pt);
|
||||
*countloadstr=i;
|
||||
if (i==0) { mypl->myfree(old_table); old_table=NULL; }
|
||||
|
||||
return old_table;
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
static int restore_old_table(void * v)
|
||||
{
|
||||
int i; char *p=NULL;
|
||||
|
||||
/* restore old proxy table */
|
||||
if(old_proxy_table)
|
||||
{
|
||||
|
||||
for(i=0; i < count_str_proxy_in_3proxy; i++){
|
||||
p=mypl->proxy_table[i];
|
||||
mypl->proxy_table[i]=old_proxy_table[i];
|
||||
mypl->myfree(p);
|
||||
}
|
||||
mypl->myfree(old_proxy_table);
|
||||
old_proxy_table = NULL;
|
||||
|
||||
}
|
||||
|
||||
p=NULL;
|
||||
|
||||
/* restore old admin table */
|
||||
if(old_admin_table)
|
||||
{
|
||||
|
||||
for(i=0; i < count_str_admin_in_3proxy; i++){
|
||||
p=mypl->admin_table[i];
|
||||
mypl->admin_table[i]=old_admin_table[i];
|
||||
mypl->myfree(p);
|
||||
}
|
||||
mypl->myfree(old_admin_table);
|
||||
old_admin_table = NULL;
|
||||
}
|
||||
/*return 1 delete job, 0 no delete!!! :)*/
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport) int start(struct pluginlink * pluginlink,
|
||||
int argc, char** argv);
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
if (ul_reason_for_call == DLL_PROCESS_DETACH)
|
||||
{
|
||||
if(old_proxy_table) { restore_old_table(NULL); }
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
|
||||
int start(struct pluginlink * pluginlink,
|
||||
int argc, char** argv);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*---------------------- start plugin init ------------------------------ */
|
||||
int start(struct pluginlink * pluginlink, int argc, char** argv)
|
||||
{
|
||||
FILE *f=NULL;
|
||||
|
||||
mypl=pluginlink;
|
||||
|
||||
if(old_proxy_table||old_admin_table) restore_old_table(NULL);
|
||||
|
||||
if(!(f=fopen(argv[1],"r"))) return 1001;
|
||||
|
||||
/*count string service PROXY in 3proxy */
|
||||
count_str_proxy_in_3proxy=0;
|
||||
while( mypl->proxy_table[count_str_proxy_in_3proxy] != NULL )
|
||||
{ count_str_proxy_in_3proxy++; }
|
||||
|
||||
/*count string service ADMIN in 3proxy */
|
||||
count_str_admin_in_3proxy=0;
|
||||
while( mypl->admin_table[count_str_admin_in_3proxy] != NULL )
|
||||
{ count_str_admin_in_3proxy++; }
|
||||
|
||||
/*---- load string for PROXY service ----*/
|
||||
old_proxy_table=load_string(f,count_str_proxy_in_3proxy,
|
||||
&count_load_str_proxy_from_file,
|
||||
"[--proxy--]","[/--proxy--]",
|
||||
mypl->proxy_table);
|
||||
|
||||
|
||||
if (old_proxy_table == NULL)
|
||||
{
|
||||
fprintf(stderr,"Error StringsPlugin: No load string from file %s \
|
||||
for service PROXY !\n",argv[1]);
|
||||
}
|
||||
|
||||
if(count_str_proxy_in_3proxy!= count_load_str_proxy_from_file)
|
||||
{
|
||||
fprintf(stderr,"Warning StringsPlugin: Count string for service PROXY in\
|
||||
3proxy not equality count string in file %s \n",argv[1]);
|
||||
}
|
||||
|
||||
|
||||
/*---- load string for ADMIN service ----*/
|
||||
old_admin_table=load_string(f,count_str_admin_in_3proxy,
|
||||
&count_load_str_admin_from_file,
|
||||
"[--admin--]","[/--admin--]",
|
||||
mypl->admin_table);
|
||||
|
||||
|
||||
if (old_admin_table == NULL)
|
||||
{
|
||||
fprintf(stderr,"Error StringsPlugin: No load string from file %s \
|
||||
for service ADMIN !\n",argv[1]);
|
||||
}
|
||||
|
||||
if(count_str_admin_in_3proxy!= count_load_str_admin_from_file)
|
||||
{
|
||||
fprintf(stderr,"Warning StringsPlugin: Count string for service ADMIN in\
|
||||
3proxy not equality count string in file %s\n",argv[1]);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
/* create job shedule for processing reload */
|
||||
if(*pluginlink->schedule!=&myschedule){
|
||||
memset(&myschedule,0,sizeof(struct schedule));
|
||||
myschedule.type=NONE;
|
||||
myschedule.function=restore_old_table;
|
||||
myschedule.next = *pluginlink->schedule;
|
||||
*pluginlink->schedule=&myschedule;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern }
|
||||
#endif
|
||||
Reference in new issue
Block a user