author | Tomas Klacko <tomas.klacko@oracle.com> |
Mon, 28 Jul 2014 03:27:16 -0700 | |
branch | s11u2-sru |
changeset 3234 | 1de12229da80 |
parent 2724 | 90c18e89db60 |
permissions | -rw-r--r-- |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
1 |
diff --git a/include/dirtree.h b/include/dirtree.h |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
2 |
index 0f41986..fe7b14b 100644 |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
3 |
--- a/include/dirtree.h |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
4 |
+++ b/include/dirtree.h |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
5 |
@@ -126,6 +126,10 @@ typedef struct cmd_struc { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
6 |
pr_table_t *notes; /* Private data for passing/retaining between handlers */ |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
7 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
8 |
int cmd_id; /* Index into commands list, for faster comparisons */ |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
9 |
+ |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
10 |
+ int error_code; /* Stores errno of failed file transfer |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
11 |
+ * commands. Required for Solaris auditing. |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
12 |
+ */ |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
13 |
} cmd_rec; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
14 |
|
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
15 |
struct config_struc { |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
16 |
diff --git a/modules/mod_core.c b/modules/mod_core.c |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
17 |
index e33ee11..f680748 100644 |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
18 |
--- a/modules/mod_core.c |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
19 |
+++ b/modules/mod_core.c |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
20 |
@@ -4775,6 +4775,7 @@ MODRET core_rmd(cmd_rec *cmd) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
21 |
dir = dir_canonical_path(cmd->tmp_pool, dir); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
22 |
if (dir == NULL) { |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
23 |
int xerrno = EINVAL; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
24 |
+ cmd->error_code = EINVAL; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
25 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
26 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
27 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
28 |
@@ -4784,6 +4785,7 @@ MODRET core_rmd(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
29 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
30 |
if (!dir_check_canon(cmd->tmp_pool, cmd, cmd->group, dir, NULL)) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
31 |
int xerrno = EACCES; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
32 |
+ cmd->error_code = EACCES; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
33 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
34 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
35 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
36 |
@@ -4793,6 +4795,7 @@ MODRET core_rmd(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
37 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
38 |
if (pr_fsio_rmdir(dir) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
39 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
40 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
41 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
42 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
43 |
"error removing directory '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
44 |
@@ -4849,6 +4852,7 @@ MODRET core_mkd(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
45 |
dir = dir_canonical_path(cmd->tmp_pool, dir); |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
46 |
if (dir == NULL) { |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
47 |
int xerrno = EINVAL; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
48 |
+ cmd->error_code = EINVAL; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
49 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
50 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
51 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
52 |
@@ -4858,6 +4862,7 @@ MODRET core_mkd(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
53 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
54 |
if (!dir_check_canon(cmd->tmp_pool, cmd, cmd->group, dir, NULL)) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
55 |
int xerrno = EACCES; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
56 |
+ cmd->error_code = EACCES; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
57 |
|
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
58 |
pr_log_debug(DEBUG8, "%s command denied by <Limit> config", cmd->argv[0]); |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
59 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
60 |
@@ -4869,6 +4874,7 @@ MODRET core_mkd(cmd_rec *cmd) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
61 |
if (pr_fsio_smkdir(cmd->tmp_pool, dir, 0777, session.fsuid, |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
62 |
session.fsgid) < 0) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
63 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
64 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
65 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
66 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
67 |
"error making directory '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
68 |
@@ -4915,6 +4921,7 @@ MODRET core_mdtm(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
69 |
!dir_check(cmd->tmp_pool, cmd, cmd->group, path, NULL) || |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
70 |
pr_fsio_stat(path, &st) == -1) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
71 |
int xerrno = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
72 |
+ cmd->error_code = errno; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
73 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
74 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
75 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
76 |
@@ -5026,6 +5033,7 @@ MODRET core_dele(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
77 |
path = dir_canonical_path(cmd->tmp_pool, path); |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
78 |
if (path == NULL) { |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
79 |
int xerrno = ENOENT; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
80 |
+ cmd->error_code = ENOENT; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
81 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
82 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
83 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
84 |
@@ -5035,6 +5043,7 @@ MODRET core_dele(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
85 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
86 |
if (!dir_check(cmd->tmp_pool, cmd, cmd->group, path, NULL)) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
87 |
int xerrno = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
88 |
+ cmd->error_code = errno; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
89 |
|
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
90 |
pr_log_debug(DEBUG7, "deleting '%s' denied by <Limit> configuration", path); |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
91 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
92 |
@@ -5051,6 +5060,7 @@ MODRET core_dele(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
93 |
pr_fs_clear_cache(); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
94 |
if (pr_fsio_lstat(path, &st) < 0) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
95 |
int xerrno = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
96 |
+ cmd->error_code = errno; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
97 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
98 |
pr_log_debug(DEBUG3, "unable to lstat '%s': %s", path, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
99 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
100 |
@@ -5065,6 +5075,7 @@ MODRET core_dele(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
101 |
*/ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
102 |
if (S_ISDIR(st.st_mode)) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
103 |
int xerrno = EISDIR; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
104 |
+ cmd->error_code = EISDIR; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
105 |
|
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
106 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
107 |
"error deleting '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
108 |
@@ -5081,6 +5092,7 @@ MODRET core_dele(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
109 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
110 |
if (pr_fsio_unlink(path) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
111 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
112 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
113 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
114 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
115 |
"error deleting '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
116 |
@@ -5165,6 +5177,7 @@ MODRET core_rnto(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
117 |
pr_log_debug(DEBUG6, "AllowOverwrite denied permission for %s", path); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
118 |
pr_response_add_err(R_550, _("%s: Rename permission denied"), cmd->arg); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
119 |
errno = EACCES; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
120 |
+ cmd->error_code = EACCES; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
121 |
return PR_ERROR(cmd); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
122 |
} |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
123 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
124 |
@@ -5172,6 +5185,7 @@ MODRET core_rnto(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
125 |
!dir_check_canon(cmd->tmp_pool, cmd, cmd->group, path, NULL) || |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
126 |
pr_fsio_rename(session.xfer.path, path) == -1) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
127 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
128 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
129 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
130 |
if (xerrno != EXDEV) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
131 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
132 |
@@ -5223,6 +5237,7 @@ MODRET core_rnto(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
133 |
*/ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
134 |
if (pr_fs_copy_file(session.xfer.path, path) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
135 |
xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
136 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
137 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
138 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
139 |
"error copying '%s' to '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
140 |
@@ -5238,6 +5253,8 @@ MODRET core_rnto(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
141 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
142 |
/* Once copied, unlink the original file. */ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
143 |
if (pr_fsio_unlink(session.xfer.path) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
144 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
145 |
+ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
146 |
pr_log_debug(DEBUG0, "error unlinking '%s': %s", session.xfer.path, |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
147 |
strerror(errno)); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
148 |
} |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
149 |
@@ -5295,6 +5312,7 @@ MODRET core_rnfr(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
150 |
!dir_check(cmd->tmp_pool, cmd, cmd->group, path, NULL) || |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
151 |
!exists(path)) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
152 |
int xerrno = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
153 |
+ cmd->error_code = errno; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
154 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
155 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
156 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
157 |
diff --git a/modules/mod_xfer.c b/modules/mod_xfer.c |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
158 |
index bcfb487..41c597e 100644 |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
159 |
--- a/modules/mod_xfer.c |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
160 |
+++ b/modules/mod_xfer.c |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
161 |
@@ -1190,6 +1190,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
162 |
if (cmd->argc < 2) { |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
163 |
pr_response_add_err(R_500, _("'%s' not understood"), |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
164 |
pr_cmd_get_displayable_str(cmd, NULL)); |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
165 |
+ cmd->error_code = EINVAL; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
166 |
errno = EINVAL; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
167 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
168 |
} |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
169 |
@@ -1200,6 +1201,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
170 |
if (!path || |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
171 |
!dir_check(cmd->tmp_pool, cmd, cmd->group, path, NULL)) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
172 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
173 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
174 |
|
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
175 |
pr_log_debug(DEBUG8, "%s %s denied by <Limit> configuration", cmd->argv[0], |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
176 |
cmd->arg); |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
177 |
@@ -1232,6 +1234,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
178 |
if (xfer_check_limit(cmd) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
179 |
pr_response_add_err(R_451, _("%s: Too many transfers"), cmd->arg); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
180 |
errno = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
181 |
+ cmd->error_code = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
182 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
183 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
184 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
185 |
@@ -1244,6 +1247,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
186 |
pr_log_debug(DEBUG6, "AllowOverwrite denied permission for %s", cmd->arg); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
187 |
pr_response_add_err(R_550, _("%s: Overwrite permission denied"), cmd->arg); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
188 |
errno = EACCES; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
189 |
+ cmd->error_code = EACCES; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
190 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
191 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
192 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
193 |
@@ -1267,6 +1271,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
194 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
195 |
/* Deliberately use EISDIR for anything non-file (e.g. directories). */ |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
196 |
errno = EISDIR; |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
197 |
+ cmd->error_code = EISDIR; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
198 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
199 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
200 |
} |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
201 |
@@ -1285,6 +1290,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
202 |
session.restart_pos = 0L; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
203 |
session.xfer.xfer_type = STOR_DEFAULT; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
204 |
errno = EPERM; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
205 |
+ cmd->error_code = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
206 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
207 |
} |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
208 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
209 |
@@ -1306,6 +1312,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
210 |
/* Otherwise everthing is good */ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
211 |
if (pr_table_add(cmd->notes, "mod_xfer.store-path", |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
212 |
pstrdup(cmd->pool, path), 0) < 0) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
213 |
+ cmd->error_code = errno; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
214 |
if (errno != EEXIST) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
215 |
pr_log_pri(PR_LOG_NOTICE, |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
216 |
"notice: error adding 'mod_xfer.store-path': %s", strerror(errno)); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
217 |
@@ -1326,6 +1333,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
218 |
pr_response_add_err(R_501, |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
219 |
_("REST not compatible with server configuration")); |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
220 |
errno = EINVAL; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
221 |
+ cmd->error_code = EINVAL; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
222 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
223 |
} |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
224 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
225 |
@@ -1335,6 +1343,7 @@ MODRET xfer_pre_stor(cmd_rec *cmd) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
226 |
pr_response_add_err(R_550, |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
227 |
_("APPE not compatible with server configuration")); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
228 |
errno = EINVAL; |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
229 |
+ cmd->error_code = EINVAL; |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
230 |
return PR_ERROR(cmd); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
231 |
} |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
232 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
233 |
@@ -1400,6 +1409,7 @@ MODRET xfer_pre_stou(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
234 |
tmpfd = mkstemp(filename); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
235 |
if (tmpfd < 0) { |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
236 |
int xerrno = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
237 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
238 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
239 |
pr_log_pri(PR_LOG_WARNING, "error: unable to use mkstemp(): %s", |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
240 |
strerror(xerrno)); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
241 |
@@ -1428,6 +1438,7 @@ MODRET xfer_pre_stou(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
242 |
if (!filename || |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
243 |
!dir_check(cmd->tmp_pool, cmd, cmd->group, filename, NULL)) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
244 |
int xerrno = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
245 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
246 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
247 |
/* Do not forget to delete the file created by mkstemp(3) if there is |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
248 |
* an error. |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
249 |
@@ -1461,12 +1472,14 @@ MODRET xfer_pre_stou(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
250 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
251 |
/* Deliberately use EISDIR for anything non-file (e.g. directories). */ |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
252 |
errno = EISDIR; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
253 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
254 |
return PR_ERROR(cmd); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
255 |
} |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
256 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
257 |
/* Otherwise everthing is good */ |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
258 |
if (pr_table_add(cmd->notes, "mod_xfer.store-path", |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
259 |
pstrdup(cmd->pool, filename), 0) < 0) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
260 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
261 |
if (errno != EEXIST) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
262 |
pr_log_pri(PR_LOG_NOTICE, |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
263 |
"notice: error adding 'mod_xfer.store-path': %s", strerror(errno)); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
264 |
@@ -1492,6 +1505,7 @@ MODRET xfer_post_stou(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
265 |
mode_t mode = 0666; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
266 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
267 |
if (pr_fsio_chmod(cmd->arg, mode) < 0) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
268 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
269 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
270 |
/* Not much to do but log the error. */ |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
271 |
pr_log_pri(PR_LOG_NOTICE, "error: unable to chmod '%s' to %04o: %s", |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
272 |
@@ -1510,6 +1524,7 @@ MODRET xfer_pre_appe(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
273 |
if (xfer_check_limit(cmd) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
274 |
pr_response_add_err(R_451, _("%s: Too many transfers"), cmd->arg); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
275 |
errno = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
276 |
+ cmd->error_code = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
277 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
278 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
279 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
280 |
@@ -1580,6 +1595,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
281 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
282 |
if (stor_fh) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
283 |
if (pr_fsio_lseek(stor_fh, 0, SEEK_END) == (off_t) -1) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
284 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
285 |
pr_log_debug(DEBUG4, "unable to seek to end of '%s' for appending: %s", |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
286 |
cmd->arg, strerror(errno)); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
287 |
(void) pr_fsio_close(stor_fh); |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
288 |
@@ -1588,6 +1604,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
289 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
290 |
} else { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
291 |
ferrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
292 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
293 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
294 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
295 |
"error opening '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
296 |
@@ -1601,6 +1618,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
297 |
O_WRONLY|(session.restart_pos ? 0 : O_TRUNC|O_CREAT)); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
298 |
if (stor_fh == NULL) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
299 |
ferrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
300 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
301 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
302 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
303 |
"error opening '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
304 |
@@ -1614,11 +1632,13 @@ MODRET xfer_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
305 |
int xerrno = 0; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
306 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
307 |
if (pr_fsio_lseek(stor_fh, session.restart_pos, SEEK_SET) == -1) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
308 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
309 |
pr_log_debug(DEBUG4, "unable to seek to position %" PR_LU " of '%s': %s", |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
310 |
(pr_off_t) session.restart_pos, cmd->arg, strerror(errno)); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
311 |
xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
312 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
313 |
} else if (pr_fsio_stat(path, &st) == -1) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
314 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
315 |
pr_log_debug(DEBUG4, "unable to stat '%s': %s", cmd->arg, |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
316 |
strerror(errno)); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
317 |
xerrno = errno; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
318 |
@@ -1755,6 +1775,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
319 |
pr_data_abort(EPERM, FALSE); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
320 |
errno = EPERM; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
321 |
#endif |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
322 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
323 |
return PR_ERROR(cmd); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
324 |
} |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
325 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
326 |
@@ -1766,6 +1787,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
327 |
res = pr_fsio_write(stor_fh, lbuf, len); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
328 |
if (res != len) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
329 |
int xerrno = EIO; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
330 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
331 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
332 |
if (res < 0) |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
333 |
xerrno = errno; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
334 |
@@ -1795,6 +1817,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
335 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
336 |
/* default abort errno, in case session.d et al has already gone away */ |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
337 |
int xerrno = ECONNABORTED; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
338 |
+ cmd->error_code = ECONNABORTED; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
339 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
340 |
stor_abort(); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
341 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
342 |
@@ -1814,6 +1837,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
343 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
344 |
if (stor_complete() < 0) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
345 |
int xerrno = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
346 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
347 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
348 |
_log_transfer('i', 'i'); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
349 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
350 |
@@ -1826,12 +1850,14 @@ MODRET xfer_stor(cmd_rec *cmd) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
351 |
if (xerrno == EDQUOT) { |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
352 |
pr_response_add_err(R_552, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
353 |
errno = xerrno; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
354 |
+ cmd->error_code = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
355 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
356 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
357 |
#elif defined(EFBIG) |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
358 |
if (xerrno == EFBIG) { |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
359 |
pr_response_add_err(R_552, "%s: %s", cmd->arg, strerror(xerrno)); |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
360 |
errno = xerrno; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
361 |
+ cmd->error_code = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
362 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
363 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
364 |
#endif |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
365 |
@@ -1845,6 +1871,7 @@ MODRET xfer_stor(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
366 |
session.xfer.path_hidden) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
367 |
if (pr_fsio_rename(session.xfer.path_hidden, session.xfer.path) != 0) { |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
368 |
int xerrno = errno; |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
369 |
+ cmd->error_code = errno; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
370 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
371 |
/* This should only fail on a race condition with a chmod/chown |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
372 |
* or if STOR_APPEND is on and the permissions are squirrely. |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
373 |
@@ -1947,6 +1974,7 @@ MODRET xfer_pre_retr(cmd_rec *cmd) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
374 |
pr_response_add_err(R_500, _("'%s' not understood"), |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
375 |
pr_cmd_get_displayable_str(cmd, NULL)); |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
376 |
errno = EINVAL; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
377 |
+ cmd->error_code = EINVAL; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
378 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
379 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
380 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
381 |
@@ -1956,6 +1984,7 @@ MODRET xfer_pre_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
382 |
if (!dir || |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
383 |
!dir_check(cmd->tmp_pool, cmd, cmd->group, dir, NULL)) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
384 |
int xerrno = errno; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
385 |
+ cmd->error_code; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
386 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
387 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
388 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
389 |
@@ -1978,12 +2007,14 @@ MODRET xfer_pre_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
390 |
if (xfer_check_limit(cmd) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
391 |
pr_response_add_err(R_451, _("%s: Too many transfers"), cmd->arg); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
392 |
errno = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
393 |
+ cmd->error_code = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
394 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
395 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
396 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
397 |
fmode = file_mode(dir); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
398 |
if (fmode == 0) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
399 |
int xerrno = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
400 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
401 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
402 |
pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno)); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
403 |
|
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
404 |
@@ -2000,6 +2031,7 @@ MODRET xfer_pre_retr(cmd_rec *cmd) { |
2724
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
405 |
|
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
406 |
/* Deliberately use EISDIR for anything non-file (e.g. directories). */ |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
407 |
errno = EISDIR; |
90c18e89db60
16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents:
305
diff
changeset
|
408 |
+ cmd->error_code = EISDIR; |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
409 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
410 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
411 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
412 |
@@ -2014,12 +2046,14 @@ MODRET xfer_pre_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
413 |
cmd->arg); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
414 |
session.restart_pos = 0L; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
415 |
errno = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
416 |
+ cmd->error_code = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
417 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
418 |
} |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
419 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
420 |
/* Otherwise everthing is good */ |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
421 |
if (pr_table_add(cmd->notes, "mod_xfer.retr-path", |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
422 |
pstrdup(cmd->pool, dir), 0) < 0) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
423 |
+ cmd->error_code = errno; |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
424 |
if (errno != EEXIST) { |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
425 |
pr_log_pri(PR_LOG_NOTICE, "notice: error adding 'mod_xfer.retr-path': %s", |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
426 |
strerror(errno)); |
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
427 |
@@ -2046,6 +2080,7 @@ MODRET xfer_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
428 |
retr_fh = pr_fsio_open(dir, O_RDONLY); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
429 |
if (retr_fh == NULL) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
430 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
431 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
432 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
433 |
(void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): " |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
434 |
"error opening '%s': %s", cmd->argv[0], session.user, |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
435 |
@@ -2059,6 +2094,7 @@ MODRET xfer_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
436 |
if (pr_fsio_stat(dir, &st) < 0) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
437 |
/* Error stat'ing the file. */ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
438 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
439 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
440 |
pr_fsio_close(retr_fh); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
441 |
errno = xerrno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
442 |
|
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
443 |
@@ -2083,6 +2119,7 @@ MODRET xfer_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
444 |
if (pr_fsio_lseek(retr_fh, session.restart_pos, |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
445 |
SEEK_SET) == (off_t) -1) { |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
446 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
447 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
448 |
pr_fsio_close(retr_fh); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
449 |
errno = xerrno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
450 |
retr_fh = NULL; |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
451 |
@@ -2143,6 +2180,7 @@ MODRET xfer_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
452 |
retr_abort(); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
453 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
454 |
/* Set errno to EPERM ("Operation not permitted") */ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
455 |
+ cmd->error_code = EPERM; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
456 |
pr_data_abort(EPERM, FALSE); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
457 |
return PR_ERROR(cmd); |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
458 |
} |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
459 |
@@ -2174,6 +2212,7 @@ MODRET xfer_retr(cmd_rec *cmd) { |
305
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
460 |
* is preserved; errno itself might be overwritten in retr_abort(). |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
461 |
*/ |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
462 |
int xerrno = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
463 |
+ cmd->error_code = errno; |
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
464 |
|
e95b65443448
PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff
changeset
|
465 |
retr_abort(); |
3234
1de12229da80
18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents:
2724
diff
changeset
|
466 |
pr_data_abort(xerrno, FALSE); |