Esempio n. 1
0
File: ca.c Progetto: Kalimeiro/burp
static char *get_ca_dir(struct conf *conf)
{
	FILE *fp=NULL;
	char buf[4096]="";
	if(!(fp=open_file(conf->ca_conf, "r"))) return NULL;
	while(fgets(buf, sizeof(buf), fp))
	{
		char *field=NULL;
		char *value=NULL;
		if(conf_get_pair(buf, &field, &value)
		  || !field || !value) continue;

		if(!strcasecmp(field, "CA_DIR"))
		{
			if(!(gca_dir=strdup(value)))
			{
				log_out_of_memory(__func__);
				fclose(fp);
				return NULL;
			}
			break;
		}
	}
	fclose(fp);
	return gca_dir;
}
Esempio n. 2
0
static int conf_parse_line(struct conf **confs, const char *conf_path,
	char buf[], int line)
{
	int ret=-1;
	char *f=NULL; // field
	char *v=NULL; // value
	char *extrafile=NULL;

	if(!strncmp(buf, ". ", 2))
	{
		// The conf file specifies another file to include.
		char *np=NULL;

		if(!(extrafile=strdup_w(buf+2, __func__))) goto end;

		if((np=strrchr(extrafile, '\n'))) *np='\0';
		if(!*extrafile) goto end;

		ret=deal_with_dot_inclusion(conf_path, &extrafile, confs);
		goto end;
	}

	if(conf_get_pair(buf, &f, &v)) goto end;
	if(f && v
	  && load_conf_field_and_value(confs, f, v, conf_path, line))
		goto end;
	ret=0;
end:
	free_w(&extrafile);
	return ret;
}
Esempio n. 3
0
File: ca.c Progetto: vanElden/burp
static char *get_ca_dir(struct conf **confs)
{
	struct fzp *fzp=NULL;
	char buf[4096]="";
	const char *ca_conf=get_string(confs[OPT_CA_CONF]);
	if(!(fzp=fzp_open(ca_conf, "r"))) goto end;
	while(fzp_gets(fzp, buf, sizeof(buf)))
	{
		char *field=NULL;
		char *value=NULL;
		if(conf_get_pair(buf, &field, &value)
		  || !field || !value) continue;

		if(!strcasecmp(field, "CA_DIR"))
		{
			if(!(gca_dir=strdup_w(value, __func__)))
				goto end;
			break;
		}
	}
end:
	fzp_close(&fzp);
	return gca_dir;
}