1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
/*
cfg.h - all the configurable options in cvsd
Copyright (C) 2003, 2004, 2006 Arthur de Jong.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _CVSDCFG_H
#define _CVSDCFG_H 1
#include <unistd.h>
#include <sys/types.h>
#ifdef USE_CAPABILITIES
#include <sys/capability.h>
#endif /* USE_CAPABILITIES */
/* values for uid and gid */
#define NOUID ((gid_t)-1)
#define NOGID ((gid_t)-1)
/* the index where to set CVSUMASK=<cvs_umask> in cfg->cvsenv
see also the static char *default_environment in cfg.c */
#define CVSUMASK_IDX 4
/* the addresses to listen on */
struct cvsd_addrs
{
char *node; /* supplied node(address) name in config */
char *service; /* supplied service(port) name in config */
struct addrinfo *addrs; /* addresses asiciated with node+service */
struct cvsd_addrs *next; /* next configured node+service */
};
/* default address/port combination to listen on
if nothing is supplied in the config file */
#define DEFAULT_ADDR "*"
#define DEFAULT_PORT "2401"
/* struct to hold all configuration information
initial values are set in cfg_new() */
struct cvsd_cfg
{
/* the configuration file
DEFAULT_CONFIGFILE is set in config.h */
char *configfile;
/* the pid file
default is no pidfile (NULL) */
char *pidfile;
/* whether debugging mode is enabled */
int debugging;
/* the location of the rootjail
NULL or "none": no chroot */
char *rootjail;
/* the user id cvs should be run as
NOUID: don't change */
uid_t uid;
/* the group id cvs should be run as
NOGID: don't change */
gid_t gid;
/* the nice value the daemon should run as
0: don't change */
int nice;
/* the umask that should be used to create files */
mode_t umask;
/* TODO: limits (are currently stored in structures in reslimit.c)*/
#ifdef USE_CAPABILITIES
/* the capabilities for cvs */
cap_t capabilities;
#endif /* USE_CAPABILITIES */
/* the addresses/ports that should be listened on */
struct cvsd_addrs *addresses;
/* the maximum number of connections to handle
0: unlimited */
int maxconnections;
/* TODO: repositories (currently only added to cvsargs below) */
/* the command that will be run (location of the binary) */
char *cvscmd;
/* the arguments that will be passed */
char **cvsargs;
/* the environment that should be used */
char **cvsenv;
};
/* initialize the configuration with some reasonable default values */
struct cvsd_cfg *cfg_new(void);
/* add a string as a command line argument to the cvs command */
void cfg_addcvsarg(struct cvsd_cfg *cfg,const char *arg);
/* add the given node and service to the list of addresses that
will be listened on */
void cfg_addaddress(struct cvsd_cfg *cfg,
const char *filename,int lnr,
const char *node,const char *service);
#endif /* not _CVSDCFG_H */
|