diff options
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | methods/rsh.cc | 41 | ||||
-rw-r--r-- | methods/rsh.h | 5 |
3 files changed, 40 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog index b86a0b1ea..bec05281c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/methods/rsh.cc b/methods/rsh.cc index 619cd9508..29ddcdb2c 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -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 /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/methods/rsh.h b/methods/rsh.h index 1b3bcaea4..bb97f062c 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -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; |