MCPcopy Create free account
hub / github.com/apache/httpd / ftp_get_PWD

Function ftp_get_PWD

modules/proxy/mod_proxy_ftp.c:890–916  ·  view source on GitHub ↗

Return the current directory which we have selected on the FTP server, or NULL */

Source from the content-addressed store, hash-verified

888
889/* Return the current directory which we have selected on the FTP server, or NULL */
890static 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)

Callers 1

proxy_ftp_handlerFunction · 0.85

Calls 3

proxy_ftp_commandFunction · 0.85
ap_proxyerrorFunction · 0.85
ap_getword_confFunction · 0.85

Tested by

no test coverage detected