Commit Graph

680 Commits

Author SHA1 Message Date
5aba1c5f15 su: Make it setuid root, ask for a password, and accept a username
It asks for a password only if you are not root, obviously.
2022-10-28 20:57:13 +02:00
477af66cdc ps: Show usernames of processes, using getpwuid() 2022-10-28 20:55:39 +02:00
7d0e442cde libc: Add /etc/passwd and the pwd.h API
getpwent, getpwnam, getpwuid... they may have been a pain to implement but once they work they're awesome :)

Right now passwords are stored in plaintext in the world-readable passwd file, which is not good.
But I don't have any sort of hashing implemented so it'll stay that way for now.
2022-10-28 20:55:00 +02:00
e05f3f5325 Kernel: Read file modes from the initrd, filtering out write permissions 2022-10-28 20:52:10 +02:00
a2d9ada4dc oopsie 2022-10-28 19:38:04 +02:00
b8296eb92d su: Also set group ID 2022-10-28 17:55:56 +02:00
fa0dc4b18c apps: Remove sym and crash
Not necessary anymore.
2022-10-28 17:53:22 +02:00
68d0d0b759 apps: Add a new su utility 2022-10-28 17:52:46 +02:00
8f0e358360 libc: Add setuid, setgid, seteuid, setegid 2022-10-28 17:52:39 +02:00
09a615bd99 Kernel, libc: Expose processes' UID and GID in pstat() 2022-10-28 17:31:34 +02:00
acdc2d3ad7 init: Open /dev/console for appending 2022-10-28 17:31:00 +02:00
17671fd435 libc: Implement getuid, geteuid, getgid, getegid 2022-10-28 17:24:28 +02:00
1c4f1ab867 Kernel, libc: Add setuid() and setgid() system calls 2022-10-28 17:19:26 +02:00
2269ec267c apps: Add a 'stat' utility 2022-10-28 17:14:20 +02:00
b1729689df libc: Open stdout and stderr write-only on init 2022-10-28 17:14:09 +02:00
77d331b258 init: Open /etc/motd with O_CLOEXEC to avoid leaking this file to children 2022-10-28 17:13:45 +02:00
c312d81de4 Kernel, libc: Add st_uid and st_gid to stat, and handle st_mode differently 2022-10-28 17:13:20 +02:00
26b20938de Kernel, libc: Use mode in mkdir() 2022-10-28 17:11:35 +02:00
0115cce750 Kernel/VFS: Add file owners and file modes, and check those in system calls 2022-10-28 17:10:28 +02:00
6ddfc5ee52 Kernel: Invoke sys_stat when asked 2022-10-28 17:06:33 +02:00
16dc227a05 Kernel: Add UID and GID fields to Task 2022-10-28 17:06:13 +02:00
3effe8b004 Kernel: Add EACCES to std/errno.h 2022-10-28 17:02:27 +02:00
b2f321c0b8 libc: Parse the mode string 2022-10-28 17:02:08 +02:00
8ed0ff1381 libc: Ensure /dev/random is opened with O_CLOEXEC on init 2022-10-27 17:50:15 +02:00
d93a4062a2 libc: Do not use the heavy variadic syscall() function for wrappers
That function is meant more for user programs, and should still be rarely used, since it's not portable.
Instead, we already know the number of arguments. We just call __lc_fast_syscallN, which also sets errno.
2022-10-27 17:42:00 +02:00
0eb0ca4028 libc: Add an empty locale.h 2022-10-27 17:23:59 +02:00
7155cf8d6b libc: Add alloca.h 2022-10-27 17:23:50 +02:00
703b0a1435 libc: Make tv_usec in timeval signed, as it should be 2022-10-27 17:20:46 +02:00
50cda50f01 Kernel, libc: Add F_GETFD, F_SETFD and FD_CLOEXEC 2022-10-27 17:17:24 +02:00
fcf53ef6a5 Kernel: Make waitpid() block by default unless WNOHANG is specified 2022-10-27 17:05:42 +02:00
da8a3de480 It's actually S_ISCHR in this case 2022-10-27 08:10:35 +02:00
cdb1f46b93 libc: Add S_ISDEV 2022-10-27 08:09:10 +02:00
06e6429567 Kernel: Reorganize a bit of scheduler code 2022-10-27 08:07:34 +02:00
f9dad8a8d6 Kernel, libc: Stub out struct stat.st_dev 2022-10-27 08:01:33 +02:00
9b0f6b6595 Kernel, libc: Add O_EXCL 2022-10-27 07:55:59 +02:00
211c76f920 libc: Provide a definition for timeval 2022-10-27 07:55:02 +02:00
1c35eabb2b open(): Add a third optional mode argument 2022-10-27 07:52:57 +02:00
a3c6635f3e Kernel, libc: Add O_APPEND and stub out O_CREAT and O_TRUNC 2022-10-27 07:43:55 +02:00
651ffe6d64 Ports: Simplify remove-port.sh 2022-10-26 22:00:31 +02:00
d875224045 Ports: Add mpc, mpfr and gmp ports 2022-10-26 21:56:43 +02:00
f004122735 cat: Remove unnecessary include 2022-10-26 20:55:08 +02:00
41f7232b77 Devices: Return EOF after first read for some devices
Still not optimal.
2022-10-26 20:54:47 +02:00
d5a64319f9 apps: Add cat 2022-10-26 20:51:20 +02:00
2512acc716 ls: Use command-line arguments 2022-10-26 20:30:22 +02:00
e1f58c0163 Kernel: If wrapping a line at screen bottom, scroll properly 2022-10-26 20:14:24 +02:00
6892fd96d0 sh: Split a command into arguments and pass those on
This is a big achievement!!
2022-10-26 20:06:21 +02:00
a4e430d35e Kernel: count the null byte while calculating how much stack space argv will use 2022-10-26 20:05:24 +02:00
23b12d2d56 sh: Clear exit status if we do not execute another command 2022-10-26 19:39:04 +02:00
5492b1b44d sh: Implement our own execvp() while we wait for libc.
Of course, this is a very primitive execvp with hardcoded paths.
If it were decent, it would be integrated into libc instantly.
2022-10-26 19:36:09 +02:00
796d61020b argv might be null when we're init 2022-10-26 19:22:50 +02:00