mirror of
https://github.com/3proxy/3proxy.git
synced 2026-10-16 00:25:48 +08:00
nservers, numservers and authnserver (resolve.c, common.c) and radiuslist, nradservers and radiussecret (authradius.c) were globals of their own; they are configuration, set by nserver, authnserver and radius, and now live in struct extparam with the rest of it. MAXNSERVERS, MAXRADIUS and struct radserver move to structures.h, which plugins include without proxy.h. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
140 lines
3.9 KiB
C
140 lines
3.9 KiB
C
/*
|
|
3APA3A simplest proxy server
|
|
(c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
|
|
|
|
please read License Agreement
|
|
|
|
*/
|
|
|
|
#include "proxy.h"
|
|
|
|
unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nbytesout);
|
|
void trafcountfunc(struct clientparam *param);
|
|
int checkACL(struct clientparam * param);
|
|
void decodeurl(unsigned char *s, int allowcr);
|
|
int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned char ** buff, int *inbuf, int *bufsize);
|
|
struct ace * make_ace (int argc, unsigned char ** argv);
|
|
extern char * proxy_stringtable[];
|
|
#ifdef WITH_HTTPSRV
|
|
extern char * admin_stringtable[];
|
|
#endif
|
|
extern struct schedule * schedule;
|
|
int start_proxy_thread(struct child * chp);
|
|
|
|
extern int linenum;
|
|
extern char *conffile;
|
|
|
|
struct symbol symbols[] = {
|
|
{symbols+1, "conf", (void *) &conf},
|
|
{symbols+2, "socksend", (void *) socksend},
|
|
{symbols+3, "socksendto", (void *) socksendto},
|
|
{symbols+4, "sockrecvfrom", (void *) sockrecvfrom},
|
|
{symbols+5, "sockgetcharcli", (void *) sockgetcharcli},
|
|
{symbols+6, "sockgetcharsrv", (void *) sockgetcharsrv},
|
|
{symbols+7, "sockgetlinebuf", (void *) sockgetlinebuf},
|
|
{symbols+8, "myinet_ntop", (void *) myinet_ntop},
|
|
{symbols+9, "dobuf", (void *) dobuf},
|
|
{symbols+10, "scanaddr", (void *) scanaddr},
|
|
{symbols+11, "getip46", (void *) getip46},
|
|
{symbols+12, "sockmap", (void *) sockmap},
|
|
{symbols+13, "sockfuncs", (void *) &so},
|
|
{symbols+14, "ACLmatches", (void *) ACLmatches},
|
|
{symbols+15, "bandlimitfunc", (void *) bandlimitfunc},
|
|
{symbols+16, "trafcountfunc", (void *) trafcountfunc},
|
|
{symbols+17, "alwaysauth", (void *) alwaysauth},
|
|
{symbols+18, "ipauth", (void *) ipauth},
|
|
{symbols+19, "strongauth", (void *) strongauth},
|
|
{symbols+20, "checkACL", (void *) checkACL},
|
|
{symbols+21, "nservers", (void *) conf.nservers},
|
|
{symbols+22, "udpresolve", (void *) udpresolve},
|
|
{symbols+23, "bandlim_mutex", (void *) &bandlim_mutex},
|
|
{symbols+24, "tc_mutex", (void *) &tc_mutex},
|
|
{symbols+25, "linenum", (void *) &linenum},
|
|
{symbols+26, "proxy_stringtable", (void *) proxy_stringtable},
|
|
{symbols+27, "en64", (void *) en64},
|
|
{symbols+28, "de64", (void *) de64},
|
|
{symbols+29, "tohex", (void *) tohex},
|
|
{symbols+30, "fromhex", (void *) fromhex},
|
|
{symbols+31, "dnspr", (void *) dnsprchild},
|
|
{symbols+32, "pop3p", (void *) pop3pchild},
|
|
{symbols+33, "proxy", (void *) proxychild},
|
|
{symbols+34, "socks", (void *) sockschild},
|
|
{symbols+35, "tcppm", (void *) tcppmchild},
|
|
{symbols+36, "udppm", (void *) udppmchild},
|
|
{symbols+38, "ftppr", (void *) ftpprchild},
|
|
{symbols+39, "smtpp", (void *) smtppchild},
|
|
{symbols+40, "auto", (void *) smtppchild},
|
|
{symbols+41, "tlspr", (void *) smtppchild},
|
|
{symbols+42, "authfuncs", (void *) &authfuncs},
|
|
{symbols+43, "commandhandlers", (void *) &commandhandlers},
|
|
{symbols+44, "decodeurl", (void *) decodeurl},
|
|
{symbols+45, "parsestr", (void *) parsestr},
|
|
{symbols+46, "make_ace", (void *) make_ace},
|
|
{symbols+47, "freeacl", (void *) freeacl},
|
|
{symbols+48, "handleredirect", (void *) handleredirect},
|
|
{symbols+49, "imapp", (void *) imappchild},
|
|
{NULL, "", NULL}
|
|
};
|
|
|
|
static void * findbyname(const char *name){
|
|
struct symbol * symbols;
|
|
for(symbols = &pluginlink.symbols; symbols; symbols=symbols->next)
|
|
if(!strcmp(symbols->name, name)) return symbols->value;
|
|
return NULL;
|
|
}
|
|
|
|
|
|
struct pluginlink pluginlink = {
|
|
{symbols, "", NULL},
|
|
&conf,
|
|
conf.nservers,
|
|
&linenum,
|
|
authfuncs,
|
|
commandhandlers,
|
|
findbyname,
|
|
socksend,
|
|
socksendto,
|
|
sockrecvfrom,
|
|
sockgetcharcli,
|
|
sockgetcharsrv,
|
|
sockgetlinebuf,
|
|
myinet_ntop,
|
|
dobuf,
|
|
dobuf2,
|
|
scanaddr,
|
|
getip46,
|
|
sockmap,
|
|
ACLmatches,
|
|
alwaysauth,
|
|
checkACL,
|
|
en64,
|
|
de64,
|
|
tohex,
|
|
fromhex,
|
|
decodeurl,
|
|
parsestr,
|
|
make_ace,
|
|
malloc,
|
|
free,
|
|
realloc,
|
|
strdup,
|
|
trafcountfunc,
|
|
proxy_stringtable,
|
|
&schedule,
|
|
freeacl,
|
|
#ifdef WITH_HTTPSRV
|
|
admin_stringtable,
|
|
#else
|
|
NULL,
|
|
#endif
|
|
&childdef,
|
|
start_proxy_thread,
|
|
freeparam,
|
|
parsehostname,
|
|
parseusername,
|
|
parseconnusername,
|
|
&so,
|
|
dologname
|
|
};
|
|
|