72 static char *eat_ws(
CONF *conf,
char *
p);
73 static char *eat_alpha_numeric(
CONF *conf,
char *
p);
74 static void clear_comments(
CONF *conf,
char *
p);
75 static int str_copy(
CONF *conf,
char *section,
char **to,
char *from);
76 static char *scan_quote(
CONF *conf,
char *
p);
77 static char *scan_dquote(
CONF *conf,
char *
p);
78 #define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
81 static int def_init_default(
CONF *conf);
82 static int def_init_WIN32(
CONF *conf);
83 static int def_destroy(
CONF *conf);
84 static int def_destroy_data(
CONF *conf);
85 static int def_load(
CONF *conf,
const char *name,
long *
eline);
87 static int def_dump(
const CONF *conf,
BIO *
bp);
88 static int def_is_number(
const CONF *conf,
char c);
89 static int def_to_int(
const CONF *conf,
char c);
121 return &default_method;
125 return &WIN32_method;
134 if (meth->
init(ret) == 0)
142 static int def_init_default(
CONF *conf)
147 conf->
meth = &default_method;
154 static int def_init_WIN32(
CONF *conf)
159 conf->
meth = &WIN32_method;
160 conf->
meth_data = (
void *)CONF_type_win32;
166 static int def_destroy(
CONF *conf)
168 if (def_destroy_data(conf))
176 static int def_destroy_data(
CONF *conf)
184 static int def_load(
CONF *conf,
const char *name,
long *line)
189 #ifdef OPENSSL_SYS_VMS
203 ret = def_load_bio(conf, in, line);
209 static int def_load_bio(
CONF *conf,
BIO *in,
long *line)
212 #define CONFBUFSIZE 512
222 char *start,*psection,*pname;
223 void *
h = (
void *)(conf->data);
262 p= &(buff->
data[bufnum]);
267 if (i == 0 && !again)
break;
271 if ((p[i-1] !=
'\r') && (p[i-1] !=
'\n'))
297 p= &(buff->
data[bufnum-1]);
299 ((bufnum <= 1) || !
IS_ESC(conf,p[-1])))
309 clear_comments(conf, buf);
311 if (
IS_EOF(conf,*s))
continue;
317 start=eat_ws(conf, s);
320 end=eat_alpha_numeric(conf, ss);
334 if (!str_copy(conf,NULL,§ion,start))
goto err;
349 end=eat_alpha_numeric(conf, s);
350 if ((end[0] ==
':') && (end[1] ==
':'))
356 end=eat_alpha_numeric(conf, end);
367 start=eat_ws(conf, p);
371 while ((p != start) && (
IS_WS(conf,*p)))
382 if (psection == NULL) psection=section;
392 if (!str_copy(conf,psection,&(v->
value),start))
goto err;
394 if (strcmp(psection,section) != 0)
441 if (line != NULL) *line=
eline;
444 if ((h != conf->data) && (conf->data != NULL))
458 static void clear_comments(
CONF *conf,
char *p)
483 p=scan_dquote(conf, p);
488 p=scan_quote(conf, p);
503 static int str_copy(
CONF *conf,
char *section,
char **pto,
char *from)
505 int q,r,rr=0,to=0,
len=0;
506 char *s,*
e,*rp,*
p,*rrp,*np,*cp,v;
520 while (!
IS_EOF(conf,*from) && (*from != q))
525 if (
IS_EOF(conf,*from))
break;
527 buf->
data[to++]= *(from++);
529 if (*from == q) from++;
535 while (!
IS_EOF(conf,*from))
548 buf->
data[to++]= *(from++);
550 if (*from == q) from++;
552 else if (
IS_ESC(conf,*from))
556 if (
IS_EOF(conf,v))
break;
557 else if (v ==
'r') v=
'\r';
558 else if (v ==
'n') v=
'\n';
559 else if (v ==
'b') v=
'\b';
560 else if (v ==
't') v=
'\t';
563 else if (
IS_EOF(conf,*from))
565 else if (*from ==
'$')
581 if ((e[0] ==
':') && (e[1] ==
':'))
614 if (rrp != NULL) *rrp=rr;
623 buf->
data[to++]= *(p++);
637 buf->
data[to++]= *(from++);
649 static char *eat_ws(
CONF *conf,
char *p)
656 static char *eat_alpha_numeric(
CONF *conf,
char *p)
671 static char *scan_quote(
CONF *conf,
char *p)
676 while (!(
IS_EOF(conf,*p)) && (*p != q))
681 if (
IS_EOF(conf,*p))
return(p);
690 static char *scan_dquote(
CONF *conf,
char *p)
695 while (!(
IS_EOF(conf,*p)))
724 static
int def_dump(const
CONF *conf,
BIO *out)
731 static int def_is_number(
const CONF *conf,
char c)
736 static int def_to_int(
const CONF *conf,
char c)