Skip to content
Permalink
Browse files Browse the repository at this point in the history
daemon: use libreport's function checking file name
Move the functions to libreport because we need the same functionality
there too.

Related: #1214451

Signed-off-by: Jakub Filak <jfilak@redhat.com>
  • Loading branch information
Jakub Filak committed May 4, 2015
1 parent e6dc590 commit c796c76
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/daemon/abrt-server.c
Expand Up @@ -476,22 +476,6 @@ static int create_problem_dir(GHashTable *problem_info, unsigned pid)
exit(0);
}

/* Checks if a string contains only printable characters. */
static gboolean printable_str(const char *str)
{
do {
if ((unsigned char)(*str) < ' ' || *str == 0x7f)
return FALSE;
str++;
} while (*str);
return TRUE;
}

static gboolean is_correct_filename(const char *value)
{
return printable_str(value) && !strchr(value, '/') && !strchr(value, '.');
}

static gboolean key_value_ok(gchar *key, gchar *value)
{
char *i;
Expand All @@ -510,7 +494,7 @@ static gboolean key_value_ok(gchar *key, gchar *value)
|| strcmp(key, FILENAME_TYPE) == 0
)
{
if (!is_correct_filename(value))
if (!str_is_correct_filename(value))
{
error_msg("Value of '%s' ('%s') is not a valid directory name",
key, value);
Expand Down

0 comments on commit c796c76

Please sign in to comment.