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