bug-cvs
[Top][All Lists]
Advanced

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

Patch: Wrong order of arguments to HP remsh when using :ext: with userna


From: Martin Jost
Subject: Patch: Wrong order of arguments to HP remsh when using :ext: with username
Date: Fri, 8 Oct 2004 15:40:34 +0200

Hello,

I found a problem with when using cvs (1.12.9) with ':ext: and HPUX 'remsh'.

In src/rsh-client.c the command send to RSH is build with '-l'-Option (for 
username) first, then the server name.
Unfortunately remsh on HPUX insists on getting the hostname _first_, then the 
options !
--------------------- man remsh: ---------------
NAME
      remsh - execute from a remote shell

 SYNOPSIS
      remsh host [-l username] [-n] command
-------------------------------------------------


So I included a patch in my cvs to swap the order, if cvs_rsh ends with 'remsh'.

(I didn't want to change the order in all cases, so not to break other systems;

OTOH I also included the patch in the  START_RSH_WITH_POPEN_RW-branch - this 
might not be needed)

Find below my proposed ChangeLog and my patch (against 1.12.9)

I tested this successful with my configuration and different settings for 
CVS_RSH.

I'm afraid a testcase is somewhat useless, because the test would need a 
HPUX-system with remsh...

Please contact me, if you need other details, other formats ....

Martin



Proposed Changelog-entry:

------------------- snip, snip ------------------------------------

2004-10-08 Martin Jost <address@hidden>

* Added code to generate correct cmdline for 'remsh' (HPUX) in rsh-client.c 

(remsh wants the hostname first)

------------------- snip, snip ------------------------------------



Patch to rsh_client.c (based on cvs1.12.9)

------------------- snip, snip ------------------------------------

--- rsh-client.c 2004/10/08 12:19:13 1.1

+++ rsh-client.c 2004/10/08 13:09:47

@@ -54,6 +54,9 @@

"cmd (w/ args)", and NULL. We leave some room to grow. */

char *rsh_argv[10];


+ char is_remsh; /* true, if cvs_rsh is a remsh (HPUX) */

+ char *pstr;

+

if (!cvs_rsh)

/* People sometimes suggest or assume that this should default

to "remsh" on systems like HPUX in which that is the

@@ -79,6 +82,25 @@

if (!cvs_server)

cvs_server = "cvs";


+

+ pstr = strrstr(cvs_rsh, "remsh");

+ if (pstr == NULL)

+ {

+ is_remsh= 0;

+ }

+ else

+ {

+ /* Does the string _end_ with 'remsh' ? */

+ if (pstr - cvs_rsh + strlen("remsh") == strlen(cvs_rsh))

+ {

+ is_remsh = 1;

+ }

+ else

+ {

+ is_remsh = 0;

+ }

+ }

+

/* The command line starts out with rsh. */

rsh_argv[i++] = cvs_rsh;


@@ -87,14 +109,24 @@

rsh_argv[i++] = "-b";

# endif /* RSH_NEEDS_BINARY_FLAG */


+ /* remsh wants Hostname as first arg ! */

+ if (is_remsh)

+ {

+ rsh_argv[i++] = root->hostname;

+ }

+

/* Then we strcat more things on the end one by one. */

if (root->username != NULL)

{

- rsh_argv[i++] = "-l";

- rsh_argv[i++] = root->username;

+ rsh_argv[i++] = "-l";

+ rsh_argv[i++] = root->username;

+ }

+

+ if (!is_remsh)

+ {

+ rsh_argv[i++] = root->hostname;

}


- rsh_argv[i++] = root->hostname;

rsh_argv[i++] = cvs_server;

rsh_argv[i++] = "server";


@@ -132,11 +164,34 @@

int tofd, fromfd;

int child_pid;


+ char is_remsh; /* true, if cvs_rsh is a remsh (HPUX) */

+ char *pstr;

+

+

if (!cvs_rsh)

cvs_rsh = RSH_DFLT;

if (!cvs_server)

cvs_server = "cvs";


+ pstr = strrstr(cvs_rsh, "remsh");

+ if (pstr == NULL)

+ {

+ is_remsh= 0;

+ }

+ else

+ {

+ /* Does the string _end_ with 'remsh' ? */

+ if (pstr - cvs_rsh + strlen("remsh") == strlen(cvs_rsh))

+ {

+ is_remsh = 1;

+ }

+ else

+ {

+ is_remsh = 0;

+ }

+ }

+

+

/* Pass the command to rsh as a single string. This shouldn't

affect most rsh servers at all, and will pacify some buggy

versions of rsh that grab switches out of the middle of the

@@ -155,6 +210,13 @@


*p++ = cvs_rsh;


+ /* remsh wants Hostname as first arg ! */

+ if (is_remsh)

+ {

+ *p++ = root->hostname;

+ }

+

+

/* If the login names differ between client and server

* pass it on to rsh.

*/

@@ -164,7 +226,11 @@

*p++ = root->username;

}


- *p++ = root->hostname;

+ if (!is_remsh)

+ {

+ *p++ = root->hostname;

+ }

+

*p++ = command;

*p++ = NULL;


------------------- snip, snip ------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]