summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2005-11-11 21:05:57 +0000
committerBart De Schuymer <bdschuym@pandora.be>2005-11-11 21:05:57 +0000
commit472e3f892e3a612974e74dde3dbac1556a1379b7 (patch)
tree6e50ae770b655c4a048de74281496735c5d22e9e
parent6bdb9f4c7111f87ab586095798363a696f9d29ef (diff)
don't allow ' ' in chain names
-rw-r--r--ebtables.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ebtables.c b/ebtables.c
index 91f40f2..968c5e7 100644
--- a/ebtables.c
+++ b/ebtables.c
@@ -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;