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