From aaa5fe602c4eb8b7e1ba7e3f98cc56cdd3f179c2 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Mon, 23 Jun 2008 21:01:33 +0200 Subject: [PATCH] Move macros and static declarations where they are needed. --- src/cron.h | 17 ----------------- src/security.c | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/cron.h b/src/cron.h index 6ed3de1..dff8fc1 100644 --- a/src/cron.h +++ b/src/cron.h @@ -49,20 +49,3 @@ #include "funcs.h" #include "globals.h" -#ifdef WITH_PAM -static pam_handle_t *pamh = NULL; -static int pam_session_opened = 0; //global for open session -static const struct pam_conv conv = { - NULL -}; - -#define PAM_FAIL_CHECK if (retcode != PAM_SUCCESS) { \ - fprintf(stderr,"\n%s\n",pam_strerror(pamh, retcode)); \ - if (pamh != NULL) { \ - if (pam_session_opened != 0) \ - pam_close_session(pamh, PAM_SILENT); \ - pam_end(pamh, retcode); \ - } \ - return(retcode); } -#endif - diff --git a/src/security.c b/src/security.c index 0333630..eb4c9c1 100644 --- a/src/security.c +++ b/src/security.c @@ -33,6 +33,25 @@ #include #endif +#ifdef WITH_PAM +static pam_handle_t *pamh = NULL; +static int pam_session_opened = 0; //global for open session +static const struct pam_conv conv = { + NULL +}; + +static int cron_open_pam_session(struct passwd *pw); + +#define PAM_FAIL_CHECK if (retcode != PAM_SUCCESS) { \ + fprintf(stderr,"\n%s\n",pam_strerror(pamh, retcode)); \ + if (pamh != NULL) { \ + if (pam_session_opened != 0) \ + pam_close_session(pamh, PAM_SILENT); \ + pam_end(pamh, retcode); \ + } \ + return(retcode); } +#endif + static char ** build_env(char **cronenv); #ifdef WITH_SELINUX @@ -140,7 +159,7 @@ int cron_start_pam(struct passwd *pw) { return retcode; } -int cron_open_pam_session(struct passwd *pw) { +static int cron_open_pam_session(struct passwd *pw) { int retcode = 0; #if defined(WITH_PAM) -- 2.40.0