extern char *config_file;
extern int remote_version;
- if (!lp_load(config_file)) {
+ if (!lp_load(config_file, 0)) {
exit_cleanup(1);
}
int daemon_main(void)
{
- log_open();
+ extern char *config_file;
if (is_a_socket(STDIN_FILENO)) {
/* we are running via inetd */
become_daemon();
+ if (!lp_load(config_file, 1)) {
+ fprintf(stderr,"failed to load config file %s\n", config_file);
+ exit_cleanup(1);
+ }
+
+ log_open();
+
rprintf(FINFO,"rsyncd version %s starting\n",VERSION);
start_accept_loop(rsync_port, start_daemon);
***************************************************************************/
static void init_globals(void)
{
+ memset(&Globals, 0, sizeof(Globals));
#ifdef LOG_DAEMON
Globals.syslog_facility = LOG_DAEMON;
#endif
Load the services array from the services file. Return True on success,
False on failure.
***************************************************************************/
-BOOL lp_load(char *pszFname)
+BOOL lp_load(char *pszFname, int globals_only)
{
- pstring n2;
- BOOL bRetval;
+ pstring n2;
+ BOOL bRetval;
- bRetval = False;
+ bRetval = False;
- bInGlobalSection = True;
+ bInGlobalSection = True;
- init_globals();
+ init_globals();
- pstrcpy(n2,pszFname);
+ pstrcpy(n2,pszFname);
- /* We get sections first, so have to start 'behind' to make up */
- iServiceIndex = -1;
- bRetval = pm_process(n2, do_section, do_parameter);
+ /* We get sections first, so have to start 'behind' to make up */
+ iServiceIndex = -1;
+ bRetval = pm_process(n2, globals_only?NULL:do_section, do_parameter);
- bLoaded = True;
+ bLoaded = True;
- return (bRetval);
+ return (bRetval);
}
break;
case '[': /* Section Header. */
- if( !Section( InFile, sfunc ) )
- return( False );
- c = EatWhitespace( InFile );
- break;
+ if (!sfunc) return True;
+ if( !Section( InFile, sfunc ) )
+ return( False );
+ c = EatWhitespace( InFile );
+ break;
case '\\': /* Bogus backslash. */
c = EatWhitespace( InFile );
} /* pm_process */
/* -------------------------------------------------------------------------- */
+