aboutsummaryrefslogtreecommitdiff
blob: c0e5fcfd459cecba44709f5e46f4c617d55f5625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- extensions/ebt_among.c.dist	2015-03-10 23:54:32.224146486 +0000
+++ extensions/ebt_among.c	2015-03-10 23:59:00.200050809 +0000
@@ -197,7 +197,7 @@
 
 		/* 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 @@
 			}
 			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 @@
 				}
 				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 @@
 		/* 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 @@
 				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);