Compare commits
3 Commits
setuid
...
aea6e94ad7
Author | SHA1 | Date | |
---|---|---|---|
![]() |
aea6e94ad7 | ||
![]() |
52fcb4d4e3 | ||
badbf2ff98 |
@@ -154,8 +154,11 @@ int init_perm_permissions_table(const char *db_filename) {
|
|||||||
euid = geteuid();
|
euid = geteuid();
|
||||||
fprintf(stderr, "Running with uid: %d, gid: %d\n", euid, getegid());
|
fprintf(stderr, "Running with uid: %d, gid: %d\n", euid, getegid());
|
||||||
|
|
||||||
if (sqlite3_open(db_filename, &perm_database)) {
|
if (sqlite3_open_v2(db_filename, &perm_database,
|
||||||
perror("Can't open permanent permissions database:");
|
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
|
||||||
|
SQLITE_OPEN_FULLMUTEX,
|
||||||
|
NULL)) {
|
||||||
|
perror("Can't open permanent permissions database");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
umask(0);
|
umask(0);
|
||||||
|
@@ -75,6 +75,7 @@ unsigned long long get_process_creation_time(pid_t pid) {
|
|||||||
int init_temp_permissions_table() {
|
int init_temp_permissions_table() {
|
||||||
pthread_mutex_init(&temp_permissions_table_lock, PTHREAD_MUTEX_DEFAULT);
|
pthread_mutex_init(&temp_permissions_table_lock, PTHREAD_MUTEX_DEFAULT);
|
||||||
init(&temp_permissions_table);
|
init(&temp_permissions_table);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -225,7 +226,6 @@ int give_temp_access(const char *filename, struct process_info pi) {
|
|||||||
push(&new_permission_entry.allowed_files, strdup(filename));
|
push(&new_permission_entry.allowed_files, strdup(filename));
|
||||||
|
|
||||||
insert(&temp_permissions_table, pi.PID, new_permission_entry);
|
insert(&temp_permissions_table, pi.PID, new_permission_entry);
|
||||||
printf("temp_permissions_table size: %ld\n", size(&temp_permissions_table));
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&temp_permissions_table_lock);
|
pthread_mutex_unlock(&temp_permissions_table_lock);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user