Fossil

Check-in [3b3099bd]
Login

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | see
Files: files | file ages | folders
SHA3-256:3b3099bdc010c39a3665e67527deac305e3f9082ccf57541df17ee9875130107
User & Date: mistachkin 2017-05-29 23:14:20
Context
2017-05-30
01:26
Further enhancements to SEE integration. Closed-Leaf check-in: 53048387 user: mistachkin tags: see
2017-05-29
23:14
Merge updates from trunk. check-in: 3b3099bd user: mistachkin tags: see
23:07
Rename new function for clarity and consistency. check-in: d6422ab0 user: mistachkin tags: trunk
02:37
Enable the 'sqlite' command to work with SEE. check-in: 564edc69 user: mistachkin tags: see
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/db.c.

  1041   1041   #endif
  1042   1042   }
  1043   1043   
  1044   1044   
  1045   1045   /*
  1046   1046   ** Sets the encryption key for the database, if necessary.
  1047   1047   */
  1048         -void db_set_key(sqlite3 *db, const char *zDbName){
         1048  +void db_maybe_set_encryption_key(sqlite3 *db, const char *zDbName){
  1049   1049     Blob key;
  1050   1050     blob_init(&key, 0, 0);
  1051   1051     db_maybe_obtain_encryption_key(zDbName, &key);
  1052   1052     if( blob_size(&key)>0 ){
  1053   1053       char *zCmd = sqlite3_mprintf("PRAGMA key(%Q)", blob_str(&key));
  1054   1054       sqlite3_exec(db, zCmd, 0, 0, 0);
  1055   1055       fossil_secure_zero(zCmd, strlen(zCmd));
................................................................................
  1071   1071          zDbName, &db,
  1072   1072          SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
  1073   1073          g.zVfsName
  1074   1074     );
  1075   1075     if( rc!=SQLITE_OK ){
  1076   1076       db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
  1077   1077     }
  1078         -  db_set_key(db, zDbName);
         1078  +  db_maybe_set_encryption_key(db, zDbName);
  1079   1079     sqlite3_busy_timeout(db, 5000);
  1080   1080     sqlite3_wal_autocheckpoint(db, 1);  /* Set to checkpoint frequently */
  1081   1081     sqlite3_create_function(db, "user", 0, SQLITE_UTF8, 0, db_sql_user, 0, 0);
  1082   1082     sqlite3_create_function(db, "cgi", 1, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
  1083   1083     sqlite3_create_function(db, "cgi", 2, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
  1084   1084     sqlite3_create_function(db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
  1085   1085     sqlite3_create_function(

Changes to src/sqlcmd.c.

   149    149     db_add_aux_functions(db);
   150    150     re_add_sql_func(db);
   151    151     search_sql_setup(db);
   152    152     foci_register(db);
   153    153     g.repositoryOpen = 1;
   154    154     g.db = db;
   155    155     sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "repository");
   156         -  db_set_key(db, g.zRepositoryName);
          156  +  db_maybe_set_encryption_key(db, g.zRepositoryName);
   157    157     if( g.zLocalDbName ){
   158    158       char *zSql = sqlite3_mprintf("ATTACH %Q AS 'localdb' KEY ''",
   159    159                                    g.zLocalDbName);
   160    160       sqlite3_exec(db, zSql, 0, 0, 0);
   161    161       sqlite3_free(zSql);
   162    162     }
   163    163     if( g.zConfigDbName ){