mirror of
https://github.com/3proxy/3proxy.git
synced 2026-06-15 20:00:12 +08:00
Compare commits
No commits in common. "451b3d180cf6c98fa6c7e412cef55d5a7f2b840c" and "e6c3427cab98ccb63c7a43e5a176355cd83eb47e" have entirely different histories.
451b3d180c
...
e6c3427cab
@ -823,7 +823,7 @@ int doauth(struct clientparam * param){
|
|||||||
(res = (*authfuncs->authorize)(param)))
|
(res = (*authfuncs->authorize)(param)))
|
||||||
return res;
|
return res;
|
||||||
if(conf.authcachetype && authfuncs->authenticate && authfuncs->authenticate != cacheauth && param->username && (!(conf.authcachetype&4) || (!param->pwtype && param->password))){
|
if(conf.authcachetype && authfuncs->authenticate && authfuncs->authenticate != cacheauth && param->username && (!(conf.authcachetype&4) || (!param->pwtype && param->password))){
|
||||||
struct authcache ac={.username=""};
|
struct authcache ac={};
|
||||||
|
|
||||||
if(param->username) strncpy((char *)ac.username, (char *)param->username, 64);
|
if(param->username) strncpy((char *)ac.username, (char *)param->username, 64);
|
||||||
if(*SAFAMILY(¶m->sincr) == AF_INET
|
if(*SAFAMILY(¶m->sincr) == AF_INET
|
||||||
|
|||||||
@ -153,7 +153,6 @@ int start_proxy_thread(struct child * chp){
|
|||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
DWORD num;
|
|
||||||
#endif
|
#endif
|
||||||
char r[1];
|
char r[1];
|
||||||
|
|
||||||
@ -172,7 +171,7 @@ int start_proxy_thread(struct child * chp){
|
|||||||
pthread_attr_destroy(&pa);
|
pthread_attr_destroy(&pa);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ReadFile(conf.threadinit[0], r, 1, &num, NULL);
|
ReadFile(conf.threadinit[0], r, 1, NULL, NULL);
|
||||||
#else
|
#else
|
||||||
while(read(conf.threadinit[0], r, 1) !=1) if(errno != EINTR) {
|
while(read(conf.threadinit[0], r, 1) !=1) if(errno != EINTR) {
|
||||||
fprintf(stderr, "pipe failed\n");
|
fprintf(stderr, "pipe failed\n");
|
||||||
|
|||||||
29
src/hash.c
29
src/hash.c
@ -8,8 +8,8 @@ struct hashentry {
|
|||||||
char value[4];
|
char value[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t hashindex(unsigned tablesize, const uint8_t* hash){
|
static uint32_t hashindex(struct hashtable *ht, const uint8_t* hash){
|
||||||
return (*(unsigned *)hash) % tablesize;
|
return (*(unsigned *)hash ) % (ht->tablesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -135,27 +135,6 @@ static void hashgrow(struct hashtable *ht){
|
|||||||
hvalue(ht,newsize)->inext = ht->ihashempty;
|
hvalue(ht,newsize)->inext = ht->ihashempty;
|
||||||
ht->ihashempty = ht->poolsize + 1;
|
ht->ihashempty = ht->poolsize + 1;
|
||||||
ht->poolsize = newsize;
|
ht->poolsize = newsize;
|
||||||
if (ht->poolsize / ht->tablesize > 10) {
|
|
||||||
unsigned newtablesize = ht->poolsize / 3;
|
|
||||||
uint32_t *newitable = myalloc(newtablesize * sizeof(uint32_t));
|
|
||||||
if (newitable) {
|
|
||||||
unsigned j;
|
|
||||||
memset(newitable, 0, newtablesize * sizeof(uint32_t));
|
|
||||||
for (j = 0; j < ht->tablesize; j++) {
|
|
||||||
uint32_t he = ht->ihashtable[j];
|
|
||||||
while (he) {
|
|
||||||
uint32_t next = hvalue(ht, he)->inext;
|
|
||||||
unsigned idx = hashindex(newtablesize, hhash(ht, he));
|
|
||||||
hvalue(ht, he)->inext = newitable[idx];
|
|
||||||
newitable[idx] = he;
|
|
||||||
he = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myfree(ht->ihashtable);
|
|
||||||
ht->ihashtable = newitable;
|
|
||||||
ht->tablesize = newtablesize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,7 +153,7 @@ void hashadd(struct hashtable *ht, const void* name, const void* value, time_t e
|
|||||||
|
|
||||||
ht->index2hash(ht, name, hash);
|
ht->index2hash(ht, name, hash);
|
||||||
pthread_mutex_lock(&hash_mutex);
|
pthread_mutex_lock(&hash_mutex);
|
||||||
index = hashindex(ht->tablesize, hash);
|
index = hashindex(ht, hash);
|
||||||
|
|
||||||
for(hep = ht->ihashtable + index; (he = *hep)!=0; ){
|
for(hep = ht->ihashtable + index; (he = *hep)!=0; ){
|
||||||
if(hvalue(ht,he)->expires < conf.time || !memcmp(hash, hhash(ht,he), ht->hash_size)) {
|
if(hvalue(ht,he)->expires < conf.time || !memcmp(hash, hhash(ht,he), ht->hash_size)) {
|
||||||
@ -222,7 +201,7 @@ int hashresolv(struct hashtable *ht, const void* name, void* value, uint32_t *tt
|
|||||||
}
|
}
|
||||||
ht->index2hash(ht,name, hash);
|
ht->index2hash(ht,name, hash);
|
||||||
pthread_mutex_lock(&hash_mutex);
|
pthread_mutex_lock(&hash_mutex);
|
||||||
index = hashindex(ht->tablesize, hash);
|
index = hashindex(ht, hash);
|
||||||
for(hep = ht->ihashtable + index; (he = *hep)!=0; ){
|
for(hep = ht->ihashtable + index; (he = *hep)!=0; ){
|
||||||
if(hvalue(ht, he)->expires < conf.time) {
|
if(hvalue(ht, he)->expires < conf.time) {
|
||||||
(*hep) = hvalue(ht,he)->inext;
|
(*hep) = hvalue(ht,he)->inext;
|
||||||
|
|||||||
@ -18,9 +18,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined(WATCOM)
|
#if defined(_MSC_VER)
|
||||||
#define BLAKE2_PACKED(x) _Packed x
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
|
#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
|
||||||
#else
|
#else
|
||||||
#define BLAKE2_PACKED(x) x __attribute__((packed))
|
#define BLAKE2_PACKED(x) x __attribute__((packed))
|
||||||
|
|||||||
@ -279,7 +279,7 @@ SSL_CONN ssl_handshake_to_server(SOCKET s, char * hostname, SSL_CONFIG *config,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
do {
|
do {
|
||||||
struct pollfd fds[1] = {{INVALID_SOCKET}};
|
struct pollfd fds[1] = {{}};
|
||||||
int sslerr;
|
int sslerr;
|
||||||
|
|
||||||
err = SSL_connect(conn->ssl);
|
err = SSL_connect(conn->ssl);
|
||||||
@ -350,7 +350,7 @@ SSL_CONN ssl_handshake_to_client(SOCKET s, SSL_CONFIG *config, X509 *server_cert
|
|||||||
SSL_set_fd(conn->ssl, s);
|
SSL_set_fd(conn->ssl, s);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
struct pollfd fds[1] = {{INVALID_SOCKET}};
|
struct pollfd fds[1] = {{}};
|
||||||
int sslerr;
|
int sslerr;
|
||||||
|
|
||||||
err = SSL_accept(conn->ssl);
|
err = SSL_accept(conn->ssl);
|
||||||
|
|||||||
@ -116,11 +116,11 @@ void * threadfunc (void *p) {
|
|||||||
#undef param
|
#undef param
|
||||||
|
|
||||||
int pushthreadinit(){
|
int pushthreadinit(){
|
||||||
|
return
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD n;
|
WriteFile(conf.threadinit[1], "1", 1, NULL, NULL);
|
||||||
return WriteFile(conf.threadinit[1], "1", 1, &n, NULL);
|
|
||||||
#else
|
#else
|
||||||
return write(conf.threadinit[1], "1", 1);
|
write(conf.threadinit[1], "1", 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user