Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch jan-clientcert Excluding Merge-Ins
This is equivalent to a diff from fa81575c8d to 0c0392af3d
2011-04-10
| ||
00:27 | Cache passphrase for protected PEM files to avoid having to re-type passphrase for each new https connection. Leaf check-in: 0c0392af3d user: jan tags: jan-clientcert | |
2011-04-04
| ||
03:29 | Update the built-in SQLite to the latest beta for 3.7.6. check-in: a74cfe0a14 user: drh tags: trunk | |
01:10 | Create new branch named "betterExeHandling" check-in: 85c6c1d7eb user: bharder tags: betterExeHandling | |
2011-04-02
| ||
14:42 | Merge from trunk. check-in: e4ebc85e66 user: jan tags: jan-clientcert | |
2011-04-01
| ||
01:22 | Add the "fossil bisect options" command. Make the auto-next and direct-only options default to on since that seems to generate a more useful bisect in a heavily branched tree. check-in: fa81575c8d user: drh tags: trunk | |
2011-03-31
| ||
11:41 | Change the "filechng" query parameter for timeline to "fc". Add "Show Files" and "Hide Files" submenus. check-in: 0208b7fc43 user: drh tags: trunk | |
Changes to src/clone.c.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
** admin user. This can be overridden using the -A|--admin-user ** parameter. ** ** Options: ** ** --admin-user|-A USERNAME Make USERNAME the administrator ** --private Also clone private branches ** */ void clone_cmd(void){ char *zPassword; const char *zDefaultUser; /* Optional name of the default user */ int nErr = 0; int bPrivate; /* Also clone private branches */ bPrivate = find_option("private",0,0)!=0; url_proxy_options(); if( g.argc < 4 ){ usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); } db_open_config(0); if( file_size(g.argv[3])>0 ){ fossil_panic("file already exists: %s", g.argv[3]); |
> > > |
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
** admin user. This can be overridden using the -A|--admin-user ** parameter. ** ** Options: ** ** --admin-user|-A USERNAME Make USERNAME the administrator ** --private Also clone private branches ** --certbundle NAME Use certificate bundle NAME for https ** connections ** */ void clone_cmd(void){ char *zPassword; const char *zDefaultUser; /* Optional name of the default user */ int nErr = 0; int bPrivate; /* Also clone private branches */ bPrivate = find_option("private",0,0)!=0; g.urlCertBundle = find_option("certbundle",0,1); url_proxy_options(); if( g.argc < 4 ){ usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); } db_open_config(0); if( file_size(g.argv[3])>0 ){ fossil_panic("file already exists: %s", g.argv[3]); |
Changes to src/http_ssl.c.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 .. 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ... 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 ... 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 ... 284 285 286 287 288 289 290 291 |
** at a time. State information is stored in static variables. The identity ** of the server is held in global variables that are set by url_parse(). ** ** SSL support is abstracted out into this module because Fossil can ** be compiled without SSL support (which requires OpenSSL library) */ #include "config.h" #ifdef FOSSIL_ENABLE_SSL #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/err.h> #include "http_ssl.h" #include <assert.h> #include <sys/types.h> /* ** There can only be a single OpenSSL IO connection open at a time. ** State information about that IO is stored in the following ** local variables: */ static int sslIsInit = 0; /* True after global initialization */ static BIO *iBio; /* OpenSSL I/O abstraction */ static char *sslErrMsg = 0; /* Text of most recent OpenSSL error */ static SSL_CTX *sslCtx; /* SSL context */ static SSL *ssl; /* ** Clear the SSL error message */ static void ssl_clear_errmsg(void){ free(sslErrMsg); ................................................................................ /* ** Return the current SSL error message */ const char *ssl_errmsg(void){ return sslErrMsg; } /* ** Call this routine once before any other use of the SSL interface. ** This routine does initial configuration of the SSL module. */ void ssl_global_init(void){ if( sslIsInit==0 ){ SSL_library_init(); SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); sslCtx = SSL_CTX_new(SSLv23_client_method()); X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx)); sslIsInit = 1; } } /* ** Call this routine to shutdown the SSL module prior to program exit. */ ................................................................................ ** g.urlPort TCP/IP port to use. Ex: 80 ** ** Return the number of errors. */ int ssl_open(void){ X509 *cert; int hasSavedCertificate = 0; char *connStr ; ssl_global_init(); /* Get certificate for current server from global config and * (if we have it in config) add it to certificate store. */ cert = ssl_get_certificate(); if ( cert!=NULL ){ X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert); X509_free(cert); hasSavedCertificate = 1; } iBio = BIO_new_ssl_connect(sslCtx); BIO_get_ssl(iBio, &ssl); SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); if( iBio==NULL ) { ssl_set_errmsg("SSL: cannot open SSL (%s)", ERR_reason_error_string(ERR_get_error())); return 1; } connStr = mprintf("%s:%d", g.urlName, g.urlPort); BIO_set_conn_hostname(iBio, connStr); free(connStr); if( BIO_do_connect(iBio)<=0 ){ ................................................................................ blob_reset(&ans); } X509_free(cert); return 0; } /* ** Save certificate to global config. */ void ssl_save_certificate(X509 *cert){ BIO *mem; char *zCert, *zHost; mem = BIO_new(BIO_s_mem()); PEM_write_bio_X509(mem, cert); BIO_write(mem, "", 1); // null-terminate mem buffer BIO_get_mem_data(mem, &zCert); zHost = mprintf("cert:%s", g.urlName); db_set(zHost, zCert, 1); free(zHost); BIO_free(mem); } /* ** Get certificate for g.urlName from global config. ** Return NULL if no certificate found. */ X509 *ssl_get_certificate(void){ char *zHost, *zCert; BIO *mem; X509 *cert; zHost = mprintf("cert:%s", g.urlName); zCert = db_get(zHost, NULL); free(zHost); if ( zCert==NULL ) return NULL; mem = BIO_new(BIO_s_mem()); BIO_puts(mem, zCert); cert = PEM_read_bio_X509(mem, NULL, 0, NULL); free(zCert); BIO_free(mem); return cert; ................................................................................ total += got; N -= got; pContent = (void*)&((char*)pContent)[got]; } return total; } #endif /* FOSSIL_ENABLE_SSL */ |
< < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | | | | | | | | | > > > > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 .. 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 ... 173 174 175 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 ... 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 ... 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 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 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
** at a time. State information is stored in static variables. The identity ** of the server is held in global variables that are set by url_parse(). ** ** SSL support is abstracted out into this module because Fossil can ** be compiled without SSL support (which requires OpenSSL library) */ #ifdef FOSSIL_ENABLE_SSL #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/err.h> #include <assert.h> #include <sys/types.h> #endif #include "config.h" #include "http_ssl.h" /* ** Make sure the CERT table exists in the ~/.fossil database. ** ** This routine must be called in between two calls to db_swap_databases(). */ static void create_cert_table_if_not_exist(void){ static const char zSql[] = @ CREATE TABLE IF NOT EXISTS certs( @ name TEXT NOT NULL, @ type TEXT NOT NULL, @ filepath TEXT NOT NULL, @ PRIMARY KEY(name, type) @ ); ; db_multi_exec(zSql); } #ifdef FOSSIL_ENABLE_SSL /* ** There can only be a single OpenSSL IO connection open at a time. ** State information about that IO is stored in the following ** local variables: */ static int sslIsInit = 0; /* True after global initialization */ static BIO *iBio; /* OpenSSL I/O abstraction */ static char *sslErrMsg = 0; /* Text of most recent OpenSSL error */ static SSL_CTX *sslCtx; /* SSL context */ static SSL *ssl; static char *pempasswd = 0; /* Passphrase used to unlock key */ /* ** Clear the SSL error message */ static void ssl_clear_errmsg(void){ free(sslErrMsg); ................................................................................ /* ** Return the current SSL error message */ const char *ssl_errmsg(void){ return sslErrMsg; } /* ** Called by SSL when a passphrase protected file needs to be unlocked. ** We cache the passphrase so the user doesn't have to re-enter it for each new ** connection. */ static int ssl_passwd_cb(char *buf, int size, int rwflag, void *userdata){ if( userdata==0 ){ Blob passwd; prompt_for_password("\nPEM unlock passphrase: ", &passwd, 0); strncpy(buf, (char *)blob_str(&passwd), size); buf[size-1] = '\0'; blob_reset(&passwd); pempasswd = strdup(buf); if( !pempasswd ){ fossil_panic("Unable to allocate memory for PEM passphrase."); } SSL_CTX_set_default_passwd_cb_userdata(sslCtx, pempasswd); }else{ strncpy(buf, (char *)userdata, size); } return strlen(buf); } /* ** Call this routine once before any other use of the SSL interface. ** This routine does initial configuration of the SSL module. */ void ssl_global_init(void){ if( sslIsInit==0 ){ SSL_library_init(); SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); sslCtx = SSL_CTX_new(SSLv23_client_method()); X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx)); SSL_CTX_set_default_passwd_cb(sslCtx, ssl_passwd_cb); SSL_CTX_set_default_passwd_cb_userdata(sslCtx, NULL); sslIsInit = 1; } } /* ** Call this routine to shutdown the SSL module prior to program exit. */ ................................................................................ ** g.urlPort TCP/IP port to use. Ex: 80 ** ** Return the number of errors. */ int ssl_open(void){ X509 *cert; int hasSavedCertificate = 0; char *connStr; ssl_global_init(); /* If client certificate/key has been set, load them into the SSL context. */ ssl_load_client_authfiles(); /* Get certificate for current server from global config and ** (if we have it in config) add it to certificate store. */ cert = ssl_get_certificate(); if ( cert!=NULL ){ X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert); X509_free(cert); hasSavedCertificate = 1; } iBio = BIO_new_ssl_connect(sslCtx); BIO_get_ssl(iBio, &ssl); SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); if( iBio==NULL ){ ssl_set_errmsg("SSL: cannot open SSL (%s)", ERR_reason_error_string(ERR_get_error())); return 1; } connStr = mprintf("%s:%d", g.urlName, g.urlPort); BIO_set_conn_hostname(iBio, connStr); free(connStr); if( BIO_do_connect(iBio)<=0 ){ ................................................................................ blob_reset(&ans); } X509_free(cert); return 0; } /* ** Save certificate to global certificate/key store. */ void ssl_save_certificate(X509 *cert){ BIO *mem; char *zCert; mem = BIO_new(BIO_s_mem()); PEM_write_bio_X509(mem, cert); BIO_write(mem, "", 1); // null-terminate mem buffer BIO_get_mem_data(mem, &zCert); db_swap_connections(); create_cert_table_if_not_exist(); db_begin_transaction(); db_multi_exec("REPLACE INTO certs(name,type,filepath) " "VALUES(%Q,'scert',%Q)", g.urlName, zCert); db_end_transaction(0); db_swap_connections(); BIO_free(mem); } /* ** Get certificate for g.urlName from global certificate/key store. ** Return NULL if no certificate found. */ X509 *ssl_get_certificate(void){ char *zCert; BIO *mem; X509 *cert; db_swap_connections(); create_cert_table_if_not_exist(); zCert = db_text(0, "SELECT filepath FROM certs WHERE name=%Q" " AND type='scert'", g.urlName); db_swap_connections(); if( zCert==NULL ) return NULL; mem = BIO_new(BIO_s_mem()); BIO_puts(mem, zCert); cert = PEM_read_bio_X509(mem, NULL, 0, NULL); free(zCert); BIO_free(mem); return cert; ................................................................................ total += got; N -= got; pContent = (void*)&((char*)pContent)[got]; } return total; } /* ** If a certbundle has been specified on the command line, then use it to look ** up certificates and keys, and then store the URL-certbundle association in ** the global database. If no certbundle has been specified on the command ** line, see if there's an entry for the url in global_config, and use it if ** applicable. */ void ssl_load_client_authfiles(void){ char *zBundleName = NULL; char *cafile; char *capath; char *certfile; char *keyfile; if( g.urlCertBundle ){ char *zName; zName = mprintf("certbundle:%s", g.urlName); db_set(zName, g.urlCertBundle, 1); free(zName); zBundleName = strdup(g.urlCertBundle); }else{ db_swap_connections(); zBundleName = db_text(0, "SELECT value FROM global_config" " WHERE name='certbundle:%q'", g.urlName); db_swap_connections(); } if( !zBundleName ){ /* No cert bundle specified on command line or found cached for URL */ return; } db_swap_connections(); create_cert_table_if_not_exist(); cafile = db_text(0, "SELECT filepath FROM certs WHERE name=%Q" " AND type='cafile'", zBundleName); capath = db_text(0, "SELECT filepath FROM certs WHERE name=%Q" " AND type='capath'", zBundleName); db_swap_connections(); if( cafile || capath ){ /* The OpenSSL documentation warns that if several CA certificates match ** the same name, key identifier and serial number conditions, only the ** first will be examined. The caveat situation occurs when one stores an ** expired CA certificate among the valid ones. ** Simply put: Do not mix expired and valid certificates. */ if( SSL_CTX_load_verify_locations(sslCtx, cafile, capath)==0 ){ fossil_fatal("SSL: Unable to load CA verification file/path"); } } db_swap_connections(); keyfile = db_text(0, "SELECT filepath FROM certs WHERE name=%Q" " AND type='ckey'", zBundleName); certfile = db_text(0, "SELECT filepath FROM certs WHERE name=%Q" " AND type='ccert'", zBundleName); db_swap_connections(); if( certfile ){ /* If a client certificate is explicitly specified, but a key is not, then ** assume the key is in the same file as the certificate. */ if( !keyfile ){ keyfile = certfile; } if( SSL_CTX_use_certificate_file(sslCtx, certfile, SSL_FILETYPE_PEM)<=0 ){ fossil_fatal("SSL: Unable to open client certificate in %s.", certfile); } if( SSL_CTX_use_PrivateKey_file(sslCtx, keyfile, SSL_FILETYPE_PEM)<=0 ){ fossil_fatal("SSL: Unable to open client key in %s.", keyfile); } if( certfile && keyfile && !SSL_CTX_check_private_key(sslCtx) ){ fossil_fatal("SSL: Private key does not match the certificate public " "key."); } } if( keyfile != certfile ){ free(keyfile); } free(certfile); free(capath); free(cafile); } #endif /* FOSSIL_ENABLE_SSL */ /* ** COMMAND: cert ** ** Usage: %fossil cert SUBCOMMAND ... ** ** Manage/bundle PKI client keys/certificates and CA certificates for SSL ** certificate chain verifications. ** ** %fossil cert add NAME ?--key KEYFILE? ?--cert CERTFILE? ** ?--cafile CAFILE? ?--capath CAPATH? ** ** Create a certificate bundle NAME with the associated ** certificates/keys. If a client certificate is specified but no ** key, it is assumed that the key is located in the client ** certificate file. ** The file formats must be PEM. ** ** %fossil cert list ** ** List all certificate bundles, their values and their URL ** associations. ** ** %fossil cert disassociate URL ** ** Disassociate URL from any certificate bundle. ** ** %fossil cert delete NAME ** ** Remove the certificate bundle NAME and all its URL associations. ** */ void cert_cmd(void){ int n; const char *zCmd = "list"; /* Default sub-command */ if( g.argc>=3 ){ zCmd = g.argv[2]; } n = strlen(zCmd); if( strncmp(zCmd, "add", n)==0 ){ const char *zContainer; const char *zCKey; const char *zCCert; const char *zCAFile; const char *zCAPath; if( g.argc<5 ){ usage("add NAME ?--key KEYFILE? ?--cert CERTFILE? ?--cafile CAFILE? " "?--capath CAPATH?"); } zContainer = g.argv[3]; zCKey = find_option("key",0,1); zCCert = find_option("cert",0,1); zCAFile = find_option("cafile",0,1); zCAPath = find_option("capath",0,1); /* If a client certificate was specified, but a key was not, assume the ** key is stored in the same file as the certificate. */ if( !zCKey && zCCert ){ zCKey = zCCert; } db_open_config(0); db_swap_connections(); create_cert_table_if_not_exist(); db_begin_transaction(); if( db_exists("SELECT 1 FROM certs WHERE name='%q'", zContainer)!=0 ){ db_end_transaction(0); fossil_fatal("certificate bundle \"%s\" already exists", zContainer); } if( zCKey ){ db_multi_exec("INSERT INTO certs (name,type,filepath) " "VALUES(%Q,'ckey',%Q)", zContainer, zCKey); } if( zCCert ){ db_multi_exec("INSERT INTO certs (name,type,filepath) " "VALUES(%Q,'ccert',%Q)", zContainer, zCCert); } if( zCAFile ){ db_multi_exec("INSERT INTO certs (name,type,filepath) " "VALUES(%Q,'cafile',%Q)", zContainer, zCAFile); } if( zCAPath ){ db_multi_exec("INSERT INTO certs (name,type,filepath) " "VALUES(%Q,'capath',%Q)", zContainer, zCAPath); } db_end_transaction(0); db_swap_connections(); }else if(strncmp(zCmd, "list", n)==0){ Stmt q; char *bndl = NULL; db_open_config(0); db_swap_connections(); create_cert_table_if_not_exist(); db_prepare(&q, "SELECT name,type,filepath FROM certs" " WHERE type NOT IN ('server')" " ORDER BY name,type"); while( db_step(&q)==SQLITE_ROW ){ const char *zCont = db_column_text(&q, 0); const char *zType = db_column_text(&q, 1); const char *zFilePath = db_column_text(&q, 2); if( fossil_strcmp(zCont, bndl)!=0 ){ free(bndl); bndl = strdup(zCont); puts(zCont); } printf("\t%s=%s\n", zType, zFilePath); } db_finalize(&q); /* List the URL associations. */ db_prepare(&q, "SELECT name FROM global_config" " WHERE name LIKE 'certbundle:%%' AND value=%Q" " ORDER BY name", bndl); free(bndl); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); static int first = 1; if( first ) { puts("\tAssociations"); first = 0; } printf("\t\t%s\n", zName+11); } db_swap_connections(); }else if(strncmp(zCmd, "disassociate", n)==0){ const char *zURL; if( g.argc<4 ){ usage("disassociate URL"); } zURL = g.argv[3]; db_open_config(0); db_swap_connections(); db_begin_transaction(); db_multi_exec("DELETE FROM global_config WHERE name='certbundle:%q'", zURL); if( db_changes() == 0 ){ fossil_warning("No certificate bundle associated with URL \"%s\".", zURL); }else{ printf("%s disassociated from its certificate bundle.\n", zURL); } db_end_transaction(0); db_swap_connections(); }else if(strncmp(zCmd, "delete", n)==0){ const char *zContainer; if( g.argc<4 ){ usage("delete NAME"); } zContainer = g.argv[3]; db_open_config(0); db_swap_connections(); create_cert_table_if_not_exist(); db_begin_transaction(); db_multi_exec("DELETE FROM certs WHERE name=%Q", zContainer); if( db_changes() == 0 ){ fossil_warning("No certificate bundle named \"%s\" found", zContainer); }else{ printf("%d entries removed\n", db_changes()); } db_multi_exec("DELETE FROM global_config WHERE name LIKE 'certbundle:%%'" " AND value=%Q", zContainer); if( db_changes() > 0 ){ printf("%d associations removed\n", db_changes()); } db_end_transaction(0); db_swap_connections(); }else{ fossil_panic("cert subcommand should be one of: " "add list disassociate delete"); } } |
Changes to src/main.c.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
char *urlPath; /* Pathname for http: */ char *urlUser; /* User id for http: */ char *urlPasswd; /* Password for http: */ char *urlCanonical; /* Canonical representation of the URL */ char *urlProxyAuth; /* Proxy-Authorizer: string */ char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */ int dontKeepUrl; /* Do not persist the URL */ const char *zLogin; /* Login name. "" if not logged in. */ int useLocalauth; /* No login required if from 127.0.0.1 */ int noPswd; /* Logged in without password (on 127.0.0.1) */ int userUid; /* Integer user id */ /* Information used to populate the RCVFROM table */ |
> |
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
char *urlPath; /* Pathname for http: */
char *urlUser; /* User id for http: */
char *urlPasswd; /* Password for http: */
char *urlCanonical; /* Canonical representation of the URL */
char *urlProxyAuth; /* Proxy-Authorizer: string */
char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */
int dontKeepUrl; /* Do not persist the URL */
const char *urlCertBundle; /* Which ceritificate bundle to use for URL */
const char *zLogin; /* Login name. "" if not logged in. */
int useLocalauth; /* No login required if from 127.0.0.1 */
int noPswd; /* Logged in without password (on 127.0.0.1) */
int userUid; /* Integer user id */
/* Information used to populate the RCVFROM table */
|
Changes to src/sync.c.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 ... 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 ... 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 ... 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
static void process_sync_args(int *pConfigSync, int *pPrivate){ const char *zUrl = 0; const char *zPw = 0; int configSync = 0; int urlOptional = find_option("autourl",0,0)!=0; g.dontKeepUrl = find_option("once",0,0)!=0; *pPrivate = find_option("private",0,0)!=0; url_proxy_options(); db_find_and_open_repository(0, 0); db_open_config(0); if( g.argc==2 ){ zUrl = db_get("last-sync-url", 0); zPw = unobscure(db_get("last-sync-pw", 0)); if( db_get_boolean("auto-sync",1) ) configSync = CONFIGSET_SHUN; ................................................................................ ** subsequent push, pull, and sync operations. However, the "--once" ** command-line option makes the URL a one-time-use URL that is not ** saved. ** ** Use the --private option to pull private branches from the ** remote repository. ** ** See also: clone, push, sync, remote-url */ void pull_cmd(void){ int syncFlags; int bPrivate; process_sync_args(&syncFlags, &bPrivate); client_sync(0,1,0,bPrivate,syncFlags,0); } ................................................................................ ** subsequent push, pull, and sync operations. However, the "--once" ** command-line option makes the URL a one-time-use URL that is not ** saved. ** ** Use the --private option to push private branches to the ** remote repository. ** ** See also: clone, pull, sync, remote-url */ void push_cmd(void){ int syncFlags; int bPrivate; process_sync_args(&syncFlags, &bPrivate); client_sync(1,0,0,bPrivate,0,0); } ................................................................................ ** subsequent push, pull, and sync operations. However, the "--once" ** command-line option makes the URL a one-time-use URL that is not ** saved. ** ** Use the --private option to sync private branches with the ** remote repository. ** ** See also: clone, push, pull, remote-url */ void sync_cmd(void){ int syncFlags; int bPrivate; process_sync_args(&syncFlags, &bPrivate); client_sync(1,1,0,bPrivate,syncFlags,0); } |
> > > > > > | > > > > > | > > > > > | |
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 ... 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 ... 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 ... 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
static void process_sync_args(int *pConfigSync, int *pPrivate){ const char *zUrl = 0; const char *zPw = 0; int configSync = 0; int urlOptional = find_option("autourl",0,0)!=0; g.dontKeepUrl = find_option("once",0,0)!=0; *pPrivate = find_option("private",0,0)!=0; g.urlCertBundle = find_option("certbundle",0,1); url_proxy_options(); db_find_and_open_repository(0, 0); db_open_config(0); if( g.argc==2 ){ zUrl = db_get("last-sync-url", 0); zPw = unobscure(db_get("last-sync-pw", 0)); if( db_get_boolean("auto-sync",1) ) configSync = CONFIGSET_SHUN; ................................................................................ ** subsequent push, pull, and sync operations. However, the "--once" ** command-line option makes the URL a one-time-use URL that is not ** saved. ** ** Use the --private option to pull private branches from the ** remote repository. ** ** Use the "--certbundle NAME" option to specify the name of the ** certificate/key bundle to use for https connections. If this option ** is not specified, a cached value associated with the URL will be ** used if it exists. ** ** See also: cert, clone, push, sync, remote-url */ void pull_cmd(void){ int syncFlags; int bPrivate; process_sync_args(&syncFlags, &bPrivate); client_sync(0,1,0,bPrivate,syncFlags,0); } ................................................................................ ** subsequent push, pull, and sync operations. However, the "--once" ** command-line option makes the URL a one-time-use URL that is not ** saved. ** ** Use the --private option to push private branches to the ** remote repository. ** ** Use the "--certbundle NAME" option to specify the name of the ** certificate/key bundle to use for https connections. If this option ** is not specified, a cached value associated with the URL will be ** used if it exists. ** ** See also: cert, clone, pull, sync, remote-url */ void push_cmd(void){ int syncFlags; int bPrivate; process_sync_args(&syncFlags, &bPrivate); client_sync(1,0,0,bPrivate,0,0); } ................................................................................ ** subsequent push, pull, and sync operations. However, the "--once" ** command-line option makes the URL a one-time-use URL that is not ** saved. ** ** Use the --private option to sync private branches with the ** remote repository. ** ** Use the "--certbundle NAME" option to specify the name of the ** certificate/key bundle to use for https connections. If this option ** is not specified, a cached value associated with the URL will be ** used if it exists. ** ** See also: cert, clone, push, pull, remote-url */ void sync_cmd(void){ int syncFlags; int bPrivate; process_sync_args(&syncFlags, &bPrivate); client_sync(1,1,0,bPrivate,syncFlags,0); } |