X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/8ef4ffd6987bb566c268d2a353d5fea1cfd9e430..0c515f17c44344813e8949fbb684b357ad70cfdf:/loadparm.c diff --git a/loadparm.c b/loadparm.c index d22bef81..da2e2270 100644 --- a/loadparm.c +++ b/loadparm.c @@ -52,7 +52,7 @@ #define strequal(a,b) (strcasecmp(a,b)==0) #define BOOLSTR(b) ((b) ? "Yes" : "No") typedef char pstring[1024]; -#define pstrcpy(a,b) strcpy(a,b) +#define pstrcpy(a,b) strlcpy(a,b,sizeof(pstring)-1) /* the following are used by loadparm for option lists */ typedef enum @@ -98,6 +98,9 @@ static BOOL bLoaded = False; typedef struct { char *motd_file; + char *lock_file; + int syslog_facility; + int max_connections; } global; static global Globals; @@ -116,6 +119,8 @@ typedef struct BOOL list; char *uid; char *gid; + char *hosts_allow; + char *hosts_deny; } service; @@ -129,6 +134,8 @@ static service sDefault = True, /* list */ "nobody",/* uid */ "nobody",/* gid */ + NULL, /* hosts allow */ + NULL, /* hosts deny */ }; @@ -145,7 +152,10 @@ static BOOL bInGlobalSection = True; /* note that we do not initialise the defaults union - it is not allowed in ANSI C */ static struct parm_struct parm_table[] = { + {"max connections", P_INTEGER, P_GLOBAL, &Globals.max_connections,NULL, 0}, {"motd file", P_STRING, P_GLOBAL, &Globals.motd_file, NULL, 0}, + {"lock file", P_STRING, P_GLOBAL, &Globals.lock_file, NULL, 0}, + {"syslog facility", P_INTEGER, P_GLOBAL, &Globals.syslog_facility, NULL,0}, {"name", P_STRING, P_LOCAL, &sDefault.name, NULL, 0}, {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, 0}, {"path", P_STRING, P_LOCAL, &sDefault.path, NULL, 0}, @@ -153,6 +163,8 @@ static struct parm_struct parm_table[] = {"list", P_BOOL, P_LOCAL, &sDefault.list, NULL, 0}, {"uid", P_STRING, P_LOCAL, &sDefault.uid, NULL, 0}, {"gid", P_STRING, P_LOCAL, &sDefault.gid, NULL, 0}, + {"hosts allow", P_STRING, P_LOCAL, &sDefault.hosts_allow, NULL, 0}, + {"hosts deny", P_STRING, P_LOCAL, &sDefault.hosts_deny, NULL, 0}, {NULL, P_BOOL, P_NONE, NULL, NULL, 0} }; @@ -162,6 +174,10 @@ Initialise the global parameter structure. ***************************************************************************/ static void init_globals(void) { +#ifdef LOG_DAEMON + Globals.syslog_facility = LOG_DAEMON; +#endif + Globals.lock_file = "/var/run/rsyncd.lock"; } /*************************************************************************** @@ -197,6 +213,9 @@ static void init_locals(void) FN_GLOBAL_STRING(lp_motd_file, &Globals.motd_file) +FN_GLOBAL_STRING(lp_lock_file, &Globals.lock_file) +FN_GLOBAL_INTEGER(lp_max_connections, &Globals.max_connections) +FN_GLOBAL_INTEGER(lp_syslog_facility, &Globals.syslog_facility) FN_LOCAL_STRING(lp_name, name) FN_LOCAL_STRING(lp_comment, comment) FN_LOCAL_STRING(lp_path, path) @@ -204,6 +223,8 @@ FN_LOCAL_BOOL(lp_read_only, read_only) FN_LOCAL_BOOL(lp_list, list) FN_LOCAL_STRING(lp_uid, uid) FN_LOCAL_STRING(lp_gid, gid) +FN_LOCAL_STRING(lp_hosts_allow, hosts_allow) +FN_LOCAL_STRING(lp_hosts_deny, hosts_deny) /* local prototypes */ static int strwicmp( char *psz1, char *psz2 ); @@ -221,13 +242,12 @@ initialise a service to the defaults ***************************************************************************/ static void init_service(service *pservice) { - bzero((char *)pservice,sizeof(service)); - copy_service(pservice,&sDefault); + bzero((char *)pservice,sizeof(service)); + copy_service(pservice,&sDefault); } static void string_set(char **s, char *v) { - if (*s) free(*s); if (!v) { *s = NULL; return;