static void afp_dsi_close(AFPObj *obj) { DSI *dsi = obj->handle; sigset_t sigs; close(obj->ipc_fd); obj->ipc_fd = -1; /* we may have been called from a signal handler caught when afpd was running * as uid 0, that's the wrong user for volume's prexec_close scripts if any, * restore our login user */ if (geteuid() != obj->uid) { if (seteuid( obj->uid ) < 0) { LOG(log_error, logtype_afpd, "can't seteuid(%u) back %s: uid: %u, euid: %u", obj->uid, strerror(errno), getuid(), geteuid()); exit(EXITERR_SYS); } } close_all_vol(); if (obj->logout) { /* Block sigs, PAM/systemd/whoever might send us a SIG??? in (*obj->logout)() -> pam_close_session() */ sigfillset(&sigs); pthread_sigmask(SIG_BLOCK, &sigs, NULL); (*obj->logout)(); } LOG(log_note, logtype_afpd, "AFP statistics: %.2f KB read, %.2f KB written", dsi->read_count/1024.0, dsi->write_count/1024.0); log_dircache_stat(); dsi_close(dsi); }
static void afp_dsi_close(AFPObj *obj) { DSI *dsi = obj->dsi; close(obj->ipc_fd); obj->ipc_fd = -1; /* we may have been called from a signal handler caught when afpd was running * as uid 0, that's the wrong user for volume's prexec_close scripts if any, * restore our login user */ if (geteuid() != obj->uid) { if (seteuid( obj->uid ) < 0) { LOG(log_error, logtype_afpd, "can't seteuid(%u) back %s: uid: %u, euid: %u", obj->uid, strerror(errno), getuid(), geteuid()); exit(EXITERR_SYS); } } close_all_vol(obj); if (obj->logout) (*obj->logout)(); LOG(log_note, logtype_afpd, "AFP statistics: %.2f KB read, %.2f KB written", dsi->read_count/1024.0, dsi->write_count/1024.0); log_dircache_stat(); dsi_close(dsi); }