Blame 0105-daemon-use-libreport-s-function-checking-file-name.patch

69165ba
From c796c76341ee846cfb897ed645bac211d7d0a932 Mon Sep 17 00:00:00 2001
69165ba
From: Jakub Filak <jfilak@redhat.com>
69165ba
Date: Thu, 23 Apr 2015 13:12:01 +0200
69165ba
Subject: [ABRT PATCH] daemon: use libreport's function checking file name
69165ba
69165ba
Move the functions to libreport because we need the same functionality
69165ba
there too.
69165ba
69165ba
Related: #1214451
69165ba
69165ba
Signed-off-by: Jakub Filak <jfilak@redhat.com>
69165ba
---
69165ba
 src/daemon/abrt-server.c | 18 +-----------------
69165ba
 1 file changed, 1 insertion(+), 17 deletions(-)
69165ba
69165ba
diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c
69165ba
index 5789075..4d486d4 100644
69165ba
--- a/src/daemon/abrt-server.c
69165ba
+++ b/src/daemon/abrt-server.c
69165ba
@@ -476,22 +476,6 @@ static int create_problem_dir(GHashTable *problem_info, unsigned pid)
69165ba
     exit(0);
69165ba
 }
69165ba
 
69165ba
-/* Checks if a string contains only printable characters. */
69165ba
-static gboolean printable_str(const char *str)
69165ba
-{
69165ba
-    do {
69165ba
-        if ((unsigned char)(*str) < ' ' || *str == 0x7f)
69165ba
-            return FALSE;
69165ba
-        str++;
69165ba
-    } while (*str);
69165ba
-    return TRUE;
69165ba
-}
69165ba
-
69165ba
-static gboolean is_correct_filename(const char *value)
69165ba
-{
69165ba
-    return printable_str(value) && !strchr(value, '/') && !strchr(value, '.');
69165ba
-}
69165ba
-
69165ba
 static gboolean key_value_ok(gchar *key, gchar *value)
69165ba
 {
69165ba
     char *i;
69165ba
@@ -510,7 +494,7 @@ static gboolean key_value_ok(gchar *key, gchar *value)
69165ba
      || strcmp(key, FILENAME_TYPE) == 0
69165ba
     )
69165ba
     {
69165ba
-        if (!is_correct_filename(value))
69165ba
+        if (!str_is_correct_filename(value))
69165ba
         {
69165ba
             error_msg("Value of '%s' ('%s') is not a valid directory name",
69165ba
                       key, value);
69165ba
-- 
69165ba
1.8.3.1
69165ba