1 /* 2 * $Id: structs.h,v 1.7 2004/01/23 18:56:43 vixie Exp $ 3 */ 4 5 /* 6 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 7 * Copyright (c) 1997,2000 by Internet Software Consortium, Inc. 8 * 9 * Permission to use, copy, modify, and distribute this software for any 10 * purpose with or without fee is hereby granted, provided that the above 11 * copyright notice and this permission notice appear in all copies. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 */ 21 22 #ifndef CRONIE_STRUCTS_H 23 #define CRONIE_STRUCTS_H 24 25 #include <time.h> 26 #include <sys/types.h> 27 #ifdef WITH_SELINUX 28 #include <selinux/selinux.h> 29 #endif 30 #include "macros.h" 31 #include "bitstring.h" 32 33 typedef struct _entry { 34 struct _entry *next; 35 struct passwd *pwd; 36 char **envp; 37 char *cmd; 38 bitstr_t bit_decl(minute, MINUTE_COUNT); 39 bitstr_t bit_decl(hour, HOUR_COUNT); 40 bitstr_t bit_decl(dom, DOM_COUNT); 41 bitstr_t bit_decl(month, MONTH_COUNT); 42 bitstr_t bit_decl(dow, DOW_COUNT); 43 int flags; 44 int delay; 45 #define MIN_STAR 0x01 46 #define HR_STAR 0x02 47 #define DOM_STAR 0x04 48 #define DOW_STAR 0x08 49 #define WHEN_REBOOT 0x10 50 #define DONT_LOG 0x20 51 } entry; 52 53 /* the crontab database will be a list of the 54 * following structure, one element per user 55 * plus one for the system. 56 * 57 * These are the crontabs. 58 */ 59 #ifndef WITH_SELINUX 60 #define security_context_t unsigned 61 #endif 62 63 typedef struct _user { 64 struct _user *next, *prev; /* links */ 65 char *name; 66 char *tabname; /* /etc/cron.d/ file name or NULL */ 67 time_t mtime; /* last modtime of crontab */ 68 entry *crontab; /* this person's crontab */ 69 security_context_t scontext; /* SELinux security context */ 70 int system; /* is it a system crontab */ 71 } user; 72 73 typedef struct _orphan { 74 struct _orphan *next; /* link */ 75 char *uname; 76 char *fname; 77 char *tabname; 78 } orphan; 79 80 typedef struct _cron_db { 81 user *head, *tail; /* links */ 82 time_t mtime; /* last modtime on spooldir */ 83 #ifdef WITH_INOTIFY 84 int ifd; 85 #endif 86 } cron_db; 87 /* in the C tradition, we only create 88 * variables for the main program, just 89 * extern them elsewhere. 90 */ 91 92 #endif /* CRONIE_STRUCTS_H */