Fossil

Check-in [4473a27f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Further attempts to help the "ssh" sync protocol move past noisy motd comments and other extraneous login text, synchronize with the remote end, and start exchanging messages successfully.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4473a27f3b6e049e3c162e440e0e4c87daf9570c
User & Date: drh 2012-11-11 22:42:50
Context
2012-11-12
14:49
Added the --sshtrace command-line option that provides diagnostic output on the connection setup for all SSH sync traffic. Make the SSH connection setup pause waiting for responses, if the desired response is not obtained right away. check-in: 00cf858a user: drh tags: trunk
13:19
merge trunk check-in: aaa1cb04 user: jan.nijtmans tags: improve_commit_warning
13:17
merge trunk Closed-Leaf check-in: 2b63068b user: jan.nijtmans tags: ticket-fb3057f6ed
13:12
merge trunk check-in: b1beeb77 user: jan.nijtmans tags: convert_before_commit
2012-11-11
22:42
Further attempts to help the "ssh" sync protocol move past noisy motd comments and other extraneous login text, synchronize with the remote end, and start exchanging messages successfully. check-in: 4473a27f user: drh tags: trunk
17:59
Add the --binary-ok flag to the "fossil commit" command. Ticket [63cc656c9dfef126] check-in: 8c7faee6 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/http_transport.c.

108
109
110
111
112
113
114


115
116
117
118
119
120
121
...
153
154
155
156
157
158
159
160
161
162
163
164
165





166
167
168
169
170
171
172
173
174
    /* Only SSH requires a global initialization.  For SSH we need to create
    ** and run an SSH command to talk to the remote machine.
    */
    const char *zSsh;  /* The base SSH command */
    Blob zCmd;         /* The SSH command */
    char *zHost;       /* The host name to contact */
    char *zIn;         /* An input line received back from remote */



    zSsh = db_get("ssh-command", zDefaultSshCmd);
    blob_init(&zCmd, zSsh, -1);
    if( g.urlPort!=g.urlDfltPort ){
#ifdef __MINGW32__
      blob_appendf(&zCmd, " -P %d", g.urlPort);
#else
................................................................................
    free(zHost);
    popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
    if( sshPid==0 ){
      fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd);
    }
    blob_reset(&zCmd);

    /* Send an "echo" command to the other side to make sure that the
    ** connection is up and working.
    */
    fprintf(sshOut, "echo test\n");
    fflush(sshOut);
    zIn = fossil_malloc(16000);





    sshin_read(zIn, 16000);
    if( memcmp(zIn, "test", 4)!=0 ){
      pclose2(sshIn, sshOut, sshPid);
      fossil_fatal("ssh connection failed: [%s]", zIn);
    }
    fossil_free(zIn);
  }
}








>
>







 







|


|

|
>
>
>
>
>
|
|







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
    /* Only SSH requires a global initialization.  For SSH we need to create
    ** and run an SSH command to talk to the remote machine.
    */
    const char *zSsh;  /* The base SSH command */
    Blob zCmd;         /* The SSH command */
    char *zHost;       /* The host name to contact */
    char *zIn;         /* An input line received back from remote */
    unsigned iRandom;
    char zProbe[30]; 

    zSsh = db_get("ssh-command", zDefaultSshCmd);
    blob_init(&zCmd, zSsh, -1);
    if( g.urlPort!=g.urlDfltPort ){
#ifdef __MINGW32__
      blob_appendf(&zCmd, " -P %d", g.urlPort);
#else
................................................................................
    free(zHost);
    popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
    if( sshPid==0 ){
      fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd);
    }
    blob_reset(&zCmd);

    /* Send a couple of "echo" command to the other side to make sure that the
    ** connection is up and working.
    */
    fprintf(sshOut, "echo test1\n");
    fflush(sshOut);
    zIn = fossil_malloc(50000);
    sshin_read(zIn, 50000);
    sqlite3_randomness(sizeof(iRandom), &iRandom);
    sqlite3_snprintf(sizeof(zProbe), zProbe, "probe-%08x", iRandom);
    fprintf(sshOut, "echo %s\n", zProbe);
    fflush(sshOut);
    sshin_read(zIn, 500);
    if( memcmp(zIn, zProbe, 14)!=0 ){
      pclose2(sshIn, sshOut, sshPid);
      fossil_fatal("ssh connection failed: [%s]", zIn);
    }
    fossil_free(zIn);
  }
}