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