Dear wget maintainers,

Wget is a very useful utility for background downloading files, especially
over slow connections. Wget does also well support FTP downloading. However,
it cannot give the SITE GROUP <group> and SITE GPASS <password> commands,
which are used on some FTP servers to restrict anonymous users access to
particular files/directories via server-internal password authentication.
This makes impossible to download such files with restricted access with
wget even if you know your group/gpass.

Therefore, I'd ask you to include the support of these functionality into
wget. The patch against wget-1.6 is in the attachment. It affects several
rather local parts of ftp-basic.c (the new commands are implemented as an
optional part of the FTP authentication), init.c, main.c, options.h
(interpretation of the new options and the `wget --help` text), an update to
wget.texi and to the ru.po russian translation. Additionally, a small typo
in ru.po corrected, which lead to some part of the help listing left
untranslated.

The ChangeLog update might look so

2001-05-02  Georgy Salnikov  <[EMAIL PROTECTED]>

        * src/options.h,main.c,init.c,ftp-basic.c,doc/wget.texi,po/ru.po:
        SITE GROUP/SITE GPASS implementation for FTP.

Thanks in advance,
Georgy.
_______________________________________________________________________________

Georgy Salnikov
NMR Group
Novosibirsk Institute of Organic Chemistry
Lavrentjeva, 9, 630090 Novosibirsk, Russia
Tel.   +7-3832-341960   +7-3832-331456
Fax                     +7-3832-331456
Email   [EMAIL PROTECTED]
_______________________________________________________________________________
diff -Naur wget-1.6.orig/doc/wget.texi wget-1.6/doc/wget.texi
--- wget-1.6.orig/doc/wget.texi Sun Dec 31 11:35:58 2000
+++ wget-1.6/doc/wget.texi      Wed May  2 16:21:14 2001
@@ -837,6 +837,15 @@
 @section FTP Options
 
 @table @samp
+@cindex ftp group
+@cindex ftp gpass
+@cindex ftp site authentication
+@item --ftp-group=@var{group}
+@itemx --ftp-gpass=@var{password}
+Specify the group @var{group} and password @var{password} on an
+@sc{ftp} server.  Wget will send the appropriate @sc{site group} and
+@sc{site gpass} requests.
+
 @cindex symbolic links, retrieving
 @item --retr-symlinks
 Usually, when retrieving @sc{ftp} directories recursively and a symbolic
diff -Naur wget-1.6.orig/po/ru.po wget-1.6/po/ru.po
--- wget-1.6.orig/po/ru.po      Sun Dec 31 11:59:12 2000
+++ wget-1.6/po/ru.po   Wed May  2 16:21:22 2001
@@ -695,7 +695,7 @@
 "       --spider                 don't download anything.\n"
 "  -T,  --timeout=SECONDS        set the read timeout to SECONDS.\n"
 "  -w,  --wait=SECONDS           wait SECONDS between retrievals.\n"
-"       --waitretry=SECONDS\twait 1...SECONDS between retries of a "
+"       --waitretry=SECONDS      wait 1...SECONDS between retries of a "
 "retrieval.\n"
 "  -Y,  --proxy=on/off           turn proxy on or off.\n"
 "  -Q,  --quota=NUMBER           set retrieval quota to NUMBER.\n"
@@ -781,6 +781,8 @@
 #: src/main.c:174
 msgid ""
 "FTP options:\n"
+"       --ftp-group=GROUP send ftp command site group GROUP.\n"
+"       --ftp-gpass=GPASS send ftp command site gpass GPASS.\n"
 "       --retr-symlinks   when recursing, retrieve linked-to files (not "
 "dirs).\n"
 "  -g,  --glob=on/off     turn file name globbing on or off.\n"
@@ -788,6 +790,8 @@
 "\n"
 msgstr ""
 "��������� FTP:\n"
+"       --ftp-group=GROUP ���� FTP ������� ������� site group GROUP.\n"
+"       --ftp-gpass=GPASS ���� FTP ������� ������� site gpass GPASS.\n"
 "       --retr-symlinks   �������� �� FTP ������� ����� ������ ���������� "
 "������\n"
 "                         ��� �������� (������� �� ����������� � ���������).\n"
diff -Naur wget-1.6.orig/src/ftp-basic.c wget-1.6/src/ftp-basic.c
--- wget-1.6.orig/src/ftp-basic.c       Mon Dec 18 00:14:29 2000
+++ wget-1.6/src/ftp-basic.c    Wed May  2 16:21:14 2001
@@ -104,10 +104,12 @@
   if (opt.server_response)
     {
       /* Hack: don't print out password.  */
-      if (strncmp (res, "PASS", 4) != 0)
-       logprintf (LOG_ALWAYS, "--> %s\n", res);
-      else
+      if (strncmp (res, "PASS", 4) == 0)
        logputs (LOG_ALWAYS, "--> PASS Turtle Power!\n");
+      else if (strncmp (res, "SITE GPASS", 10) == 0)
+       logputs (LOG_ALWAYS, "--> SITE GPASS Turtle Power!\n");
+      else
+       logprintf (LOG_ALWAYS, "--> %s\n", res);
     }
   else
     DEBUGP (("\n--> %s\n", res));
