|
xambroz |
2c36c19 |
diff -ru greenbone-security-assistant-6.0.9.orig/src/gsad.c greenbone-security-assistant-6.0.9.new/src/gsad.c
|
|
xambroz |
2c36c19 |
--- greenbone-security-assistant-6.0.9.orig/src/gsad.c 2016-02-25 17:17:40.466917939 +0100
|
|
xambroz |
2c36c19 |
+++ greenbone-security-assistant-6.0.9.new/src/gsad.c 2016-02-25 17:16:47.526709577 +0100
|
|
xambroz |
6216f00 |
@@ -3197,8 +3197,8 @@
|
|
xambroz |
6216f00 |
size_t size = (content_length ? content_length : strlen (content));
|
|
xambroz |
6216f00 |
int ret;
|
|
xambroz |
6216f00 |
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (size, (void *) content,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (size, (void *) content,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
gsad_add_content_type_header (response, &content_type);
|
|
xambroz |
6216f00 |
|
|
xambroz |
6216f00 |
if (content_disposition)
|
|
xambroz |
6216f00 |
@@ -3254,8 +3254,7 @@
|
|
xambroz |
6216f00 |
body = g_strdup_printf ("<html><body>Code 303 - Redirecting to"
|
|
xambroz |
6216f00 |
" %s</body></html>\n",
|
|
xambroz |
6216f00 |
uri, uri);
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (strlen (body), body, MHD_NO,
|
|
xambroz |
6216f00 |
- MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (strlen (body), body, MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (body);
|
|
xambroz |
6216f00 |
|
|
xambroz |
6216f00 |
if (!response)
|
|
xambroz |
2c36c19 |
@@ -3367,7 +3366,7 @@
|
|
xambroz |
2c36c19 |
/* Only accept GET and POST methods and send ERROR_PAGE in other cases. */
|
|
xambroz |
2c36c19 |
if (strcmp (method, "GET") && strcmp (method, "POST"))
|
|
xambroz |
2c36c19 |
{
|
|
xambroz |
2c36c19 |
- send_response (connection, ERROR_PAGE, MHD_HTTP_METHOD_NOT_ACCEPTABLE,
|
|
xambroz |
2c36c19 |
+ send_response (connection, ERROR_PAGE, MHD_HTTP_NOT_ACCEPTABLE,
|
|
xambroz |
2c36c19 |
NULL, GSAD_CONTENT_TYPE_TEXT_HTML, NULL, 0);
|
|
xambroz |
2c36c19 |
return MHD_YES;
|
|
xambroz |
2c36c19 |
}
|
|
xambroz |
6216f00 |
@@ -3478,8 +3477,8 @@
|
|
xambroz |
6216f00 |
guest_username ? guest_username : "");
|
|
xambroz |
6216f00 |
g_free (language);
|
|
xambroz |
6216f00 |
res = xsl_transform (xml);
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (strlen (res), res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (strlen (res), res,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (path);
|
|
xambroz |
6216f00 |
g_free (xml);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
@@ -3494,10 +3493,9 @@
|
|
xambroz |
6216f00 |
tracef ("File %s failed, ", path);
|
|
xambroz |
6216f00 |
g_free (path);
|
|
xambroz |
6216f00 |
|
|
xambroz |
6216f00 |
- return MHD_create_response_from_data (strlen (FILE_NOT_FOUND),
|
|
xambroz |
6216f00 |
+ return MHD_create_response_from_buffer (strlen (FILE_NOT_FOUND),
|
|
xambroz |
6216f00 |
(void *) FILE_NOT_FOUND,
|
|
xambroz |
6216f00 |
- MHD_NO,
|
|
xambroz |
6216f00 |
- MHD_YES);
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
6216f00 |
|
|
xambroz |
6216f00 |
/* Guess content type. */
|
|
xambroz |
6216f00 |
@@ -3534,8 +3532,8 @@
|
|
xambroz |
6216f00 |
NULL);
|
|
xambroz |
6216f00 |
g_free (path);
|
|
xambroz |
6216f00 |
fclose (file);
|
|
xambroz |
6216f00 |
- ret = MHD_create_response_from_data (strlen (res), (void *) res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ ret = MHD_create_response_from_buffer (strlen (res), (void *) res,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
return ret;
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
2c36c19 |
@@ -3739,7 +3737,7 @@
|
|
xambroz |
2c36c19 |
/* Only accept GET and POST methods and send ERROR_PAGE in other cases. */
|
|
xambroz |
2c36c19 |
if (strcmp (method, "GET") && strcmp (method, "POST"))
|
|
xambroz |
2c36c19 |
{
|
|
xambroz |
2c36c19 |
- send_response (connection, ERROR_PAGE, MHD_HTTP_METHOD_NOT_ACCEPTABLE,
|
|
xambroz |
2c36c19 |
+ send_response (connection, ERROR_PAGE, MHD_HTTP_NOT_ACCEPTABLE,
|
|
xambroz |
2c36c19 |
NULL, GSAD_CONTENT_TYPE_TEXT_HTML, NULL, 0);
|
|
xambroz |
2c36c19 |
return MHD_YES;
|
|
xambroz |
2c36c19 |
}
|
|
xambroz |
6216f00 |
@@ -3905,8 +3903,8 @@
|
|
xambroz |
6216f00 |
res = xsl_transform (xml);
|
|
xambroz |
6216f00 |
g_free (xml);
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (strlen (res), res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (strlen (res), res,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
ADD_CONTENT_SECURITY_HEADERS (response);
|
|
xambroz |
6216f00 |
return handler_send_response (connection,
|
|
xambroz |
6216f00 |
@@ -3975,8 +3973,8 @@
|
|
xambroz |
6216f00 |
g_free (full_url);
|
|
xambroz |
6216f00 |
res = xsl_transform (xml);
|
|
xambroz |
6216f00 |
g_free (xml);
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (strlen (res), res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (strlen (res), res,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
ADD_CONTENT_SECURITY_HEADERS (response);
|
|
xambroz |
6216f00 |
return handler_send_response (connection,
|
|
xambroz |
6216f00 |
@@ -4023,8 +4021,8 @@
|
|
xambroz |
6216f00 |
g_free (language);
|
|
xambroz |
6216f00 |
res = xsl_transform (xml);
|
|
xambroz |
6216f00 |
g_free (xml);
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (strlen (res), res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (strlen (res), res,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
ADD_CONTENT_SECURITY_HEADERS (response);
|
|
xambroz |
6216f00 |
return handler_send_response (connection,
|
|
xambroz |
6216f00 |
@@ -4084,9 +4082,9 @@
|
|
xambroz |
6216f00 |
content_type = GSAD_CONTENT_TYPE_APP_XML;
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
6216f00 |
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (res_len,
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (res_len,
|
|
xambroz |
6216f00 |
(void *) res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
if (content_type_string)
|
|
xambroz |
6216f00 |
{
|
|
xambroz |
6216f00 |
MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE,
|
|
xambroz |
6216f00 |
@@ -4132,8 +4130,8 @@
|
|
xambroz |
6216f00 |
credentials_free (credentials);
|
|
xambroz |
6216f00 |
return MHD_NO;
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data ((unsigned int) res_len,
|
|
xambroz |
6216f00 |
- res, MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer ((unsigned int) res_len,
|
|
xambroz |
6216f00 |
+ res, MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
6216f00 |
else if (!strncmp (&url[0], "/help/",
|
|
xambroz |
6216f00 |
@@ -4232,8 +4230,8 @@
|
|
xambroz |
6216f00 |
"Invalid request", __FUNCTION__, __LINE__,
|
|
xambroz |
6216f00 |
"Error generating help page.",
|
|
xambroz |
6216f00 |
"/help/contents.html");
|
|
xambroz |
6216f00 |
- response = MHD_create_response_from_data (strlen (res), res,
|
|
xambroz |
6216f00 |
- MHD_NO, MHD_YES);
|
|
xambroz |
6216f00 |
+ response = MHD_create_response_from_buffer (strlen (res), res,
|
|
xambroz |
6216f00 |
+ MHD_RESPMEM_MUST_COPY);
|
|
xambroz |
6216f00 |
g_free (res);
|
|
xambroz |
6216f00 |
}
|
|
xambroz |
6216f00 |
else
|