X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fconf%2Fconf.c;h=861043c08df2511ca913d4ff90989a48c9350a0c;hp=68243e9f015324b9dc1859aeac5a831d255be574;hb=3a1daca9efa22c3d9e38f40c84b48388fa57585d;hpb=eda1f21f1af8b6f77327e7b37573af9c1ba73726 diff --git a/crypto/conf/conf.c b/crypto/conf/conf.c index 68243e9f01..861043c08d 100644 --- a/crypto/conf/conf.c +++ b/crypto/conf/conf.c @@ -1,5 +1,5 @@ /* crypto/conf/conf.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -93,9 +93,9 @@ static CONF_VALUE *new_section(); static CONF_VALUE *get_section(); #endif -#define scan_esc(p) ((*(++p) == '\0')?(p):(++p)) +#define scan_esc(p) ((((p)[1] == '\0')?(p++):(p+=2)),p) -char *CONF_version="CONF part of SSLeay 0.8.1b 29-Jun-1998"; +char *CONF_version="CONF part of OpenSSL 0.9.2 31-Dec-1998"; LHASH *CONF_load(h,file,line) LHASH *h; @@ -105,10 +105,12 @@ long *line; LHASH *ret=NULL; FILE *in=NULL; #define BUFSIZE 512 + char btmp[16]; int bufnum=0,i,ii; BUF_MEM *buff=NULL; char *s,*p,*end; - int again,n,eline=0; + int again,n; + long eline=0; CONF_VALUE *v=NULL,*vv,*tv; CONF_VALUE *sv=NULL; char *section=NULL,*buf; @@ -124,7 +126,9 @@ long *line; in=fopen(file,"rb"); if (in == NULL) { - SYSerr(SYS_F_FOPEN,errno); + SYSerr(SYS_F_FOPEN,get_last_sys_error()); + ERR_set_error_data(BUF_strdup(file), + ERR_TXT_MALLOCED|ERR_TXT_STRING); CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); goto err; } @@ -217,12 +221,21 @@ long *line; if (IS_EOF(*s)) continue; /* blank line */ if (*s == '[') { + char *ss; + s++; start=eat_ws(s); - end=eat_alpha_numeric(start); + ss=start; +again: + end=eat_alpha_numeric(ss); p=eat_ws(end); if (*p != ']') { + if (*p != '\0') + { + ss=p; + goto again; + } CONFerr(CONF_F_CONF_LOAD,CONF_R_MISSING_CLOSE_SQUARE_BRACKET); goto err; } @@ -326,6 +339,8 @@ err: if (buff != NULL) BUF_MEM_free(buff); if (section != NULL) Free(section); if (line != NULL) *line=eline; + sprintf(btmp,"%ld",eline); + ERR_add_error_data(2,"line ",btmp); if (in != NULL) fclose(in); if ((h != ret) && (ret != NULL)) CONF_free(ret); if (v != NULL) @@ -706,13 +721,13 @@ char *section; v->value=(char *)sk; vv=(CONF_VALUE *)lh_insert(conf,(char *)v); -#ifndef WIN16 if (vv != NULL) { +#if !defined(NO_STDIO) && !defined(WIN16) fprintf(stderr,"internal fault\n"); +#endif abort(); } -#endif ok=1; err: if (!ok)