fix: use getuser() syscall for determining username rather than session.toml hack

This commit is contained in:
2026-04-01 11:44:13 +02:00
parent 8e63b75fe7
commit 6276f8b162
8 changed files with 40 additions and 67 deletions
+4 -12
View File
@@ -8,7 +8,6 @@
#include <montauk/syscall.h>
#include <montauk/string.h>
#include <montauk/heap.h>
#include <montauk/config.h>
extern "C" {
#include <string.h>
@@ -114,17 +113,10 @@ extern "C" void _start() {
// Build output path: 0:/users/<username>/Pictures/screenshot_YYYYMMDD_HHMMSS.jpg
char username[32] = {};
{
auto doc = montauk::config::load("session");
const char* name = doc.get_string("session.username", "");
if (name[0] == '\0') {
doc.destroy();
montauk::mfree(jpeg.data);
montauk::print("screenshot: no user session\n");
montauk::exit(1);
}
montauk::strncpy(username, name, sizeof(username) - 1);
doc.destroy();
if (montauk::getuser(username, sizeof(username)) <= 0 || username[0] == '\0') {
montauk::mfree(jpeg.data);
montauk::print("screenshot: no user session\n");
montauk::exit(1);
}
char home[128];