mirror of
https://github.com/3proxy/3proxy.git
synced 2026-10-24 17:12:16 +00:00
Correct IP matching in cache auth
This commit is contained in:
parent
8cdf341d0e
commit
fbcdcf3d7b
1 changed files with 3 additions and 3 deletions
|
|
@ -654,7 +654,7 @@ int cacheauth(struct clientparam * param){
|
|||
|
||||
}
|
||||
if(((!(conf.authcachetype&2)) || (param->username && ac->username && !strcmp(ac->username, (char *)param->username))) &&
|
||||
((!(conf.authcachetype&1)) || (*SAFAMILY(&ac->sa) == *SAFAMILY(¶m->sincr) && !memcmp(SAADDR(&ac->sa), ¶m->sincr, SAADDRLEN(&ac->sa)))) &&
|
||||
((!(conf.authcachetype&1)) || (*SAFAMILY(&ac->sa) == *SAFAMILY(¶m->sincr) && !memcmp(SAADDR(&ac->sa), SAADDR(¶m->sincr), SAADDRLEN(&ac->sa)))) &&
|
||||
(!(conf.authcachetype&4) || (ac->password && param->password && !strcmp(ac->password, (char *)param->password)))) {
|
||||
if(param->username){
|
||||
myfree(param->username);
|
||||
|
|
@ -688,7 +688,7 @@ int doauth(struct clientparam * param){
|
|||
pthread_mutex_lock(&hash_mutex);
|
||||
for(ac = authc; ac; ac = ac->next){
|
||||
if((!(conf.authcachetype&2) || !strcmp(ac->username, (char *)param->username)) &&
|
||||
(!(conf.authcachetype&1) || (*SAFAMILY(&ac->sa) == *SAFAMILY(¶m->sincr) && !memcmp(SAADDR(&ac->sa), ¶m->sincr, SAADDRLEN(&ac->sa)))) &&
|
||||
(!(conf.authcachetype&1) || (*SAFAMILY(&ac->sa) == *SAFAMILY(¶m->sincr) && !memcmp(SAADDR(&ac->sa), SAADDR(¶m->sincr), SAADDRLEN(&ac->sa)))) &&
|
||||
(!(conf.authcachetype&4) || (ac->password && !strcmp(ac->password, (char *)param->password)))) {
|
||||
ac->expires = conf.time + conf.authcachetime;
|
||||
if(strcmp(ac->username, (char *)param->username)){
|
||||
|
|
@ -709,7 +709,7 @@ int doauth(struct clientparam * param){
|
|||
ac = myalloc(sizeof(struct authcache));
|
||||
if(ac){
|
||||
ac->expires = conf.time + conf.authcachetime;
|
||||
ac->username = mystrdup((char *)param->username);
|
||||
ac->username = param->username?mystrdup((char *)param->username):NULL;
|
||||
ac->sa = param->sincr;
|
||||
ac->password = NULL;
|
||||
if((conf.authcachetype&4) && param->password) ac->password = mystrdup((char *)param->password);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue