Skip to content

Commit

Permalink
remove time limit between consective attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
bjin committed Nov 18, 2010
1 parent 1a3d2f7 commit 54c91ad
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
1 change: 0 additions & 1 deletion http-auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,3 @@ char* digest_authentication_encode(const char *line, const char *user, const cha

const char *auth_request_header = "Proxy-Authenticate:";
const char *auth_response_header = "Proxy-Authorization:";
const time_t auth_error_gap = 60;
1 change: 0 additions & 1 deletion http-auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

typedef struct http_auth_t {
char *last_auth_query;
time_t last_auth_time;
int last_auth_count;
} http_auth;

Expand Down
7 changes: 2 additions & 5 deletions http-connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ static struct evbuffer *httpc_mkconnect(redsocks_client *client);

extern const char *auth_request_header;
extern const char *auth_response_header;
extern const time_t auth_error_gap; // quit after connsective auth fail in a time interval, in secs

static char *get_auth_request_header(struct evbuffer *buf)
{
Expand Down Expand Up @@ -82,9 +81,8 @@ static void httpc_read_cb(struct bufferevent *buffev, void *_arg)
if (code == 407) { // auth failed
http_auth *auth = (void*)(client->instance + 1);

time_t now_time = time(NULL);
if (auth->last_auth_query != NULL && now_time - auth->last_auth_time < auth_error_gap && auth->last_auth_count == 1) {
redsocks_log_error(client, LOG_NOTICE, "consective auth failure");
if (auth->last_auth_query != NULL && auth->last_auth_count == 1) {
redsocks_log_error(client, LOG_NOTICE, "proxy auth failed");
redsocks_drop_client(client);

dropped = 1;
Expand All @@ -105,7 +103,6 @@ static void httpc_read_cb(struct bufferevent *buffev, void *_arg)

auth->last_auth_query = calloc(strlen(ptr) + 1, 1);
strcpy(auth->last_auth_query, ptr);
auth->last_auth_time = now_time;
auth->last_auth_count = 0;

free(auth_request);
Expand Down

0 comments on commit 54c91ad

Please sign in to comment.