Services: threadperclient with PAM, LDAP or Windows authentication

struct auth has blocks, for an authentication waiting other than in
sockpoll(): PamAuth, LdapPlugin and WindowsAuthentication set it, and a
service authenticating with one of them gives each client a thread.

Incompatible for plugins, which have to be built again with the same
version of 3proxy: struct auth has blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir Dubrovin 2026-10-24 20:06:39 +03:00
parent 5d3f1e9567
commit df993b5304
6 changed files with 8 additions and 0 deletions

View File

@ -558,6 +558,7 @@ static int h_auth(int argc, unsigned char **argv){
conf->authfuncs->desc = au->desc; conf->authfuncs->desc = au->desc;
conf->authfuncs->authenticate = au->authenticate; conf->authfuncs->authenticate = au->authenticate;
conf->authfuncs->authorize = au->authorize; conf->authfuncs->authorize = au->authorize;
conf->authfuncs->blocks = au->blocks;
break; break;
} }
} }

View File

@ -313,8 +313,11 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){
} }
if(conf->authfuncs){ if(conf->authfuncs){
struct auth *au;
srv->authfuncs = copyauth(conf->authfuncs); srv->authfuncs = copyauth(conf->authfuncs);
if(!srv->authfuncs) return 2; if(!srv->authfuncs) return 2;
for(au = srv->authfuncs; au; au = au->next) if(au->blocks) srv->threadperclient = 1;
} }
#else #else
srv->needuser = 0; srv->needuser = 0;

View File

@ -551,6 +551,7 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink,
myalwaysauth.authenticate = ldapfunc; myalwaysauth.authenticate = ldapfunc;
myalwaysauth.authorize = pluginlink->checkACL; myalwaysauth.authorize = pluginlink->checkACL;
myalwaysauth.desc = "ldap"; myalwaysauth.desc = "ldap";
myalwaysauth.blocks = 1;
myalwaysauth.next = pluginlink->authfuncs->next; myalwaysauth.next = pluginlink->authfuncs->next;
pluginlink->authfuncs->next = &myalwaysauth; pluginlink->authfuncs->next = &myalwaysauth;

View File

@ -141,6 +141,7 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink, int argc, unsigne
pamauth.authenticate = pamfunc; pamauth.authenticate = pamfunc;
pamauth.authorize = pluginlink->checkACL; pamauth.authorize = pluginlink->checkACL;
pamauth.desc = "pam"; pamauth.desc = "pam";
pamauth.blocks = 1;
pamauth.next = pluginlink->authfuncs->next; pamauth.next = pluginlink->authfuncs->next;
pluginlink->authfuncs->next = &pamauth; pluginlink->authfuncs->next = &pamauth;

View File

@ -80,6 +80,7 @@ PLUGINAPI int PLUGINCALL WindowsAuthentication(struct pluginlink * pluginlink, i
alwaysauth.authenticate = windowsfunc; alwaysauth.authenticate = windowsfunc;
alwaysauth.authorize = pluginlink->checkACL; alwaysauth.authorize = pluginlink->checkACL;
alwaysauth.desc = "windows"; alwaysauth.desc = "windows";
alwaysauth.blocks = 1;
alwaysauth.next = pluginlink->authfuncs->next; alwaysauth.next = pluginlink->authfuncs->next;
pluginlink->authfuncs->next = &alwaysauth; pluginlink->authfuncs->next = &alwaysauth;
loaded = 1; loaded = 1;

View File

@ -284,6 +284,7 @@ struct auth {
AUTHFUNC authenticate; AUTHFUNC authenticate;
AUTHFUNC authorize; AUTHFUNC authorize;
char * desc; char * desc;
int blocks; /* waits other than in sockpoll(): PAM, LDAP */
}; };
struct iplist { struct iplist {