Commit graph

22 commits

Author SHA1 Message Date
Tim Ledbetter 08cb49c2bd useradd: Simplify uid validation 2023-08-26 19:01:22 -04:00
Tim Ledbetter 8955560801 useradd: Allow group name or number to be used with the -g option 2023-08-26 19:01:22 -04:00
Sam Atkins 0f95ff64ed Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
Timothy Flynn 15532df83d AK+Everywhere: Change AK::fill_with_random to accept a Bytes object
Rather than the very C-like API we currently have, accepting a void* and
a length, let's take a Bytes object instead. In almost all existing
cases, the compiler figures out the length.
2023-04-03 15:53:49 +02:00
Ali Mohammad Pur 500044906d LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
2023-03-01 10:47:19 +01:00
Andrew Kaster 72a48ee1ee LibCore+Utilities: Replace uses of strpbrk with find_any_of()
We don't need to use scary C string POSIX APIs when we have nicer ones
on String/DeprecatedString.
2023-02-25 22:31:17 +01:00
Linus Groh 6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Jelle Raaijmakers 25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
sin-ack 3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack 60f6bc902b Userland: Convert command line arguments to String/StringView
StringView was used where possible. Some utilities still use libc
functions which expect null-terminated strings, so String objects were
used there instead.
2022-07-12 23:11:35 +02:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
TheOddGarlic 6499699d6d useradd: Port to LibMain 2022-02-28 14:05:04 +01:00
brapru d7a25cdb82 Utilities: Do not allow creating users with existing usernames
Previously useradd would not check if a username already existed on the
system, and would instead add the user anyway and just increment the
uid. useradd should instead return an error when the user attempts to
create already existing users.
2021-06-09 09:00:31 +02:00
Linus Groh f5c35fccca Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
brapru ff4f3dd586 Utilities: Update useradd to use /etc/shadow
This updates useradd to write the spwd struct entry into
the /etc/shadow file via putspent.

Fixes #4884
2021-05-30 17:42:03 +01:00
brapru 1560775494 Utilities: Change default shell of useradd to /bin/sh 2021-05-30 17:42:03 +01:00
Linus Groh d8a3609aa9 Everywhere: Add a blank line after copyright header where missing 2021-05-15 00:27:09 +01:00
Jean-Baptiste Boric e16894af5a LibC: Do not include errno.h inside unistd.h
POSIX does not mandate this, therefore let's not do it.
2021-05-14 22:24:02 +02:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling 931f3c03d0 useradd: Convert String::format() => String::formatted()
Also make more use of warnln().
2021-04-21 23:49:02 +02:00
Andreas Kling ececac65c2 Userland: Move command-line utilities to Userland/Utilities/ 2021-01-12 12:04:09 +01:00
Renamed from Userland/useradd.cpp (Browse further)