@@ -229,6 +231,53 @@
       return FTPLOGINC;
     }
   free (respline);
+  if (opt.ftp_group && opt.ftp_gpass)
+    {
+      /* Send SITE GROUP group.  */
+      request = ftp_request ("SITE GROUP", opt.ftp_group);
+      nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
+      if (nwritten < 0)
+       {
+         free (request);
+         return WRITEFAILED;
+       }
+      free (request);
+      /* Get appropriate response.  */
+      err = ftp_response (rbuf, &respline);
+      if (err != FTPOK)
+       {
+         free (respline);
+         return err;
+       }
+      if (*respline != '2')
+       {
+         free (respline);
+         return FTPSRVERR;
+       }
+      free (respline);
+      /* Send SITE GPASS gpass.  */
+      request = ftp_request ("SITE GPASS", opt.ftp_gpass);
+      nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
+      if (nwritten < 0)
+       {
+         free (request);
+         return WRITEFAILED;
+       }
+      free (request);
+      /* Get appropriate response.  */
+      err = ftp_response (rbuf, &respline);
+      if (err != FTPOK)
+       {
+         free (respline);
+         return err;
+       }
+      if (*respline != '2')
+       {
+         free (respline);
+         return FTPLOGINC;
+       }
+      free (respline);
+    }
   /* All OK.  */
   return FTPOK;
 }
diff -Naur wget-1.6.orig/src/init.c wget-1.6/src/init.c
--- wget-1.6.orig/src/init.c    Mon Dec 18 01:28:19 2000
+++ wget-1.6/src/init.c Wed May  2 16:21:14 2001
@@ -117,6 +117,8 @@
   { "followftp",       &opt.follow_ftp,        cmd_boolean },
   { "followtags",      &opt.follow_tags,       cmd_vector },
   { "forcehtml",       &opt.force_html,        cmd_boolean },
+  { "ftpgpass",                &opt.ftp_gpass,         cmd_string },
+  { "ftpgroup",                &opt.ftp_group,         cmd_string },
   { "ftpproxy",                &opt.ftp_proxy,         cmd_string },
   { "glob",            &opt.ftp_glob,          cmd_boolean },
   { "header",          NULL,                   cmd_spec_header },
@@ -1004,4 +1006,6 @@
   FREE_MAYBE (opt.http_user);
   FREE_MAYBE (opt.http_passwd);
   FREE_MAYBE (opt.user_header);
+  FREE_MAYBE (opt.ftp_group);
+  FREE_MAYBE (opt.ftp_gpass);
 }
diff -Naur wget-1.6.orig/src/main.c wget-1.6/src/main.c
--- wget-1.6.orig/src/main.c    Sun Dec 31 10:05:18 2000
+++ wget-1.6/src/main.c Wed May  2 16:21:14 2001
@@ -174,6 +174,8 @@
   -U,  --user-agent=AGENT    identify as AGENT instead of Wget/VERSION.\n\
 \n"), _("\
 FTP options:\n\
+       --ftp-group=GROUP send ftp command site group GROUP.\n\
+       --ftp-gpass=GPASS send ftp command site gpass GPASS.\n\
        --retr-symlinks   when recursing, retrieve linked-to files (not dirs).\n\
   -g,  --glob=on/off     turn file name globbing on or off.\n\
        --passive-ftp     use the \"passive\" transfer mode.\n\
@@ -290,6 +292,8 @@
     { "use-proxy", required_argument, NULL, 'Y' },
     { "wait", required_argument, NULL, 'w' },
     { "waitretry", required_argument, NULL, 24 },
+    { "ftp-group", required_argument, NULL, 28 },
+    { "ftp-gpass", required_argument, NULL, 29 },
     { 0, 0, 0, 0 }
   };
 
@@ -483,6 +487,12 @@
          break;
        case 25:
          setval ("followtags", optarg);
+         break;
+       case 28:
+         setval ("ftpgroup", optarg);
+         break;
+       case 29:
+         setval ("ftpgpass", optarg);
          break;
        case 129:
          setval ("referer", optarg);
diff -Naur wget-1.6.orig/src/options.h wget-1.6/src/options.h
--- wget-1.6.orig/src/options.h Mon Dec 11 06:53:11 2000
+++ wget-1.6/src/options.h      Wed May  2 16:21:14 2001
@@ -152,6 +152,9 @@
                                   necessary to display a page properly. */
 
   struct sockaddr_in *bind_address; /* What local IP address to bind to. */
+
+  char *ftp_group;             /* FTP group. */
+  char *ftp_gpass;             /* FTP gpass. */
 };
 
 #ifndef OPTIONS_DEFINED_HERE

Reply via email to