Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst Allow setting an empty base directory....



details:   https://anonhg.NetBSD.org/src/rev/8a81558c85cb
branches:  trunk
changeset: 748208:8a81558c85cb
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Oct 16 19:01:03 2009 +0000

description:
Allow setting an empty base directory. FTP server like tnftpd do not
allow ftp://foo//bar and similar URLs.

diffstat:

 distrib/utils/sysinst/net.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 99d22b3610e6 -r 8a81558c85cb distrib/utils/sysinst/net.c
--- a/distrib/utils/sysinst/net.c       Fri Oct 16 12:41:37 2009 +0000
+++ b/distrib/utils/sysinst/net.c       Fri Oct 16 19:01:03 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.122 2009/04/07 11:49:18 joerg Exp $  */
+/*     $NetBSD: net.c,v 1.123 2009/10/16 19:01:03 joerg Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -932,7 +932,7 @@
        const char *ftp_opt;
        char ftp_user_encoded[STRSIZE];
        char ftp_dir_encoded[STRSIZE];
-       char *cp;
+       char *cp, *set_dir2;
        int rval;
 
        /*
@@ -965,9 +965,14 @@
        cp = url_encode(ftp_dir_encoded, ftp.dir,
                        ftp_dir_encoded + sizeof ftp_dir_encoded - 1,
                        RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1);
-       if (set_dir[0] != '/')
+       if (cp != ftp_dir_encoded && cp[-1] != '/')
                *cp++ = '/';
-       url_encode(cp, set_dir,
+
+       set_dir2 = set_dir;
+       while (*set_dir2 == '/')
+               ++set_dir2;
+
+       url_encode(cp, set_dir2,
                        ftp_dir_encoded + sizeof ftp_dir_encoded,
                        RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 0);
 



Home | Main Index | Thread Index | Old Index