summaryrefslogtreecommitdiff
path: root/Userland/Utilities/pls.cpp
AgeCommit message (Collapse)Author
2022-11-05Userland/pls: Use Core::System::exec_command method to execute a commandLiav A
2022-09-28pls: Use `LibCore::Account::login()` instead of manually setting the uidLucas CHOLLET
In addition to changing the uid, the method also changes the gid and properly sets groups. So this patch will also mitigate the security issue of `pls`.
2022-07-12Everywhere: Split Error::from_string_literal and Error::from_string_viewsin-ack
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-06-28pls: Implement support for `--preserve-env`Tim Schumacher
2022-06-28pls: Don't rely on `getenv` to find `TERM`Tim Schumacher
This allows us to skip storing the actual backing data in a separate `Vector`, as we know that we are working with `environ`-backed storage here. Also, while the logic is currently very similar to what `getenv` does internally, this allows us to eventually implement custom environment variable filters while remaining linear in run time.
2022-04-11pls: Use Core::System::exec()Sam Atkins
2021-12-28pls: Stop on first non option when parsing argumentsIdan Horowitz
This allows using pls on a program with arguments more ergonomically, e.g. `pls -- echo "hello friends"` can now simply be done as: `pls echo "hello friends"`.
2021-12-16pls: Port to LibMain :^)Andreas Kling
2021-09-12LibCore: Make Account::authenticate take a SecretStringBrian Gianforcaro
To encourage users to use the SecretString API, change the API so that Account::authenticate only accepts a SecretString.
2021-09-12LibCore: Make get_password return SecretString instead of StringBrian Gianforcaro
We shouldn't let secrets sit around in memory, as they could potentially be retrieved by an attacker, or left in memory during a core dump.
2021-08-16Userland: Add as-user execution to the pls utilitypyunbiwi
Commands may be executed as a specific user by passing the user's UID to the '-u' flag in pls.
2021-05-30pls: Fix typo in TERM environment variable propagationAndreas Kling
2021-05-30pls: Drastically simplify this programAndreas Kling
Since this program is setuid-root, it should be as simple as possible. To that end, remove `/etc/plsusers` and use filesystem permissions to achieve the same thing. `/bin/pls` is now only executable by `root` or members of the `wheel` group. Also remove all the logic that went to great lengths to `unveil()` a minimal set of filesystem paths that may be used for the command. The complexity-to-benefit ratio did not seem justified, and I think we're better off keeping this simple. Finally, remove pledge promises the moment they are no longer needed.
2021-05-30pls: Unveil search paths with browse permissionsBrendan Coles
2021-05-29Userland: Check sudoers file perms and owner in plsJesse Buhagiar
As per comment found in #6319 by @bcoles, `pls` should check the permissions and owner of the sudoers file to ensure that it hasn't been compromised.
2021-05-29Userland: Implement `pls`, a sudo cloneJesse Buhagiar