]> granicus.if.org Git - cronie/commitdiff
Into with_selinux and with_pam part was added variables
authormmaslano <mmaslano@redhat.com>
Fri, 17 Aug 2007 13:16:14 +0000 (15:16 +0200)
committermmaslano <mmaslano@redhat.com>
Fri, 24 Aug 2007 13:06:00 +0000 (15:06 +0200)
used only there. In Makefile are libs set by variables.

Makefile
security.c
structs.h

index 0e38b6376699e19ee6e90f66f4e64e7b76fb4b16..dbd1a2e61008d5102e59159f80698bd8411c3e15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,19 @@ DESTETC              =       $(DESTROOT)/../etc
 INCLUDE                =       -I.
 #INCLUDE       =
 #<<need getopt()>>
-LIBS           =       -lselinux -lpam -lpam_misc -laudit
+ifdef WITH_SELINUX
+SELINUX_LIBS=-lselinux
+SELINUX_DEFS=-DWITH_SELINUX
+endif
+ifdef WITH_PAM
+PAM_LIBS=-lpam -lpam_misc
+PAM_DEFS=-DWITH_PAM
+endif
+ifdef WITH_AUDIT
+AUDIT_LIBS=-laudit
+AUDIT_DEFS=-DWITH_AUDIT
+endif
+LIBS           =       $(SELINUX_LIBS) $(PAM_LIBS) $(AUDIT_LIBS)
 #<<optimize or debug?>>
 #CDEBUG                =       -O
 #CDEBUG                =       -g
@@ -70,7 +82,7 @@ LINTFLAGS     =       -hbxa $(INCLUDE) $(DEBUGGING)
 #<<want to use a nonstandard CC?>>
 CC             =       gcc -Wall -Wno-unused -Wno-comment
 #<<manifest defines>>
-DEFS           =       -DWITH_SELINUX -DWITH_PAM -DWITH_AUDIT
+DEFS           =       $(SELINUX_DEFS) $(PAM_DEFS) $(AUDIT_DEFS)
 #(SGI IRIX systems need this)
 #DEFS          =       -D_BSD_SIGNALS -Dconst=
 #<<the name of the BSD-like install program>>
index 2aafa82566a3d1617dd07a0dcbc0e014dd5d7a68..7f9878f11c6ddbd5f13e99e8ea2532837dcaf462 100644 (file)
@@ -190,6 +190,7 @@ int get_security_context( const char *name,
                          int crontab_fd, 
                          security_context_t *rcontext, 
                          const char *tabname) {
+#ifdef WITH_SELINUX
        security_context_t scontext=NULL;
        security_context_t  file_context=NULL;
        struct av_decision avd;
@@ -199,8 +200,6 @@ int get_security_context( const char *name,
 
        *rcontext = NULL;
 
-#ifdef WITH_SELINUX
-
        if (is_selinux_enabled() <= 0) 
            return 0;
 
@@ -286,14 +285,14 @@ int crontab_security_access(void)
    crontab environment */
 static char ** build_env(char **cronenv)
 {
+#ifdef WITH_PAM
     char **jobenv = cronenv;
-
     char **pamenv = pam_getenvlist(pamh);
     char *cronvar;
     int count = 0;
-
     jobenv = env_copy(pamenv);
 
+
         /* Now add the cron environment variables. Since env_set()
            overwrites existing variables, this will let cron's
            environment settings override pam's */
@@ -304,6 +303,8 @@ static char ** build_env(char **cronenv)
            return NULL;
        }
     }
-
-    return jobenv;
+    return jobenv;    
+#else
+    return env_copy(cronenv);
+#endif
 }
index a98b1cc35cce4dbf600bc86d8956a91abac55216..b309bf8f4b9404adbb4d60e804f4b8e37cfc1416 100644 (file)
--- a/structs.h
+++ b/structs.h
@@ -44,6 +44,9 @@ typedef       struct _entry {
                         *
                         * These are the crontabs.
                         */
+#ifndef WITH_SELINUX
+#define security_context_t unsigned
+#endif
 
 typedef        struct _user {
        struct _user    *next, *prev;   /* links */
@@ -51,9 +54,7 @@ typedef       struct _user {
         char            *tabname;       /* /etc/cron.d/ file name or NULL */
        time_t          mtime;          /* last modtime of crontab */
        entry           *crontab;       /* this person's crontab */
-#ifdef WITH_SELINUX
         security_context_t scontext;    /* SELinux security context */
-#endif        
 } user;
 
 typedef        struct _cron_db {