65#define PQS_USER_DATABASE_MAGIC "PQSUSERDB1"
70#define PQS_USER_DEFAULT_SHELL_PROFILE "default"
79 uint8_t
salt[PQS_USER_SALT_SIZE];
94 char path[QSC_SYSTEM_MAX_PATH];
PQS_EXPORT_API pqs_user_privileges pqs_user_privilege_from_string(const char *value)
Convert a stable text name to a privilege level.
Definition pqsuser.c:669
PQS_EXPORT_API bool pqs_user_verify_passphrase_timing_neutral(const pqs_user_record *record, const char *username, const char *passphrase)
Verify a passphrase using a timing-neutral valid or dummy account path.
Definition pqsuser.c:722
PQS_EXPORT_API bool pqs_user_verify_passphrase(const pqs_user_record *record, const char *passphrase)
Verify a plaintext passphrase against a user record.
Definition pqsuser.c:694
PQS_EXPORT_API bool pqs_user_passphrase_is_valid(const char *passphrase)
Test whether a passphrase length is valid for a PQS account and login request.
Definition pqsuser.c:103
PQS_EXPORT_API bool pqs_user_store_set_passphrase(pqs_user_store *store, const char *username, const char *passphrase)
Set a user's passphrase verifier.
Definition pqsuser.c:617
PQS_EXPORT_API pqs_user_record * pqs_user_store_find_mutable(pqs_user_store *store, const char *username)
Find a mutable user record by name.
Definition pqsuser.c:409
PQS_EXPORT_API const pqs_user_record * pqs_user_store_find(const pqs_user_store *store, const char *username)
Find a user record by name.
Definition pqsuser.c:385
PQS_EXPORT_API bool pqs_user_store_set_privilege(pqs_user_store *store, const char *username, pqs_user_privileges privilege)
Set the user privilege level.
Definition pqsuser.c:570
PQS_EXPORT_API bool pqs_user_store_enable(pqs_user_store *store, const char *username, bool enabled)
Disable or enable a user account.
Definition pqsuser.c:359
PQS_EXPORT_API bool pqs_user_store_initialize(pqs_user_store *store, const char *path)
Initialize and load the user database.
Definition pqsuser.c:433
PQS_EXPORT_API bool pqs_user_store_save(const pqs_user_store *store)
Save the user database to disk.
Definition pqsuser.c:527
PQS_EXPORT_API bool pqs_user_name_is_valid(const char *username)
Test whether a user name is valid for a PQS account and login request.
Definition pqsuser.c:66
PQS_EXPORT_API bool pqs_user_store_set_shell_profile(pqs_user_store *store, const char *username, const char *shellprofile)
Set a user's assigned shell profile name.
Definition pqsuser.c:590
PQS_EXPORT_API bool pqs_user_store_add(pqs_user_store *store, const char *username, const char *passphrase, pqs_user_privileges privilege)
Add a user to the user database.
Definition pqsuser.c:315
PQS_EXPORT_API const char * pqs_user_privilege_to_string(pqs_user_privileges privilege)
Convert a privilege level to its stable text name.
Definition pqsuser.c:647
PQS_EXPORT_API bool pqs_user_store_remove(pqs_user_store *store, const char *username)
Remove a user from the user database.
Definition pqsuser.c:492
A PQS server user account record.
Definition pqsuser.h:76
uint32_t failures
Definition pqsuser.h:83
uint64_t created
Definition pqsuser.h:81
uint64_t modified
Definition pqsuser.h:82
uint8_t salt[PQS_USER_SALT_SIZE]
Definition pqsuser.h:79
char username[PQS_USERNAME_MAX]
Definition pqsuser.h:77
bool enabled
Definition pqsuser.h:85
pqs_user_privileges privilege
Definition pqsuser.h:84
char shellprofile[PQS_SHELL_PROFILE_NAME_MAX]
Definition pqsuser.h:78
uint8_t verifier[PQS_USER_VERIFIER_SIZE]
Definition pqsuser.h:80
The fixed-size PQS server user database.
Definition pqsuser.h:92
pqs_user_record records[PQS_USER_DATABASE_MAX]
Definition pqsuser.h:93
size_t count
Definition pqsuser.h:95
char path[QSC_SYSTEM_MAX_PATH]
Definition pqsuser.h:94
bool initialized
Definition pqsuser.h:96