Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Reimplement the default test-http behavior while retaining the ability to use http to take advantage of Fossil capabilities with SSH URLs. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | ssh-test-http |
| Files: | files | file ages | folders |
| SHA1: |
7c9347f9c70db96454a70963950012d9 |
| User & Date: | andybradford 2013-08-09 07:29:19.625 |
Context
|
2013-08-09
| ||
| 07:49 | Fix logic so ignoring login requirement only affects ssh:// URLs. check-in: 9284bfb157 user: andybradford tags: ssh-test-http | |
| 07:29 | Reimplement the default test-http behavior while retaining the ability to use http to take advantage of Fossil capabilities with SSH URLs. check-in: 7c9347f9c7 user: andybradford tags: ssh-test-http | |
| 07:23 | Avoid zombies on client side by waiting for children. This can happen when there are a large number of changes to transmit. Closed-Leaf check-in: 308f52a63a user: andybradford tags: ssh-shared-account | |
Changes
Changes to src/clone.c.
| ︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
** Options:
** --admin-user|-A USERNAME Make USERNAME the administrator
** --private Also clone private branches
** --ssl-identity=filename Use the SSL identity if requested by the server
** --ssh-fossil|-f /fossil Use this path as remote fossil command
** --ssh-command|-c 'command' Use this SSH command
** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
**
** See also: init
*/
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
int nErr = 0;
| > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
** Options:
** --admin-user|-A USERNAME Make USERNAME the administrator
** --private Also clone private branches
** --ssl-identity=filename Use the SSL identity if requested by the server
** --ssh-fossil|-f /fossil Use this path as remote fossil command
** --ssh-command|-c 'command' Use this SSH command
** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
** --ssh-use-http|-h Enable http instead of test-http
**
** See also: init
*/
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
int nErr = 0;
|
| ︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
if( zSshCmd && zSshCmd[0] ){
g.zSshCmd = mprintf("%s", zSshCmd);
}
zFossilUser = find_option("ssh-fossil-user","l",1);
if( zFossilUser && zFossilUser[0] ){
g.zFossilUser = mprintf("%s", zFossilUser);
}
}
/*
** Set SSH options discovered in global variables (set from command line
** options).
*/
void clone_ssh_db_set_options(void){
if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
db_set("ssh-fossil", g.zSshFossilCmd, 0);
}
if( g.zSshCmd && g.zSshCmd[0] ){
db_set("ssh-command", g.zSshCmd, 0);
}
if( g.zFossilUser && g.zFossilUser[0] ){
db_set("ssh-fossil-user", g.zFossilUser, 0);
}
| > > > | > | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
if( zSshCmd && zSshCmd[0] ){
g.zSshCmd = mprintf("%s", zSshCmd);
}
zFossilUser = find_option("ssh-fossil-user","l",1);
if( zFossilUser && zFossilUser[0] ){
g.zFossilUser = mprintf("%s", zFossilUser);
}
g.fSshUseHttp = find_option("ssh-use-http","h",0)!=0;
}
/*
** Set SSH options discovered in global variables (set from command line
** options).
*/
void clone_ssh_db_set_options(void){
if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
db_set("ssh-fossil", g.zSshFossilCmd, 0);
}
if( g.zSshCmd && g.zSshCmd[0] ){
db_set("ssh-command", g.zSshCmd, 0);
}
if( g.zFossilUser && g.zFossilUser[0] ){
db_set("ssh-fossil-user", g.zFossilUser, 0);
}
if( g.fSshUseHttp ){
db_set_int("ssh-use-http", 1, 0);
}
}
|
Changes to src/db.c.
| ︙ | ︙ | |||
2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 |
{ "proxy", 0, 32, 0, "off" },
{ "relative-paths",0, 0, 0, "on" },
{ "repo-cksum", 0, 0, 0, "on" },
{ "self-register", 0, 0, 0, "off" },
{ "ssh-command", 0, 40, 0, "" },
{ "ssh-fossil", 0, 40, 0, "" },
{ "ssh-fossil-user", 0, 40, 0, "" },
{ "ssl-ca-location",0, 40, 0, "" },
{ "ssl-identity", 0, 40, 0, "" },
#ifdef FOSSIL_ENABLE_TCL
{ "tcl", 0, 0, 0, "off" },
{ "tcl-setup", 0, 40, 0, "" },
#endif
{ "th1-setup", 0, 40, 0, "" },
| > | 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 |
{ "proxy", 0, 32, 0, "off" },
{ "relative-paths",0, 0, 0, "on" },
{ "repo-cksum", 0, 0, 0, "on" },
{ "self-register", 0, 0, 0, "off" },
{ "ssh-command", 0, 40, 0, "" },
{ "ssh-fossil", 0, 40, 0, "" },
{ "ssh-fossil-user", 0, 40, 0, "" },
{ "ssh-use-http", 0, 40, 0, "off" },
{ "ssl-ca-location",0, 40, 0, "" },
{ "ssl-identity", 0, 40, 0, "" },
#ifdef FOSSIL_ENABLE_TCL
{ "tcl", 0, 0, 0, "off" },
{ "tcl-setup", 0, 40, 0, "" },
#endif
{ "th1-setup", 0, 40, 0, "" },
|
| ︙ | ︙ | |||
2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 | ** ** ssh-command Command used to talk to a remote machine with ** the "ssh://" protocol. ** ** ssh-fossil Remote fossil command to run with the "ssh://" protocol. ** ** ssh-fossil-user Fossil user to use instead of the URL user. ** ** ssl-ca-location The full pathname to a file containing PEM encoded ** CA root certificates, or a directory of certificates ** with filenames formed from the certificate hashes as ** required by OpenSSL. ** If set, this will override the OS default list of ** OpenSSL CAs. If unset, the default list will be used. | > > | 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 | ** ** ssh-command Command used to talk to a remote machine with ** the "ssh://" protocol. ** ** ssh-fossil Remote fossil command to run with the "ssh://" protocol. ** ** ssh-fossil-user Fossil user to use instead of the URL user. ** ** ssh-use-http Use http instead of test-http. Default: off. ** ** ssl-ca-location The full pathname to a file containing PEM encoded ** CA root certificates, or a directory of certificates ** with filenames formed from the certificate hashes as ** required by OpenSSL. ** If set, this will override the OS default list of ** OpenSSL CAs. If unset, the default list will be used. |
| ︙ | ︙ |
Changes to src/http.c.
| ︙ | ︙ | |||
38 39 40 41 42 43 44 | const char *zLogin; /* The user login name */ const char *zPw; /* The user password */ Blob pw; /* The nonce with user password appended */ Blob sig; /* The signature field */ zLogin = url_or_fossil_user(); blob_zero(pLogin); | | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
const char *zLogin; /* The user login name */
const char *zPw; /* The user password */
Blob pw; /* The nonce with user password appended */
Blob sig; /* The signature field */
zLogin = url_or_fossil_user();
blob_zero(pLogin);
if( zLogin==0 || fossil_strcmp(g.urlUser, "anonymous")==0 ||
url_ssh_use_http()==0 ){
return; /* If no login card for users "nobody" and "anonymous" */
}
blob_zero(&nonce);
blob_zero(&pw);
sha1sum_blob(pPayload, &nonce);
blob_copy(&pw, &nonce);
if( g.urlPasswd ){
|
| ︙ | ︙ |
Changes to src/http_transport.c.
| ︙ | ︙ | |||
134 135 136 137 138 139 140 |
zHost = mprintf("%s", g.urlName);
}
n = blob_size(&zCmd);
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, zHost);
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
| > | > > > | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
zHost = mprintf("%s", g.urlName);
}
n = blob_size(&zCmd);
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, zHost);
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
if( db_get_boolean("ssh-use-http", 0) ){
blob_append(&zCmd, " http", 5);
}else{
blob_append(&zCmd, " test-http", 10);
}
if( g.urlPath && g.urlPath[0] ){
blob_append(&zCmd, " ", 1);
shell_escape(&zCmd, mprintf("%s", g.urlPath));
}
if( fPrintSshCmd ){
fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
fPrintSshCmd = 0;
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 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 */ char *zFossilUser; /* Fossil user if different from URL user */ 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 */ | > | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | 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 */ int fSshUseHttp; /* Use http or test-http mode for SSH */ char *zSshFossilCmd; /* Path to remoe fossil command for SSH */ char *zSshCmd; /* SSH command string */ char *zFossilUser; /* Fossil user if different from URL user */ 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 */ |
| ︙ | ︙ | |||
579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
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;
g.zFossilUser = 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);
| > | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
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.fSshUseHttp = 0;
g.zSshFossilCmd = 0;
g.zSshCmd = 0;
g.zFossilUser = 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);
|
| ︙ | ︙ |
Changes to src/url.c.
| ︙ | ︙ | |||
410 411 412 413 414 415 416 |
}
/*
** Prompt the user for the password for g.urlUser. Store the result
** in g.urlPasswd.
*/
void url_prompt_for_password(void){
| | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
}
/*
** Prompt the user for the password for g.urlUser. Store the result
** in g.urlPasswd.
*/
void url_prompt_for_password(void){
if( g.urlIsFile || url_ssh_use_http()==0 ) return;
if( isatty(fileno(stdin))
&& (g.urlFlags & URL_PROMPT_PW)!=0
&& (g.urlFlags & URL_PROMPTED)==0
){
g.urlFlags |= URL_PROMPTED;
g.urlPasswd = prompt_for_user_password(url_or_fossil_user());
if( g.urlPasswd[0]
|
| ︙ | ︙ | |||
432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
}
}
}else{
fossil_fatal("missing or incorrect password for user \"%s\"",
url_or_fossil_user() );
}
}
/*
** Remember the URL if requested.
*/
void url_remember(void){
db_set("last-sync-url", g.urlCanonical, 0);
if( g.urlFlags & URL_REMEMBER_PW ){
| > > > > > > > | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
}
}
}else{
fossil_fatal("missing or incorrect password for user \"%s\"",
url_or_fossil_user() );
}
}
/*
** Return true if http mode is in use for "ssh://" URL.
*/
int url_ssh_use_http(void){
return g.urlIsSsh && ( db_get_boolean("ssh-use-http", 0) || g.fSshUseHttp );
}
/*
** Remember the URL if requested.
*/
void url_remember(void){
db_set("last-sync-url", g.urlCanonical, 0);
if( g.urlFlags & URL_REMEMBER_PW ){
|
| ︙ | ︙ |