X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=onak-conf.c;h=c30260fd6318cbb2d47d5792fe34a8adbf9f0943;hb=3512fa56e404e5dc2e3a6a3ca6fa23eb25760493;hp=5b84e5acdac9e271a1cae7733f75015b9aa9a2c5;hpb=0c120d1895d25b59abe338862189be1b87447569;p=onak.git diff --git a/onak-conf.c b/onak-conf.c index 5b84e5a..c30260f 100644 --- a/onak-conf.c +++ b/onak-conf.c @@ -13,23 +13,24 @@ * 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. + * this program. If not, see . */ - -#include "config.h" - #include #include #include #include #include +#include "build-config.h" + +#include "cleankey.h" #include "ll.h" #include "log.h" #include "onak-conf.h" +#ifdef DBINIT extern struct onak_dbctx *DBINIT(struct onak_db_config *dbcfg, bool readonly); +#endif /* * config - Runtime configuration for onak. @@ -51,9 +52,13 @@ struct onak_config config = { .backends = NULL, .backends_dir = NULL, +#ifdef DBINIT .dbinit = DBINIT, +#else + .dbinit = NULL, +#endif - .check_sighash = true, + .clean_policies = ONAK_CLEAN_CHECK_SIGHASH, .bin_dir = NULL, .mail_dir = NULL, @@ -170,8 +175,14 @@ static bool parseoldconfigline(char *line) } else if (!strncmp("sock_dir ", line, 9)) { config.sock_dir = strdup(&line[9]); } else if (!strncmp("check_sighash ", line, 9)) { - config.check_sighash = parsebool(&line[9], - config.check_sighash); + if (parsebool(&line[9], config.clean_policies & + ONAK_CLEAN_CHECK_SIGHASH)) { + config.clean_policies |= + ONAK_CLEAN_CHECK_SIGHASH; + } else { + config.clean_policies &= + ~ONAK_CLEAN_CHECK_SIGHASH; + } } else { return false; } @@ -274,8 +285,23 @@ static bool parseconfigline(char *line) strdup(value)); /* [verification] section */ } else if (MATCH("verification", "check_sighash")) { - config.check_sighash = parsebool(value, - config.check_sighash); + if (parsebool(value, config.clean_policies & + ONAK_CLEAN_CHECK_SIGHASH)) { + config.clean_policies |= + ONAK_CLEAN_CHECK_SIGHASH; + } else { + config.clean_policies &= + ~ONAK_CLEAN_CHECK_SIGHASH; + } + } else if (MATCH("verification", "check_packet_size")) { + if (parsebool(value, config.clean_policies & + ONAK_CLEAN_LARGE_PACKETS)) { + config.clean_policies |= + ONAK_CLEAN_LARGE_PACKETS; + } else { + config.clean_policies &= + ~ONAK_CLEAN_LARGE_PACKETS; + } } else { return false; } @@ -449,7 +475,8 @@ void writeconfig(const char *configfile) fprintf(conffile, "\n"); fprintf(conffile, "[verification]\n"); - WRITE_BOOL(config.check_sighash, "check_sighash"); + WRITE_BOOL(config.clean_policies & ONAK_CLEAN_CHECK_SIGHASH, + "check_sighash"); fprintf(conffile, "\n"); fprintf(conffile, "[mail]\n");