17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53d63ea05Sas145665 * Common Development and Distribution License (the "License"). 63d63ea05Sas145665 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*2b52f2afSjk217608 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _CRON_H 277c478bd9Sstevel@tonic-gate #define _CRON_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 327c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <dirent.h> 367c478bd9Sstevel@tonic-gate #include <auth_attr.h> 377c478bd9Sstevel@tonic-gate #include <auth_list.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 407c478bd9Sstevel@tonic-gate extern "C" { 417c478bd9Sstevel@tonic-gate #endif 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #define FALSE 0 447c478bd9Sstevel@tonic-gate #define TRUE 1 457c478bd9Sstevel@tonic-gate #define MINUTE 60L 467c478bd9Sstevel@tonic-gate #define HOUR 60L*60L 477c478bd9Sstevel@tonic-gate #define DAY 24L*60L*60L 487c478bd9Sstevel@tonic-gate #define NQUEUE 26 /* number of queues available */ 497c478bd9Sstevel@tonic-gate #define ATEVENT 0 507c478bd9Sstevel@tonic-gate #define BATCHEVENT 1 517c478bd9Sstevel@tonic-gate #define CRONEVENT 2 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define ADD 'a' 547c478bd9Sstevel@tonic-gate #define DELETE 'd' 557c478bd9Sstevel@tonic-gate #define AT 'a' 567c478bd9Sstevel@tonic-gate #define CRON 'c' 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #define QUE(x) ('a'+(x)) 597c478bd9Sstevel@tonic-gate #define RCODE(x) (((x)>>8)&0377) 607c478bd9Sstevel@tonic-gate #define TSTAT(x) ((x)&0377) 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #define FLEN 15 637c478bd9Sstevel@tonic-gate #define LLEN 9 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * structure used for passing messages from the at and crontab commands to cron 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate struct message { 697c478bd9Sstevel@tonic-gate char etype; 707c478bd9Sstevel@tonic-gate char action; 717c478bd9Sstevel@tonic-gate char fname[FLEN]; 727c478bd9Sstevel@tonic-gate char logname[LLEN]; 737c478bd9Sstevel@tonic-gate } msgbuf; 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate /* anything below here can be changed */ 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #define CRONDIR "/var/spool/cron/crontabs" 787c478bd9Sstevel@tonic-gate #define ATDIR "/var/spool/cron/atjobs" 797c478bd9Sstevel@tonic-gate #define ACCTFILE "/var/cron/log" 807c478bd9Sstevel@tonic-gate #define CRONALLOW "/etc/cron.d/cron.allow" 817c478bd9Sstevel@tonic-gate #define CRONDENY "/etc/cron.d/cron.deny" 827c478bd9Sstevel@tonic-gate #define ATALLOW "/etc/cron.d/at.allow" 837c478bd9Sstevel@tonic-gate #define ATDENY "/etc/cron.d/at.deny" 847c478bd9Sstevel@tonic-gate #define PROTO "/etc/cron.d/.proto" 857c478bd9Sstevel@tonic-gate #define QUEDEFS "/etc/cron.d/queuedefs" 867c478bd9Sstevel@tonic-gate #define FIFO "/etc/cron.d/FIFO" 877c478bd9Sstevel@tonic-gate #define DEFFILE "/etc/default/cron" 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #define SHELL "/usr/bin/sh" /* shell to execute */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #define CTLINESIZE 1000 /* max chars in a crontab line */ 927c478bd9Sstevel@tonic-gate #define UNAMESIZE 20 /* max chars in a user name */ 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate int allowed(char *, char *, char *); 957c478bd9Sstevel@tonic-gate int days_in_mon(int, int); 967c478bd9Sstevel@tonic-gate char *errmsg(int); 977c478bd9Sstevel@tonic-gate char *getuser(uid_t); 987c478bd9Sstevel@tonic-gate void cron_sendmsg(char, char *, char *, char); 997c478bd9Sstevel@tonic-gate time_t num(char **); 1007c478bd9Sstevel@tonic-gate void *xmalloc(size_t); 1017c478bd9Sstevel@tonic-gate void *xcalloc(size_t, size_t); 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1047c478bd9Sstevel@tonic-gate } 1057c478bd9Sstevel@tonic-gate #endif 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #endif /* _CRON_H */ 108