aboutsummaryrefslogtreecommitdiffstats
path: root/main/knock/path-max.patch
blob: d4c398dae571bed1cd4b9c54c5f21fef0180db06 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--- knock-0.5.orig/src/knockd.c
+++ knock-0.5/src/knockd.c
@@ -131,9 +131,9 @@
 int  o_daemon    = 0;
 int  o_lookup    = 0;
 char o_int[32]           = "";		/* default (eth0) is set after parseconfig() */
-char o_cfg[PATH_MAX]     = "/etc/knockd.conf";
-char o_pidfile[PATH_MAX] = "/var/run/knockd.pid";
-char o_logfile[PATH_MAX] = "";
+char o_cfg[4096]     = "/etc/knockd.conf";
+char o_pidfile[4096] = "/var/run/knockd.pid";
+char o_logfile[4096] = "";
 
 int main(int argc, char **argv)
 {
@@ -435,7 +435,7 @@
 int parseconfig(char *configfile)
 {
 	FILE *fp = NULL;
-	char line[PATH_MAX+1];
+	char line[4096+1];
 	char *ptr = NULL;
 	char *key = NULL;
 	int linenum = 0;
@@ -448,7 +448,7 @@
 		return(1);
 	}
 
-	while(fgets(line, PATH_MAX, fp)) {
+	while(fgets(line, 4096, fp)) {
 		linenum++;
 		trim(line);
 		if(strlen(line) == 0 || line[0] == '#') {
@@ -509,12 +509,12 @@
 				trim(ptr);
 				if(!strcmp(section, "options")) {
 					if(!strcmp(key, "LOGFILE")) {
-						strncpy(o_logfile, ptr, PATH_MAX-1);
-						o_logfile[PATH_MAX-1] = '\0';
+						strncpy(o_logfile, ptr, 4096-1);
+						o_logfile[4096-1] = '\0';
 						dprint("config: log file: %s\n", o_logfile);
 					} else if(!strcmp(key, "PIDFILE")) {
-						strncpy(o_pidfile, ptr, PATH_MAX-1);
-						o_pidfile[PATH_MAX-1] = '\0';
+						strncpy(o_pidfile, ptr, 4096-1);
+						o_pidfile[4096-1] = '\0';
 						dprint("config: pid file: %s\n", o_pidfile);
 					} else if(!strcmp(key, "INTERFACE")) {
 						/* set interface only if it has not already been set by the -i switch */
@@ -692,11 +692,11 @@
  */
 long get_next_one_time_sequence(opendoor_t *door)
 {
-	char line[PATH_MAX+1];
+	char line[4096+1];
 	int pos;
 	
 	pos = ftell(door->one_time_sequences_fd);
-	while(fgets(line, PATH_MAX, door->one_time_sequences_fd)) {
+	while(fgets(line, 4096, door->one_time_sequences_fd)) {
 		trim(line);
 		if(strlen(line) == 0 || line[0] == '#') {
 			pos = ftell(door->one_time_sequences_fd);
@@ -1382,8 +1382,8 @@
 					/* run the associated command */
 					if(fork() == 0) {
 						/* child */
-						char parsed_start_cmd[PATH_MAX];
-						char parsed_stop_cmd[PATH_MAX];
+						char parsed_start_cmd[4096];
+						char parsed_stop_cmd[4096];
 						size_t cmd_len = 0;
 
 						setsid();