Return the current directory which we have selected on the FTP server, or NULL */
| 888 | |
| 889 | /* Return the current directory which we have selected on the FTP server, or NULL */ |
| 890 | static char *ftp_get_PWD(request_rec *r, conn_rec *ftp_ctrl, apr_bucket_brigade *bb) |
| 891 | { |
| 892 | char *cwd = NULL; |
| 893 | char *ftpmessage = NULL; |
| 894 | |
| 895 | /* responses: 257, 500, 501, 502, 421, 550 */ |
| 896 | /* 257 "<directory-name>" <commentary> */ |
| 897 | /* 421 Service not available, closing control connection. */ |
| 898 | /* 500 Syntax error, command unrecognized. */ |
| 899 | /* 501 Syntax error in parameters or arguments. */ |
| 900 | /* 502 Command not implemented. */ |
| 901 | /* 550 Requested action not taken. */ |
| 902 | switch (proxy_ftp_command("PWD" CRLF, r, ftp_ctrl, bb, &ftpmessage)) { |
| 903 | case -1: |
| 904 | case 421: |
| 905 | case 550: |
| 906 | ap_proxyerror(r, HTTP_BAD_GATEWAY, |
| 907 | "Failed to read PWD on ftp server"); |
| 908 | break; |
| 909 | |
| 910 | case 257: { |
| 911 | const char *dirp = ftpmessage; |
| 912 | cwd = ap_getword_conf(r->pool, &dirp); |
| 913 | } |
| 914 | } |
| 915 | return cwd; |
| 916 | } |
| 917 | |
| 918 | |
| 919 | /* Common routine for failed authorization (i.e., missing or wrong password) |
no test coverage detected