mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-02 22:05:04 +02:00
commit
3bfc2f52f3
3
debug/README.md
Normal file
3
debug/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Debug
|
||||||
|
|
||||||
|
This folder contains debug utils like gdb scripts. They are not guaranteed to work but can ease some tasks when debugging.
|
59
debug/debug.gdb
Normal file
59
debug/debug.gdb
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# this just meant to run in another term, is probably better to attach to another already running window
|
||||||
|
set inferior-tty /dev/pts/7
|
||||||
|
set pagination off
|
||||||
|
|
||||||
|
break *(read_press + 62)
|
||||||
|
define fake_read
|
||||||
|
set *((char*) $rsi) = $al
|
||||||
|
set $rax = 1
|
||||||
|
jump *(read_press + 67)
|
||||||
|
end
|
||||||
|
|
||||||
|
break *(read_press + 108)
|
||||||
|
define fake_magic_cont
|
||||||
|
set $eax = 1
|
||||||
|
jump *(read_press + 113)
|
||||||
|
end
|
||||||
|
define fake_magic_end
|
||||||
|
set $eax = 0
|
||||||
|
jump *(read_press + 113)
|
||||||
|
end
|
||||||
|
|
||||||
|
run
|
||||||
|
set $al = 0x1b
|
||||||
|
fake_read
|
||||||
|
fake_magic_cont
|
||||||
|
set $al = '['
|
||||||
|
fake_read
|
||||||
|
fake_magic_cont
|
||||||
|
set $al = 'D'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = 'p'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = 'a'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = 's'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = 's'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = 'w'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = 'd'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
||||||
|
|
||||||
|
set $al = '\n'
|
||||||
|
fake_read
|
||||||
|
fake_magic_end
|
31
src/auth.c
31
src/auth.c
@ -121,19 +121,26 @@ void moarEnv(char* user, struct session session, struct passwd* pw,
|
|||||||
sourceFileTry((char*)vec_get(&config->behavior.source, i));
|
sourceFileTry((char*)vec_get(&config->behavior.source, i));
|
||||||
}
|
}
|
||||||
/* printf("\n"); */
|
/* printf("\n"); */
|
||||||
if (pw->pw_dir) {
|
|
||||||
uint home_len = strlen(pw->pw_dir);
|
|
||||||
for (size_t i = 0; i < config->behavior.user_source.length; i++) {
|
|
||||||
char* file2sourcepath = (char*)vec_get(&config->behavior.user_source, i);
|
|
||||||
size_t newbuf_len = home_len + strlen(file2sourcepath) + 2;
|
|
||||||
char* newbuf = malloc(newbuf_len); // nullbyte and slash
|
|
||||||
if (newbuf == NULL) continue; // can't bother
|
|
||||||
memcpy(newbuf, pw->pw_dir, newbuf_len);
|
|
||||||
newbuf[home_len] = '/'; // assume pw_dir doesn't start with '/' :P
|
|
||||||
memcpy(&newbuf[home_len + 1], file2sourcepath, newbuf_len - home_len);
|
|
||||||
|
|
||||||
sourceFileTry(newbuf);
|
if (pw->pw_dir) {
|
||||||
free(newbuf);
|
const char* home = pw->pw_dir;
|
||||||
|
size_t home_len = strlen(home);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < config->behavior.user_source.length; i++) {
|
||||||
|
const char* filename = (char*)vec_get(&config->behavior.user_source, i);
|
||||||
|
size_t filename_len = strlen(filename);
|
||||||
|
|
||||||
|
size_t path_len = home_len + 1 + filename_len + 1; // nullbyte and slash
|
||||||
|
char* path = malloc(path_len);
|
||||||
|
if (!path) continue; // can't bother
|
||||||
|
|
||||||
|
memcpy(path, home, home_len);
|
||||||
|
path[home_len] = '/'; // assume pw_dir doesn't start with '/' :P
|
||||||
|
memcpy(&path[home_len + 1], filename, filename_len);
|
||||||
|
path[path_len - 1] = '\0';
|
||||||
|
|
||||||
|
sourceFileTry(path);
|
||||||
|
free(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user