Fix umask and password memory wipe

- Set umask(0077) in daemonize() to prevent world-readable files
- Wipe password from memory after psync_set_user_pass()

Fixes #203, #204
This commit is contained in:
Levi Neely 2026-03-03 11:18:21 +01:00
parent b5a6847968
commit 8d57e404d1
2 changed files with 2 additions and 1 deletions

View File

@ -485,7 +485,7 @@ int daemonize(bool do_commands) {
}
/* Open any logs here */
umask(0);
umask(0077);
sid = setsid();
if (sid < 0) {
exit(EXIT_FAILURE);

View File

@ -442,6 +442,7 @@ static void status_change(pstatus_t *status) {
psync_set_user_pass(clib::pclsync_lib::get_lib().get_username().c_str(),
clib::pclsync_lib::get_lib().get_password().c_str(),
(int)clib::pclsync_lib::get_lib().save_pass_);
clib::pclsync_lib::get_lib().wipe_password();
std::cout << "logging in" << std::endl;
} else if (status->status == PSTATUS_TFA_REQUIRED) {
if (clib::pclsync_lib::get_lib().get_tfa_code().empty()) {