Fossil SCM
Seems to fix it.. will try on the real conditions..
Commit
e8fac25a20c840f62f672cf205c11546255cc475
Parent
5d00d241f78610c…
1 file changed
+12
-32
+12
-32
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -92,15 +92,11 @@ | ||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /* |
| 95 | 95 | ** Default SSH command |
| 96 | 96 | */ |
| 97 | -#ifdef __MINGW32__ | |
| 98 | -static char zDefaultSshCmd[] = "ssh -T"; | |
| 99 | -#else | |
| 100 | -static char zDefaultSshCmd[] = "ssh -e none -T"; | |
| 101 | -#endif | |
| 97 | +static char zDefaultSshCmd[] = "ssh"; | |
| 102 | 98 | |
| 103 | 99 | /* |
| 104 | 100 | ** Global initialization of the transport layer |
| 105 | 101 | */ |
| 106 | 102 | void transport_global_startup(void){ |
| @@ -149,33 +145,25 @@ | ||
| 149 | 145 | } |
| 150 | 146 | blob_append(&zCmd, " ", 1); |
| 151 | 147 | shell_escape(&zCmd, zHost); |
| 152 | 148 | fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ |
| 153 | 149 | free(zHost); |
| 150 | + | |
| 151 | + /* Append fossil test-http command directly during the invocation of ssh, | |
| 152 | + ** to make sure no output from shell or login will pollute the sshIn pipe. | |
| 153 | + */ | |
| 154 | + blob_append(&zCmd, " \"", 2); | |
| 155 | + shell_escape(&zCmd, g.urlFossil); | |
| 156 | + blob_append(&zCmd, " test-http ", -1); | |
| 157 | + shell_escape(&zCmd, g.urlPath); | |
| 158 | + blob_append(&zCmd, "\"", 1); | |
| 159 | + | |
| 154 | 160 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 155 | 161 | if( sshPid==0 ){ |
| 156 | 162 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 157 | 163 | } |
| 158 | 164 | blob_reset(&zCmd); |
| 159 | - | |
| 160 | - /* Send an "echo" command to the other side to make sure that the | |
| 161 | - ** connection is up and working. | |
| 162 | - */ | |
| 163 | - zIn = fossil_malloc(16000); | |
| 164 | - fprintf(sshOut, "echo toto\n"); | |
| 165 | - fflush(sshOut); | |
| 166 | - usleep(2000000); | |
| 167 | - sshin_read(zIn, 16000); | |
| 168 | - fossil_print("Second Read: [%s]\n", zIn); | |
| 169 | - fprintf(sshOut, "echo test\n"); | |
| 170 | - fflush(sshOut); | |
| 171 | - sshin_read(zIn, 16000); | |
| 172 | - if( memcmp(zIn, "test", 4)!=0 ){ | |
| 173 | - pclose2(sshIn, sshOut, sshPid); | |
| 174 | - fossil_fatal("ssh connection failed: [%s]", zIn); | |
| 175 | - } | |
| 176 | - fossil_free(zIn); | |
| 177 | 165 | } |
| 178 | 166 | } |
| 179 | 167 | |
| 180 | 168 | /* |
| 181 | 169 | ** Open a connection to the server. The server is defined by the following |
| @@ -189,19 +177,11 @@ | ||
| 189 | 177 | */ |
| 190 | 178 | int transport_open(void){ |
| 191 | 179 | int rc = 0; |
| 192 | 180 | if( transport.isOpen==0 ){ |
| 193 | 181 | if( g.urlIsSsh ){ |
| 194 | - Blob cmd; | |
| 195 | - blob_zero(&cmd); | |
| 196 | - shell_escape(&cmd, g.urlFossil); | |
| 197 | - blob_append(&cmd, " test-http ", -1); | |
| 198 | - shell_escape(&cmd, g.urlPath); | |
| 199 | - /* printf("%s\n", blob_str(&cmd)); fflush(stdout); */ | |
| 200 | - fprintf(sshOut, "%s\n", blob_str(&cmd)); | |
| 201 | - fflush(sshOut); | |
| 202 | - blob_reset(&cmd); | |
| 182 | + transport.isOpen = 1; | |
| 203 | 183 | }else if( g.urlIsHttps ){ |
| 204 | 184 | #ifdef FOSSIL_ENABLE_SSL |
| 205 | 185 | rc = ssl_open(); |
| 206 | 186 | if( rc==0 ) transport.isOpen = 1; |
| 207 | 187 | #else |
| 208 | 188 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -92,15 +92,11 @@ | |
| 92 | } |
| 93 | |
| 94 | /* |
| 95 | ** Default SSH command |
| 96 | */ |
| 97 | #ifdef __MINGW32__ |
| 98 | static char zDefaultSshCmd[] = "ssh -T"; |
| 99 | #else |
| 100 | static char zDefaultSshCmd[] = "ssh -e none -T"; |
| 101 | #endif |
| 102 | |
| 103 | /* |
| 104 | ** Global initialization of the transport layer |
| 105 | */ |
| 106 | void transport_global_startup(void){ |
| @@ -149,33 +145,25 @@ | |
| 149 | } |
| 150 | blob_append(&zCmd, " ", 1); |
| 151 | shell_escape(&zCmd, zHost); |
| 152 | fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ |
| 153 | free(zHost); |
| 154 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 155 | if( sshPid==0 ){ |
| 156 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 157 | } |
| 158 | blob_reset(&zCmd); |
| 159 | |
| 160 | /* Send an "echo" command to the other side to make sure that the |
| 161 | ** connection is up and working. |
| 162 | */ |
| 163 | zIn = fossil_malloc(16000); |
| 164 | fprintf(sshOut, "echo toto\n"); |
| 165 | fflush(sshOut); |
| 166 | usleep(2000000); |
| 167 | sshin_read(zIn, 16000); |
| 168 | fossil_print("Second Read: [%s]\n", zIn); |
| 169 | fprintf(sshOut, "echo test\n"); |
| 170 | fflush(sshOut); |
| 171 | sshin_read(zIn, 16000); |
| 172 | if( memcmp(zIn, "test", 4)!=0 ){ |
| 173 | pclose2(sshIn, sshOut, sshPid); |
| 174 | fossil_fatal("ssh connection failed: [%s]", zIn); |
| 175 | } |
| 176 | fossil_free(zIn); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /* |
| 181 | ** Open a connection to the server. The server is defined by the following |
| @@ -189,19 +177,11 @@ | |
| 189 | */ |
| 190 | int transport_open(void){ |
| 191 | int rc = 0; |
| 192 | if( transport.isOpen==0 ){ |
| 193 | if( g.urlIsSsh ){ |
| 194 | Blob cmd; |
| 195 | blob_zero(&cmd); |
| 196 | shell_escape(&cmd, g.urlFossil); |
| 197 | blob_append(&cmd, " test-http ", -1); |
| 198 | shell_escape(&cmd, g.urlPath); |
| 199 | /* printf("%s\n", blob_str(&cmd)); fflush(stdout); */ |
| 200 | fprintf(sshOut, "%s\n", blob_str(&cmd)); |
| 201 | fflush(sshOut); |
| 202 | blob_reset(&cmd); |
| 203 | }else if( g.urlIsHttps ){ |
| 204 | #ifdef FOSSIL_ENABLE_SSL |
| 205 | rc = ssl_open(); |
| 206 | if( rc==0 ) transport.isOpen = 1; |
| 207 | #else |
| 208 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -92,15 +92,11 @@ | |
| 92 | } |
| 93 | |
| 94 | /* |
| 95 | ** Default SSH command |
| 96 | */ |
| 97 | static char zDefaultSshCmd[] = "ssh"; |
| 98 | |
| 99 | /* |
| 100 | ** Global initialization of the transport layer |
| 101 | */ |
| 102 | void transport_global_startup(void){ |
| @@ -149,33 +145,25 @@ | |
| 145 | } |
| 146 | blob_append(&zCmd, " ", 1); |
| 147 | shell_escape(&zCmd, zHost); |
| 148 | fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ |
| 149 | free(zHost); |
| 150 | |
| 151 | /* Append fossil test-http command directly during the invocation of ssh, |
| 152 | ** to make sure no output from shell or login will pollute the sshIn pipe. |
| 153 | */ |
| 154 | blob_append(&zCmd, " \"", 2); |
| 155 | shell_escape(&zCmd, g.urlFossil); |
| 156 | blob_append(&zCmd, " test-http ", -1); |
| 157 | shell_escape(&zCmd, g.urlPath); |
| 158 | blob_append(&zCmd, "\"", 1); |
| 159 | |
| 160 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 161 | if( sshPid==0 ){ |
| 162 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 163 | } |
| 164 | blob_reset(&zCmd); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | ** Open a connection to the server. The server is defined by the following |
| @@ -189,19 +177,11 @@ | |
| 177 | */ |
| 178 | int transport_open(void){ |
| 179 | int rc = 0; |
| 180 | if( transport.isOpen==0 ){ |
| 181 | if( g.urlIsSsh ){ |
| 182 | transport.isOpen = 1; |
| 183 | }else if( g.urlIsHttps ){ |
| 184 | #ifdef FOSSIL_ENABLE_SSL |
| 185 | rc = ssl_open(); |
| 186 | if( rc==0 ) transport.isOpen = 1; |
| 187 | #else |
| 188 |