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

Bug#90654: improvements to rsh and ssh methods: config options



Package: apt
Version: 0.5.3
Severity: wishlist
Tags: patch

Adds Acquire::ssh|rsh::Options and Acquire::ssh|rsh::TimeOut
Options is a list:

Acquire::ssh::Options { "-obatchmode=yes"; "-q"; };


--- /tmp/zopa/apt-0.5.3/methods/rsh.cc	Wed Mar  7 23:20:43 2001
+++ rsh.cc	Thu Mar 22 01:26:39 2001
@@ -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 @@
    // 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);
@@ -109,6 +110,20 @@
       // dup2(open("/dev/null",O_RDONLY),STDERR_FILENO);
 
       Args[i++] = Prog;
+
+      // 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();
+         }
+      }
+
       if (User.empty() == false) {
          Args[i++] = "-l";
 	 Args[i++] = User.c_str();
@@ -338,13 +353,30 @@
 // RSHMethod::RSHMethod - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
-RSHMethod::RSHMethod() : pkgAcqMethod("1.0")
+RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig)
 {
    signal(SIGTERM,SigTerm);
    signal(SIGINT,SigTerm);
    Server = 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	/*{{{*/
 // ---------------------------------------------------------------------


--- /tmp/zopa/apt-0.5.3/methods/rsh.h	Wed Mar  7 23:20:43 2001
+++ rsh.h	Wed Mar 21 23:24:07 2001
@@ -53,6 +53,7 @@
 class RSHMethod : public pkgAcqMethod
 {
    virtual bool Fetch(FetchItem *Itm);
+   virtual bool Configuration(string Message);
 
    RSHConn *Server;
 


Versions of packages apt depends on:
ii  libc6                         2.2.2-1    GNU C Library: Shared libraries an
ii  libstdc++2.10-glibc2.2        1:2.95.3-8 The GNU stdc++ library            

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh



Reply to: