Fossil

Check-in [a7563f08db]
Login

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

Overview
Comment:Avoid reprompting for the encryption key on every HTTP request when running "fossil ui" on an encrypted repository.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | see
Files: files | file ages | folders
SHA1: a7563f08db720bf878b46d739bb23c6940287244
User & Date: drh 2016-04-22 18:03:27.737
Context
2016-04-22
18:08
Add the ability to use a repository that is in a database protected by the [http://www.hwaci.com/sw/sqlite/see.html|SQLite Encryption Extension (SEE)]. SEE is proprietary code and is not included in this tree, but if a user has a copy of SEE, with this change she can compile a version of Fossil that uses it. check-in: ed871fb5fa user: drh tags: trunk
18:03
Avoid reprompting for the encryption key on every HTTP request when running "fossil ui" on an encrypted repository. Closed-Leaf check-in: a7563f08db user: drh tags: see
17:56
Prompt for and use the encryption key for encrypted repositories. check-in: 3a02d7b631 user: drh tags: see
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
870
871
872
873
874
875
876
877


878
879
880
881
882
883
884




885
886
887


888
889
890
891
892
893
894
                          db_tolocal_function, 0, 0);
  sqlite3_create_function(db, "fromLocal", 0, SQLITE_UTF8, 0,
                          db_fromlocal_function, 0, 0);
}

/*
** If the database file zDbFile has a name that suggests that it is
** encrypted, then prompt for the encryption key.


*/
static void db_encryption_key(
  const char *zDbFile,   /* Name of the database file */
  Blob *pKey             /* Put the encryption key here */
){
  blob_init(pKey, 0, 0);
  if( sqlite3_strglob("*efossil", zDbFile)==0 ){




    char *zPrompt = mprintf("\rencryption key for '%s': ", zDbFile);
    prompt_for_password(zPrompt, pKey, 0);
    fossil_free(zPrompt);


  }
}


/*
** Open a database file.  Return a pointer to the new database
** connection.  An error results in process abort.







|
>
>







>
>
>
>
|
|
|
>
>







870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
                          db_tolocal_function, 0, 0);
  sqlite3_create_function(db, "fromLocal", 0, SQLITE_UTF8, 0,
                          db_fromlocal_function, 0, 0);
}

/*
** If the database file zDbFile has a name that suggests that it is
** encrypted, then prompt for the encryption key and return it in the
** blob *pKey.  Or, if the encryption key has previously been requested,
** just return a copy of the previous result.
*/
static void db_encryption_key(
  const char *zDbFile,   /* Name of the database file */
  Blob *pKey             /* Put the encryption key here */
){
  blob_init(pKey, 0, 0);
  if( sqlite3_strglob("*efossil", zDbFile)==0 ){
    static char *zSavedKey = 0;
    if( zSavedKey ){
      blob_set(pKey, zSavedKey);
    }else{
      char *zPrompt = mprintf("\rencryption key for '%s': ", zDbFile);
      prompt_for_password(zPrompt, pKey, 0);
      fossil_free(zPrompt);
      zSavedKey = fossil_strdup(blob_str(pKey));
    }
  }
}


/*
** Open a database file.  Return a pointer to the new database
** connection.  An error results in process abort.