Commit graph

14 commits

Author SHA1 Message Date
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
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Arda Cinar
3f99a8734e LibCore: Call the mkstemp function in a slightly prettier way
This removes a FIXME, although the new version isn't less char-pointery.
2023-01-13 09:29:44 -05:00
Timothy Flynn
e305b32d9a LibCore: Protect Core::Group against null group::gr_mem members
Serenity's implementation does not set this pointer to anything, so we
should not assume it was set.
2022-12-14 07:25:36 -05:00
Timothy Flynn
d09266237d LibCore: Define and use a fallible, OS-independent getgrent(_r) wrapper
Rather than maintaining a list of #ifdef guards to check systems that do
not provide the reentrant version of getgrent, we can use C++ concepts
to let the compiler perform this check for us.

While we're at it, we can also provide this wrapper as fallible to let
the caller TRY calling it.
2022-12-14 07:25:36 -05:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +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
ne0ndrag0n
d8f25ad644 LibCore: Sync groups, getgrent to getgrent_r, fix gr_mem bug 2022-11-25 23:13:16 +01:00
ne0ndrag0n
9ddb86f7db LibCore: Add query for all accounts and groups 2022-11-13 17:49:03 -07:00
Andrew Kaster
d84fc60f96 LibCore: Add support for compiling for Android with API Version >= 30
Most changes are around user and group management, which are exposed in
the Android NDK differently than other Unices.

We require version 30 for memfd_create, version 28 for posix_spawn, and
so on. It's possible a shim for memfd_create could be used, but since
Google is mandating new apps use API level 30 as of Nov 2022, this seems
suitable.
2022-07-19 10:44:02 +01:00
Kenneth Myhra
fbe22af86e Everywhere: Use my fairly new and shiny serenityos.org email :^) 2022-06-30 15:59:42 +01:00
Kenneth Myhra
1fb8408aa2 LibCore: Do not leak FILE pointer in Group::add_group()
By using a ScopeGuard we make sure that we always close the FILE, also
on early returns.
2022-01-21 18:34:24 +01:00
Kenneth Myhra
6df3fdd83f LibCore: Use generic AK_OS_BSD_GENERIC to hide Group::add_group()
This hides the method Group::add_group() on both MacOS and OpenBSD since
the function putgrent(), which is essential for add_group() to work, is
not available on these OSes.
2022-01-21 18:34:24 +01:00
Kenneth Myhra
a99b50ce8c LibCore: Add Core::Group abstraction for group management :^)
This adds the Core::Group C++ abstraction to ease interaction with the
group entry database, as well as represent the Group entry.

Core::Group abstraction currently contains the following functionality:
- Add a group entry - 'Core::Group::add_group()'
2022-01-16 11:19:07 +01:00