Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
lib: add functions validating dump dir
Move the code from abrt-server to shared library and fix the condition validating dump dir's path. As of now, abrt is allowed to process only direct sub-directories of the dump locations. Signed-off-by: Jakub Filak <jfilak@redhat.com>
- Loading branch information
Jakub Filak
committed
May 4, 2015
1 parent
c796c76
commit b7f8bd2
Showing
6 changed files
with
158 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # -*- Autotest -*- | ||
|
|
||
| AT_BANNER([hooklib]) | ||
|
|
||
| AT_TESTFUN([dir_is_in_dump_location], | ||
| [[ | ||
| #include "libabrt.h" | ||
| #include <assert.h> | ||
|
|
||
| void test(char *name, bool expected) | ||
| { | ||
| if (dir_is_in_dump_location(name) != expected) | ||
| { | ||
| fprintf(stderr, "Bad: %s", name); | ||
| abort(); | ||
| } | ||
|
|
||
| free(name); | ||
| } | ||
|
|
||
| int main(void) | ||
| { | ||
| g_verbose = 3; | ||
| load_abrt_conf(); | ||
|
|
||
| g_verbose = 3; | ||
|
|
||
| char *name; | ||
|
|
||
| assert(dir_is_in_dump_location("/") == false); | ||
|
|
||
| asprintf(&name, "%s", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s..evil", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s///", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/.", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s///.", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/./", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/.///", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/..", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s///..", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/../", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/..///", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/good/../../../evil", g_settings_dump_location); | ||
| test(name, false); | ||
|
|
||
| asprintf(&name, "%s/good..still", g_settings_dump_location); | ||
| test(name, true); | ||
|
|
||
| asprintf(&name, "%s/good.new", g_settings_dump_location); | ||
| test(name, true); | ||
|
|
||
| asprintf(&name, "%s/.meta", g_settings_dump_location); | ||
| test(name, true); | ||
|
|
||
| asprintf(&name, "%s/..data", g_settings_dump_location); | ||
| test(name, true); | ||
|
|
||
| return 0; | ||
| } | ||
| ]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ | |
| m4_include([koops-parser.at]) | ||
| m4_include([pyhook.at]) | ||
| m4_include([ignored_problems.at]) | ||
| m4_include([hooklib.at]) | ||