author | Tomas Klacko <tomas.klacko@oracle.com> |
Tue, 25 Feb 2014 02:29:07 -0800 | |
branch | s11-update |
changeset 2966 | 93b92606f5e1 |
permissions | -rw-r--r-- |
2966
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
1 |
http://bugs.proftpd.org/show_bug.cgi?id=4014 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
2 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
3 |
I addition, this patch backports the pr_str_get_nbytes() function. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
4 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
5 |
diff --git a/include/options.h b/include/options.h |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
6 |
index 96fa35d..0b29bf7 100644 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
7 |
--- a/include/options.h |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
8 |
+++ b/include/options.h |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
9 |
@@ -110,6 +110,13 @@ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
10 |
# define PR_TUNABLE_XFER_BUFFER_SIZE PR_TUNABLE_BUFFER_SIZE |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
11 |
#endif |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
12 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
13 |
+/* Maximum FTP command size. For details on this size of 512KB, see |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
14 |
+ * the Bug#4014 discussion. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
15 |
+ */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
16 |
+#ifndef PR_TUNABLE_CMD_BUFFER_SIZE |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
17 |
+# define PR_TUNABLE_CMD_BUFFER_SIZE (512 * 1024) |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
18 |
+#endif |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
19 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
20 |
/* Maximum path length. GNU HURD (and some others) do not define |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
21 |
* MAXPATHLEN. POSIX' PATH_MAX is mandated to be at least 256 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
22 |
* (according to some), so 1K, in the absense of MAXPATHLEN, should be |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
23 |
diff --git a/include/str.h b/include/str.h |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
24 |
index b4fed7c..1cf8724 100644 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
25 |
--- a/include/str.h |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
26 |
+++ b/include/str.h |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
27 |
@@ -39,6 +39,7 @@ char *pstrndup(pool *, const char *, size_t); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
28 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
29 |
char *pr_str_strip(pool *, char *); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
30 |
char *pr_str_strip_end(char *, char *); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
31 |
+int pr_str_get_nbytes(const char *, const char *, off_t *); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
32 |
char *pr_str_get_word(char **, int); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
33 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
34 |
#define PR_STR_FL_PRESERVE_COMMENTS 0x0001 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
35 |
diff --git a/modules/mod_core.c b/modules/mod_core.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
36 |
index 18a47c2..922f4d1 100644 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
37 |
--- a/modules/mod_core.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
38 |
+++ b/modules/mod_core.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
39 |
@@ -2240,18 +2240,44 @@ MODRET set_allowforeignaddress(cmd_rec *cmd) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
40 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
41 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
42 |
MODRET set_commandbuffersize(cmd_rec *cmd) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
43 |
- int size = 0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
44 |
+ int res; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
45 |
+ size_t size = 0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
46 |
+ off_t nbytes = 0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
47 |
config_rec *c = NULL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
48 |
+ const char *units = NULL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
49 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
50 |
+ if (cmd->argc < 2 || cmd->argc > 3) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
51 |
+ CONF_ERROR(cmd, "wrong number of parameters") |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
52 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
53 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
54 |
- CHECK_ARGS(cmd, 1); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
55 |
CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
56 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
57 |
- /* NOTE: need to add checks for maximum possible sizes, negative sizes. */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
58 |
- size = atoi(cmd->argv[1]); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
59 |
+ if (cmd->argc == 3) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
60 |
+ units = cmd->argv[2]; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
61 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
62 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
63 |
+ if (pr_str_get_nbytes(cmd->argv[1], units, &nbytes) < 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
64 |
+ CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "unable to parse: ", |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
65 |
+ cmd->argv[1], " ", units, ": ", strerror(errno), NULL)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
66 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
67 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
68 |
+ if (nbytes > PR_TUNABLE_CMD_BUFFER_SIZE) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
69 |
+ char max[1024]; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
70 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
71 |
+ snprintf(max, sizeof(max)-1, "%lu", (unsigned long) |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
72 |
+ PR_TUNABLE_CMD_BUFFER_SIZE); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
73 |
+ max[sizeof(max)-1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
74 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
75 |
+ CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "size ", cmd->argv[1], units, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
76 |
+ "exceeds max size ", max, NULL)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
77 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
78 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
79 |
+ /* Possible truncation here, but only for an absurdly large size. */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
80 |
+ size = (size_t) nbytes; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
81 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
82 |
c = add_config_param(cmd->argv[0], 1, NULL); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
83 |
- c->argv[0] = pcalloc(c->pool, sizeof(int)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
84 |
- *((int *) c->argv[0]) = size; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
85 |
+ c->argv[0] = pcalloc(c->pool, sizeof(size_t)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
86 |
+ *((size_t *) c->argv[0]) = size; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
87 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
88 |
return PR_HANDLED(cmd); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
89 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
90 |
diff --git a/src/main.c b/src/main.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
91 |
index 3e6d637..660e14b 100644 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
92 |
--- a/src/main.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
93 |
+++ b/src/main.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
94 |
@@ -466,42 +466,21 @@ static int _dispatch(cmd_rec *cmd, int cmd_type, int validate, char *match) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
95 |
return success; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
96 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
97 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
98 |
-/* Returns the appropriate maximum buffer length to use for FTP commands |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
99 |
- * from the client, taking the CommandBufferSize directive into account. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
100 |
+/* Returns the appropriate maximum buffer size to use for FTP commands |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
101 |
+ * from the client. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
102 |
*/ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
103 |
-static long get_max_cmd_len(size_t buflen) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
104 |
- long res; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
105 |
- int *bufsz = NULL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
106 |
- size_t default_cmd_bufsz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
107 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
108 |
- /* It's possible for the admin to select a PR_TUNABLE_BUFFER_SIZE which |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
109 |
- * is smaller than PR_DEFAULT_CMD_BUFSZ. We need to handle such cases |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
110 |
- * properly. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
111 |
- */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
112 |
- default_cmd_bufsz = PR_DEFAULT_CMD_BUFSZ; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
113 |
- if (default_cmd_bufsz > buflen) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
114 |
- default_cmd_bufsz = buflen; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
115 |
- } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
116 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
117 |
+static size_t get_max_cmd_sz(void) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
118 |
+ size_t res; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
119 |
+ size_t *bufsz = NULL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
120 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
121 |
bufsz = get_param_ptr(main_server->conf, "CommandBufferSize", FALSE); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
122 |
if (bufsz == NULL) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
123 |
- res = default_cmd_bufsz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
124 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
125 |
- } else if (*bufsz <= 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
126 |
- pr_log_pri(PR_LOG_WARNING, "invalid CommandBufferSize size (%d) given, " |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
127 |
- "using default buffer size (%lu) instead", *bufsz, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
128 |
- (unsigned long) default_cmd_bufsz); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
129 |
- res = default_cmd_bufsz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
130 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
131 |
- } else if (*bufsz + 1 > buflen) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
132 |
- pr_log_pri(PR_LOG_WARNING, "invalid CommandBufferSize size (%d) given, " |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
133 |
- "using default buffer size (%lu) instead", *bufsz, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
134 |
- (unsigned long) default_cmd_bufsz); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
135 |
- res = default_cmd_bufsz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
136 |
+ res = PR_DEFAULT_CMD_BUFSZ; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
137 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
138 |
} else { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
139 |
- pr_log_debug(DEBUG1, "setting CommandBufferSize to %d", *bufsz); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
140 |
- res = (long) *bufsz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
141 |
+ pr_log_debug(DEBUG1, "setting CommandBufferSize to %lu", |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
142 |
+ (unsigned long) *bufsz); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
143 |
+ res = *bufsz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
144 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
145 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
146 |
return res; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
147 |
@@ -509,21 +488,29 @@ static long get_max_cmd_len(size_t buflen) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
148 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
149 |
int pr_cmd_read(cmd_rec **res) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
150 |
static long cmd_bufsz = -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
151 |
- char buf[PR_DEFAULT_CMD_BUFSZ+1] = {'\0'}; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
152 |
+ static char *cmd_buf = NULL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
153 |
char *cp; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
154 |
- size_t buflen; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
155 |
+ size_t cmd_buflen; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
156 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
157 |
if (res == NULL) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
158 |
errno = EINVAL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
159 |
return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
160 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
161 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
162 |
+ if (cmd_bufsz == -1) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
163 |
+ cmd_bufsz = get_max_cmd_sz(); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
164 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
165 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
166 |
+ if (cmd_buf == NULL) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
167 |
+ cmd_buf = pcalloc(session.pool, cmd_bufsz + 1); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
168 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
169 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
170 |
while (TRUE) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
171 |
pr_signals_handle(); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
172 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
173 |
- memset(buf, '\0', sizeof(buf)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
174 |
+ memset(cmd_buf, '\0', cmd_bufsz); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
175 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
176 |
- if (pr_netio_telnet_gets(buf, sizeof(buf)-1, session.c->instrm, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
177 |
+ if (pr_netio_telnet_gets(cmd_buf, cmd_bufsz, session.c->instrm, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
178 |
session.c->outstrm) == NULL) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
179 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
180 |
if (errno == E2BIG) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
181 |
@@ -544,9 +531,6 @@ int pr_cmd_read(cmd_rec **res) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
182 |
break; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
183 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
184 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
185 |
- if (cmd_bufsz == -1) |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
186 |
- cmd_bufsz = get_max_cmd_len(sizeof(buf)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
187 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
188 |
/* This strlen(3) is guaranteed to terminate; the last byte of buf is |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
189 |
* always NUL, since pr_netio_telnet_gets() is told that the buf size is |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
190 |
* one byte less than it really is. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
191 |
@@ -554,26 +538,28 @@ int pr_cmd_read(cmd_rec **res) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
192 |
* If the strlen(3) says that the length is less than the cmd_bufsz, then |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
193 |
* there is no need to truncate the buffer by inserting a NUL. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
194 |
*/ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
195 |
- buflen = strlen(buf); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
196 |
- if (buflen > (cmd_bufsz - 1)) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
197 |
+ cmd_buflen = strlen(cmd_buf); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
198 |
+ if (cmd_buflen > cmd_bufsz) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
199 |
pr_log_debug(DEBUG0, "truncating incoming command length (%lu bytes) to " |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
200 |
"CommandBufferSize %lu; use the CommandBufferSize directive to increase " |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
201 |
- "the allowed command length", (unsigned long) buflen, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
202 |
+ "the allowed command length", (unsigned long) cmd_buflen, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
203 |
(unsigned long) cmd_bufsz); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
204 |
- buf[cmd_bufsz - 1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
205 |
+ cmd_buf[cmd_bufsz-1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
206 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
207 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
208 |
- if (buflen && |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
209 |
- (buf[buflen-1] == '\n' || buf[buflen-1] == '\r')) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
210 |
- buf[buflen-1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
211 |
- buflen--; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
212 |
+ if (cmd_buflen && |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
213 |
+ (cmd_buf[cmd_buflen-1] == '\n' || cmd_buf[cmd_buflen-1] == '\r')) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
214 |
+ cmd_buf[cmd_buflen-1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
215 |
+ cmd_buflen--; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
216 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
217 |
- if (buflen && |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
218 |
- (buf[buflen-1] == '\n' || buf[buflen-1] =='\r')) |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
219 |
- buf[buflen-1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
220 |
+ if (cmd_buflen && |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
221 |
+ (cmd_buf[cmd_buflen-1] == '\n' || cmd_buf[cmd_buflen-1] =='\r')) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
222 |
+ cmd_buf[cmd_buflen-1] = '\0'; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
223 |
+ cmd_buflen--; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
224 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
225 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
226 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
227 |
- cp = buf; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
228 |
+ cp = cmd_buf; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
229 |
if (*cp == '\r') |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
230 |
cp++; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
231 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
232 |
@@ -587,11 +573,11 @@ int pr_cmd_read(cmd_rec **res) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
233 |
* command handlers themselves, via cmd->arg. This small hack |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
234 |
* reduces the burden on SITE module developers, however. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
235 |
*/ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
236 |
- if (strncasecmp(cp, C_SITE, 4) == 0) |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
237 |
+ if (strncasecmp(cp, C_SITE, 4) == 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
238 |
flags |= PR_STR_FL_PRESERVE_WHITESPACE; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
239 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
240 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
241 |
cmd = make_ftp_cmd(session.pool, cp, flags); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
242 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
243 |
if (cmd) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
244 |
*res = cmd; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
245 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
246 |
diff --git a/src/str.c b/src/str.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
247 |
index d243a17..4f327bf 100644 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
248 |
--- a/src/str.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
249 |
+++ b/src/str.c |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
250 |
@@ -367,6 +367,81 @@ char *pr_str_strip_end(char *s, char *ch) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
251 |
return s; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
252 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
253 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
254 |
+int pr_str_get_nbytes(const char *str, const char *units, off_t *nbytes) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
255 |
+ off_t sz; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
256 |
+ char *ptr = NULL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
257 |
+ float factor = 0.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
258 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
259 |
+ if (str == NULL) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
260 |
+ errno = EINVAL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
261 |
+ return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
262 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
263 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
264 |
+ /* No negative numbers. */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
265 |
+ if (*str == '-') { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
266 |
+ errno = EINVAL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
267 |
+ return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
268 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
269 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
270 |
+ if (units == NULL || |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
271 |
+ *units == '\0') { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
272 |
+ factor = 1.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
273 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
274 |
+ } else if (strncasecmp(units, "KB", 3) == 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
275 |
+ factor = 1024.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
276 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
277 |
+ } else if (strncasecmp(units, "MB", 3) == 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
278 |
+ factor = 1024.0 * 1024.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
279 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
280 |
+ } else if (strncasecmp(units, "GB", 3) == 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
281 |
+ factor = 1024.0 * 1024.0 * 1024.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
282 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
283 |
+ } else if (strncasecmp(units, "TB", 3) == 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
284 |
+ factor = 1024.0 * 1024.0 * 1024.0 * 1024.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
285 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
286 |
+ } else if (strncasecmp(units, "B", 2) == 0) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
287 |
+ factor = 1.0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
288 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
289 |
+ } else { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
290 |
+ errno = EINVAL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
291 |
+ return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
292 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
293 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
294 |
+ errno = 0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
295 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
296 |
+#ifdef HAVE_STRTOULL |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
297 |
+ sz = strtoull(str, &ptr, 10); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
298 |
+#else |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
299 |
+ sz = strtoul(str, &ptr, 10); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
300 |
+#endif /* !HAVE_STRTOULL */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
301 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
302 |
+ if (errno == ERANGE) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
303 |
+ return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
304 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
305 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
306 |
+ if (ptr != NULL && *ptr) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
307 |
+ /* Error parsing the given string */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
308 |
+ errno = EINVAL; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
309 |
+ return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
310 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
311 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
312 |
+ /* Don't bother applying the factor if the result will overflow the result. */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
313 |
+#ifdef ULLONG_MAX |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
314 |
+ if (sz > (ULLONG_MAX / factor)) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
315 |
+#else |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
316 |
+ if (sz > (ULONG_MAX / factor)) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
317 |
+#endif /* !ULLONG_MAX */ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
318 |
+ errno = ERANGE; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
319 |
+ return -1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
320 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
321 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
322 |
+ if (nbytes != NULL) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
323 |
+ *nbytes = (off_t) (sz * factor); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
324 |
+ } |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
325 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
326 |
+ return 0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
327 |
+} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
328 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
329 |
char *pr_str_get_word(char **cp, int flags) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
330 |
char *res, *dst; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
331 |
char quote_mode = 0; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
332 |
diff --git a/tests/t/lib/ProFTPD/Tests/Config/CommandBufferSize.pm b/tests/t/lib/ProFTPD/Tests/Config/CommandBufferSize.pm |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
333 |
index ed4672a..a57c898 100644 |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
334 |
--- a/tests/t/lib/ProFTPD/Tests/Config/CommandBufferSize.pm |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
335 |
+++ b/tests/t/lib/ProFTPD/Tests/Config/CommandBufferSize.pm |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
336 |
@@ -94,6 +94,8 @@ sub cmdbuffersz_small { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
337 |
die("Can't open $test_path: $!"); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
338 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
339 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
340 |
+ my $idle_timeout = 3; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
341 |
+ |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
342 |
my $config = { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
343 |
PidFile => $pid_file, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
344 |
ScoreboardFile => $scoreboard_file, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
345 |
@@ -103,6 +105,7 @@ sub cmdbuffersz_small { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
346 |
AuthGroupFile => $auth_group_file, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
347 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
348 |
CommandBufferSize => $cmdbufsz, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
349 |
+ TimeoutIdle => $idle_timeout, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
350 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
351 |
IfModules => { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
352 |
'mod_delay.c' => { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
353 |
@@ -128,44 +131,16 @@ sub cmdbuffersz_small { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
354 |
defined(my $pid = fork()) or die("Can't fork: $!"); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
355 |
if ($pid) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
356 |
eval { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
357 |
- my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
358 |
+ my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port, 0, 1); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
359 |
$client->login($user, $passwd); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
360 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
361 |
- my $conn = $client->list_raw($test_file); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
362 |
- unless ($conn) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
363 |
- die("Failed to LIST $test_file: " . $client->response_code() . " " . |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
364 |
- $client->response_msg()); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
365 |
+ # Since our filename is longer than the CommandBufferSize, proftpd |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
366 |
+ # should simply ignore this. It will fail because of the idle timeout |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
367 |
+ # first. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
368 |
+ eval { $client->stat($test_file) }; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
369 |
+ unless ($@) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
370 |
+ die("STAT command succeeded unexpectedly"); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
371 |
} |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
372 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
373 |
- my $buf; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
374 |
- $conn->read($buf, 8192, 30); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
375 |
- eval { $conn->close() }; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
376 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
377 |
- my $resp_code = $client->response_code(); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
378 |
- my $resp_msg = $client->response_msg(); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
379 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
380 |
- # CommandBufferSize works by truncating any input longer than the |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
381 |
- # configured length. (It should arguably reject such longer input, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
382 |
- # but that is a different consideration.) |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
383 |
- # |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
384 |
- # Since our file name is longer than the CommandBufferSize, it means |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
385 |
- # the path will be truncated, and the LIST should return 450. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
386 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
387 |
- my $expected; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
388 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
389 |
- $expected = 450; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
390 |
- $self->assert($expected == $resp_code, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
391 |
- test_msg("Expected $expected, got $resp_code")); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
392 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
393 |
- # This length is CommandBufferSize - "LIST"(4) - " "(1) - 1 for |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
394 |
- # the NUL reserved in the code. Thus CommandBufferSize - 6. |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
395 |
- my $truncated_name = ("A" x ($cmdbufsz - 6)); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
396 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
397 |
- $expected = "$truncated_name: No such file or directory"; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
398 |
- $self->assert($expected eq $resp_msg, |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
399 |
- test_msg("Expected '$expected', got '$resp_msg'")); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
400 |
- |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
401 |
- $client->quit(); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
402 |
}; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
403 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
404 |
if ($@) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
405 |
@@ -176,7 +151,7 @@ sub cmdbuffersz_small { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
406 |
$wfh->flush(); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
407 |
|
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
408 |
} else { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
409 |
- eval { server_wait($config_file, $rfh) }; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
410 |
+ eval { server_wait($config_file, $rfh, 15) }; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
411 |
if ($@) { |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
412 |
warn($@); |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
413 |
exit 1; |
93b92606f5e1
15825705 SUNBT7206929 all of the ftp test cases with "-f" are timeouted in krb5_r_apps
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff
changeset
|
414 |