Further ideas on user authentication. Not yet working code.

FossilOrigin-Name: c8171ecd0d6f097c9e95d5f6643bae8d67f44750
This commit is contained in:
drh
2014-09-10 17:34:28 +00:00
parent d45309796b
commit e933b83f02
9 changed files with 117 additions and 101 deletions
+7 -10
View File
@@ -995,24 +995,21 @@ struct FuncDefHash {
*/
typedef struct sqlite3_userauth sqlite3_userauth;
struct sqlite3_userauth {
u8 authFlags; /* Status flags for user authentication */
u8 authLevel; /* Current authentication level */
int nAuthPW; /* Size of the zAuthPW in bytes */
char *zAuthPW; /* Password used to authenticate */
char *zAuthUser; /* User name used to authenticate */
};
/* Allowed values for sqlite3_userauth.authFlags */
#define UAUTH_Ovrd 0x01 /* Do not enforce access restrictions */
#define UAUTH_Auth 0x02 /* True if the user has authenticated */
#define UAUTH_Admin 0x04 /* True if the user is an administrator */
#define UAUTH_AuthReqd 0x08 /* True if main has an sqlite_user table */
/* Macros for accessing sqlite3.auth.authFlags */
#define DbIsAuth(D) (((D)->auth.authFlags&UAUTH_Auth)!=0)
#define DbIsAdmin(D) (((D)->auth.authFlags&UAUTH_Admin)!=0)
/* Allowed values for sqlite3_userauth.authLevel */
#define UAUTH_Unknown 0 /* Authentication not yet checked */
#define UAUTH_Fail 1 /* User authentication failed */
#define UAUTH_User 2 /* Authenticated as a normal user */
#define UAUTH_Admin 3 /* Authenticated as an administrator */
/* Functions used only by user authorization logic */
int sqlite3UserAuthTable(const char*);
int sqlite3UserAuthCheckLogin(sqlite3*,const char*,u8*);
#endif /* SQLITE_USER_AUTHENTICATION */