From 0274b29916883efac50e0961c0a3b49ce8a11f1f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 20 Apr 2011 18:23:56 +0200 Subject: delete ugly parse_conf(), use load_abrt_conf() instead Therefore moved abrt_conf.* to libreport Signed-off-by: Denys Vlasenko --- src/daemon/CommLayerServerDBus.c | 1 - src/daemon/Makefile.am | 2 - src/daemon/MiddleWare.c | 1 - src/daemon/abrt-action-save-package-data.c | 1 - src/daemon/abrt-server.c | 14 ++- src/daemon/abrt_conf.c | 167 ----------------------------- src/daemon/abrt_conf.h | 43 -------- src/daemon/abrtd.c | 2 +- src/hooks/CCpp.conf | 10 ++ src/hooks/Makefile.am | 5 + src/hooks/abrt-hook-ccpp.c | 35 ++++-- src/include/abrtlib.h | 1 + src/lib/Makefile.am | 1 + src/lib/abrt_conf.c | 166 ++++++++++++++++++++++++++++ src/lib/abrt_conf.h | 50 +++++++++ src/lib/hash_sha1.h | 4 + src/lib/hooklib.c | 72 ------------- src/lib/hooklib.h | 10 +- src/plugins/CCpp.conf | 37 ------- src/plugins/Makefile.am | 1 - 20 files changed, 277 insertions(+), 346 deletions(-) delete mode 100644 src/daemon/abrt_conf.c delete mode 100644 src/daemon/abrt_conf.h create mode 100644 src/hooks/CCpp.conf create mode 100644 src/lib/abrt_conf.c create mode 100644 src/lib/abrt_conf.h delete mode 100644 src/plugins/CCpp.conf diff --git a/src/daemon/CommLayerServerDBus.c b/src/daemon/CommLayerServerDBus.c index dd03d989..05f7df92 100644 --- a/src/daemon/CommLayerServerDBus.c +++ b/src/daemon/CommLayerServerDBus.c @@ -21,7 +21,6 @@ #include "abrt_dbus.h" #include "comm_layer_inner.h" #include "MiddleWare.h" -#include "abrt_conf.h" #include "CommLayerServerDBus.h" /* diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index f57f85ff..6bb71b78 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -12,7 +12,6 @@ sbin_PROGRAMS = \ abrtd_SOURCES = \ MiddleWare.h MiddleWare.c \ CommLayerServerDBus.h CommLayerServerDBus.c \ - abrt_conf.h abrt_conf.c \ comm_layer_inner.h comm_layer_inner.c \ abrtd.c abrtd_CPPFLAGS = \ @@ -75,7 +74,6 @@ abrt_handle_crashdump_LDADD = \ abrt_action_save_package_data_SOURCES = \ rpm.h rpm.c \ - abrt_conf.h abrt_conf.c \ abrt-action-save-package-data.c abrt_action_save_package_data_CPPFLAGS = \ -I$(srcdir)/../include/report -I$(srcdir)/../include \ diff --git a/src/daemon/MiddleWare.c b/src/daemon/MiddleWare.c index d337668f..fb943b1c 100644 --- a/src/daemon/MiddleWare.c +++ b/src/daemon/MiddleWare.c @@ -19,7 +19,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "abrtlib.h" -#include "abrt_conf.h" #include "comm_layer_inner.h" #include "CommLayerServerDBus.h" #include "MiddleWare.h" diff --git a/src/daemon/abrt-action-save-package-data.c b/src/daemon/abrt-action-save-package-data.c index af63ff2b..93350994 100644 --- a/src/daemon/abrt-action-save-package-data.c +++ b/src/daemon/abrt-action-save-package-data.c @@ -18,7 +18,6 @@ */ #include #include "abrtlib.h" -#include "abrt_conf.h" #include "rpm.h" #include "parse_options.h" diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c index 4626d5de..53bb5fba 100644 --- a/src/daemon/abrt-server.c +++ b/src/daemon/abrt-server.c @@ -147,12 +147,16 @@ static void create_debug_dump() log("Saved %s crash dump of pid %u to %s", analyzer, pid, path); /* Trim old crash dumps if necessary */ - unsigned maxCrashReportsSize = 0; - parse_conf(NULL, &maxCrashReportsSize, NULL, NULL); - if (maxCrashReportsSize > 0) + load_abrt_conf(); + free_abrt_conf_data(); /* can do this because we need only g_settings_nMaxCrashReportsSize */ + /* x1.25: go a bit up, so that usual in-daemon trimming + * kicks in first, and we don't "fight" with it: + */ + g_settings_nMaxCrashReportsSize += g_settings_nMaxCrashReportsSize / 4; + if (g_settings_nMaxCrashReportsSize > 0) { - check_free_space(maxCrashReportsSize); - trim_debug_dumps(DEBUG_DUMPS_DIR, maxCrashReportsSize * (double)(1024*1024), path); + check_free_space(g_settings_nMaxCrashReportsSize); + trim_debug_dumps(DEBUG_DUMPS_DIR, g_settings_nMaxCrashReportsSize * (double)(1024*1024), path); } free(path); diff --git a/src/daemon/abrt_conf.c b/src/daemon/abrt_conf.c deleted file mode 100644 index 46d8f44c..00000000 --- a/src/daemon/abrt_conf.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 RedHat Inc - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include "abrtlib.h" -#include "abrt_conf.h" - -bool g_settings_bOpenGPGCheck = false; -GList * g_settings_setOpenGPGPublicKeys = NULL; -GList * g_settings_setBlackListedPkgs = NULL; -GList * g_settings_setBlackListedPaths = NULL; -char * g_settings_sWatchCrashdumpArchiveDir = NULL; -unsigned int g_settings_nMaxCrashReportsSize = 1000; -bool g_settings_bProcessUnpackaged = false; - - -void free_abrt_conf_data() -{ - list_free_with_free(g_settings_setOpenGPGPublicKeys); - g_settings_setOpenGPGPublicKeys = NULL; - - list_free_with_free(g_settings_setBlackListedPkgs); - g_settings_setBlackListedPkgs = NULL; - - list_free_with_free(g_settings_setBlackListedPaths); - g_settings_setBlackListedPaths = NULL; - - free(g_settings_sWatchCrashdumpArchiveDir); - g_settings_sWatchCrashdumpArchiveDir = NULL; -} - -static GList *parse_list(const char* list) -{ - struct strbuf *item = strbuf_new(); - GList *l = NULL; - - char *trim_item = NULL; - - for (unsigned ii = 0; list[ii]; ii++) - { - if (list[ii] == ',') - { - trim_item = strtrim(item->buf); - l = g_list_append(l, xstrdup(trim_item)); - strbuf_clear(item); - } - else - strbuf_append_char(item, list[ii]); - } - - if (item->len > 0) - { - trim_item = strtrim(item->buf); - l = g_list_append(l, xstrdup(trim_item)); - } - - strbuf_free(item); - - return l; -} - -static void ParseCommon(map_string_h *settings, const char *conf_filename) -{ - char *value; - - value = g_hash_table_lookup(settings, "OpenGPGCheck"); - if (value) - { - g_settings_bOpenGPGCheck = string_to_bool(value); - g_hash_table_remove(settings, "OpenGPGCheck"); - } - - value = g_hash_table_lookup(settings, "BlackList"); - if (value) - { - g_settings_setBlackListedPkgs = parse_list(value); - g_hash_table_remove(settings, "BlackList"); - } - - value = g_hash_table_lookup(settings, "BlackListedPaths"); - if (value) - { - g_settings_setBlackListedPaths = parse_list(value); - g_hash_table_remove(settings, "BlackListedPaths"); - } - - value = g_hash_table_lookup(settings, "WatchCrashdumpArchiveDir"); - if (value) - { - g_settings_sWatchCrashdumpArchiveDir = xstrdup(value); - g_hash_table_remove(settings, "WatchCrashdumpArchiveDir"); - } - - value = g_hash_table_lookup(settings, "MaxCrashReportsSize"); - if (value) - { -//FIXME: dont die - g_settings_nMaxCrashReportsSize = xatoi_positive(value); - g_hash_table_remove(settings, "MaxCrashReportsSize"); - } - - value = g_hash_table_lookup(settings, "ProcessUnpackaged"); - if (value) - { - g_settings_bProcessUnpackaged = string_to_bool(value); - g_hash_table_remove(settings, "ProcessUnpackaged"); - } - - GHashTableIter iter; - char *name; - /*char *value; - already declared */ - g_hash_table_iter_init(&iter, settings); - while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value)) - { - error_msg("Unrecognized variable '%s' in '%s'", name, conf_filename); - } -} - -static void LoadGPGKeys() -{ - FILE *fp = fopen(CONF_DIR"/gpg_keys", "r"); - if (fp) - { - /* every line is one key - * FIXME: make it more robust, it doesn't handle comments - */ - char *line; - while ((line = xmalloc_fgetline(fp)) != NULL) - { - if (line[0] == '/') // probably the beginning of a path, so let's handle it as a key - g_settings_setOpenGPGPublicKeys = g_list_append(g_settings_setOpenGPGPublicKeys, line); - else - free(line); - } - fclose(fp); - } -} - -int load_abrt_conf() -{ - free_abrt_conf_data(); - - map_string_h *settings = new_map_string(); - if (!load_conf_file(CONF_DIR"/abrt.conf", settings, /*skip key w/o values:*/ false)) - error_msg("Can't open '%s'", CONF_DIR"/abrt.conf"); - - ParseCommon(settings, CONF_DIR"/abrt.conf"); - free_map_string(settings); - - LoadGPGKeys(); - - return 0; -} diff --git a/src/daemon/abrt_conf.h b/src/daemon/abrt_conf.h deleted file mode 100644 index 2208e13a..00000000 --- a/src/daemon/abrt_conf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 RedHat Inc - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef SETTINGS_H_ -#define SETTINGS_H_ - -#include "abrt_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern GList * g_settings_setOpenGPGPublicKeys; -extern GList * g_settings_setBlackListedPkgs; -extern GList * g_settings_setBlackListedPaths; -extern unsigned int g_settings_nMaxCrashReportsSize; -extern bool g_settings_bOpenGPGCheck; -extern bool g_settings_bProcessUnpackaged; -extern char * g_settings_sWatchCrashdumpArchiveDir; - -int load_abrt_conf(); -void free_abrt_conf_data(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c index 08c95f21..d18265f4 100644 --- a/src/daemon/abrtd.c +++ b/src/daemon/abrtd.c @@ -23,9 +23,9 @@ #include #include #include /* ioctl(FIONREAD) */ + #include "abrtlib.h" #include "comm_layer_inner.h" -#include "abrt_conf.h" #include "CommLayerServerDBus.h" #include "MiddleWare.h" #include "parse_options.h" diff --git a/src/hooks/CCpp.conf b/src/hooks/CCpp.conf new file mode 100644 index 00000000..a431c0c3 --- /dev/null +++ b/src/hooks/CCpp.conf @@ -0,0 +1,10 @@ +# Configuration file for CCpp hook +Enabled = yes + +# If you also want to dump file named "core" +# in crashed process' current dir, set to "yes" +MakeCompatCore = yes + +# Do you want a copy of crashed binary be saved? +# (useful, for example, when _deleted binary_ segfaults) +SaveBinaryImage = no diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am index 66951f0f..cae22726 100644 --- a/src/hooks/Makefile.am +++ b/src/hooks/Makefile.am @@ -1,3 +1,8 @@ +pluginsconfdir = $(PLUGINS_CONF_DIR) + +dist_pluginsconf_DATA = \ + CCpp.conf + libexec_PROGRAMS = abrt-hook-ccpp # abrt-hook-ccpp diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c index d13851f3..84bbf4fa 100644 --- a/src/hooks/abrt-hook-ccpp.c +++ b/src/hooks/abrt-hook-ccpp.c @@ -390,11 +390,27 @@ int main(int argc, char** argv) char *user_pwd = get_cwd(pid); /* may be NULL on error */ - /* Parse abrt.conf and plugins/CCpp.conf */ - unsigned setting_MaxCrashReportsSize = 0; - bool setting_MakeCompatCore = false; - bool setting_SaveBinaryImage = false; - parse_conf(PLUGINS_CONF_DIR"/CCpp.conf", &setting_MaxCrashReportsSize, &setting_MakeCompatCore, &setting_SaveBinaryImage); + /* Parse abrt.conf */ + load_abrt_conf(); + free_abrt_conf_data(); /* can do this because we need only g_settings_nMaxCrashReportsSize */ + /* x1.25: go a bit up, so that usual in-daemon trimming + * kicks in first, and we don't "fight" with it: + */ + g_settings_nMaxCrashReportsSize += g_settings_nMaxCrashReportsSize / 4; + /* ... and plugins/CCpp.conf */ + bool setting_MakeCompatCore; + bool setting_SaveBinaryImage; + { + map_string_h *settings = new_map_string(); + load_conf_file(PLUGINS_CONF_DIR"/CCpp.conf", settings, /*skip key w/o values:*/ false); + char *value; + value = g_hash_table_lookup(settings, "MakeCompatCore"); + setting_MakeCompatCore = value && string_to_bool(value); + value = g_hash_table_lookup(settings, "SaveBinaryImage"); + setting_SaveBinaryImage = value && string_to_bool(value); + free_map_string(settings); + } + if (!setting_SaveBinaryImage && src_fd_binary >= 0) { close(src_fd_binary); @@ -441,9 +457,10 @@ int main(int argc, char** argv) goto create_user_core; } - if (setting_MaxCrashReportsSize > 0) + if (g_settings_nMaxCrashReportsSize > 0) { - check_free_space(setting_MaxCrashReportsSize); + g_settings_nMaxCrashReportsSize += g_settings_nMaxCrashReportsSize / 4; + check_free_space(g_settings_nMaxCrashReportsSize); } char path[PATH_MAX]; @@ -628,9 +645,9 @@ int main(int argc, char** argv) free(newpath); /* rhbz#539551: "abrt going crazy when crashing process is respawned" */ - if (setting_MaxCrashReportsSize > 0) + if (g_settings_nMaxCrashReportsSize > 0) { - trim_debug_dumps(DEBUG_DUMPS_DIR, setting_MaxCrashReportsSize * (double)(1024*1024), path); + trim_debug_dumps(DEBUG_DUMPS_DIR, g_settings_nMaxCrashReportsSize * (double)(1024*1024), path); } return 0; diff --git a/src/include/abrtlib.h b/src/include/abrtlib.h index e0014593..6d9337d5 100644 --- a/src/include/abrtlib.h +++ b/src/include/abrtlib.h @@ -83,6 +83,7 @@ int vdprintf(int d, const char *format, va_list ap); #include "hooklib.h" #include "run_event.h" #include "event_config.h" +#include "abrt_conf.h" #ifdef __cplusplus diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index d2dc9cae..decfeffd 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -42,6 +42,7 @@ libreport_la_SOURCES = \ hooklib.c hooklib.h \ parse_release.c \ parse_options.c parse_options.h \ + abrt_conf.c abrt_conf.h \ steal_directory.c \ event_xml_parser.c \ event_config.c diff --git a/src/lib/abrt_conf.c b/src/lib/abrt_conf.c new file mode 100644 index 00000000..2a1cf369 --- /dev/null +++ b/src/lib/abrt_conf.c @@ -0,0 +1,166 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include "abrtlib.h" + +bool g_settings_bOpenGPGCheck = false; +GList * g_settings_setOpenGPGPublicKeys = NULL; +GList * g_settings_setBlackListedPkgs = NULL; +GList * g_settings_setBlackListedPaths = NULL; +char * g_settings_sWatchCrashdumpArchiveDir = NULL; +unsigned int g_settings_nMaxCrashReportsSize = 1000; +bool g_settings_bProcessUnpackaged = false; + + +void free_abrt_conf_data() +{ + list_free_with_free(g_settings_setOpenGPGPublicKeys); + g_settings_setOpenGPGPublicKeys = NULL; + + list_free_with_free(g_settings_setBlackListedPkgs); + g_settings_setBlackListedPkgs = NULL; + + list_free_with_free(g_settings_setBlackListedPaths); + g_settings_setBlackListedPaths = NULL; + + free(g_settings_sWatchCrashdumpArchiveDir); + g_settings_sWatchCrashdumpArchiveDir = NULL; +} + +static GList *parse_list(const char* list) +{ + struct strbuf *item = strbuf_new(); + GList *l = NULL; + + char *trim_item = NULL; + + for (unsigned ii = 0; list[ii]; ii++) + { + if (list[ii] == ',') + { + trim_item = strtrim(item->buf); + l = g_list_append(l, xstrdup(trim_item)); + strbuf_clear(item); + } + else + strbuf_append_char(item, list[ii]); + } + + if (item->len > 0) + { + trim_item = strtrim(item->buf); + l = g_list_append(l, xstrdup(trim_item)); + } + + strbuf_free(item); + + return l; +} + +static void ParseCommon(map_string_h *settings, const char *conf_filename) +{ + char *value; + + value = g_hash_table_lookup(settings, "OpenGPGCheck"); + if (value) + { + g_settings_bOpenGPGCheck = string_to_bool(value); + g_hash_table_remove(settings, "OpenGPGCheck"); + } + + value = g_hash_table_lookup(settings, "BlackList"); + if (value) + { + g_settings_setBlackListedPkgs = parse_list(value); + g_hash_table_remove(settings, "BlackList"); + } + + value = g_hash_table_lookup(settings, "BlackListedPaths"); + if (value) + { + g_settings_setBlackListedPaths = parse_list(value); + g_hash_table_remove(settings, "BlackListedPaths"); + } + + value = g_hash_table_lookup(settings, "WatchCrashdumpArchiveDir"); + if (value) + { + g_settings_sWatchCrashdumpArchiveDir = xstrdup(value); + g_hash_table_remove(settings, "WatchCrashdumpArchiveDir"); + } + + value = g_hash_table_lookup(settings, "MaxCrashReportsSize"); + if (value) + { +//FIXME: dont die + g_settings_nMaxCrashReportsSize = xatoi_positive(value); + g_hash_table_remove(settings, "MaxCrashReportsSize"); + } + + value = g_hash_table_lookup(settings, "ProcessUnpackaged"); + if (value) + { + g_settings_bProcessUnpackaged = string_to_bool(value); + g_hash_table_remove(settings, "ProcessUnpackaged"); + } + + GHashTableIter iter; + char *name; + /*char *value; - already declared */ + g_hash_table_iter_init(&iter, settings); + while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value)) + { + error_msg("Unrecognized variable '%s' in '%s'", name, conf_filename); + } +} + +static void LoadGPGKeys() +{ + FILE *fp = fopen(CONF_DIR"/gpg_keys", "r"); + if (fp) + { + /* every line is one key + * FIXME: make it more robust, it doesn't handle comments + */ + char *line; + while ((line = xmalloc_fgetline(fp)) != NULL) + { + if (line[0] == '/') // probably the beginning of a path, so let's handle it as a key + g_settings_setOpenGPGPublicKeys = g_list_append(g_settings_setOpenGPGPublicKeys, line); + else + free(line); + } + fclose(fp); + } +} + +int load_abrt_conf() +{ + free_abrt_conf_data(); + + map_string_h *settings = new_map_string(); + if (!load_conf_file(CONF_DIR"/abrt.conf", settings, /*skip key w/o values:*/ false)) + error_msg("Can't open '%s'", CONF_DIR"/abrt.conf"); + + ParseCommon(settings, CONF_DIR"/abrt.conf"); + free_map_string(settings); + + LoadGPGKeys(); + + return 0; +} diff --git a/src/lib/abrt_conf.h b/src/lib/abrt_conf.h new file mode 100644 index 00000000..2ca7542b --- /dev/null +++ b/src/lib/abrt_conf.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#ifndef ABRT_CONF_H_ +#define ABRT_CONF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g_settings_setOpenGPGPublicKeys abrt_g_settings_setOpenGPGPublicKeys +extern GList * g_settings_setOpenGPGPublicKeys; +#define g_settings_setBlackListedPkgs abrt_g_settings_setBlackListedPkgs +extern GList * g_settings_setBlackListedPkgs; +#define g_settings_setBlackListedPaths abrt_g_settings_setBlackListedPaths +extern GList * g_settings_setBlackListedPaths; +#define g_settings_nMaxCrashReportsSize abrt_g_settings_nMaxCrashReportsSize +extern unsigned int g_settings_nMaxCrashReportsSize; +#define g_settings_bOpenGPGCheck abrt_g_settings_bOpenGPGCheck +extern bool g_settings_bOpenGPGCheck; +#define g_settings_bProcessUnpackaged abrt_g_settings_bProcessUnpackaged +extern bool g_settings_bProcessUnpackaged; +#define g_settings_sWatchCrashdumpArchiveDir abrt_g_settings_sWatchCrashdumpArchiveDir +extern char * g_settings_sWatchCrashdumpArchiveDir; + +#define load_abrt_conf abrt_load_abrt_conf +int load_abrt_conf(); +#define free_abrt_conf_data abrt_free_abrt_conf_data +void free_abrt_conf_data(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/hash_sha1.h b/src/lib/hash_sha1.h index 2b6b7606..850fd21f 100644 --- a/src/lib/hash_sha1.h +++ b/src/lib/hash_sha1.h @@ -17,6 +17,8 @@ * * --------------------------------------------------------------------------- */ +#ifndef HASH_SHA1_H +#define HASH_SHA1_H 1 #ifdef __cplusplus extern "C" { @@ -41,3 +43,5 @@ void sha1_end(sha1_ctx_t *ctx, void *resbuf); #ifdef __cplusplus } #endif + +#endif diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c index fd7ecc9a..3bde4dfa 100644 --- a/src/lib/hooklib.c +++ b/src/lib/hooklib.c @@ -19,78 +19,6 @@ #include "hooklib.h" #include -void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool *setting_MakeCompatCore, bool *setting_SaveBinaryImage) -{ - FILE *fp = fopen(CONF_DIR"/abrt.conf", "r"); - if (!fp) - return; - - while (1) - { - char *line = xmalloc_fgetline(fp); - if (!line) - { - fclose(fp); - if (additional_conf) - { - /* Next .conf file plz */ - fp = fopen(additional_conf, "r"); - if (fp) - { - additional_conf = NULL; - continue; - } - } - break; - } - - const char *p = skip_whitespace(line); -#undef DIRECTIVE -#define DIRECTIVE "MaxCrashReportsSize" - if (setting_MaxCrashReportsSize && strncmp(p, DIRECTIVE, sizeof(DIRECTIVE)-1) == 0) - { - p = skip_whitespace(p + sizeof(DIRECTIVE)-1); - if (*p != '=') - goto free_line; - p = skip_whitespace(p + 1); - if (isdigit(*p)) - { - /* x1.25: go a bit up, so that usual in-daemon trimming - * kicks in first, and we don't "fight" with it. */ - *setting_MaxCrashReportsSize = (unsigned long)xatou(p) * 5 / 4; - } - goto free_line; - } -#undef DIRECTIVE -#define DIRECTIVE "MakeCompatCore" - if (setting_MakeCompatCore && strncmp(p, DIRECTIVE, sizeof(DIRECTIVE)-1) == 0) - { - p = skip_whitespace(p + sizeof(DIRECTIVE)-1); - if (*p != '=') - goto free_line; - p = skip_whitespace(p + 1); - *setting_MakeCompatCore = string_to_bool(p); - goto free_line; - } -#undef DIRECTIVE -#define DIRECTIVE "SaveBinaryImage" - if (setting_SaveBinaryImage && strncmp(p, DIRECTIVE, sizeof(DIRECTIVE)-1) == 0) - { - p = skip_whitespace(p + sizeof(DIRECTIVE)-1); - if (*p != '=') - goto free_line; - p = skip_whitespace(p + 1); - *setting_SaveBinaryImage = string_to_bool(p); - goto free_line; - } -#undef DIRECTIVE - /* add more 'if (strncmp(p, DIRECTIVE, sizeof(DIRECTIVE)-1) == 0)' here... */ - - free_line: - free(line); - } -} - void check_free_space(unsigned setting_MaxCrashReportsSize) { struct statvfs vfs; diff --git a/src/lib/hooklib.h b/src/lib/hooklib.h index a7421e06..c140f951 100644 --- a/src/lib/hooklib.h +++ b/src/lib/hooklib.h @@ -15,17 +15,13 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef HOOKLIB_H +#define HOOKLIB_H 1 #ifdef __cplusplus extern "C" { #endif -#define parse_conf abrt_parse_conf -void parse_conf(const char *additional_conf, - unsigned *setting_MaxCrashReportsSize, - bool *setting_MakeCompatCore, - bool *setting_SaveBinaryImage); - #define check_free_space abrt_check_free_space void check_free_space(unsigned setting_MaxCrashReportsSize); @@ -35,3 +31,5 @@ void trim_debug_dumps(const char *dirname, double cap_size, const char *exclude_ #ifdef __cplusplus } #endif + +#endif diff --git a/src/plugins/CCpp.conf b/src/plugins/CCpp.conf deleted file mode 100644 index bf66d86f..00000000 --- a/src/plugins/CCpp.conf +++ /dev/null @@ -1,37 +0,0 @@ -# Configuration file for CCpp hook and plugin -Enabled = yes - -# If you also want to dump file named "core" -# in crashed process' current dir, set to "yes" -MakeCompatCore = yes - -# Do you want a copy of crashed binary be saved? -# (useful, for example, when _deleted binary_ segfaults) -SaveBinaryImage = no - -# Generate backtrace -Backtrace = yes -# How long to wait for gdb to finish. Default is 60 seconds. -GdbTimeoutSec = 120 - -# Generate backtrace for crashes uploaded from remote machines. -# Note that for reliable backtrace generation, your local machine -# needs to have the crashed executable and all libraries it uses, -# and they need to be the same versions as on remote machines. -# If you cannot ensure that, it's better to set this option to "no" -BacktraceRemotes = no - -# How to get debuginfo: install, mount -## install - download and install debuginfo packages -## mount - mount fedora NFS with debug info -## (IGNORED FOR NOW) -DebugInfo = install - -# If this option is set to "yes", -# debuginfos will be installed to @@LOCALSTATEDIR@@/cache/abrt-di -InstallDebugInfo = yes - -# Additional directories to search for debuginfos. -# For example, you can list a network-mounted shared store -# of all debuginfos here. -# ReadonlyLocalDebugInfoDirs = /path1:/path2:... diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index deec8e8e..00be78fd 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -25,7 +25,6 @@ bin_PROGRAMS = \ pluginsconfdir = $(PLUGINS_CONF_DIR) dist_pluginsconf_DATA = \ - CCpp.conf \ Python.conf \ Kerneloops.conf \ Bugzilla.conf \ -- cgit