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