Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Needed coding style clean up that was missed. |
|---|---|
| Timelines: | family | ancestors | descendants | both | ssh-transport-changes |
| Files: | files | file ages | folders |
| SHA1: |
087cae847dbf0c7b0101b334688a2707 |
| User & Date: | amb 2013-07-18 07:28:40.639 |
Context
|
2013-07-23
| ||
| 07:23 | Start to address backwards compatibility for open fossils by prompting for missing password. check-in: 18caf358f0 user: amb tags: ssh-transport-changes | |
|
2013-07-20
| ||
| 08:40 | Alternative approach to allow multiple SSH users to share the same SSH account while maintaining separate Fossil identities. check-in: e3510cef23 user: amb tags: ssh-shared-account | |
|
2013-07-18
| ||
| 07:28 | Needed coding style clean up that was missed. check-in: 087cae847d user: amb tags: ssh-transport-changes | |
| 05:45 | Perhaps a bit premature at this point. Need additional feedback. check-in: 059f50864b user: amb tags: ssh-transport-changes | |
Changes
Changes to src/clone.c.
| ︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 |
rebuild_db(0, 1, 0);
fossil_print("project-id: %s\n", db_get("project-code", 0));
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
db_end_transaction(0);
}
void clone_ssh_options(void){
const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
const char *zSshCmd; /* SSH command string */
zSshFossilCmd = find_option("ssh-fossil","f",1);
if( zSshFossilCmd && zSshFossilCmd[0] ){
| > > > | | > > > > | | | | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
rebuild_db(0, 1, 0);
fossil_print("project-id: %s\n", db_get("project-code", 0));
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
db_end_transaction(0);
}
/*
** Look for SSH clone command line options and setup in globals.
*/
void clone_ssh_options(void){
const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
const char *zSshCmd; /* SSH command string */
zSshFossilCmd = find_option("ssh-fossil","f",1);
if( zSshFossilCmd && zSshFossilCmd[0] ){
g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
}
zSshCmd = find_option("ssh-command","c",1);
if( zSshCmd && zSshCmd[0] ){
g.zSshCmd = mprintf("%s", zSshCmd);
}
}
/*
** Set SSH options discovered in global variables (set from command line
** options). If not found, attempt to retrieve from database if present.
*/
void clone_ssh_db_options(void){
if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
db_set("ssh-fossil", g.zSshFossilCmd, 0);
}else{
g.zSshFossilCmd = db_get("ssh-fossil","fossil");
}
if( g.zSshCmd && g.zSshCmd[0] ){
db_set("ssh-command", g.zSshCmd, 0);
}
}
|
Changes to src/http_transport.c.
| ︙ | ︙ | |||
127 128 129 130 131 132 133 |
zHost = mprintf("%s@%s", g.urlUser, g.urlName);
#ifdef __MINGW32__
/* Only win32 (and specifically PLINK.EXE) support the -pw option */
if( g.urlPasswd && g.urlPasswd[0] ){
Blob pw;
blob_zero(&pw);
if( g.urlPasswd[0]=='*' ){
| | | | | | | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
zHost = mprintf("%s@%s", g.urlUser, g.urlName);
#ifdef __MINGW32__
/* Only win32 (and specifically PLINK.EXE) support the -pw option */
if( g.urlPasswd && g.urlPasswd[0] ){
Blob pw;
blob_zero(&pw);
if( g.urlPasswd[0]=='*' ){
char *zPrompt;
zPrompt = mprintf("Password for [%s]: ", zHost);
prompt_for_password(zPrompt, &pw, 0);
free(zPrompt);
}else{
blob_init(&pw, g.urlPasswd, -1);
}
blob_append(&zCmd, " -pw ", -1);
shell_escape(&zCmd, blob_str(&pw));
blob_reset(&pw);
fossil_print(" -pw ********"); /* Do not show the password text */
}
#endif
}else{
zHost = mprintf("%s", g.urlName);
}
n = blob_size(&zCmd);
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, zHost);
if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, mprintf("%s", g.zSshFossilCmd));
}else{
blob_append(&zCmd, " fossil", 7);
}
blob_append(&zCmd, " http", 5);
if( g.urlPath && g.urlPath[0] ){
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, mprintf("%s", g.urlPath));
|
| ︙ | ︙ | |||
465 466 467 468 469 470 471 472 |
}
i++;
}
if( g.fSshTrace ) printf("Got line: [%s]\n", &transport.pBuf[iStart]);
return &transport.pBuf[iStart];
}
void transport_global_shutdown(void){
| > > > > | > > > > | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
}
i++;
}
if( g.fSshTrace ) printf("Got line: [%s]\n", &transport.pBuf[iStart]);
return &transport.pBuf[iStart];
}
/*
** Global transport shutdown
*/
void transport_global_shutdown(void){
if( g.urlIsSsh ){
transport_ssh_close();
}
if( g.urlIsHttps ){
#ifdef FOSSIL_ENABLE_SSL
ssl_global_shutdown();
#endif
}else{
socket_global_shutdown();
}
}
/*
** Close SSH transport.
*/
void transport_ssh_close(void){
if( sshPid ){
/*printf("Closing SSH tunnel: ");*/
fflush(stdout);
pclose2(sshIn, sshOut, sshPid);
sshPid = 0;
}
}
|
Changes to src/main.c.
| ︙ | ︙ | |||
132 133 134 135 136 137 138 | int fSqlTrace; /* True if --sqltrace flag is present */ int fSqlStats; /* True if --sqltrace or --sqlstats are present */ int fSqlPrint; /* True if -sqlprint flag is present */ int fQuiet; /* True if -quiet flag is present */ int fHttpTrace; /* Trace outbound HTTP requests */ int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ int fSshTrace; /* Trace the SSH setup traffic */ | | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | int fSqlTrace; /* True if --sqltrace flag is present */ int fSqlStats; /* True if --sqltrace or --sqlstats are present */ int fSqlPrint; /* True if -sqlprint flag is present */ int fQuiet; /* True if -quiet flag is present */ int fHttpTrace; /* Trace outbound HTTP requests */ int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ int fSshTrace; /* Trace the SSH setup traffic */ char *zSshFossilCmd; /* Path to remoe fossil command for SSH */ char *zSshCmd; /* SSH command string */ int fNoSync; /* Do not do an autosync ever. --nosync */ char *zPath; /* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ char *zTop; /* Parent directory of zPath */ const char *zContentType; /* The content type of the input HTTP request */ int iErrPriority; /* Priority of current error message */ |
| ︙ | ︙ | |||
576 577 578 579 580 581 582 |
const char *zChdir = find_option("chdir",0,1);
g.isHTTP = 0;
g.fQuiet = find_option("quiet", 0, 0)!=0;
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
| | | | 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
const char *zChdir = find_option("chdir",0,1);
g.isHTTP = 0;
g.fQuiet = find_option("quiet", 0, 0)!=0;
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
g.zSshFossilCmd = 0;
g.zSshCmd = 0;
if( g.fSqlTrace ) g.fSqlStats = 1;
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
g.zLogin = find_option("user", "U", 1);
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
|
| ︙ | ︙ |