Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/distrib/utils/sysinst Pull up revs 1.39, 1.40 from the ...



details:   https://anonhg.NetBSD.org/src/rev/d4c59b7f780b
branches:  netbsd-1-4
changeset: 468113:d4c59b7f780b
user:      simonb <simonb%NetBSD.org@localhost>
date:      Wed Apr 07 23:39:53 1999 +0000

description:
Pull up revs 1.39, 1.40 from the trunk.  Removes single quotes at the
start and end of the FTP URL (there's no shell involved, so it doesn't
need quoting), and removes extra '/'s between the hostname and pathname
components of the FTP URL.

diffstat:

 distrib/utils/sysinst/net.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r e692154a73b2 -r d4c59b7f780b distrib/utils/sysinst/net.c
--- a/distrib/utils/sysinst/net.c       Wed Apr 07 23:27:22 1999 +0000
+++ b/distrib/utils/sysinst/net.c       Wed Apr 07 23:39:53 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.38 1999/03/19 14:49:07 perry Exp $   */
+/*     $NetBSD: net.c,v 1.38.2.1 1999/04/07 23:39:53 simonb Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -100,6 +100,10 @@
  *      and reserved characters used for their reserved purposes may be
  *      used unencoded within a URL.
  *
+ * The encoded URL _does_not_ start with a '/'.  A '/' is inserted
+ * between the hostname and the pathname components when the complete
+ * URL is constructed.
+ *
  */
 
 #define RFC1738_SAFE                           "$-_.+!*'(),"
@@ -114,6 +118,9 @@
 
        if (safe_chars == NULL)
                safe_chars = "";
+       /* Remove any initial '/'s if present */
+       while (*src == '/')
+               src++;
        while (--len > 0 && *src != '\0') {
                if (isalnum(*src) || strchr(safe_chars, *src)) {
                        *p++ = *src++;
@@ -412,20 +419,16 @@
                 * "@", ":" and "/" need quoting).  Let's be
                 * paranoid and also encode ftp_user and ftp_dir.  (For
                 * example, ftp_dir could easily contain '~', which is
-                * unsafe by a strict reading of RFC 1738).  There's
-                * no need to encode the ftp_host or filename parts
-                * of the URL for consumption by ftp, but we may need
-                * to protect them from the shell, so we wrap the
-                * whole URL in quotes for the shell.
+                * unsafe by a strict reading of RFC 1738).
                 */
                if (strcmp ("ftp", ftp_user) == 0)
-                       ret = run_prog(0, 1, "/usr/bin/ftp -a 'ftp://%s/%s/%s'",
+                       ret = run_prog(0, 1, "/usr/bin/ftp -a ftp://%s/%s/%s";,
                            ftp_host,
                            url_encode(ftp_dir_encoded, ftp_dir, STRSIZE,
                                        RFC1738_SAFE_LESS_SHELL_PLUS_SLASH),
                            filename);
                else {
-                       ret = run_prog(0, 1, "/usr/bin/ftp 'ftp://%s:%s@%s/%s/%s'",
+                       ret = run_prog(0, 1, "/usr/bin/ftp ftp://%s:%s@%s/%s/%s";,
                            url_encode(ftp_user_encoded, ftp_user, STRSIZE,
                                        RFC1738_SAFE_LESS_SHELL),
                            url_encode(ftp_pass_encoded, ftp_pass, STRSIZE,



Home | Main Index | Thread Index | Old Index