]> git.saurik.com Git - apt.git/commitdiff
Add an options and timeout config item to ssh/rsh.
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:59:53 +0000 (16:59 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:59:53 +0000 (16:59 +0000)
Author: doogie
Date: 2002-11-09 23:33:26 GMT
Add an options and timeout config item to ssh/rsh.

debian/changelog
methods/rsh.cc
methods/rsh.h

index b86a0b1eadaab7125522438a7993762f59255560..bec05281c70990014a7a78c29a49bc222c629b95 100644 (file)
@@ -64,6 +64,7 @@ apt (0.5.5) unstable; urgency=low
   * Add -n synonym for --names-only for apt-cache.  Closes: #130689
   * Display both current version and new version in apt-get -s.  Closes:
     #92358
+  * Add an options and timeout config item to ssh/rsh.  Closes: #90654
 
  -- Jason Gunthorpe <jgg@debian.org>  Sun, 15 Sep 2002 17:16:59 -0600
 
index 619cd95084a4d8417d3979e016ad062a60e73368..29ddcdb2c4f39887c7ac604a9bf5c21dd28a3257 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: rsh.cc,v 1.4 2001/03/13 06:51:46 jgg Exp $
+// $Id: rsh.cc,v 1.5 2002/11/09 23:33:26 doogie Exp $
 /* ######################################################################
 
    RSH method - Transfer files via rsh compatible program
@@ -10,7 +10,7 @@
 
    ##################################################################### */
                                                                        /*}}}*/
-// Iclude Files                                                                /*{{{*/
+// Include Files                                                       /*{{{*/
 #include "rsh.h"
 #include <apt-pkg/error.h>
 
@@ -26,6 +26,7 @@
 
 const char *Prog;
 unsigned long TimeOut = 120;
+Configuration::Item const *RshOptions = 0;
 time_t RSHMethod::FailTime = 0;
 string RSHMethod::FailFile;
 int RSHMethod::FailFd = -1;
@@ -99,8 +100,8 @@ bool RSHConn::Connect(string Host, string User)
    // The child
    if (Process == 0)
    {
-      const char *Args[6];
-      int i = 0;
+      const char *Args[400];
+      unsigned int i = 0;
 
       dup2(Pipes[1],STDOUT_FILENO);
       dup2(Pipes[2],STDIN_FILENO);
@@ -108,6 +109,19 @@ bool RSHConn::Connect(string Host, string User)
       // Probably should do
       // dup2(open("/dev/null",O_RDONLY),STDERR_FILENO);
 
+      // Insert user-supplied command line options
+      Configuration::Item const *Opts = RshOptions;
+      if (Opts != 0)
+      {
+         Opts = Opts->Child;
+        for (; Opts != 0; Opts = Opts->Next)
+         {
+            if (Opts->Value.empty() == true)
+               continue;
+            Args[i++] = Opts->Value.c_str();
+         }
+      }
+
       Args[i++] = Prog;
       if (User.empty() == false) {
          Args[i++] = "-l";
@@ -338,7 +352,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
 // RSHMethod::RSHMethod - Constructor                                  /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-RSHMethod::RSHMethod() : pkgAcqMethod("1.0")
+RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig)
 {
    signal(SIGTERM,SigTerm);
    signal(SIGINT,SigTerm);
@@ -346,6 +360,23 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0")
    FailFd = -1;
 };
                                                                        /*}}}*/
+// RSHMethod::Configuration - Handle a configuration message           /*{{{*/
+// ---------------------------------------------------------------------
+bool RSHMethod::Configuration(string Message)
+{
+   char ProgStr[100];
+  
+   if (pkgAcqMethod::Configuration(Message) == false)
+      return false;
+
+   snprintf(ProgStr, sizeof ProgStr, "Acquire::%s::Timeout", Prog);
+   TimeOut = _config->FindI(ProgStr,TimeOut);
+   snprintf(ProgStr, sizeof ProgStr, "Acquire::%s::Options", Prog);
+   RshOptions = _config->Tree(ProgStr);
+
+   return true;
+}
+                                                                       /*}}}*/
 // RSHMethod::SigTerm - Clean up and timestamp the files on exit       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
index 1b3bcaea435a138f93fd44f568cf239e8f8f4ebb..bb97f062c118ca56ae508d95ad43c10ed1bdd26b 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
-// Description                                                         /*{{{*/// $Id: rsh.h,v 1.3 2001/03/06 07:15:29 jgg Exp $
-// $Id: rsh.h,v 1.3 2001/03/06 07:15:29 jgg Exp $
+// Description                                                         /*{{{*/// $Id: rsh.h,v 1.4 2002/11/09 23:33:26 doogie Exp $
+// $Id: rsh.h,v 1.4 2002/11/09 23:33:26 doogie Exp $
 /* ######################################################################
 
    RSH method - Transfer files via rsh compatible program
@@ -53,6 +53,7 @@ class RSHConn
 class RSHMethod : public pkgAcqMethod
 {
    virtual bool Fetch(FetchItem *Itm);
+   virtual bool Configuration(string Message);
 
    RSHConn *Server;