mirror of
https://github.com/3proxy/3proxy.git
synced 2026-10-17 08:55:49 +08:00
Authorize FTP commands and data connections by the rules in force
An FTP control connection authorizes each OPEN or USER and each data connection while it lasts, which may be across a reload: these go through clientauth() too, as a client of the newest service on its listener after a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ae27a5cf90
commit
dfee08ded4
@ -203,13 +203,13 @@ SOCKET ftpdata(struct clientparam *param){
|
||||
*SAPORT(¶m->sinsl) = 0;
|
||||
i = param->operation;
|
||||
param->operation = FTP_DATA;
|
||||
if((param->res = (*param->srv->authfunc)(param))) {
|
||||
if((param->res = clientauth(param))) {
|
||||
if(param->remsock != INVALID_SOCKET) {
|
||||
param->srv->so._closesocket(param->sostate, param->remsock);
|
||||
param->remsock = INVALID_SOCKET;
|
||||
}
|
||||
memset(¶m->sinsl, 0, sizeof(param->sinsl));
|
||||
if((param->res = (*param->srv->authfunc)(param))) {
|
||||
if((param->res = clientauth(param))) {
|
||||
param->remsock = rem;
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ void * ftpprchild(struct clientparam* param) {
|
||||
param->srv->so._closesocket(param->sostate, param->remsock);
|
||||
param->remsock = INVALID_SOCKET;
|
||||
}
|
||||
if((res = (*param->srv->authfunc)(param))) {RETURN(res);}
|
||||
if((res = clientauth(param))) {RETURN(res);}
|
||||
param->ctrlsocksrv = param->remsock;
|
||||
if(socksend(param, param->ctrlsock, (unsigned char *)"220 Ready\r\n", 11, param->srv->timeouts[STRING_S])!=11) {RETURN (801);}
|
||||
status = 1;
|
||||
@ -62,7 +62,7 @@ void * ftpprchild(struct clientparam* param) {
|
||||
else if (!strncasecmp((char *)buf, "USER ", 5)){
|
||||
if(parseconnusername((char *)buf +5, param, 0, 21)){RETURN(804);}
|
||||
if(!status){
|
||||
if((res = (*param->srv->authfunc)(param))) {RETURN(res);}
|
||||
if((res = clientauth(param))) {RETURN(res);}
|
||||
param->ctrlsocksrv = param->remsock;
|
||||
}
|
||||
if(socksend(param, param->ctrlsock, (unsigned char *)"331 ok\r\n", 8, param->srv->timeouts[STRING_S])!=8) {RETURN (807);}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user