chuck 97/02/19 22:43:57
Modified: src/modules/proxy proxy_ftp.c Log: Changed send_dir() to remove user/passwd from displayed URL. Changed login error messages to be more descriptive. Removed extraneous Explain() calls. Resolution of PR #123. Revision Changes Path 1.10 +12 -5 apache/src/modules/proxy/proxy_ftp.c Index: proxy_ftp.c =================================================================== RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_ftp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C3 -r1.9 -r1.10 *** proxy_ftp.c 1997/02/20 04:14:44 1.9 --- proxy_ftp.c 1997/02/20 06:43:54 1.10 *************** *** 189,196 **** else status = 100 * linebuff[0] + 10 * linebuff[1] + linebuff[2] - 111 * '0'; - Explain1("FTP: ftp_getrc() status = %d", status); - if (linebuff[len-1] != '\n') { i = bskiplf(f); --- 189,194 ---- *************** *** 221,232 **** char buf[IOBUFSIZE]; char buf2[IOBUFSIZE]; char *filename; char urlptr[HUGE_STRING_LEN]; long total_bytes_sent; register int n, o, w; conn_rec *con = r->connection; ! ap_snprintf(buf, sizeof(buf), "<HTML><HEAD><TITLE>%s</TITLE></HEAD><BODY><H1>Directory %s</H1><HR><PRE>", url, url); bwrite(con->client, buf, strlen(buf)); if (f2 != NULL) bwrite(f2, buf, strlen(buf)); total_bytes_sent=strlen(buf); --- 219,238 ---- char buf[IOBUFSIZE]; char buf2[IOBUFSIZE]; char *filename; + char *tempurl; char urlptr[HUGE_STRING_LEN]; long total_bytes_sent; register int n, o, w; conn_rec *con = r->connection; ! tempurl = pstrdup(r->pool, url); ! if ((n = strcspn(tempurl, "@")) != strlen(tempurl)) /* hide user/passwd */ ! { ! bcopy(tempurl, tempurl + (n - 5), 6); ! tempurl += n - 5; /* leave room for ftp:// */ ! } ! ! ap_snprintf(buf, sizeof(buf), "<HTML><HEAD><TITLE>%s</TITLE></HEAD><BODY><H1>Directory %s</H1><HR><PRE>", tempurl, tempurl); bwrite(con->client, buf, strlen(buf)); if (f2 != NULL) bwrite(f2, buf, strlen(buf)); total_bytes_sent=strlen(buf); *************** *** 480,486 **** i = ftp_getrc(f); Explain1("FTP: returned status %d",i); if (i == -1) return proxyerror(r, "Error sending to remote server"); ! if (i == 530) return FORBIDDEN; else if (i != 230 && i != 331) return BAD_GATEWAY; if (i == 331) /* send password */ --- 486,492 ---- i = ftp_getrc(f); Explain1("FTP: returned status %d",i); if (i == -1) return proxyerror(r, "Error sending to remote server"); ! if (i == 530) return proxyerror(r, "Not logged in"); else if (i != 230 && i != 331) return BAD_GATEWAY; if (i == 331) /* send password */ *************** *** 495,501 **** i = ftp_getrc(f); Explain1("FTP: returned status %d",i); if (i == -1) return proxyerror(r, "Error sending to remote server"); ! if (i == 332 || i == 530) return FORBIDDEN; else if (i != 230 && i != 202) return BAD_GATEWAY; } --- 501,508 ---- i = ftp_getrc(f); Explain1("FTP: returned status %d",i); if (i == -1) return proxyerror(r, "Error sending to remote server"); ! if (i == 332) return proxyerror(r, "Need account for login"); ! else if (i == 530) return proxyerror(r, "Not logged in"); else if (i != 230 && i != 202) return BAD_GATEWAY; }