Overview
Comment: | it compiles and links properly. I don't guarantee ANYTHING else. This is a very major change - I have removed dotconf and am replacing with libconfig. Also did some cleanup along with it. Some parts are messy. I hope it's functional. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9a13922db2c0751727556b9aa6f59598 |
User & Date: | rmiller on 2011-03-06 01:57:33 |
Other Links: | manifest | tags |
Context
2011-03-06
| ||
02:10 | This fixes a few segfaults with an empty config file. It's, of course, *useless* with an empty config file, but that's for testing at a later time. check-in: 5396b2b79c user: rmiller tags: trunk | |
01:57 | it compiles and links properly. I don't guarantee ANYTHING else. This is a very major change - I have removed dotconf and am replacing with libconfig. Also did some cleanup along with it. Some parts are messy. I hope it's functional. check-in: 9a13922db2 user: rmiller tags: trunk | |
2011-03-01
| ||
22:34 | Move a bunch of includes to packetbl.h, and also fix what appears to be a small signing problem (THIS one doesn't break anything) check-in: 50168f46c0 user: rmiller tags: trunk | |
Changes
Modified autom4te.cache/output.0 from [cd3458412f] to [c36152d6d3].
︙ | ︙ | |||
3874 3875 3876 3877 3878 3879 3880 | _ACEOF fi done | | | | | | | | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 | _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for config_init in -lconfig" >&5 $as_echo_n "checking for config_init in -lconfig... " >&6; } if test "${ac_cv_lib_config_config_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lconfig $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char config_init (); int main () { return config_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_config_config_init=yes else ac_cv_lib_config_config_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5 $as_echo "$ac_cv_lib_config_config_init" >&6; } if test "x$ac_cv_lib_config_config_init" = x""yes; then : $as_echo "@%:@define HAVE_LIBCONFIG /**/" >>confdefs.h LIBS="$LIBS -lconfig" else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "You must have libconfig See \`config.log' for more details" "$LINENO" 5; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfq_set_verdict in -lnetfilter_queue" >&5 $as_echo_n "checking for nfq_set_verdict in -lnetfilter_queue... " >&6; } |
︙ | ︙ |
Modified autom4te.cache/traces.0 from [af22284bcc] to [bad0bba9bc].
︙ | ︙ | |||
384 385 386 387 388 389 390 | @%:@undef HAVE_STRINGS_H]) m4trace:configure.in:47: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */ @%:@undef HAVE_INTTYPES_H]) m4trace:configure.in:47: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */ @%:@undef HAVE_STDINT_H]) m4trace:configure.in:47: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */ @%:@undef HAVE_UNISTD_H]) | | | | | | | < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | @%:@undef HAVE_STRINGS_H]) m4trace:configure.in:47: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */ @%:@undef HAVE_INTTYPES_H]) m4trace:configure.in:47: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */ @%:@undef HAVE_STDINT_H]) m4trace:configure.in:47: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */ @%:@undef HAVE_UNISTD_H]) m4trace:configure.in:49: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBCONFIG]) m4trace:configure.in:49: -1- m4_pattern_allow([^HAVE_LIBCONFIG$]) m4trace:configure.in:49: -1- AH_OUTPUT([HAVE_LIBCONFIG], [/* Enable if you have the required libconfig library. */ @%:@undef HAVE_LIBCONFIG]) m4trace:configure.in:56: -1- AC_DEFINE_TRACE_LITERAL([HAVE_NFQUEUE]) m4trace:configure.in:56: -1- m4_pattern_allow([^HAVE_NFQUEUE$]) m4trace:configure.in:56: -1- AH_OUTPUT([HAVE_NFQUEUE], [/* Enable if you have nfqueue */ @%:@undef HAVE_NFQUEUE]) m4trace:configure.in:66: -1- AC_DEFINE_TRACE_LITERAL([HAVE_NFNETLINK]) m4trace:configure.in:66: -1- m4_pattern_allow([^HAVE_NFNETLINK$]) m4trace:configure.in:66: -1- AH_OUTPUT([HAVE_NFNETLINK], [/* Enable if netlink exists */ @%:@undef HAVE_NFNETLINK]) m4trace:configure.in:79: -1- AC_DEFINE_TRACE_LITERAL([HAVE_FIREDNS]) m4trace:configure.in:79: -1- m4_pattern_allow([^HAVE_FIREDNS$]) m4trace:configure.in:79: -1- AH_OUTPUT([HAVE_FIREDNS], [/* Enable if you have the optional firedns library */ @%:@undef HAVE_FIREDNS]) m4trace:configure.in:92: -1- AC_DEFINE_TRACE_LITERAL([USE_CACHE]) m4trace:configure.in:92: -1- m4_pattern_allow([^USE_CACHE$]) m4trace:configure.in:92: -1- AH_OUTPUT([USE_CACHE], [/* Enable if you want to use a caching mechanism. */ @%:@undef USE_CACHE]) m4trace:configure.in:97: -1- AC_CONFIG_FILES([Makefile]) m4trace:configure.in:98: -1- AC_CONFIG_HEADERS([config.h]) m4trace:configure.in:99: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) m4trace:configure.in:99: -1- m4_pattern_allow([^LIB@&t@OBJS$]) m4trace:configure.in:99: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([LTLIBOBJS]) m4trace:configure.in:99: -1- m4_pattern_allow([^LTLIBOBJS$]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([top_builddir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([top_build_prefix]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([srcdir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([abs_srcdir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([top_srcdir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([abs_top_srcdir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([builddir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([abs_builddir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([abs_top_builddir]) m4trace:configure.in:99: -1- AC_SUBST_TRACE([INSTALL]) |
Modified configure from [5a5437a7aa] to [568f3e906e].
︙ | ︙ | |||
3874 3875 3876 3877 3878 3879 3880 | _ACEOF fi done | | | | | | | | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 | _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for config_init in -lconfig" >&5 $as_echo_n "checking for config_init in -lconfig... " >&6; } if test "${ac_cv_lib_config_config_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lconfig $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char config_init (); int main () { return config_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_config_config_init=yes else ac_cv_lib_config_config_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5 $as_echo "$ac_cv_lib_config_config_init" >&6; } if test "x$ac_cv_lib_config_config_init" = x""yes; then : $as_echo "#define HAVE_LIBCONFIG /**/" >>confdefs.h LIBS="$LIBS -lconfig" else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "You must have libconfig See \`config.log' for more details" "$LINENO" 5; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfq_set_verdict in -lnetfilter_queue" >&5 $as_echo_n "checking for nfq_set_verdict in -lnetfilter_queue... " >&6; } |
︙ | ︙ |
Modified configure.in from [063c9874e8] to [39f7f4ab4f].
︙ | ︙ | |||
42 43 44 45 46 47 48 | AC_DEFINE_UNQUOTED(SOCKSTAT_PATH, ["$withval"], [Define the path of the stats socket]) fi ]) AC_CHECK_HEADERS(libipq.h stdlib.h stdio.h string.h netinet/in.h netinet/tcp.h resolv.h netdb.h ctype.h syslog.h sys/stat.h sys/types.h unistd.h getopt.h dotconf.h libpool.h time.h) | | | | < < < < < < < | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | AC_DEFINE_UNQUOTED(SOCKSTAT_PATH, ["$withval"], [Define the path of the stats socket]) fi ]) AC_CHECK_HEADERS(libipq.h stdlib.h stdio.h string.h netinet/in.h netinet/tcp.h resolv.h netdb.h ctype.h syslog.h sys/stat.h sys/types.h unistd.h getopt.h dotconf.h libpool.h time.h) AC_CHECK_LIB(config, config_init, [ AC_DEFINE(HAVE_LIBCONFIG, [], [Enable if you have the required libconfig library.]) LIBS="$LIBS -lconfig" ], [ AC_MSG_FAILURE([You must have libconfig]) ]) AC_CHECK_LIB(netfilter_queue, nfq_set_verdict, [ AC_DEFINE(HAVE_NFQUEUE, [], [Enable if you have nfqueue]) LIBS="$LIBS -lnetfilter_queue" have_nfqueue='yes' ]) |
︙ | ︙ |
Modified packetbl.c from [6783fc984d] to [de1fe284bf].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #include <sys/types.h> #include <string.h> #include <unistd.h> #include <getopt.h> #include <time.h> #include <errno.h> #include <linux/netfilter.h> | < < | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <sys/types.h> #include <string.h> #include <unistd.h> #include <getopt.h> #include <time.h> #include <errno.h> #include <linux/netfilter.h> #include <libconfig.h> #ifdef USE_SOCKSTAT #include <sys/socket.h> #include <sys/un.h> #include <pthread.h> #endif |
︙ | ︙ | |||
104 105 106 107 108 109 110 | char *string; struct config_entry *next; struct packet_info ip; struct cidr cidr; }; | < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | char *string; struct config_entry *next; struct packet_info ip; struct cidr cidr; }; char msgbuf[BUFFERSIZE]; struct config { int allow_non25; int allow_nonsyn; int default_accept; int dryrun; int log_facility; int queueno; int quiet; int debug; struct config_entry *blacklistbl; struct config_entry *whitelistbl; struct config_entry *blacklist; struct config_entry *whitelist; }; static struct config conf = { 0, 0, 1, 0, LOG_DAEMON, 0, 0, 0, NULL, NULL, NULL, NULL }; struct pbl_stat_info { uint32_t cacheaccept; uint32_t cachereject; uint32_t whitelistblhits; uint32_t blacklistblhits; uint32_t whitelisthits; |
︙ | ︙ | |||
185 186 187 188 189 190 191 | static void get_ip_string(const struct packet_info *ip); static void pbl_set_verdict(struct PBL_HANDLE *h, PBL_ID_T id, unsigned int verdict); static int pbl_callback(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data); | | | | | | | | | | | | | | | | | | | | < > | | | | | < < | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | static void get_ip_string(const struct packet_info *ip); static void pbl_set_verdict(struct PBL_HANDLE *h, PBL_ID_T id, unsigned int verdict); static int pbl_callback(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data); typedef struct facility { char *string; int num; } facility; static struct facility facenum[] = { {"auth", LOG_AUTH}, {"authpriv", LOG_AUTHPRIV}, {"cron", LOG_CRON}, {"daemon", LOG_DAEMON}, {"kern", LOG_KERN}, {"lpr", LOG_LPR}, {"mail", LOG_MAIL}, {"news", LOG_NEWS}, {"syslog", LOG_SYSLOG}, {"user", LOG_USER}, {"uucp", LOG_UUCP}, {"local0", LOG_LOCAL0}, {"local1", LOG_LOCAL1}, {"local2", LOG_LOCAL2}, {"local3", LOG_LOCAL3}, {"local4", LOG_LOCAL4}, {"local5", LOG_LOCAL5}, {"local6", LOG_LOCAL6}, {"local7", LOG_LOCAL7}, NULL }; /* * SYNOPSIS: * void daemonize(void); * * NOTES: * This function accomplishes everything needed to become a daemon. * Including closing standard in/out/err and forking. |
︙ | ︙ | |||
421 422 423 424 425 426 427 | } #endif /* the get_ip_string is set AFTER the check_packet_* * calls because of the possibility they could screw with * msgbuf. They shouldn't, really, but better safe than * sorry, at least for now. */ | | | | | | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | } #endif /* the get_ip_string is set AFTER the check_packet_* * calls because of the possibility they could screw with * msgbuf. They shouldn't, really, but better safe than * sorry, at least for now. */ if (check_packet_list(&ip, conf.whitelist) == 1) { get_ip_string(&ip); if (!conf.quiet) { if (conf.debug == 0) { syslog(LOG_INFO, "[accept whitelist] [%s]", msgbuf); } else { fprintf(stderr, "[accept whitelist] [%s]", msgbuf); } } statistics.whitelisthits++; retval=NF_ACCEPT; } else if (check_packet_list(&ip, conf.blacklist) == 1) { get_ip_string(&ip); if (!conf.quiet) { if (conf.debug == 0) { syslog(LOG_INFO, "[reject blacklist] [%s]", msgbuf); } else { fprintf(stderr, "[reject blacklist] [%s]", msgbuf); } } statistics.blacklisthits++; retval=NF_DROP; } else if (check_packet_dnsbl(&ip, conf.whitelistbl) == 1) { get_ip_string(&ip); if (!conf.quiet) { if (conf.debug == 0) { syslog(LOG_INFO, "[accept dnsbl] [%s]", msgbuf); } else { fprintf(stderr, "[accept dnsbl] [%s]", msgbuf); } } statistics.whitelistblhits++; retval=NF_ACCEPT; } else if (check_packet_dnsbl(&ip, conf.blacklistbl) == 1) { get_ip_string(&ip); if (!conf.quiet) { if (conf.debug == 0) { syslog(LOG_INFO, "[reject dnsbl] [%s]", msgbuf); } else { |
︙ | ︙ | |||
834 835 836 837 838 839 840 | * global variables. It may cause the program to abort with a failure * if the configuration is unreadable or unparsable. Due to this fact, * it should only be called during start-up and not from the main loop. * */ void parse_config(void) { | | > | > > > | | > | < | | < > > > | | | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | * global variables. It may cause the program to abort with a failure * if the configuration is unreadable or unparsable. Due to this fact, * it should only be called during start-up and not from the main loop. * */ void parse_config(void) { config_t *config = NULL; config_setting_t *config_setting = NULL; struct ce *config_entry = NULL; int result = 0; int i = 0; const char *facstr = NULL; config_init(config); result = config_read_file(config, "test.config"); if (result == CONFIG_FALSE) { if (config_error_type(config) == CONFIG_ERR_PARSE) { fprintf (stderr, "Error parsing config file %s, line %d: %s\n", config_error_file(config), config_error_line(config), config_error_text(config)); } if (config_error_type(config) == CONFIG_ERR_FILE_IO) { fprintf (stderr, "Error reading config file: %s\n", config_error_text(config)); } exit(EXIT_FAILURE); } /* there are default, so I'm not checking return values. If it fails, * then we'll just stay with the default, whatever that might be. */ config_lookup_bool(config, "options.fallthroughaccept", &conf.default_accept); config_lookup_bool(config, "options.allownonport25", &conf.allow_non25); config_lookup_bool(config, "options.dryrun", &conf.dryrun); config_lookup_bool(config, "options.allownonsyn", &conf.allow_nonsyn); config_lookup_bool(config, "options.quiet", &conf.quiet); #ifdef USE_CACHE config_lookup_int(config, "cache.ttl", &packet_cache_ttl); if (packet_cache_ttl < 0) { packet_cache_ttl = USE_CACHE_DEF_TTL; fprintf(stderr, "config cache TTL negative - using default"); } config_lookup_int(config, "cache.len", &packet_cache_len); if (packet_cache_len < 0) { packet_cache_len = USE_CACHE_DEF_LEN; fprintf(stderr, "config size TTL negative - using default"); } #endif config_lookup_string(config, "log.facility", &facstr); i = 0; while (&facenum[i] != NULL) { if (strcasecmp(facenum[i].string, facstr) == 0) { conf.log_facility = facenum[i].num; break; } else { i++; } } config_lookup_int(config, "config.queueno", &conf.queueno); if (conf.queueno < 0) { conf.queueno = 1; fprintf(stderr, "queueno negative - using default"); } config_setting = config_lookup(config, "blacklistbl"); parse_config_bl_list(config_setting, 1); config_setting = config_lookup(config, "whitelistbl"); parse_config_bl_list(config_setting, 2); config_setting = config_lookup(config, "blacklist"); parse_config_bl_list(config_setting, 3); config_setting = config_lookup(config, "whitelist"); parse_config_bl_list(config_setting, 4); } parse_config_bl_list(config_setting_t *c, int type) { struct config_entry *ce, *tmp; int i = 0, len = 0; char *setting; #ifdef HAVE_FIREDNS size_t blacklistlen = 0; #endif len = config_setting_length(c); while (i++ < len) { setting = config_setting_get_string_elem(c, i); ce = malloc(sizeof(struct config_entry)); if (ce == NULL) { /* shouldn't happen... */ fprintf(stderr, "Failed to allocate memory for ce struct\n"); exit(EXIT_FAILURE); } ce->string = (char *)strdup(setting); ce->next = NULL; #ifdef HAVE_FIREDNS blacklistlen = strlen(ce->string); if (ce->string[blacklistlen - 1] == '.') { ce->string[blacklistlen - 1] = '\0'; } #endif switch (type) { case 1: if (conf.blacklistbl == NULL) { conf.blacklistbl = ce; continue; } else { tmp = conf.blacklistbl; } break; case 2: if (conf.whitelistbl == NULL) { conf.whitelistbl = ce; continue; } else { tmp = conf.whitelistbl; } case 3: if (parse_cidr(ce) == -1) { fprintf(stderr, "Error parsing CIDR in %s, ignoring\n", ce->string); free(ce->string); free(ce); continue; } if (conf.blacklist == NULL) { conf.blacklist = ce; continue; } else { tmp = conf.blacklist; } break; case 4: if (parse_cidr(ce) == -1) { fprintf(stderr, "Error parsing CIDR in %s, ignoring\n", ce->string); free(ce->string); free(ce); continue; } if (conf.whitelist == NULL) { conf.whitelist = ce; continue; } else { tmp = conf.whitelist; } break; } while (tmp->next != NULL) { tmp = tmp->next; } tmp->next = ce; } } /* * SYNOPSIS: * void parse_arguments( * int argc, * char **argv * ); * |
︙ | ︙ | |||
901 902 903 904 905 906 907 | default: exit(EXIT_FAILURE); break; } } return; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | default: exit(EXIT_FAILURE); break; } } return; } /* * SYNOPSIS: * int parse_cidr( * struct config_entry *ce * ); |
︙ | ︙ |