--- extensions/ebt_among.c.dist 2015-03-11 22:04:19.512855582 +0000 +++ extensions/ebt_among.c 2015-03-11 22:07:15.814269639 +0000 @@ -197,7 +197,7 @@ static struct ebt_mac_wormhash *create_w /* collect MAC; all its bytes are followed by ':' (colon), * except for the last one which can be followed by - * ',' (comma), '=' or '\0' */ + * ',' (comma), '=', newline or '\0' */ for (i = 0; i < 5; i++) { if (read_until(&pc, ":", token, 2) < 0 || token[0] == 0) { @@ -213,7 +213,7 @@ static struct ebt_mac_wormhash *create_w } pc++; } - if (read_until(&pc, "=,", token, 2) == -2 || token[0] == 0) { + if (read_until(&pc, "=,\n", token, 2) == -2 || token[0] == 0) { ebt_print_error("MAC parse error: %.20s", anchor); return NULL; } @@ -238,7 +238,7 @@ static struct ebt_mac_wormhash *create_w } pc++; } - if (read_until(&pc, ",", token, 3) == -2 || token[0] == 0) { + if (read_until(&pc, ",\n", token, 3) == -2 || token[0] == 0) { ebt_print_error("IP parse error: %.20s", anchor); return NULL; } @@ -279,14 +279,14 @@ static struct ebt_mac_wormhash *create_w /* now `pc' points to comma if we are here; */ /* increment this to the next char */ /* but first assert :-> */ - if (*pc != ',') { - ebt_print_error("Something went wrong; no comma...\n"); + if (*pc != ',' && *pc != '\n') { + ebt_print_error("Something went wrong; no comma or newline...\n"); return NULL; } pc++; /* again check if end of string was reached; */ - /* we allow an ending comma */ + /* we allow an ending comma or newline */ if (!*pc) { break; } @@ -345,8 +345,6 @@ static int parse(int c, char **argv, int ebt_print_error("Couldn't map file to memory"); if (optarg[flen-1] != '\n') ebt_print_error("File should end with a newline"); - if (strchr(optarg, '\n') != optarg+flen-1) - ebt_print_error("File should only contain one line"); optarg[flen-1] = '\0'; if (ebt_errormsg[0] != '\0') { munmap(argv, flen); @@ -424,7 +422,9 @@ static void wormhash_printout(const stru ip = (unsigned char *) &p->ip; printf("=%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); } - printf(","); + if (i < (wh->poolsize - 1)) { + printf(","); + } } printf(" "); }