components/proftpd/patches/005.proftpd-error_code.patch
author Jiri Sasek <Jiri.Sasek@Oracle.COM>
Mon, 09 May 2016 01:27:27 -0700
branchs11u3-sru
changeset 5989 d41cf9a8ea6f
parent 4303 fe962209b82f
permissions -rw-r--r--
23124279 ProFTPd: Update to 1.3.5b 22202943 ProFTPD Version 1.3.5 returns wrong error code upon re-authentication 22504270 Need to backport fix for Proftpd Bug 4114 into userland Proftpd 22923893 problem in SERVICE/PROFTPD 22919363 problem in SERVICE/PROFTPD
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
     1
Collects errnos for Solaris auditing
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
     2
Not suitable to commit to upstream.
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
     3
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
     4
diff --git a/modules/mod_core.c b/modules/mod_core.c
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
     5
index e33ee11..f680748 100644
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
     6
--- a/modules/mod_core.c
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
     7
+++ b/modules/mod_core.c
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
     8
@@ -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
     9
   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
    10
   if (dir == NULL) {
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    11
     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
    12
+    cmd->error_code = EINVAL;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    13
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    14
     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
    15
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    16
@@ -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
    17
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    18
   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
    19
     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
    20
+    cmd->error_code = EACCES;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    21
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    22
     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
    23
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    24
@@ -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
    25
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    26
   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
    27
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    28
+    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
    29
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    30
     (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
    31
       "error removing directory '%s': %s", cmd->argv[0], session.user,
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    32
@@ -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
    33
   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
    34
   if (dir == NULL) {
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    35
     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
    36
+    cmd->error_code = EINVAL;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    37
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    38
     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
    39
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    40
@@ -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
    41
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    42
   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
    43
     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
    44
+    cmd->error_code = EACCES;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    45
 
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    46
     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
    47
     pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno));
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    48
@@ -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
    49
   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
    50
       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
    51
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    52
+    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
    53
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    54
     (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
    55
       "error making directory '%s': %s", cmd->argv[0], session.user,
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    56
@@ -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
    57
       !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
    58
       pr_fsio_stat(path, &st) == -1) {
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    59
     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
    60
+    cmd->error_code = errno;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    61
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    62
     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
    63
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    64
@@ -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
    65
   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
    66
   if (path == NULL) {
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    67
     int xerrno = ENOENT;
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    68
+    cmd->error_code = ENOENT;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    69
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    70
     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
    71
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    72
@@ -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
    73
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    74
   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
    75
     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
    76
+    cmd->error_code = errno;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    77
 
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    78
     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
    79
     pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno));
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    80
@@ -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
    81
   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
    82
   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
    83
     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
    84
+    cmd->error_code = errno;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    85
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    86
     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
    87
     pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno));
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    88
@@ -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
    89
    */
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    90
   if (S_ISDIR(st.st_mode)) {
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    91
     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
    92
+    cmd->error_code = EISDIR;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
    93
 
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    94
     (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
    95
       "error deleting '%s': %s", cmd->argv[0], session.user,
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
    96
@@ -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
    97
  
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
    98
   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
    99
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   100
+    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
   101
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   102
     (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
   103
       "error deleting '%s': %s", cmd->argv[0], session.user,
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   104
@@ -5165,6 +5177,7 @@ MODRET core_rnto(cmd_rec *cmd) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   105
     pr_log_debug(DEBUG6, "AllowOverwrite denied permission for %s", path);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   106
     pr_response_add_err(R_550, _("%s: Rename permission denied"), cmd->arg);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   107
     errno = EACCES;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   108
+    cmd->error_code = EACCES;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   109
     return PR_ERROR(cmd);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   110
   }
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   111
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   112
@@ -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
   113
       !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
   114
       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
   115
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   116
+    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
   117
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   118
     if (xerrno != EXDEV) {
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   119
       (void) pr_trace_msg("fileperms", 1, "%s, user '%s' (UID %lu, GID %lu): "
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   120
@@ -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
   121
      */
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   122
     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
   123
       xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   124
+      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
   125
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   126
       (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
   127
         "error copying '%s' to '%s': %s", cmd->argv[0], session.user,
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   128
@@ -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
   129
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   130
     /* 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
   131
     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
   132
+      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
   133
+
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   134
       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
   135
         strerror(errno));
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   136
     }
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   137
@@ -5295,6 +5312,7 @@ MODRET core_rnfr(cmd_rec *cmd) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   138
       !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
   139
       !exists(path)) {
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   140
     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
   141
+    cmd->error_code = errno;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   142
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   143
     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
   144
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   145
--- a/modules/mod_xfer.c	2016-03-10 17:04:32.000000000 -0800
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   146
+++ proftpd-1.3.5b/modules/mod_xfer.c	2016-04-01 01:54:06.383804153 -0700
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   147
@@ -1187,6 +1187,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   148
   if (cmd->argc < 2) {
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   149
     pr_response_add_err(R_500, _("'%s' not understood"),
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   150
       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
   151
+    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
   152
     errno = EINVAL;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   153
     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
   154
   }
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   155
@@ -1197,6 +1198,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   156
   if (!path ||
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   157
       !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
   158
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   159
+    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
   160
 
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   161
     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
   162
       cmd->arg);
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   163
@@ -1229,6 +1231,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   164
   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
   165
     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
   166
     errno = EPERM;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   167
+    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
   168
     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
   169
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   170
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   171
@@ -1241,6 +1244,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   172
     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
   173
     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
   174
     errno = EACCES;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   175
+    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
   176
     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
   177
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   178
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   179
@@ -1264,6 +1268,7 @@
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   180
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   181
       /* 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
   182
       errno = EISDIR;
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   183
+      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
   184
       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
   185
     }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   186
   }
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   187
@@ -1282,6 +1287,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   188
     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
   189
     session.xfer.xfer_type = STOR_DEFAULT;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   190
     errno = EPERM;
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   191
+    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
   192
     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
   193
   }
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   194
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   195
@@ -1303,6 +1309,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   196
   /* 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
   197
   if (pr_table_add(cmd->notes, "mod_xfer.store-path",
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   198
       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
   199
+    cmd->error_code = errno;
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   200
     if (errno != EEXIST) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   201
       pr_log_pri(PR_LOG_NOTICE,
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   202
         "notice: error adding 'mod_xfer.store-path': %s", strerror(errno));
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   203
@@ -1323,6 +1330,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   204
       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
   205
         _("REST not compatible with server configuration"));
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   206
       errno = EINVAL;
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   207
+      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
   208
       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
   209
     }
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   210
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   211
@@ -1332,6 +1340,7 @@
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   212
       pr_response_add_err(R_550,
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   213
         _("APPE not compatible with server configuration"));
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   214
       errno = EINVAL;
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   215
+      cmd->error_code = EINVAL;
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   216
       return PR_ERROR(cmd);
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   217
     }
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   218
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   219
@@ -1398,6 +1407,7 @@
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   220
   stou_fd = mkstemp(filename);
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   221
   if (stou_fd < 0) {
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   222
     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
   223
+    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
   224
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   225
     pr_log_pri(PR_LOG_WARNING, "error: unable to use mkstemp(): %s",
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   226
       strerror(xerrno));
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   227
@@ -1426,6 +1436,7 @@
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   228
   if (filename == NULL ||
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   229
       !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
   230
     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
   231
+    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
   232
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   233
     /* 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
   234
      * an error.
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   235
@@ -1459,12 +1470,14 @@
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   236
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   237
     /* Deliberately use EISDIR for anything non-file (e.g. directories). */
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   238
     errno = EISDIR;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   239
+    cmd->error_code = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   240
     return PR_ERROR(cmd);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   241
   }
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   242
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   243
   /* Otherwise everthing is good */
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   244
   if (pr_table_add(cmd->notes, "mod_xfer.store-path",
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   245
       pstrdup(cmd->pool, filename), 0) < 0) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   246
+    cmd->error_code = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   247
     if (errno != EEXIST) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   248
       pr_log_pri(PR_LOG_NOTICE,
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   249
         "notice: error adding 'mod_xfer.store-path': %s", strerror(errno));
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   250
@@ -1499,6 +1512,8 @@
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   251
   perms = (0666 & ~mask);
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   252
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   253
   if (pr_fsio_chmod(cmd->arg, perms) < 0) {
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   254
+    cmd->error_code = errno;
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   255
+
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   256
     /* Not much to do but log the error. */
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   257
     pr_log_pri(PR_LOG_NOTICE, "error: unable to chmod '%s' to %04o: %s",
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   258
       cmd->arg, perms, strerror(errno));
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   259
@@ -1516,6 +1531,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   260
   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
   261
     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
   262
     errno = EPERM;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   263
+    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
   264
     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
   265
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   266
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   267
@@ -1586,6 +1602,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   268
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   269
     if (stor_fh) {
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   270
       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
   271
+        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
   272
         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
   273
           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
   274
         (void) pr_fsio_close(stor_fh);
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   275
@@ -1594,6 +1611,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   276
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   277
     } else {
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   278
       ferrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   279
+      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
   280
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   281
       (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
   282
         "error opening '%s': %s", cmd->argv[0], session.user,
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   283
@@ -1607,6 +1625,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   284
         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
   285
     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
   286
       ferrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   287
+      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
   288
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   289
       (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
   290
         "error opening '%s': %s", cmd->argv[0], session.user,
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   291
@@ -1620,11 +1639,13 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   292
     int xerrno = 0;
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
     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
   295
+      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
   296
       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
   297
         (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
   298
       xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   299
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   300
     } 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
   301
+      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
   302
       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
   303
         strerror(errno));
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   304
       xerrno = errno;
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   305
@@ -1761,6 +1782,7 @@
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   306
       pr_data_abort(EPERM, FALSE);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   307
       errno = EPERM;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   308
 #endif
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   309
+      cmd->error_code = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   310
       return PR_ERROR(cmd);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   311
     }
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   312
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   313
@@ -1772,6 +1794,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   314
     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
   315
     if (res != len) {
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   316
       int xerrno = EIO;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   317
+      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
   318
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   319
       if (res < 0)
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   320
         xerrno = errno;
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   321
@@ -1801,6 +1824,7 @@
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   322
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   323
     /* default abort errno, in case session.d et al has already gone away */
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   324
     int xerrno = ECONNABORTED;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   325
+    cmd->error_code = ECONNABORTED;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   326
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   327
     stor_abort();
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   328
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   329
@@ -1820,6 +1844,7 @@
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   330
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   331
     if (stor_complete() < 0) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   332
       int xerrno = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   333
+      cmd->error_code = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   334
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   335
       _log_transfer('i', 'i');
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   336
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   337
@@ -1832,12 +1857,14 @@
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   338
       if (xerrno == EDQUOT) {
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   339
         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
   340
         errno = xerrno;
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   341
+        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
   342
         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
   343
       }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   344
 #elif defined(EFBIG)
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   345
       if (xerrno == EFBIG) {
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   346
         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
   347
         errno = xerrno;
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   348
+        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
   349
         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
   350
       }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   351
 #endif
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   352
@@ -1851,6 +1878,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   353
         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
   354
       if (pr_fsio_rename(session.xfer.path_hidden, session.xfer.path) != 0) {
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   355
         int xerrno = errno;
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   356
+        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
   357
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   358
         /* 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
   359
          * or if STOR_APPEND is on and the permissions are squirrely.
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   360
@@ -1953,6 +1981,7 @@
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   361
     pr_response_add_err(R_500, _("'%s' not understood"),
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   362
       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
   363
     errno = EINVAL;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   364
+    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
   365
     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
   366
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   367
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   368
@@ -1962,6 +1991,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   369
   if (!dir ||
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   370
       !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
   371
     int xerrno = errno;
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   372
+    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
   373
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   374
     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
   375
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   376
@@ -1984,12 +2014,14 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   377
   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
   378
     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
   379
     errno = EPERM;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   380
+    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
   381
     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
   382
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   383
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   384
   fmode = file_mode(dir);
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   385
   if (fmode == 0) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   386
     int xerrno = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   387
+    cmd->error_code = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   388
 
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   389
     pr_response_add_err(R_550, "%s: %s", cmd->arg, strerror(xerrno));
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   390
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   391
@@ -2006,6 +2038,7 @@
2724
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   392
 
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   393
     /* 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
   394
     errno = EISDIR;
90c18e89db60 16191277 problem in SERVICE/FTP-SERVER
Tomas Klacko <tomas.klacko@oracle.com>
parents: 305
diff changeset
   395
+    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
   396
     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
   397
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   398
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   399
@@ -2020,12 +2053,14 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   400
       cmd->arg);
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   401
     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
   402
     errno = EPERM;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   403
+    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
   404
     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
   405
   }
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   406
 
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   407
   /* Otherwise everthing is good */
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   408
   if (pr_table_add(cmd->notes, "mod_xfer.retr-path",
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   409
       pstrdup(cmd->pool, dir), 0) < 0) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   410
+    cmd->error_code = errno;
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   411
     if (errno != EEXIST) {
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   412
       pr_log_pri(PR_LOG_NOTICE, "notice: error adding 'mod_xfer.retr-path': %s",
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   413
         strerror(errno));
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   414
@@ -2052,6 +2087,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   415
   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
   416
   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
   417
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   418
+    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
   419
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   420
     (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
   421
       "error opening '%s': %s", cmd->argv[0], session.user,
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   422
@@ -2065,6 +2101,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   423
   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
   424
     /* 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
   425
     int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   426
+    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
   427
     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
   428
     errno = xerrno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   429
 
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   430
@@ -2089,6 +2126,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   431
     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
   432
         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
   433
       int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   434
+      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
   435
       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
   436
       errno = xerrno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   437
       retr_fh = NULL;
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   438
@@ -2149,6 +2187,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   439
     retr_abort();
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   440
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   441
     /* 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
   442
+    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
   443
     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
   444
     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
   445
   }
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   446
@@ -2180,6 +2219,7 @@
305
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   447
        * 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
   448
        */
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   449
       int xerrno = errno;
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   450
+      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
   451
 
e95b65443448 PSARC 2011/088 Replace WU-ftpd with modern FTP server proftpd
Milan Jurik <Milan.Jurik@oracle.com>
parents:
diff changeset
   452
       retr_abort();
3224
589e0e82672d 18771389 Update proftpd to 1.3.5
Tomas Klacko <tomas.klacko@oracle.com>
parents: 2724
diff changeset
   453
       pr_data_abort(xerrno, FALSE);
5989
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   454
--- a/include/dirtree.h	2016-03-10 17:04:32.000000000 -0800
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   455
+++ proftpd-1.3.5b/include/dirtree.h	2016-04-01 02:00:13.315707095 -0700
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   456
@@ -127,6 +127,10 @@
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   457
 
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   458
   int cmd_id;			/* Index into commands list, for faster comparisons */
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   459
 
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   460
+  int error_code;		/* Stores errno of failed file transfer commands.
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   461
+				 * Required for Solaris auditing.
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   462
+				 */
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   463
+
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   464
   /* If we detect that the client sent commands for a protocol OTHER than
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   465
    * FTP, then this field will be FALSE; the protocol field will identify
d41cf9a8ea6f 23124279 ProFTPd: Update to 1.3.5b
Jiri Sasek <Jiri.Sasek@Oracle.COM>
parents: 4303
diff changeset
   466
    * the detected protocol.