Fossil SCM
Compiler warning fixes. This includes disabling the undocumented FOSSIL_PWREADER feature and upgrading the built-in SQLite.
Commit
f35b46d4cb49d343aa41c115917e25d3dfd81953
Parent
f475b943eb84c23…
5 files changed
+5
+1
-4
+3
-3
+1
-1
+15
-11
+5
| --- src/fshell.c | ||
| +++ src/fshell.c | ||
| @@ -26,10 +26,15 @@ | ||
| 26 | 26 | ** crypto phasephrase for each command. |
| 27 | 27 | */ |
| 28 | 28 | #include "config.h" |
| 29 | 29 | #include "fshell.h" |
| 30 | 30 | #include <ctype.h> |
| 31 | + | |
| 32 | +#ifndef _WIN32 | |
| 33 | +#include <sys/types.h> | |
| 34 | +#include <sys/wait.h> | |
| 35 | +#endif | |
| 31 | 36 | |
| 32 | 37 | |
| 33 | 38 | /* |
| 34 | 39 | ** COMMAND: shell* |
| 35 | 40 | ** |
| 36 | 41 |
| --- src/fshell.c | |
| +++ src/fshell.c | |
| @@ -26,10 +26,15 @@ | |
| 26 | ** crypto phasephrase for each command. |
| 27 | */ |
| 28 | #include "config.h" |
| 29 | #include "fshell.h" |
| 30 | #include <ctype.h> |
| 31 | |
| 32 | |
| 33 | /* |
| 34 | ** COMMAND: shell* |
| 35 | ** |
| 36 |
| --- src/fshell.c | |
| +++ src/fshell.c | |
| @@ -26,10 +26,15 @@ | |
| 26 | ** crypto phasephrase for each command. |
| 27 | */ |
| 28 | #include "config.h" |
| 29 | #include "fshell.h" |
| 30 | #include <ctype.h> |
| 31 | |
| 32 | #ifndef _WIN32 |
| 33 | #include <sys/types.h> |
| 34 | #include <sys/wait.h> |
| 35 | #endif |
| 36 | |
| 37 | |
| 38 | /* |
| 39 | ** COMMAND: shell* |
| 40 | ** |
| 41 |
+1
-4
| --- src/makeheaders.c | ||
| +++ src/makeheaders.c | ||
| @@ -1106,11 +1106,11 @@ | ||
| 1106 | 1106 | ** |
| 1107 | 1107 | ** The number of errors encountered is returned. An error is an |
| 1108 | 1108 | ** unterminated token. |
| 1109 | 1109 | */ |
| 1110 | 1110 | static int GetBigToken(InStream *pIn, Token *pToken, IdentTable *pTable){ |
| 1111 | - const char *z, *zStart; | |
| 1111 | + const char *zStart; | |
| 1112 | 1112 | int iStart; |
| 1113 | 1113 | int nBrace; |
| 1114 | 1114 | int c; |
| 1115 | 1115 | int nLine; |
| 1116 | 1116 | int nErr; |
| @@ -1135,11 +1135,10 @@ | ||
| 1135 | 1135 | |
| 1136 | 1136 | default: |
| 1137 | 1137 | return nErr; |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | - z = pIn->z; | |
| 1141 | 1140 | iStart = pIn->i; |
| 1142 | 1141 | zStart = pToken->zText; |
| 1143 | 1142 | nLine = pToken->nLine; |
| 1144 | 1143 | nBrace = 1; |
| 1145 | 1144 | while( nBrace ){ |
| @@ -1681,18 +1680,16 @@ | ||
| 1681 | 1680 | ** This routine is called when we see a method for a class that begins |
| 1682 | 1681 | ** with the PUBLIC, PRIVATE, or PROTECTED keywords. Such methods are |
| 1683 | 1682 | ** added to their class definitions. |
| 1684 | 1683 | */ |
| 1685 | 1684 | static int ProcessMethodDef(Token *pFirst, Token *pLast, int flags){ |
| 1686 | - Token *pCode; | |
| 1687 | 1685 | Token *pClass; |
| 1688 | 1686 | char *zDecl; |
| 1689 | 1687 | Decl *pDecl; |
| 1690 | 1688 | String str; |
| 1691 | 1689 | int type; |
| 1692 | 1690 | |
| 1693 | - pCode = pLast; | |
| 1694 | 1691 | pLast = pLast->pPrev; |
| 1695 | 1692 | while( pFirst->zText[0]=='P' ){ |
| 1696 | 1693 | int rc = 1; |
| 1697 | 1694 | switch( pFirst->nText ){ |
| 1698 | 1695 | case 6: rc = strncmp(pFirst->zText,"PUBLIC",6); break; |
| 1699 | 1696 |
| --- src/makeheaders.c | |
| +++ src/makeheaders.c | |
| @@ -1106,11 +1106,11 @@ | |
| 1106 | ** |
| 1107 | ** The number of errors encountered is returned. An error is an |
| 1108 | ** unterminated token. |
| 1109 | */ |
| 1110 | static int GetBigToken(InStream *pIn, Token *pToken, IdentTable *pTable){ |
| 1111 | const char *z, *zStart; |
| 1112 | int iStart; |
| 1113 | int nBrace; |
| 1114 | int c; |
| 1115 | int nLine; |
| 1116 | int nErr; |
| @@ -1135,11 +1135,10 @@ | |
| 1135 | |
| 1136 | default: |
| 1137 | return nErr; |
| 1138 | } |
| 1139 | |
| 1140 | z = pIn->z; |
| 1141 | iStart = pIn->i; |
| 1142 | zStart = pToken->zText; |
| 1143 | nLine = pToken->nLine; |
| 1144 | nBrace = 1; |
| 1145 | while( nBrace ){ |
| @@ -1681,18 +1680,16 @@ | |
| 1681 | ** This routine is called when we see a method for a class that begins |
| 1682 | ** with the PUBLIC, PRIVATE, or PROTECTED keywords. Such methods are |
| 1683 | ** added to their class definitions. |
| 1684 | */ |
| 1685 | static int ProcessMethodDef(Token *pFirst, Token *pLast, int flags){ |
| 1686 | Token *pCode; |
| 1687 | Token *pClass; |
| 1688 | char *zDecl; |
| 1689 | Decl *pDecl; |
| 1690 | String str; |
| 1691 | int type; |
| 1692 | |
| 1693 | pCode = pLast; |
| 1694 | pLast = pLast->pPrev; |
| 1695 | while( pFirst->zText[0]=='P' ){ |
| 1696 | int rc = 1; |
| 1697 | switch( pFirst->nText ){ |
| 1698 | case 6: rc = strncmp(pFirst->zText,"PUBLIC",6); break; |
| 1699 |
| --- src/makeheaders.c | |
| +++ src/makeheaders.c | |
| @@ -1106,11 +1106,11 @@ | |
| 1106 | ** |
| 1107 | ** The number of errors encountered is returned. An error is an |
| 1108 | ** unterminated token. |
| 1109 | */ |
| 1110 | static int GetBigToken(InStream *pIn, Token *pToken, IdentTable *pTable){ |
| 1111 | const char *zStart; |
| 1112 | int iStart; |
| 1113 | int nBrace; |
| 1114 | int c; |
| 1115 | int nLine; |
| 1116 | int nErr; |
| @@ -1135,11 +1135,10 @@ | |
| 1135 | |
| 1136 | default: |
| 1137 | return nErr; |
| 1138 | } |
| 1139 | |
| 1140 | iStart = pIn->i; |
| 1141 | zStart = pToken->zText; |
| 1142 | nLine = pToken->nLine; |
| 1143 | nBrace = 1; |
| 1144 | while( nBrace ){ |
| @@ -1681,18 +1680,16 @@ | |
| 1680 | ** This routine is called when we see a method for a class that begins |
| 1681 | ** with the PUBLIC, PRIVATE, or PROTECTED keywords. Such methods are |
| 1682 | ** added to their class definitions. |
| 1683 | */ |
| 1684 | static int ProcessMethodDef(Token *pFirst, Token *pLast, int flags){ |
| 1685 | Token *pClass; |
| 1686 | char *zDecl; |
| 1687 | Decl *pDecl; |
| 1688 | String str; |
| 1689 | int type; |
| 1690 | |
| 1691 | pLast = pLast->pPrev; |
| 1692 | while( pFirst->zText[0]=='P' ){ |
| 1693 | int rc = 1; |
| 1694 | switch( pFirst->nText ){ |
| 1695 | case 6: rc = strncmp(pFirst->zText,"PUBLIC",6); break; |
| 1696 |
+3
-3
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -380,11 +380,11 @@ | ||
| 380 | 380 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 381 | 381 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 382 | 382 | */ |
| 383 | 383 | #define SQLITE_VERSION "3.14.0" |
| 384 | 384 | #define SQLITE_VERSION_NUMBER 3014000 |
| 385 | -#define SQLITE_SOURCE_ID "2016-08-01 17:06:44 90d2c490fc2ed4e073711b84f989ca4d496dcfb5" | |
| 385 | +#define SQLITE_SOURCE_ID "2016-08-02 08:45:26 7c38a79cdd42aaa45715aea330d10ca859098837" | |
| 386 | 386 | |
| 387 | 387 | /* |
| 388 | 388 | ** CAPI3REF: Run-Time Library Version Numbers |
| 389 | 389 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 390 | 390 | ** |
| @@ -18324,11 +18324,11 @@ | ||
| 18324 | 18324 | sqlite3_mutex_leave(pMutex); |
| 18325 | 18325 | (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ |
| 18326 | 18326 | return SQLITE_OK; |
| 18327 | 18327 | } |
| 18328 | 18328 | SQLITE_API int SQLITE_APICALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ |
| 18329 | - sqlite3_int64 iCur, iHwtr; | |
| 18329 | + sqlite3_int64 iCur = 0, iHwtr = 0; | |
| 18330 | 18330 | int rc; |
| 18331 | 18331 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 18332 | 18332 | if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; |
| 18333 | 18333 | #endif |
| 18334 | 18334 | rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); |
| @@ -193945,11 +193945,11 @@ | ||
| 193945 | 193945 | int nArg, /* Number of args */ |
| 193946 | 193946 | sqlite3_value **apUnused /* Function arguments */ |
| 193947 | 193947 | ){ |
| 193948 | 193948 | assert( nArg==0 ); |
| 193949 | 193949 | UNUSED_PARAM2(nArg, apUnused); |
| 193950 | - sqlite3_result_text(pCtx, "fts5: 2016-07-30 18:54:54 390a38a142d36d2c57b3f21aab72edcde450125d", -1, SQLITE_TRANSIENT); | |
| 193950 | + sqlite3_result_text(pCtx, "fts5: 2016-08-01 21:17:53 d8ef9f58643f13dd3d16dcde0d829ae08324f04b", -1, SQLITE_TRANSIENT); | |
| 193951 | 193951 | } |
| 193952 | 193952 | |
| 193953 | 193953 | static int fts5Init(sqlite3 *db){ |
| 193954 | 193954 | static const sqlite3_module fts5Mod = { |
| 193955 | 193955 | /* iVersion */ 2, |
| 193956 | 193956 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -380,11 +380,11 @@ | |
| 380 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 381 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 382 | */ |
| 383 | #define SQLITE_VERSION "3.14.0" |
| 384 | #define SQLITE_VERSION_NUMBER 3014000 |
| 385 | #define SQLITE_SOURCE_ID "2016-08-01 17:06:44 90d2c490fc2ed4e073711b84f989ca4d496dcfb5" |
| 386 | |
| 387 | /* |
| 388 | ** CAPI3REF: Run-Time Library Version Numbers |
| 389 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 390 | ** |
| @@ -18324,11 +18324,11 @@ | |
| 18324 | sqlite3_mutex_leave(pMutex); |
| 18325 | (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ |
| 18326 | return SQLITE_OK; |
| 18327 | } |
| 18328 | SQLITE_API int SQLITE_APICALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ |
| 18329 | sqlite3_int64 iCur, iHwtr; |
| 18330 | int rc; |
| 18331 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 18332 | if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; |
| 18333 | #endif |
| 18334 | rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); |
| @@ -193945,11 +193945,11 @@ | |
| 193945 | int nArg, /* Number of args */ |
| 193946 | sqlite3_value **apUnused /* Function arguments */ |
| 193947 | ){ |
| 193948 | assert( nArg==0 ); |
| 193949 | UNUSED_PARAM2(nArg, apUnused); |
| 193950 | sqlite3_result_text(pCtx, "fts5: 2016-07-30 18:54:54 390a38a142d36d2c57b3f21aab72edcde450125d", -1, SQLITE_TRANSIENT); |
| 193951 | } |
| 193952 | |
| 193953 | static int fts5Init(sqlite3 *db){ |
| 193954 | static const sqlite3_module fts5Mod = { |
| 193955 | /* iVersion */ 2, |
| 193956 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -380,11 +380,11 @@ | |
| 380 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 381 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 382 | */ |
| 383 | #define SQLITE_VERSION "3.14.0" |
| 384 | #define SQLITE_VERSION_NUMBER 3014000 |
| 385 | #define SQLITE_SOURCE_ID "2016-08-02 08:45:26 7c38a79cdd42aaa45715aea330d10ca859098837" |
| 386 | |
| 387 | /* |
| 388 | ** CAPI3REF: Run-Time Library Version Numbers |
| 389 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 390 | ** |
| @@ -18324,11 +18324,11 @@ | |
| 18324 | sqlite3_mutex_leave(pMutex); |
| 18325 | (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ |
| 18326 | return SQLITE_OK; |
| 18327 | } |
| 18328 | SQLITE_API int SQLITE_APICALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ |
| 18329 | sqlite3_int64 iCur = 0, iHwtr = 0; |
| 18330 | int rc; |
| 18331 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 18332 | if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; |
| 18333 | #endif |
| 18334 | rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); |
| @@ -193945,11 +193945,11 @@ | |
| 193945 | int nArg, /* Number of args */ |
| 193946 | sqlite3_value **apUnused /* Function arguments */ |
| 193947 | ){ |
| 193948 | assert( nArg==0 ); |
| 193949 | UNUSED_PARAM2(nArg, apUnused); |
| 193950 | sqlite3_result_text(pCtx, "fts5: 2016-08-01 21:17:53 d8ef9f58643f13dd3d16dcde0d829ae08324f04b", -1, SQLITE_TRANSIENT); |
| 193951 | } |
| 193952 | |
| 193953 | static int fts5Init(sqlite3 *db){ |
| 193954 | static const sqlite3_module fts5Mod = { |
| 193955 | /* iVersion */ 2, |
| 193956 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -120,11 +120,11 @@ | ||
| 120 | 120 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 121 | 121 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 122 | 122 | */ |
| 123 | 123 | #define SQLITE_VERSION "3.14.0" |
| 124 | 124 | #define SQLITE_VERSION_NUMBER 3014000 |
| 125 | -#define SQLITE_SOURCE_ID "2016-08-01 17:06:44 90d2c490fc2ed4e073711b84f989ca4d496dcfb5" | |
| 125 | +#define SQLITE_SOURCE_ID "2016-08-02 08:45:26 7c38a79cdd42aaa45715aea330d10ca859098837" | |
| 126 | 126 | |
| 127 | 127 | /* |
| 128 | 128 | ** CAPI3REF: Run-Time Library Version Numbers |
| 129 | 129 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 130 | 130 | ** |
| 131 | 131 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -120,11 +120,11 @@ | |
| 120 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 121 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 122 | */ |
| 123 | #define SQLITE_VERSION "3.14.0" |
| 124 | #define SQLITE_VERSION_NUMBER 3014000 |
| 125 | #define SQLITE_SOURCE_ID "2016-08-01 17:06:44 90d2c490fc2ed4e073711b84f989ca4d496dcfb5" |
| 126 | |
| 127 | /* |
| 128 | ** CAPI3REF: Run-Time Library Version Numbers |
| 129 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 130 | ** |
| 131 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -120,11 +120,11 @@ | |
| 120 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 121 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 122 | */ |
| 123 | #define SQLITE_VERSION "3.14.0" |
| 124 | #define SQLITE_VERSION_NUMBER 3014000 |
| 125 | #define SQLITE_SOURCE_ID "2016-08-02 08:45:26 7c38a79cdd42aaa45715aea330d10ca859098837" |
| 126 | |
| 127 | /* |
| 128 | ** CAPI3REF: Run-Time Library Version Numbers |
| 129 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 130 | ** |
| 131 |
+15
-11
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -170,27 +170,29 @@ | ||
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | /* |
| 173 | 173 | ** Do a single prompt for a passphrase. Store the results in the blob. |
| 174 | 174 | ** |
| 175 | -** If the FOSSIL_PWREADER environment variable is set, then it will | |
| 176 | -** be the name of a program that prompts the user for their password/ | |
| 177 | -** passphrase in a secure manner. The program should take one or more | |
| 178 | -** arguments which are the prompts and should output the acquired | |
| 179 | -** passphrase as a single line on stdout. This function will read the | |
| 180 | -** output using popen(). | |
| 181 | -** | |
| 182 | -** If FOSSIL_PWREADER is not set, or if it is not the name of an | |
| 183 | -** executable, then use the C-library getpass() routine. | |
| 184 | 175 | ** |
| 185 | 176 | ** The return value is a pointer to a static buffer that is overwritten |
| 186 | 177 | ** on subsequent calls to this same routine. |
| 187 | 178 | */ |
| 188 | 179 | static void prompt_for_passphrase(const char *zPrompt, Blob *pPassphrase){ |
| 189 | 180 | char *z; |
| 181 | +#if 0 | |
| 182 | + */ | |
| 183 | + ** If the FOSSIL_PWREADER environment variable is set, then it will | |
| 184 | + ** be the name of a program that prompts the user for their password/ | |
| 185 | + ** passphrase in a secure manner. The program should take one or more | |
| 186 | + ** arguments which are the prompts and should output the acquired | |
| 187 | + ** passphrase as a single line on stdout. This function will read the | |
| 188 | + ** output using popen(). | |
| 189 | + ** | |
| 190 | + ** If FOSSIL_PWREADER is not set, or if it is not the name of an | |
| 191 | + ** executable, then use the C-library getpass() routine. | |
| 192 | + */ | |
| 190 | 193 | const char *zProg = fossil_getenv("FOSSIL_PWREADER"); |
| 191 | - const char *zSecure; | |
| 192 | 194 | if( zProg && zProg[0] ){ |
| 193 | 195 | static char zPass[100]; |
| 194 | 196 | Blob cmd; |
| 195 | 197 | FILE *in; |
| 196 | 198 | blob_zero(&cmd); |
| @@ -199,11 +201,13 @@ | ||
| 199 | 201 | in = popen(blob_str(&cmd), "r"); |
| 200 | 202 | fgets(zPass, sizeof(zPass), in); |
| 201 | 203 | pclose(in); |
| 202 | 204 | blob_reset(&cmd); |
| 203 | 205 | z = zPass; |
| 204 | - }else if( fossil_security_level()>=2 ){ | |
| 206 | + }else | |
| 207 | +#endif | |
| 208 | + if( fossil_security_level()>=2 ){ | |
| 205 | 209 | userGenerateScrambleCode(); |
| 206 | 210 | z = getpass(zPrompt); |
| 207 | 211 | if( z ) userDescramble(z); |
| 208 | 212 | printf("\033[3A\033[J"); /* Erase previous three lines */ |
| 209 | 213 | fflush(stdout); |
| 210 | 214 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -170,27 +170,29 @@ | |
| 170 | |
| 171 | |
| 172 | /* |
| 173 | ** Do a single prompt for a passphrase. Store the results in the blob. |
| 174 | ** |
| 175 | ** If the FOSSIL_PWREADER environment variable is set, then it will |
| 176 | ** be the name of a program that prompts the user for their password/ |
| 177 | ** passphrase in a secure manner. The program should take one or more |
| 178 | ** arguments which are the prompts and should output the acquired |
| 179 | ** passphrase as a single line on stdout. This function will read the |
| 180 | ** output using popen(). |
| 181 | ** |
| 182 | ** If FOSSIL_PWREADER is not set, or if it is not the name of an |
| 183 | ** executable, then use the C-library getpass() routine. |
| 184 | ** |
| 185 | ** The return value is a pointer to a static buffer that is overwritten |
| 186 | ** on subsequent calls to this same routine. |
| 187 | */ |
| 188 | static void prompt_for_passphrase(const char *zPrompt, Blob *pPassphrase){ |
| 189 | char *z; |
| 190 | const char *zProg = fossil_getenv("FOSSIL_PWREADER"); |
| 191 | const char *zSecure; |
| 192 | if( zProg && zProg[0] ){ |
| 193 | static char zPass[100]; |
| 194 | Blob cmd; |
| 195 | FILE *in; |
| 196 | blob_zero(&cmd); |
| @@ -199,11 +201,13 @@ | |
| 199 | in = popen(blob_str(&cmd), "r"); |
| 200 | fgets(zPass, sizeof(zPass), in); |
| 201 | pclose(in); |
| 202 | blob_reset(&cmd); |
| 203 | z = zPass; |
| 204 | }else if( fossil_security_level()>=2 ){ |
| 205 | userGenerateScrambleCode(); |
| 206 | z = getpass(zPrompt); |
| 207 | if( z ) userDescramble(z); |
| 208 | printf("\033[3A\033[J"); /* Erase previous three lines */ |
| 209 | fflush(stdout); |
| 210 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -170,27 +170,29 @@ | |
| 170 | |
| 171 | |
| 172 | /* |
| 173 | ** Do a single prompt for a passphrase. Store the results in the blob. |
| 174 | ** |
| 175 | ** |
| 176 | ** The return value is a pointer to a static buffer that is overwritten |
| 177 | ** on subsequent calls to this same routine. |
| 178 | */ |
| 179 | static void prompt_for_passphrase(const char *zPrompt, Blob *pPassphrase){ |
| 180 | char *z; |
| 181 | #if 0 |
| 182 | */ |
| 183 | ** If the FOSSIL_PWREADER environment variable is set, then it will |
| 184 | ** be the name of a program that prompts the user for their password/ |
| 185 | ** passphrase in a secure manner. The program should take one or more |
| 186 | ** arguments which are the prompts and should output the acquired |
| 187 | ** passphrase as a single line on stdout. This function will read the |
| 188 | ** output using popen(). |
| 189 | ** |
| 190 | ** If FOSSIL_PWREADER is not set, or if it is not the name of an |
| 191 | ** executable, then use the C-library getpass() routine. |
| 192 | */ |
| 193 | const char *zProg = fossil_getenv("FOSSIL_PWREADER"); |
| 194 | if( zProg && zProg[0] ){ |
| 195 | static char zPass[100]; |
| 196 | Blob cmd; |
| 197 | FILE *in; |
| 198 | blob_zero(&cmd); |
| @@ -199,11 +201,13 @@ | |
| 201 | in = popen(blob_str(&cmd), "r"); |
| 202 | fgets(zPass, sizeof(zPass), in); |
| 203 | pclose(in); |
| 204 | blob_reset(&cmd); |
| 205 | z = zPass; |
| 206 | }else |
| 207 | #endif |
| 208 | if( fossil_security_level()>=2 ){ |
| 209 | userGenerateScrambleCode(); |
| 210 | z = getpass(zPrompt); |
| 211 | if( z ) userDescramble(z); |
| 212 | printf("\033[3A\033[J"); /* Erase previous three lines */ |
| 213 | fflush(stdout); |
| 214 |