diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-07-11 00:15:36 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-07-11 00:15:36 +0200 |
| commit | e98f3e30335e3061a2a2d65f297e8a26d77c480c (patch) | |
| tree | fa2f2b0e183197cde674f9776c6d056d925d27d7 /src/bcrypt-test.c | |
| parent | f37858eb4c448eef9c6fe05d2b56856940a7d6ad (diff) | |
| download | use-bcrypt-e98f3e30335e3061a2a2d65f297e8a26d77c480c.tar.gz use-bcrypt-e98f3e30335e3061a2a2d65f297e8a26d77c480c.tar.bz2 use-bcrypt-e98f3e30335e3061a2a2d65f297e8a26d77c480c.zip | |
kleinere Fehlerkorrekturen im Beispiel
Diffstat (limited to 'src/bcrypt-test.c')
| -rw-r--r-- | src/bcrypt-test.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/bcrypt-test.c b/src/bcrypt-test.c index 57cf390..b3f6dbb 100644 --- a/src/bcrypt-test.c +++ b/src/bcrypt-test.c | |||
| @@ -20,8 +20,8 @@ valid_char(int chr) | |||
| 20 | /** | 20 | /** |
| 21 | * Create a new user/password | 21 | * Create a new user/password |
| 22 | * | 22 | * |
| 23 | * \param[in] username | 23 | * \param[in] username User name. |
| 24 | * \param[in] password | 24 | * \param[in] password Plain-text password. |
| 25 | * | 25 | * |
| 26 | * \return true on success (user was created) or false on error | 26 | * \return true on success (user was created) or false on error |
| 27 | */ | 27 | */ |
| @@ -43,6 +43,8 @@ create_user(const char *username, const char *password) // NOLINT | |||
| 43 | char hash[_PASSWORD_LEN + 1] = { 0 }; | 43 | char hash[_PASSWORD_LEN + 1] = { 0 }; |
| 44 | 44 | ||
| 45 | if ( bcrypt_newhash(password, SECURITY_LEVEL, hash, _PASSWORD_LEN) != 0 ) { | 45 | if ( bcrypt_newhash(password, SECURITY_LEVEL, hash, _PASSWORD_LEN) != 0 ) { |
| 46 | (void) fclose(database); | ||
| 47 | |||
| 46 | return false; | 48 | return false; |
| 47 | } | 49 | } |
| 48 | 50 | ||
| @@ -53,10 +55,10 @@ create_user(const char *username, const char *password) // NOLINT | |||
| 53 | } | 55 | } |
| 54 | 56 | ||
| 55 | /** | 57 | /** |
| 56 | * Check is a valid username/password exists in the user-database | 58 | * Check whether a valid username/password exists in the user-database |
| 57 | * | 59 | * |
| 58 | * username A username | 60 | * \param[in] username User name. |
| 59 | * password A strong password | 61 | * \param[in] password Plain-text password. |
| 60 | * | 62 | * |
| 61 | * @return true, if the user was successfully authenticated, otherwise false | 63 | * @return true, if the user was successfully authenticated, otherwise false |
| 62 | */ | 64 | */ |
| @@ -98,9 +100,9 @@ check_user(const char *const username, const char *const password) // NOLINT | |||
| 98 | /** | 100 | /** |
| 99 | * Check if a valid username already exists in the user-database | 101 | * Check if a valid username already exists in the user-database |
| 100 | * | 102 | * |
| 101 | * \param[in] username to be checked | 103 | * \param[in] username User name. |
| 102 | * | 104 | * |
| 103 | * \return true, if the user was successfully authenticated, otherwise false | 105 | * \return true, if the user exists, otherwise false |
| 104 | */ | 106 | */ |
| 105 | bool | 107 | bool |
| 106 | check_user_if_exists(const char *username) | 108 | check_user_if_exists(const char *username) |
