Ejemplo n.º 1
0
static int check_manual_file(struct sdirs *sdirs, const char *cname)
{
	int ret=-1;
	char *manual=NULL;

	// A 'backup' file placed in the storage directory tells this script
	// that a backup needs to be done right now.
	// This gives the 'server initiates a manual backup' feature.
	// The path should probably be part of sdirs so we do not have to build
	// it here.
	if(astrcat(&manual, sdirs->clients, __func__)
	  || astrcat(&manual, "/", __func__)
	  || astrcat(&manual, cname, __func__)
	  || astrcat(&manual, "/backup", __func__))
		goto end;
	if(is_reg_lstat(manual)>0)
	{
		logp("Found %s\n", manual);
		unlink(manual);
		ret=0;
		goto end;
	}
	ret=1;
end:
	free_w(&manual);
	return ret;
}
Ejemplo n.º 2
0
static pid_t fork_monitor(int *csin, int *csout, struct conf **confs)
{
	int a=0;
	char *args[12];

	// FIX THIS: get all args from configuration.
	if(is_reg_lstat(prog_long)>0)
		args[a++]=(char *)prog_long;
	else
		args[a++]=(char *)"/usr/sbin/burp";
	args[a++]=(char *)"-c";
	args[a++]=get_string(confs[OPT_CONFFILE]);
	args[a++]=(char *)"-a";
	args[a++]=(char *)"m";
	args[a++]=NULL;

	return forkchild_fd(csin, csout, NULL, args[0], args);
}