diff options
author | Bart De Schuymer <bdschuym@pandora.be> | 2005-11-11 21:05:57 +0000 |
---|---|---|
committer | Bart De Schuymer <bdschuym@pandora.be> | 2005-11-11 21:05:57 +0000 |
commit | 472e3f892e3a612974e74dde3dbac1556a1379b7 (patch) | |
tree | 6e50ae770b655c4a048de74281496735c5d22e9e /ebtables.c | |
parent | 6bdb9f4c7111f87ab586095798363a696f9d29ef (diff) | |
download | ebtables-472e3f892e3a612974e74dde3dbac1556a1379b7.tar.gz |
don't allow ' ' in chain names
Diffstat (limited to 'ebtables.c')
-rw-r--r-- | ebtables.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -612,6 +612,8 @@ int do_command(int argc, char *argv[], int exec_style, else if (strlen(optarg) >= EBT_CHAIN_MAXNAMELEN) ebt_print_error2("Chain name length can't exceed %d", EBT_CHAIN_MAXNAMELEN - 1); + else if (strchr(optarg, ' ') != NULL) + ebt_print_error2("Use of ' ' not allowed in chain names"); ebt_new_chain(replace, optarg, EBT_ACCEPT); /* This is needed to get -N x -P y working */ replace->selected_chain = ebt_get_chainnr(replace, optarg); @@ -640,14 +642,16 @@ int do_command(int argc, char *argv[], int exec_style, if (c == 'E') { if (optind >= argc) ebt_print_error2("No new chain name specified"); - if (optind < argc - 1) + else if (optind < argc - 1) ebt_print_error2("No extra options allowed with -E"); - if (strlen(argv[optind]) >= EBT_CHAIN_MAXNAMELEN) + else if (strlen(argv[optind]) >= EBT_CHAIN_MAXNAMELEN) ebt_print_error2("Chain name length can't exceed %d characters", EBT_CHAIN_MAXNAMELEN - 1); - if (ebt_get_chainnr(replace, argv[optind]) != -1) + else if (ebt_get_chainnr(replace, argv[optind]) != -1) ebt_print_error2("Chain '%s' already exists", argv[optind]); - if (ebt_find_target(argv[optind])) + else if (ebt_find_target(argv[optind])) ebt_print_error2("Target with name '%s' exists", argv[optind]); + else if (strchr(argv[optind], ' ') != NULL) + ebt_print_error2("Use of ' ' not allowed in chain names"); ebt_rename_chain(replace, argv[optind]); optind++; break; |