summaryrefslogtreecommitdiff
path: root/modules/pam_namespace/pam_namespace.c
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2009-02-27 14:29:39 +0000
committerTomas Mraz <tm@t8m.info>2009-02-27 14:29:39 +0000
commit42f4743cc3ca046833afcaeec01f9793d74bbfb4 (patch)
treeb969c921b0a5a924b09cf4d34ac74b01b309425c /modules/pam_namespace/pam_namespace.c
parent5891c5508e3b9ba699a6a6ba3dae9221a45528e5 (diff)
Relevant BUGIDs:
Purpose of commit: new feature Commit summary: --------------- 2009-02-27 Tomas Mraz <t8m@centrum.cz> * modules/pam_mkhomedir/pam_mkhomedir.c(create_homedir): Replace signal() with sigaction(). * modules/pam_namespace/pam_namespace.c(inst_init, cleanup_tmpdirs): Likewise. * modules/pam_unix/pam_unix_acct.c(_unix_run_verify_binary): Likewise. * modules/pam_unix/pam_unix_passwd.c(_unix_run_update_binary): Likewise. * modules/pam_unix/passverify.c(su_sighandler): Likewise. * modules/pam_unix/support.c(_unix_run_helper_binary): Likewise. * modules/pam_tally2/Makefile.am: Link the pam_tally2 app to libpam for auxiliary functions. * modules/pam_tally2/pam_tally2.8.xml: Drop non-existing no_reset option. Document new serialize option. * modules/pam_tally2/pam_tally2.c: Add support for the new serialize option. (_cleanup, tally_set_data, tally_get_data): Add tally file handle to tally PAM data. Needed for fcntl() locking. (get_tally): Use low level file access instead of stdio buffered FILE. If serialize option is used lock the tally file access. (set_tally, tally_bump, tally_reset): Use low level file access instead of stdio buffered FILE. Close the file handle only when it is not owned by PAM data. (pam_sm_authenticate, pam_sm_setcred, pam_sm_acct_mgmt): Pass the tally file handle to tally_set_data(). Get it from tally_get_data(). (main): Use low level file access instead of stdio buffered FILE.
Diffstat (limited to 'modules/pam_namespace/pam_namespace.c')
-rw-r--r--modules/pam_namespace/pam_namespace.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
index 89bc3686..7d668d9e 100644
--- a/modules/pam_namespace/pam_namespace.c
+++ b/modules/pam_namespace/pam_namespace.c
@@ -1157,15 +1157,15 @@ static int inst_init(const struct polydir_s *polyptr, const char *ipath,
struct instance_data *idata, int newdir)
{
pid_t rc, pid;
- sighandler_t osighand = NULL;
+ struct sigaction newsa, oldsa;
int status;
const char *init_script = NAMESPACE_INIT_SCRIPT;
- osighand = signal(SIGCHLD, SIG_DFL);
- if (osighand == SIG_ERR) {
+ memset(&newsa, '\0', sizeof(newsa));
+ newsa.sa_handler = SIG_DFL;
+ if (sigaction(SIGCHLD, &newsa, &oldsa) == -1) {
pam_syslog(idata->pamh, LOG_ERR, "Cannot set signal value");
- rc = PAM_SESSION_ERR;
- goto out;
+ return PAM_SESSION_ERR;
}
if ((polyptr->flags & POLYDIR_ISCRIPT) && polyptr->init_script)
@@ -1214,7 +1214,7 @@ static int inst_init(const struct polydir_s *polyptr, const char *ipath,
}
rc = PAM_SUCCESS;
out:
- (void) signal(SIGCHLD, osighand);
+ (void) sigaction(SIGCHLD, &oldsa, NULL);
return rc;
}
@@ -1594,14 +1594,14 @@ static int cleanup_tmpdirs(struct instance_data *idata)
{
struct polydir_s *pptr;
pid_t rc, pid;
- sighandler_t osighand = NULL;
+ struct sigaction newsa, oldsa;
int status;
- osighand = signal(SIGCHLD, SIG_DFL);
- if (osighand == SIG_ERR) {
+ memset(&newsa, '\0', sizeof(newsa));
+ newsa.sa_handler = SIG_DFL;
+ if (sigaction(SIGCHLD, &newsa, &oldsa) == -1) {
pam_syslog(idata->pamh, LOG_ERR, "Cannot set signal value");
- rc = PAM_SESSION_ERR;
- goto out;
+ return PAM_SESSION_ERR;
}
for (pptr = idata->polydirs_ptr; pptr; pptr = pptr->next) {
@@ -1639,7 +1639,7 @@ static int cleanup_tmpdirs(struct instance_data *idata)
rc = PAM_SUCCESS;
out:
- signal(SIGCHLD, osighand);
+ sigaction(SIGCHLD, &oldsa, NULL);
return rc;
}