version 1.12, 2003/05/06 22:10:11 |
version 1.13, 2003/05/14 01:34:35 |
|
|
*/ |
*/ |
|
|
/* |
/* |
* $From: defs.h,v 6.82 1998/03/23 23:28:25 michaelc Exp $ |
* $From: defs.h,v 1.6 2001/03/12 18:16:30 kim Exp $ |
* @(#)defs.h 5.2 (Berkeley) 3/20/86 |
* @(#)defs.h 5.2 (Berkeley) 3/20/86 |
*/ |
*/ |
|
|
/* |
|
* POSIX settings |
|
*/ |
|
#if defined(_POSIX_SOURCE) || defined(__OpenBSD__) |
|
#include <unistd.h> |
#include <unistd.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#endif /* _POSIX_SOURCE */ |
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <string.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
#include <pwd.h> |
#include <pwd.h> |
|
|
#include <sys/time.h> |
#include <sys/time.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
|
|
#ifndef __GNUC__ |
|
# ifndef __attribute__ |
|
# define __attribute__(a) |
|
# endif |
|
#endif |
|
|
|
#ifndef __STDC__ |
|
# ifndef const |
|
# define const |
|
# endif |
|
#endif |
|
|
#include "version.h" |
#include "version.h" |
#include "config-def.h" |
#include "config-def.h" |
#include "config.h" |
#include "config.h" |
#include "config-data.h" |
#include "config-data.h" |
#include "pathnames.h" |
#include "pathnames.h" |
#include "types.h" |
#include "types.h" |
|
#include "filesys.h" |
|
|
#include <signal.h> |
#include <signal.h> |
|
|
|
|
*/ |
*/ |
#if defined(SVR4) |
#if defined(SVR4) |
#define NEED_FCNTL_H |
#define NEED_FCNTL_H |
#define NEED_UNISTD_H |
|
#define NEED_NETDB_H |
#define NEED_NETDB_H |
#endif /* defined(SVR4) */ |
#endif /* defined(SVR4) */ |
|
|
|
|
#if defined(NEED_LIMITS_H) |
#if defined(NEED_LIMITS_H) |
#include <limits.h> |
#include <limits.h> |
#endif /* NEED_LIMITS_H */ |
#endif /* NEED_LIMITS_H */ |
#if defined(NEED_UNISTD_H) |
|
#include <unistd.h> |
|
#endif /* NEED_UNISTD_H */ |
|
#if defined(NEED_STRING_H) |
|
#include <string.h> |
|
#endif /* NEED_STRING_H */ |
|
|
|
#if defined(ARG_TYPE) |
#if defined(ARG_TYPE) |
#if ARG_TYPE == ARG_STDARG |
#if ARG_TYPE == ARG_STDARG |
|
|
#define C_RECVDIR 'D' /* Receive a directory */ |
#define C_RECVDIR 'D' /* Receive a directory */ |
#define C_RECVSYMLINK 'K' /* Receive a symbolic link */ |
#define C_RECVSYMLINK 'K' /* Receive a symbolic link */ |
#define C_RECVHARDLINK 'k' /* Receive a hard link */ |
#define C_RECVHARDLINK 'k' /* Receive a hard link */ |
#define C_END 'E' /* Indicate end of receive/send */ |
#define C_END 'E' /* Indicate end of recieve/send */ |
#define C_CLEAN 'C' /* Clean up */ |
#define C_CLEAN 'C' /* Clean up */ |
#define C_QUERY 'Q' /* Query without checking */ |
#define C_QUERY 'Q' /* Query without checking */ |
#define C_SPECIAL 'S' /* Execute special command */ |
#define C_SPECIAL 'S' /* Execute special command */ |
#define C_CMDSPECIAL 's' /* Execute cmd special command */ |
#define C_CMDSPECIAL 's' /* Execute cmd special command */ |
#define C_CHMOD 'M' /* Chmod a file */ |
#define C_CHMOG 'M' /* Chown,Chgrp,Chmod a file */ |
|
|
#define ack() (void) sendcmd(C_ACK, (char *)NULL) |
#define ack() (void) sendcmd(C_ACK, (char *)NULL) |
#define err() (void) sendcmd(C_ERRMSG, (char *)NULL) |
#define err() (void) sendcmd(C_ERRMSG, (char *)NULL) |
|
|
#define SC_FREEFILES 'f' /* Set min free files */ |
#define SC_FREEFILES 'f' /* Set min free files */ |
#define SC_HOSTNAME 'H' /* Set client hostname */ |
#define SC_HOSTNAME 'H' /* Set client hostname */ |
#define SC_LOGGING 'L' /* Set logging options */ |
#define SC_LOGGING 'L' /* Set logging options */ |
|
#define SC_DEFOWNER 'o' /* Set default owner */ |
|
#define SC_DEFGROUP 'g' /* Set default group */ |
|
|
/* |
/* |
* Query commands |
* Query commands |
|
|
extern char *progname; /* Name of this program */ |
extern char *progname; /* Name of this program */ |
extern char **realargv; /* Real argv */ |
extern char **realargv; /* Real argv */ |
extern int optind; /* Option index into argv */ |
extern int optind; /* Option index into argv */ |
extern int contimedout; /* Connection timed out */ |
|
extern int debug; /* Debugging flag */ |
extern int debug; /* Debugging flag */ |
extern opt_t defoptions; /* Default install options */ |
extern opt_t defoptions; /* Default install options */ |
extern int do_fork; /* Should we do fork()'ing */ |
extern int do_fork; /* Should we do fork()'ing */ |
|
#ifndef __STDC__ |
extern int errno; /* System error number */ |
extern int errno; /* System error number */ |
|
#endif |
extern int isserver; /* Acting as remote server */ |
extern int isserver; /* Acting as remote server */ |
extern int nerrs; /* Number of errors seen */ |
extern int nerrs; /* Number of errors seen */ |
extern int nflag; /* NOP flag, don't execute commands */ |
extern int nflag; /* NOP flag, don't execute commands */ |
|
|
extern int rem_w; /* Remote file descriptor, writing */ |
extern int rem_w; /* Remote file descriptor, writing */ |
extern int rtimeout; /* Response time out in seconds */ |
extern int rtimeout; /* Response time out in seconds */ |
extern int setjmp_ok; /* setjmp/longjmp flag */ |
extern int setjmp_ok; /* setjmp/longjmp flag */ |
extern void mysetlinebuf(); /* set line buffering */ |
|
extern UID_T userid; /* User ID of rdist user */ |
extern UID_T userid; /* User ID of rdist user */ |
extern jmp_buf finish_jmpbuf; /* Setjmp buffer for finish() */ |
extern jmp_buf finish_jmpbuf; /* Setjmp buffer for finish() */ |
extern struct group *gr; /* pointer to static area used by getgrent */ |
extern struct group *gr; /* pointer to static area used by getgrent */ |
extern struct linkbuf *ihead; /* list of files with more than one link */ |
extern struct linkbuf *ihead; /* list of files with more than one link */ |
extern struct passwd *pw; /* pointer to static area used by getpwent */ |
extern struct passwd *pw; /* pointer to static area used by getpwent */ |
|
extern char defowner[64]; /* Default owner */ |
|
extern char defgroup[64]; /* Default group */ |
|
extern volatile sig_atomic_t contimedout; /* Connection timed out */ |
#ifdef USE_STATDB |
#ifdef USE_STATDB |
extern int dostatdb; |
extern int dostatdb; |
extern int juststatdb; |
extern int juststatdb; |
#endif /* USE_STATDB */ |
#endif /* USE_STATDB */ |
|
|
/* |
/* |
* System function declarations |
|
*/ |
|
char *hasmntopt(); |
|
char *strchr(); |
|
char *strdup(); |
|
char *strrchr(); |
|
char *strtok(); |
|
|
|
/* |
|
* Our own declarations. |
* Our own declarations. |
*/ |
*/ |
char *exptilde(); |
|
char *makestr(); |
|
char *xcalloc(); |
|
char *xmalloc(); |
|
char *xrealloc(); |
|
char *xstrdup(); |
|
extern char *xbasename(); |
|
extern char *getdistoptlist(); |
|
extern char *getgroupname(); |
|
extern char *getnlstr(); |
|
extern char *getnotifyfile(); |
|
extern char *getondistoptlist(); |
|
extern char *getusername(); |
|
extern char *getversion(); |
|
extern char *msgparseopts(); |
|
extern char *searchpath(); |
|
extern int any(); |
|
extern int init(); |
|
extern int install(); |
|
extern int isexec(); |
|
extern int parsedistopts(); |
|
extern int remline(); |
|
extern int setfiletime(); |
|
extern int spawn(); |
|
extern struct subcmd *makesubcmd(); |
|
extern void checkhostname(); |
|
extern void cleanup(); |
|
extern void complain(); |
|
extern void docmds(); |
|
extern void finish(); |
|
extern void log(); |
|
extern void logmsg(); |
|
extern void lostconn(); |
|
extern void markassigned(); |
|
extern void msgprusage(); |
|
extern void note(); |
|
extern void runcmdspecial(); |
|
extern void runcommand(); |
|
extern void server(); |
|
extern void setprogname(); |
|
extern void sighandler(); |
|
extern void waitup(); |
|
struct namelist *expand(); |
|
struct namelist *lookup(); |
|
struct namelist *makenl(); |
|
extern WRITE_RETURN_T xwrite(); |
|
|
|
#if defined(ARG_TYPE) && ARG_TYPE == ARG_STDARG |
/* child.c */ |
extern void debugmsg(int, char *, ...); |
void waitup(void); |
extern void error(char *, ...); |
int spawn(struct cmd *, struct cmd *); |
extern void fatalerr(char *, ...); |
int setnonblocking(int, int); |
extern void message(int, char *, ...); |
int setnonblocking(int, int); |
#ifndef HAVE_SETPROCTITLE |
|
extern void setproctitle(char *fmt, ...); |
/* client.c */ |
|
char *remfilename(char *, char *, char *, char *, int); |
|
int inlist(struct namelist *, char *); |
|
void runcmdspecial(struct cmd *, opt_t); |
|
int checkfilename(char *); |
|
void freelinkinfo(struct linkbuf *); |
|
void cleanup(int); |
|
int install(char *, char *, int, int , opt_t); |
|
|
|
/* common.c */ |
|
WRITE_RETURN_T xwrite(int, void *, WRITE_AMT_T); |
|
int init(int, char **, char **); |
|
void finish(void); |
|
void lostconn(void); |
|
void coredump(void); |
|
void sighandler(int); |
|
int sendcmd(char, char *, ...); |
|
int remline(u_char *, int, int); |
|
int readrem(char *, int); |
|
char *getusername(UID_T, char *, opt_t); |
|
char *getgroupname(GID_T, char *, opt_t); |
|
int response(void); |
|
char *exptilde(char *, char *, size_t); |
|
int becomeuser(void); |
|
int becomeroot(void); |
|
int setfiletime(char *, time_t, time_t); |
|
char *getversion(void); |
|
void runcommand(char *); |
|
char *xmalloc(size_t); |
|
char *xrealloc(char *, size_t); |
|
char *xcalloc(size_t, size_t); |
|
char *xstrdup(const char *); |
|
char *xbasename(char *); |
|
char *searchpath(char *); |
|
int mysetlinebuf(FILE *); |
|
int getsocketpair(int, int, int, int[]); |
|
|
|
/* distopt.c */ |
|
DISTOPTINFO *getdistopt(char *, int *); |
|
int parsedistopts(char *, opt_t *, int); |
|
char *getdistoptlist(void); |
|
char *getondistoptlist(opt_t); |
|
|
|
/* docmd.c */ |
|
void markassigned(struct cmd *, struct cmd *); |
|
int okname(char *); |
|
int except(char *); |
|
void docmds(struct namelist *, int, char **); |
|
|
|
/* expand.c */ |
|
struct namelist *expand(struct namelist *, int); |
|
u_char *xstrchr(u_char *, int); |
|
void expstr(u_char *); |
|
void expsh(u_char *); |
|
void matchdir(char *); |
|
int execbrc(u_char *, u_char *); |
|
int match(char *, char *); |
|
int amatch(char *, u_char *); |
|
|
|
/* filesys.c */ |
|
char *find_file(char *, struct stat *, int *); |
|
mntent_t *findmnt(struct stat *, struct mntinfo *); |
|
int isdupmnt(mntent_t *, struct mntinfo *); |
|
void wakeup(int); |
|
struct mntinfo *makemntinfo(struct mntinfo *); |
|
mntent_t *getmntpt(char *, struct stat *, int *); |
|
int is_nfs_mounted(char *, struct stat *, int *); |
|
int is_ro_mounted(char *, struct stat *, int *); |
|
int is_symlinked(char *, struct stat *, int *); |
|
int getfilesysinfo(char *, long *, long *); |
|
|
|
/* gram.c */ |
|
int yylex(void); |
|
int any(int, char *); |
|
void insert(char *, struct namelist *, struct namelist *, struct subcmd *); |
|
void append(char *, struct namelist *, char *, struct subcmd *); |
|
void yyerror(char *); |
|
struct namelist *makenl(char *); |
|
struct subcmd *makesubcmd(int); |
|
int yyparse(void); |
|
|
|
/* hasmntopt.c */ |
|
#ifdef NEED_HASMNTOPT |
|
char *hasmntopt(struct mntent *, char *); |
#endif |
#endif |
extern void yyerror(char *); |
|
#else |
/* isexec.c */ |
extern void debugmsg(); |
int isexec(char *, struct stat *); |
extern void error(); |
|
extern void fatalerr(); |
/* lookup.c */ |
extern void message(); |
void define(char *); |
#ifndef HAVE_SETPROCTITLE |
struct namelist *lookup(char *, int, struct namelist *); |
extern void setproctitle(); |
|
|
/* message.c */ |
|
void msgprusage(void); |
|
void msgprconfig(void); |
|
char *msgparseopts(char *, int); |
|
void checkhostname(void); |
|
void message(int, char *, ...); |
|
void debugmsg(int, char *, ...); |
|
void error(char *, ...); |
|
void fatalerr(char *, ...); |
|
char *getnotifyfile(void); |
|
|
|
/* rdist.c */ |
|
FILE *opendist(char *); |
|
void docmdargs(int, char *[]); |
|
char *getnlstr(struct namelist *); |
|
|
|
/* rshrcmd.c */ |
|
int rshrcmd(char **, u_short, char *, char *, char *, int *); |
|
|
|
/* server.c */ |
|
void server(void); |
|
|
|
/* setargs.c */ |
|
void setargs_settup(int, char **, char **); |
|
void _setproctitle(char *); |
|
void setproctitle(const char *, ...); |
|
|
|
/* signal.c */ |
|
#ifdef NEED_SIGBLOCK |
|
int sigblock(int); |
#endif |
#endif |
extern void yyerror(); |
#ifdef NEED_SIGMASK |
|
int sigsetmask(int); |
#endif |
#endif |
|
|
|
/* strcasecmp.c */ |
|
#ifdef NEED_STRCASECMP |
|
int strcasecmp(char *, char *); |
|
int strncasecmp(char *, char *, int); |
|
#endif |
|
|
|
/* strerror.c */ |
|
#ifdef NEED_STRERROR |
|
char *strerror(int); |
|
#endif |
|
|
|
/* strtol.c */ |
|
#ifdef NEED_STRTOL |
|
long strtol(char *, char **, int); |
|
#endif |
|
|
|
/* unvis.c */ |
|
#ifdef NEED_VIS |
|
int unvis(char *, int, int *, int ); |
|
int strunvis(char *, const char *); |
|
#endif |
|
|
|
/* vis.c */ |
|
#ifdef NEED_VIS |
|
char *vis(char *, int, int, int ); |
|
int strvis(char *, const char *, int); |
|
int strvisx(char *, const char *, size_t, int); |
|
#endif |
|
|
|
/* vsnprintf.c */ |
|
#ifdef NEED_VSNPRINTF |
|
int vsnprintf(char *, size_t, const char *, va_list); |
|
int snprintf(char *, size_t, const char *, ...); |
|
#endif |
|
|
|
/* zopen.c */ |
|
int zread(void *, char *, int); |
|
int zwrite(void *, const char *, int); |
|
int z_close(void *); |
|
void *z_open(int, char *, int); |
|
|
|
#include <vis.h> |
|
#define DECODE(a, b) strunvis(a, b) |
|
#define ENCODE(a, b) strvis(a, b, VIS_WHITE) |
|
|
#endif /* __DEFS_H__ */ |
#endif /* __DEFS_H__ */ |