mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +00:00
AK+Everywhere: Remove the null state of DeprecatedString
This commit removes DeprecatedString's "null" state, and replaces all its users with one of the following: - A normal, empty DeprecatedString - Optional<DeprecatedString> Note that null states of DeprecatedFlyString/StringView/etc are *not* affected by this commit. However, DeprecatedString::empty() is now considered equal to a null StringView.
This commit is contained in:
parent
daf6d8173c
commit
aeee98b3a1
189 changed files with 597 additions and 652 deletions
|
@ -41,7 +41,7 @@ public:
|
|||
ErrorOr<void> login() const;
|
||||
|
||||
DeprecatedString username() const { return m_username; }
|
||||
DeprecatedString password_hash() const { return m_password_hash; }
|
||||
DeprecatedString password_hash() const { return m_password_hash.value_or(DeprecatedString::empty()); }
|
||||
|
||||
// Setters only affect in-memory copy of password.
|
||||
// You must call sync to apply changes.
|
||||
|
@ -56,9 +56,9 @@ public:
|
|||
void set_extra_gids(Vector<gid_t> extra_gids) { m_extra_gids = move(extra_gids); }
|
||||
void delete_password();
|
||||
|
||||
// A null password means that this account was missing from /etc/shadow.
|
||||
// A nonexistent password means that this account was missing from /etc/shadow.
|
||||
// It's considered to have a password in that case, and authentication will always fail.
|
||||
bool has_password() const { return !m_password_hash.is_empty() || m_password_hash.is_null(); }
|
||||
bool has_password() const { return !m_password_hash.has_value() || !m_password_hash->is_empty(); }
|
||||
|
||||
uid_t uid() const { return m_uid; }
|
||||
gid_t gid() const { return m_gid; }
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
|
||||
DeprecatedString m_username;
|
||||
|
||||
DeprecatedString m_password_hash;
|
||||
Optional<DeprecatedString> m_password_hash;
|
||||
uid_t m_uid { 0 };
|
||||
gid_t m_gid { 0 };
|
||||
DeprecatedString m_gecos;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue