Fossil SCM

Only print SSH command string if --sshtrace is enabled.

amb 2013-09-10 02:49 ssh-transport-changes
Commit 0088ab83f64faf33ed0a40ec1d9032a57340e05b
1 file changed +2 -4
--- src/http_transport.c
+++ src/http_transport.c
@@ -90,11 +90,10 @@
9090
*/
9191
int transport_ssh_open(void){
9292
/* For SSH we need to create and run SSH fossil http
9393
** to talk to the remote machine.
9494
*/
95
- static int fPrintSshCmd = 1; /* Print SSH command only once */
9695
const char *zSsh; /* The base SSH command */
9796
Blob zCmd; /* The SSH command */
9897
char *zHost; /* The host name to contact */
9998
int n; /* Size of prefix string */
10099
@@ -106,11 +105,11 @@
106105
blob_appendf(&zCmd, " -P %d", g.urlPort);
107106
#else
108107
blob_appendf(&zCmd, " -p %d", g.urlPort);
109108
#endif
110109
}
111
- if( fPrintSshCmd ){
110
+ if( g.fSshTrace ){
112111
fossil_force_newline();
113112
fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
114113
}
115114
if( g.urlUser && g.urlUser[0] ){
116115
zHost = mprintf("%s@%s", g.urlUser, g.urlName);
@@ -125,13 +124,12 @@
125124
blob_append(&zCmd, " test-http", 10);
126125
if( g.urlPath && g.urlPath[0] ){
127126
blob_append(&zCmd, " ", 1);
128127
shell_escape(&zCmd, mprintf("%s", g.urlPath));
129128
}
130
- if( fPrintSshCmd ){
129
+ if( g.fSshTrace ){
131130
fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
132
- fPrintSshCmd = 0;
133131
}
134132
free(zHost);
135133
popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
136134
if( sshPid==0 ){
137135
socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
138136
--- src/http_transport.c
+++ src/http_transport.c
@@ -90,11 +90,10 @@
90 */
91 int transport_ssh_open(void){
92 /* For SSH we need to create and run SSH fossil http
93 ** to talk to the remote machine.
94 */
95 static int fPrintSshCmd = 1; /* Print SSH command only once */
96 const char *zSsh; /* The base SSH command */
97 Blob zCmd; /* The SSH command */
98 char *zHost; /* The host name to contact */
99 int n; /* Size of prefix string */
100
@@ -106,11 +105,11 @@
106 blob_appendf(&zCmd, " -P %d", g.urlPort);
107 #else
108 blob_appendf(&zCmd, " -p %d", g.urlPort);
109 #endif
110 }
111 if( fPrintSshCmd ){
112 fossil_force_newline();
113 fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
114 }
115 if( g.urlUser && g.urlUser[0] ){
116 zHost = mprintf("%s@%s", g.urlUser, g.urlName);
@@ -125,13 +124,12 @@
125 blob_append(&zCmd, " test-http", 10);
126 if( g.urlPath && g.urlPath[0] ){
127 blob_append(&zCmd, " ", 1);
128 shell_escape(&zCmd, mprintf("%s", g.urlPath));
129 }
130 if( fPrintSshCmd ){
131 fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
132 fPrintSshCmd = 0;
133 }
134 free(zHost);
135 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
136 if( sshPid==0 ){
137 socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
138
--- src/http_transport.c
+++ src/http_transport.c
@@ -90,11 +90,10 @@
90 */
91 int transport_ssh_open(void){
92 /* For SSH we need to create and run SSH fossil http
93 ** to talk to the remote machine.
94 */
 
95 const char *zSsh; /* The base SSH command */
96 Blob zCmd; /* The SSH command */
97 char *zHost; /* The host name to contact */
98 int n; /* Size of prefix string */
99
@@ -106,11 +105,11 @@
105 blob_appendf(&zCmd, " -P %d", g.urlPort);
106 #else
107 blob_appendf(&zCmd, " -p %d", g.urlPort);
108 #endif
109 }
110 if( g.fSshTrace ){
111 fossil_force_newline();
112 fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
113 }
114 if( g.urlUser && g.urlUser[0] ){
115 zHost = mprintf("%s@%s", g.urlUser, g.urlName);
@@ -125,13 +124,12 @@
124 blob_append(&zCmd, " test-http", 10);
125 if( g.urlPath && g.urlPath[0] ){
126 blob_append(&zCmd, " ", 1);
127 shell_escape(&zCmd, mprintf("%s", g.urlPath));
128 }
129 if( g.fSshTrace ){
130 fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
 
131 }
132 free(zHost);
133 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
134 if( sshPid==0 ){
135 socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
136

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button