diff options
| author | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-09-24 14:58:40 +0200 |
|---|---|---|
| committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-09-24 14:58:40 +0200 |
| commit | 675d5159fbb9f5f760549a694543cd47f3638cac (patch) | |
| tree | 1a01bd90d3df41fb18f56fe1b3527c9c83a748b7 /src | |
| parent | 3f0f33fc439a411af661ba3cc0f08b4127c77237 (diff) | |
g_settings_setBlackListedPkgs uses GList
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/daemon/Settings.cpp | 33 | ||||
| -rw-r--r-- | src/daemon/Settings.h | 2 | ||||
| -rw-r--r-- | src/daemon/abrt-action-save-package-data.cpp | 10 |
3 files changed, 39 insertions, 6 deletions
diff --git a/src/daemon/Settings.cpp b/src/daemon/Settings.cpp index a6d59f54..ca4764b2 100644 --- a/src/daemon/Settings.cpp +++ b/src/daemon/Settings.cpp @@ -52,7 +52,7 @@ static map_string_t s_mapSectionCron; bool g_settings_bOpenGPGCheck = false; /* one line: "OpenGPGPublicKeys = value1,value2" */ GList *g_settings_setOpenGPGPublicKeys = NULL; -set_string_t g_settings_setBlackListedPkgs; +GList *g_settings_setBlackListedPkgs = NULL; set_string_t g_settings_setBlackListedPaths; std::string g_settings_sDatabase; std::string g_settings_sWatchCrashdumpArchiveDir; @@ -73,6 +73,31 @@ map_cron_t g_settings_mapCron; * Loading */ +static GList *parse_list(const char* list) +{ + struct strbuf *item = strbuf_new(); + GList *l = NULL; + + for (unsigned ii = 0; list[ii]; ii++) + { + if (list[ii] == ',') + { + l = g_list_append(l, xstrdup(item->buf)); + strbuf_clear(item); + } + else + strbuf_append_char(item, list[ii]); + } + + if (item->len > 0) + l = g_list_append(l, xstrdup(item->buf)); + + strbuf_free(item); + return l; +} + + +// function will be removed static set_string_t ParseList(const char* pList) { unsigned ii; @@ -203,7 +228,7 @@ static int ParseCommon() it = s_mapSectionCommon.find("BlackList"); if (it != end) { - g_settings_setBlackListedPkgs = ParseList(it->second.c_str()); + g_settings_setBlackListedPkgs = parse_list(it->second.c_str()); } it = s_mapSectionCommon.find("BlackListedPaths"); if (it != end) @@ -567,4 +592,8 @@ void settings_free() g_list_free(g_settings_setOpenGPGPublicKeys); + for (GList *li = g_settings_setBlackListedPkgs; li != NULL; li = g_list_next(li)) + free((char*)li->data); + + g_list_free(g_settings_setBlackListedPkgs); } diff --git a/src/daemon/Settings.h b/src/daemon/Settings.h index 2a920204..6c137e67 100644 --- a/src/daemon/Settings.h +++ b/src/daemon/Settings.h @@ -27,7 +27,7 @@ typedef map_vector_pair_string_string_t map_cron_t; typedef map_map_string_t map_abrt_settings_t; extern GList *g_settings_setOpenGPGPublicKeys; -extern set_string_t g_settings_setBlackListedPkgs; +extern GList *g_settings_setBlackListedPkgs; extern set_string_t g_settings_setBlackListedPaths; extern unsigned int g_settings_nMaxCrashReportsSize; extern bool g_settings_bOpenGPGCheck; diff --git a/src/daemon/abrt-action-save-package-data.cpp b/src/daemon/abrt-action-save-package-data.cpp index 039fa24a..7a8b45ba 100644 --- a/src/daemon/abrt-action-save-package-data.cpp +++ b/src/daemon/abrt-action-save-package-data.cpp @@ -197,11 +197,15 @@ static int SavePackageDescriptionToDebugDump(const char *dump_dir_name) package_short_name = get_package_name_from_NVR_or_NULL(package_full_name); VERB2 log("Package:'%s' short:'%s'", package_full_name, package_short_name); - if (g_settings_setBlackListedPkgs.find(package_short_name) != g_settings_setBlackListedPkgs.end()) + for (GList *li = g_settings_setBlackListedPkgs; li != NULL; li = g_list_next(li)) { - log("Blacklisted package '%s'", package_short_name); - goto ret; /* return 1 (failure) */ + if (strcmp((char*)li->data, package_short_name) == 0) + { + log("Blacklisted package '%s'", package_short_name); + goto ret; /* return 1 (failure) */ + } } + if (g_settings_bOpenGPGCheck && !remote) { if (rpm_chk_fingerprint(package_short_name)) |
