mirror of
https://github.com/darkk/redsocks.git
synced 2025-08-25 19:25:30 +00:00
fix the fatal issue in lastest commit
This commit is contained in:
parent
b8a5598b17
commit
1a3d2f7df2
@ -235,7 +235,6 @@ char* digest_authentication_encode(const char *line, const char *user, const cha
|
||||
|
||||
/* prepare the final string */
|
||||
int len = 256;
|
||||
//if (!realm || !nonce || !user || !passwd || !path || !method)
|
||||
len += strlen(user);
|
||||
len += strlen(realm);
|
||||
len += strlen(nonce);
|
||||
|
@ -59,7 +59,7 @@ static char *get_auth_request_header(struct evbuffer *buf)
|
||||
line = evbuffer_readline(buf);
|
||||
if (line == NULL || *line == '\0' || strchr(line, ':') == NULL)
|
||||
return NULL;
|
||||
if (strcasecmp(line, auth_request_header) == 0)
|
||||
if (strncasecmp(line, auth_request_header, strlen(auth_request_header)) == 0)
|
||||
return line;
|
||||
}
|
||||
}
|
||||
@ -186,10 +186,10 @@ static struct evbuffer *httpc_mkconnect(redsocks_client *client)
|
||||
redsocks_log_error(client, LOG_NOTICE, "find previous challange %s, apply it", auth->last_auth_query);
|
||||
|
||||
|
||||
if (strcasecmp(auth->last_auth_query, "Basic") == 0) {
|
||||
if (strncasecmp(auth->last_auth_query, "Basic", 5) == 0) {
|
||||
auth_string = basic_authentication_encode(client->instance->config.login, client->instance->config.password);
|
||||
auth_scheme = "Basic";
|
||||
} else if (strcasecmp(auth->last_auth_query, "Digest") == 0) {
|
||||
} else if (strncasecmp(auth->last_auth_query, "Digest", 6) == 0) {
|
||||
/* calculate uri */
|
||||
char uri[128];
|
||||
snprintf(uri, 128, "%s:%u", inet_ntoa(client->destaddr.sin_addr), ntohs(client->destaddr.sin_port));
|
||||
|
Loading…
Reference in New Issue
Block a user