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

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