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 /* 222b52f2afSjk217608 * 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 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 307c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <dirent.h> 347c478bd9Sstevel@tonic-gate #include <auth_attr.h> 357c478bd9Sstevel@tonic-gate #include <auth_list.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define FALSE 0 427c478bd9Sstevel@tonic-gate #define TRUE 1 437c478bd9Sstevel@tonic-gate #define MINUTE 60L 447c478bd9Sstevel@tonic-gate #define HOUR 60L*60L 457c478bd9Sstevel@tonic-gate #define DAY 24L*60L*60L 467c478bd9Sstevel@tonic-gate #define NQUEUE 26 /* number of queues available */ 477c478bd9Sstevel@tonic-gate #define ATEVENT 0 487c478bd9Sstevel@tonic-gate #define BATCHEVENT 1 497c478bd9Sstevel@tonic-gate #define CRONEVENT 2 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #define ADD 'a' 527c478bd9Sstevel@tonic-gate #define DELETE 'd' 537c478bd9Sstevel@tonic-gate #define AT 'a' 547c478bd9Sstevel@tonic-gate #define CRON 'c' 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate #define QUE(x) ('a'+(x)) 577c478bd9Sstevel@tonic-gate #define RCODE(x) (((x)>>8)&0377) 587c478bd9Sstevel@tonic-gate #define TSTAT(x) ((x)&0377) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define FLEN 15 617c478bd9Sstevel@tonic-gate #define LLEN 9 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * structure used for passing messages from the at and crontab commands to cron 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate struct message { 677c478bd9Sstevel@tonic-gate char etype; 687c478bd9Sstevel@tonic-gate char action; 697c478bd9Sstevel@tonic-gate char fname[FLEN]; 707c478bd9Sstevel@tonic-gate char logname[LLEN]; 717c478bd9Sstevel@tonic-gate } msgbuf; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* anything below here can be changed */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate #define CRONDIR "/var/spool/cron/crontabs" 767c478bd9Sstevel@tonic-gate #define ATDIR "/var/spool/cron/atjobs" 777c478bd9Sstevel@tonic-gate #define ACCTFILE "/var/cron/log" 787c478bd9Sstevel@tonic-gate #define CRONALLOW "/etc/cron.d/cron.allow" 797c478bd9Sstevel@tonic-gate #define CRONDENY "/etc/cron.d/cron.deny" 807c478bd9Sstevel@tonic-gate #define ATALLOW "/etc/cron.d/at.allow" 817c478bd9Sstevel@tonic-gate #define ATDENY "/etc/cron.d/at.deny" 827c478bd9Sstevel@tonic-gate #define PROTO "/etc/cron.d/.proto" 837c478bd9Sstevel@tonic-gate #define QUEDEFS "/etc/cron.d/queuedefs" 847c478bd9Sstevel@tonic-gate #define FIFO "/etc/cron.d/FIFO" 857c478bd9Sstevel@tonic-gate #define DEFFILE "/etc/default/cron" 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #define SHELL "/usr/bin/sh" /* shell to execute */ 887c478bd9Sstevel@tonic-gate 89*5b08e637SChris Gerhard #define ENV_SHELL "SHELL=" 90*5b08e637SChris Gerhard #define ENV_TZ "TZ=" 91*5b08e637SChris Gerhard #define ENV_HOME "HOME=" 92*5b08e637SChris Gerhard 937c478bd9Sstevel@tonic-gate #define CTLINESIZE 1000 /* max chars in a crontab line */ 947c478bd9Sstevel@tonic-gate #define UNAMESIZE 20 /* max chars in a user name */ 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate int allowed(char *, char *, char *); 977c478bd9Sstevel@tonic-gate int days_in_mon(int, int); 987c478bd9Sstevel@tonic-gate char *errmsg(int); 997c478bd9Sstevel@tonic-gate char *getuser(uid_t); 1007c478bd9Sstevel@tonic-gate void cron_sendmsg(char, char *, char *, char); 1017c478bd9Sstevel@tonic-gate time_t num(char **); 1027c478bd9Sstevel@tonic-gate void *xmalloc(size_t); 1037c478bd9Sstevel@tonic-gate void *xcalloc(size_t, size_t); 104*5b08e637SChris Gerhard int isvalid_shell(const char *shell); 105*5b08e637SChris Gerhard int isvalid_dir(const char *dir); 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1087c478bd9Sstevel@tonic-gate } 1097c478bd9Sstevel@tonic-gate #endif 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #endif /* _CRON_H */ 112