Skip to content
Open

Three #115

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
To email a contributor remove "DELETE" from the email address.
(The DELETEs are necessary as this list is published online.)

2016/02/03 Jeffrey Fulmer <http://www.joedog.org/support/>
* SIEGE RELEASE RELEASE_3-1-4_FEB_02_2016
* src/auth.c Patched from 4.x.x
* src/auth.h Patched from 4.x.x
* src/client.c Patched 407 block from 4.x.x
* src/http.c Patched proxy-auth block from 4.x.x
* src/version.c Version increment: 3.1.4

2015/12/12 Jeffrey Fulmer <http://www.joedog.org/support/>
* SIEGE BETA RELEASE_3-1-4b2_DEC_12_2015
* configure.ac Added check for sys/types.h
Expand Down
42 changes: 29 additions & 13 deletions src/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ AUTH
auth_destroy(AUTH this)
{
this->creds = array_destroy(this->creds);
xfree(this->basic.encode);
xfree(this->digest.encode);
xfree(this->ntlm.encode);
xfree(this->proxy.encode);
xfree(this);
return NULL;
}
Expand Down Expand Up @@ -197,7 +201,7 @@ auth_set_basic_header(AUTH this, SCHEME scheme, char *realm)
CREDS tmp = array_get(this->creds, i);
if (realm == NULL) break;
if (strmatch(creds_get_realm(tmp), realm)) {
if (creds_get_scheme(tmp) == HTTP || creds_get_scheme(tmp) == HTTPS) {
if (creds_get_scheme(tmp) == scheme) {
return __basic_header(this, scheme, tmp);
}
}
Expand All @@ -208,7 +212,7 @@ auth_set_basic_header(AUTH this, SCHEME scheme, char *realm)
for (i = 0; i < array_length(this->creds); i++) {
CREDS tmp = array_get(this->creds, i);
if (strmatch(creds_get_realm(tmp), "any")) {
if (creds_get_scheme(tmp) == HTTP || creds_get_scheme(tmp) == HTTPS) {
if (creds_get_scheme(tmp) == scheme) {
return __basic_header(this, scheme, tmp);
}
}
Expand Down Expand Up @@ -253,22 +257,29 @@ auth_get_ntlm_header(AUTH this, SCHEME scheme)
}
}

//digest_generate_authorization(C->auth.wwwchlg, C->auth.wwwcred, "GET", fullpath);
char *
auth_get_digest_header(AUTH this, SCHEME scheme, DCHLG *chlg, DCRED *cred, const char *method, const char *uri)
{
size_t len;
char *cnonce = NULL;
char *nonce_count = NULL;
char *qop = NULL;
char *response = NULL;
char *cnonce = NULL;
char *nonce_count = NULL;
char *qop = NULL;
char *response = NULL;
char *request_digest = NULL;
char *h_a1 = NULL;
char *h_a2 = NULL;
char *opaque = NULL;
char *result, *tmp;
char *h_a1 = NULL;
char *h_a2 = NULL;
char *opaque = NULL;
char *result = NULL;
char *tmp = NULL;

/**
* The user probably didn't set login credentials.
* We'll return "" here and display a message after
* the authorization failure.
*/
if (chlg == NULL || cred == NULL) return "";

if (NULL != chlg->qop) {
if (chlg != NULL && chlg->qop != NULL) {
nonce_count = xstrcat(", nc=", cred->nc, NULL);
cnonce = xstrcat(", cnonce=\"", cred->cnonce_value, "\"", NULL);

Expand Down Expand Up @@ -304,7 +315,7 @@ auth_get_digest_header(AUTH this, SCHEME scheme, DCHLG *chlg, DCRED *cred, const
xfree(tmp);
response = xstrcat(" response=\"", request_digest, "\"", NULL);
}
if (NULL != chlg->opaque)
if (chlg != NULL && chlg->opaque != NULL)
opaque = xstrcat(", opaque=\"", chlg->opaque, "\"", NULL);

result = xstrcat (
Expand Down Expand Up @@ -544,6 +555,11 @@ __ntlm_header(AUTH this, SCHEME scheme, const char *header, CREDS creds)
return FALSE;
}

NOTIFY( // honestly this is here to silence the compiler...
DEBUG, "Parsing NTLM header: %d, %d, %s, %s",
this->okay, scheme, header, creds_get_username(creds)
);

header += 4; // Step past NTLM
while (*header && ISSPACE(*header)) {
header++;
Expand Down
16 changes: 5 additions & 11 deletions src/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,14 @@ BOOLEAN is_variable_line(char *line);
* '#' empty lines beginning with \n
* Takes a char* as an argument
*/
void
void
parse(char *str)
{
char *ch;
char *sp = strchr(str, ' ');
char *sl = strchr(str, '/');
if (sl==NULL && sp != NULL) {
ch = (char *)strstr(str, "#");
if (ch) {*ch = '\0';}
}
ch = (char *)strstr(str, "\n");
if (ch) {*ch = '\0';}

trim(str);
ch = (char *)strstr(str, "#");
if (ch){ *ch = '\0'; }
ch = (char *)strstr(str, "\n");
if (ch){ *ch = '\0'; }
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,14 @@ __http(CONN *C, URL U, CLIENT *client)
if (head->auth.type.proxy == DIGEST) {
BOOLEAN b;
client->auth.type.proxy = DIGEST;
b = auth_set_digest_header(
b = auth_set_digest_header (
my.auth, &(client->auth.pchlg), &(client->auth.pcred), &(client->rand_r_SEED),
head->auth.realm.proxy, head->auth.challenge.proxy
);
if (b == FALSE) {
NOTIFY(ERROR, "unable to set digest header");
fprintf(stderr, "ERROR: Unable to respond to a proxy authorization challenge\n");
fprintf(stderr, " in the following HTTP realm: '%s'\n", head->auth.realm.proxy);
fprintf(stderr, " Did you set proxy-login credentials in the conf file?\n");
return FALSE;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ http_get(CONN *C, URL U)
if (C->auth.proxy) {
if (C->auth.type.proxy==DIGEST) {
snprintf (
authwww, sizeof(authwww), "%s",
auth_get_digest_header(my.auth, HTTP, C->auth.wchlg, C->auth.wcred, url_get_method_name(U), fullpath)
authpxy, sizeof(authpxy), "%s",
auth_get_digest_header(my.auth, PROXY, C->auth.pchlg, C->auth.pcred, url_get_method_name(U), fullpath)
);
} else {
snprintf(authpxy, sizeof(authpxy), "%s", auth_get_basic_header(my.auth, PROXY));
Expand Down Expand Up @@ -313,7 +313,7 @@ http_post(CONN *C, URL U)
authwww, sizeof(authwww), "%s",
auth_get_digest_header(my.auth, HTTP, C->auth.wchlg, C->auth.wcred, url_get_method_name(U), fullpath)
);
} else if(C->auth.type.www==NTLM) {
} else if (C->auth.type.www==NTLM) {
snprintf(authwww, sizeof(authwww), "%s", auth_get_ntlm_header(my.auth, HTTP));
} else {
snprintf(authwww, sizeof(authwww), "%s", auth_get_basic_header(my.auth, HTTP));
Expand All @@ -322,8 +322,8 @@ http_post(CONN *C, URL U)
if (C->auth.proxy) {
if (C->auth.type.proxy==DIGEST) {
snprintf (
authwww, sizeof(authwww), "%s",
auth_get_digest_header(my.auth, HTTP, C->auth.wchlg, C->auth.wcred, url_get_method_name(U), fullpath)
authpxy, sizeof(authpxy), "%s",
auth_get_digest_header(my.auth, PROXY, C->auth.pchlg, C->auth.pcred, url_get_method_name(U), fullpath)
);
} else {
snprintf(authpxy, sizeof(authpxy), "%s", auth_get_basic_header(my.auth, PROXY));
Expand Down
5 changes: 5 additions & 0 deletions src/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static const struct ContentType tmap[] = {
{"cpt", FALSE, "application/mac-compactpro"},
{"csh", FALSE, "application/x-csh"},
{"css", TRUE, "text/css"},
{"csv", TRUE, "text/csv"},
{"dcr", FALSE, "application/x-director"},
{"dir", FALSE, "application/x-director"},
{"dms", FALSE, "application/octet-stream"},
Expand All @@ -87,6 +88,7 @@ static const struct ContentType tmap[] = {
{"htm", TRUE, "text/html"},
{"html", TRUE, "text/html"},
{"ice", FALSE, "x-conference/x-cooltalk"},
{"ico", FALSE, "image/x-icon"},
{"ief", FALSE, "image/ief"},
{"iges", FALSE, "model/iges"},
{"igs", FALSE, "model/iges"},
Expand All @@ -104,6 +106,7 @@ static const struct ContentType tmap[] = {
{"lzh", FALSE, "application/octet-stream"},
{"m", TRUE, "text/plain"},
{"man", FALSE, "application/x-troff-man"},
{"md", TRUE, "text/x-markdown"},
{"me", FALSE, "application/x-troff-me"},
{"mesh", FALSE, "model/mesh"},
{"mid", FALSE, "audio/midi"},
Expand Down Expand Up @@ -170,6 +173,7 @@ static const struct ContentType tmap[] = {
{"stp", FALSE, "application/STEP"},
{"sv4cpio", FALSE, "application/x-sv4cpio"},
{"sv4crc", FALSE, "application/x-sv4crc"},
{"svg", TRUE, "image/svg+xml"},
{"swf", FALSE, "application/x-shockwave-flash"},
{"t", FALSE, "application/x-troff"},
{"tar", FALSE, "application/x-tar"},
Expand Down Expand Up @@ -203,6 +207,7 @@ static const struct ContentType tmap[] = {
{"xpm", FALSE, "image/x-xpixmap"},
{"xwd", FALSE, "image/x-xwindowdump"},
{"xyz", FALSE, "chemical/x-pdb"},
{"yml", TRUE, "application/x-yaml"},
{"zip", FALSE, "application/zip"}
};

Expand Down
2 changes: 1 addition & 1 deletion src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* used by configure to dynamically assign those values
* to documentation files.
*/
const char *version_string = "3.1.4-beta2";
const char *version_string = "3.1.4";
const char *program_name = "siege";
const char *author_name = "Jeffrey Fulmer, et al.";
const char *email_address = "[email protected]";
Expand Down