doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

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

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