mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-24 02:55:40 +08:00
re-authenticate user on
This commit is contained in:
parent
dcec2cadaa
commit
eeb2d78fb1
@ -59,8 +59,8 @@ void __stdcall CommandHandler( DWORD dwCommand )
|
||||
case SERVICE_CONTROL_STOP:
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
SetStatus( SERVICE_STOP_PENDING, 0, 1 );
|
||||
conf.paused++;
|
||||
conf.timetoexit = 1;
|
||||
conf.paused++;
|
||||
Sleep(2000);
|
||||
SetStatus( SERVICE_STOPPED, 0, 0 );
|
||||
#ifndef NOODBC
|
||||
|
@ -476,8 +476,8 @@ unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nb
|
||||
|
||||
if(!nbytesin && !nbytesout) return 0;
|
||||
pthread_mutex_lock(&bandlim_mutex);
|
||||
if(param->srv->version != conf.paused){
|
||||
initbandlims(param);
|
||||
if(param->paused != conf.paused){
|
||||
return (1);
|
||||
}
|
||||
for(i=0; nbytesin&& i<MAXBANDLIMS && param->bandlims[i]; i++){
|
||||
if( !param->bandlims[i]->basetime ||
|
||||
@ -558,7 +558,7 @@ int alwaysauth(struct clientparam * param){
|
||||
|
||||
res = doconnect(param);
|
||||
if(!res){
|
||||
if(param->srv->version != conf.paused) return 333;
|
||||
if(param->srv->paused != conf.paused) return 333;
|
||||
initbandlims(param);
|
||||
for(tc = conf.trafcounter; tc; tc = tc->next) {
|
||||
if(tc->disabled) continue;
|
||||
|
@ -63,7 +63,7 @@ struct extparam conf = {
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
0, -1, 0, 0, 0, 0, 0, 500, 0, 0, 0,
|
||||
0, -1, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0,
|
||||
6, 600,
|
||||
1048576,
|
||||
NULL, NULL,
|
||||
|
@ -1685,6 +1685,7 @@ int reload (void){
|
||||
|
||||
fp = confopen();
|
||||
if(fp){
|
||||
conf.version++;
|
||||
error = readconfig(fp);
|
||||
if(error) {
|
||||
freeconf(&conf);
|
||||
|
@ -509,7 +509,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
|
||||
for (;;) {
|
||||
for(;;){
|
||||
while((conf.paused == srv.version && srv.childcount >= srv.maxchild)){
|
||||
while((conf.paused == srv.paused && srv.childcount >= srv.maxchild)){
|
||||
nlog++;
|
||||
if(!srv.silent && nlog > 5000) {
|
||||
sprintf((char *)buf, "Warning: too many connected clients (%d/%d)", srv.childcount, srv.maxchild);
|
||||
@ -519,7 +519,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
usleep(SLEEPTIME);
|
||||
}
|
||||
if (iscbc) break;
|
||||
if (conf.paused != srv.version) break;
|
||||
if (conf.paused != srv.paused) break;
|
||||
if (srv.fds.events & POLLIN) {
|
||||
error = so._poll(&srv.fds, 1, 1000);
|
||||
}
|
||||
@ -535,7 +535,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if((conf.paused != srv.version) || (error < 0)) break;
|
||||
if((conf.paused != srv.paused) || (error < 0)) break;
|
||||
error = 0;
|
||||
if(!isudp){
|
||||
size = sizeof(defparam.sincr);
|
||||
@ -710,7 +710,8 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
void srvinit(struct srvparam * srv, struct clientparam *param){
|
||||
|
||||
memset(srv, 0, sizeof(struct srvparam));
|
||||
srv->version = conf.paused;
|
||||
srv->version = conf.version;
|
||||
srv->paused = conf.paused;
|
||||
srv->logfunc = conf.logfunc;
|
||||
if(srv->logformat)myfree(srv->logformat);
|
||||
srv->logformat = conf.logformat? (unsigned char *)mystrdup((char *)conf.logformat) : NULL;
|
||||
@ -730,6 +731,8 @@ void srvinit(struct srvparam * srv, struct clientparam *param){
|
||||
srv->needuser = 1;
|
||||
memset(param, 0, sizeof(struct clientparam));
|
||||
param->srv = srv;
|
||||
param->version = srv->version;
|
||||
param->paused = srv->paused;
|
||||
param->remsock = param->clisock = param->ctrlsock = param->ctrlsocksrv = INVALID_SOCKET;
|
||||
*SAFAMILY(¶m->req) = *SAFAMILY(¶m->sinsl) = *SAFAMILY(¶m->sinsr) = *SAFAMILY(¶m->sincr) = *SAFAMILY(¶m->sincl) = AF_INET;
|
||||
pthread_mutex_init(&srv->counter_mutex, NULL);
|
||||
|
@ -68,6 +68,11 @@ int sockmap(struct clientparam * param, int timeo){
|
||||
|
||||
while (!stop&&!conf.timetoexit){
|
||||
sasize = sizeof(struct sockaddr_in);
|
||||
if(param->version != conf.version){
|
||||
if (res = (*param->srv->authfunc)(param)) {return(res);}
|
||||
param->paused = conf.paused;
|
||||
param->version = conf.version;
|
||||
}
|
||||
if((param->maxtrafin64 && param->statssrv64 >= param->maxtrafin64) || (param->maxtrafout64 && param->statscli64 >= param->maxtrafout64)){
|
||||
return (10);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ struct srvparam {
|
||||
SOCKET srvsock, cbsock;
|
||||
int childcount;
|
||||
int maxchild;
|
||||
int version;
|
||||
int paused, version;
|
||||
int singlepacket;
|
||||
int usentlm;
|
||||
int needuser;
|
||||
@ -440,7 +440,9 @@ struct clientparam {
|
||||
nolongdatfilter,
|
||||
nooverwritefilter,
|
||||
transparent,
|
||||
chunked;
|
||||
chunked,
|
||||
paused,
|
||||
version;
|
||||
|
||||
unsigned char *hostname,
|
||||
*username,
|
||||
@ -494,7 +496,7 @@ struct extparam {
|
||||
struct trafcount * trafcounter;
|
||||
struct srvparam *services;
|
||||
int stacksize, threadinit, counterd, haveerror, rotate, paused, archiverc,
|
||||
demon, maxchild, singlepacket, needreload, timetoexit;
|
||||
demon, maxchild, singlepacket, needreload, timetoexit, version;
|
||||
int authcachetype, authcachetime;
|
||||
int filtermaxsize;
|
||||
unsigned char *logname, **archiver;
|
||||
|
Loading…
Reference in New Issue
Block a user