apps/ca.c:457: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `CONF_load`.
Showing all 10 steps of the trace


apps/ca.c:457:12: Call
455.   
456.   	BIO_printf(bio_err,"Using configuration from %s\n",configfile);
457.   	if ((conf=CONF_load(NULL,configfile,&errorline)) == NULL)
                  ^
458.   		{
459.   		if (errorline <= 0)

crypto/conf/conf.c:86:1: Parameter `h->num_nodes`
  84.   
  85.   
  86. > LHASH *CONF_load(LHASH *h, const char *file, long *line)
  87.   	{
  88.   	LHASH *ltmp;

crypto/conf/conf.c:102:9: Call
  100.   		}
  101.   
  102.   	ltmp = CONF_load_bio(h, in, line);
                 ^
  103.   	BIO_free(in);
  104.   

crypto/conf/conf.c:122:1: Parameter `h->num_nodes`
    120.   #endif
    121.   
    122. > LHASH *CONF_load_bio(LHASH *h, BIO *in, long *line)
    123.   	{
    124.   	LHASH *ret=NULL;

crypto/conf/conf.c:359:35: Call
    357.   	sprintf(btmp,"%ld",eline);
    358.   	ERR_add_error_data(2,"line ",btmp);
    359.   	if ((h != ret) && (ret != NULL)) CONF_free(ret);
                                             ^
    360.   	if (v != NULL)
    361.   		{

crypto/conf/conf.c:440:1: Parameter `conf->num_nodes`
      438.   	}
      439.   
      440. > void CONF_free(LHASH *conf)
      441.   	{
      442.   	if (conf == NULL) return;

crypto/conf/conf.c:446:2: Call
      444.   	conf->down_load=0; 	/* evil thing to make sure the 'Free()'
      445.   				 * works as expected */
      446.   	lh_doall_arg(conf,(void (*)())value_free_hash,conf);
              ^
      447.   
      448.   	/* We now have only 'section' entries in the hash table.

crypto/lhash/lhash.c:275:1: <LHS trace>
273.   	}
274.   
275. > void lh_doall_arg(LHASH *lh, void (*func)(), void *arg)
276.   	{
277.   	int i;

crypto/lhash/lhash.c:275:1: Parameter `lh->num_nodes`
        273.   	}
        274.   
        275. > void lh_doall_arg(LHASH *lh, void (*func)(), void *arg)
        276.   	{
        277.   	int i;

crypto/lhash/lhash.c:282:7: Binary operation: ([0, +oo] - 1):unsigned32 by call to `CONF_load` 
        280.   	/* reverse the order so we search from 'top to bottom'
        281.   	 * We were having memory leaks otherwise */
        282.   	for (i=lh->num_nodes-1; i>=0; i--)
                     ^
        283.   		{
        284.   		a=lh->b[i];

void lh_doall_arg(LHASH *lh, void (*func)(), void *arg)
	{
	int i;
	LHASH_NODE *a,*n;
	for (i=lh->num_nodes-1; i>=0; i--)
		{
		a=lh->b[i];
		while (a != NULL)
			{
			n=a->next;
			func(a->data,arg);
			a=n;
			}
		}
	}
['int MAIN(int argc, char **argv)\n\t{\n\tchar *key=NULL;\n\tint total=0;\n\tint total_done=0;\n\tint badops=0;\n\tint ret=1;\n\tint req=0;\n\tint verbose=0;\n\tint gencrl=0;\n\tint dorevoke=0;\n\tlong crldays=0;\n\tlong crlhours=0;\n\tlong errorline= -1;\n\tchar *configfile=NULL;\n\tchar *md=NULL;\n\tchar *policy=NULL;\n\tchar *keyfile=NULL;\n\tchar *certfile=NULL;\n\tchar *infile=NULL;\n\tchar *spkac_file=NULL;\n\tchar *ss_cert_file=NULL;\n\tEVP_PKEY *pkey=NULL;\n\tint output_der = 0;\n\tchar *outfile=NULL;\n\tchar *outdir=NULL;\n\tchar *serialfile=NULL;\n\tchar *extensions=NULL;\n\tchar *crl_ext=NULL;\n\tBIGNUM *serial=NULL;\n\tchar *startdate=NULL;\n\tchar *enddate=NULL;\n\tint days=0;\n\tint batch=0;\n\tint notext=0;\n\tX509 *x509=NULL;\n\tX509 *x=NULL;\n\tBIO *in=NULL,*out=NULL,*Sout=NULL,*Cout=NULL;\n\tchar *dbfile=NULL;\n\tTXT_DB *db=NULL;\n\tX509_CRL *crl=NULL;\n\tX509_CRL_INFO *ci=NULL;\n\tX509_REVOKED *r=NULL;\n\tchar **pp,*p,*f;\n\tint i,j;\n\tlong l;\n\tconst EVP_MD *dgst=NULL;\n\tSTACK_OF(CONF_VALUE) *attribs=NULL;\n\tSTACK *cert_sk=NULL;\n\tBIO *hex=NULL;\n#undef BSIZE\n#define BSIZE 256\n\tMS_STATIC char buf[3][BSIZE];\n\tchar *randfile=NULL;\n#ifdef EFENCE\nEF_PROTECT_FREE=1;\nEF_PROTECT_BELOW=1;\nEF_ALIGNMENT=0;\n#endif\n\tapps_startup();\n\tconf = NULL;\n\tkey = NULL;\n\tsection = NULL;\n\tpreserve=0;\n\tmsie_hack=0;\n\tif (bio_err == NULL)\n\t\tif ((bio_err=BIO_new(BIO_s_file())) != NULL)\n\t\t\tBIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);\n\targc--;\n\targv++;\n\twhile (argc >= 1)\n\t\t{\n\t\tif\t(strcmp(*argv,"-verbose") == 0)\n\t\t\tverbose=1;\n\t\telse if\t(strcmp(*argv,"-config") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tconfigfile= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-name") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tsection= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-startdate") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tstartdate= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-enddate") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tenddate= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-days") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tdays=atoi(*(++argv));\n\t\t\t}\n\t\telse if (strcmp(*argv,"-md") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tmd= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-policy") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tpolicy= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-keyfile") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tkeyfile= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-key") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tkey= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-cert") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tcertfile= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-in") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tinfile= *(++argv);\n\t\t\treq=1;\n\t\t\t}\n\t\telse if (strcmp(*argv,"-out") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\toutfile= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-outdir") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\toutdir= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-notext") == 0)\n\t\t\tnotext=1;\n\t\telse if (strcmp(*argv,"-batch") == 0)\n\t\t\tbatch=1;\n\t\telse if (strcmp(*argv,"-preserveDN") == 0)\n\t\t\tpreserve=1;\n\t\telse if (strcmp(*argv,"-gencrl") == 0)\n\t\t\tgencrl=1;\n\t\telse if (strcmp(*argv,"-msie_hack") == 0)\n\t\t\tmsie_hack=1;\n\t\telse if (strcmp(*argv,"-crldays") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tcrldays= atol(*(++argv));\n\t\t\t}\n\t\telse if (strcmp(*argv,"-crlhours") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tcrlhours= atol(*(++argv));\n\t\t\t}\n\t\telse if (strcmp(*argv,"-infiles") == 0)\n\t\t\t{\n\t\t\targc--;\n\t\t\targv++;\n\t\t\treq=1;\n\t\t\tbreak;\n\t\t\t}\n\t\telse if (strcmp(*argv, "-ss_cert") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tss_cert_file = *(++argv);\n\t\t\treq=1;\n\t\t\t}\n\t\telse if (strcmp(*argv, "-spkac") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tspkac_file = *(++argv);\n\t\t\treq=1;\n\t\t\t}\n\t\telse if (strcmp(*argv,"-revoke") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tinfile= *(++argv);\n\t\t\tdorevoke=1;\n\t\t\t}\n\t\telse if (strcmp(*argv,"-extensions") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\textensions= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-crlexts") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tcrl_ext= *(++argv);\n\t\t\t}\n\t\telse\n\t\t\t{\nbad:\n\t\t\tBIO_printf(bio_err,"unknown option %s\\n",*argv);\n\t\t\tbadops=1;\n\t\t\tbreak;\n\t\t\t}\n\t\targc--;\n\t\targv++;\n\t\t}\n\tif (badops)\n\t\t{\n\t\tfor (pp=ca_usage; (*pp != NULL); pp++)\n\t\t\tBIO_printf(bio_err,*pp);\n\t\tgoto err;\n\t\t}\n\tERR_load_crypto_strings();\n\tif (configfile == NULL) configfile = getenv("OPENSSL_CONF");\n\tif (configfile == NULL) configfile = getenv("SSLEAY_CONF");\n\tif (configfile == NULL)\n\t\t{\n#ifdef VMS\n\t\tstrncpy(buf[0],X509_get_default_cert_area(),\n\t\t\tsizeof(buf[0])-1-sizeof(CONFIG_FILE));\n#else\n\t\tstrncpy(buf[0],X509_get_default_cert_area(),\n\t\t\tsizeof(buf[0])-2-sizeof(CONFIG_FILE));\n\t\tstrcat(buf[0],"/");\n#endif\n\t\tstrcat(buf[0],CONFIG_FILE);\n\t\tconfigfile=buf[0];\n\t\t}\n\tBIO_printf(bio_err,"Using configuration from %s\\n",configfile);\n\tif ((conf=CONF_load(NULL,configfile,&errorline)) == NULL)\n\t\t{\n\t\tif (errorline <= 0)\n\t\t\tBIO_printf(bio_err,"error loading the config file \'%s\'\\n",\n\t\t\t\tconfigfile);\n\t\telse\n\t\t\tBIO_printf(bio_err,"error on line %ld of config file \'%s\'\\n"\n\t\t\t\t,errorline,configfile);\n\t\tgoto err;\n\t\t}\n\tif (section == NULL)\n\t\t{\n\t\tsection=CONF_get_string(conf,BASE_SECTION,ENV_DEFAULT_CA);\n\t\tif (section == NULL)\n\t\t\t{\n\t\t\tlookup_fail(BASE_SECTION,ENV_DEFAULT_CA);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\tif (conf != NULL)\n\t\t{\n\t\tp=CONF_get_string(conf,NULL,"oid_file");\n\t\tif (p != NULL)\n\t\t\t{\n\t\t\tBIO *oid_bio;\n\t\t\toid_bio=BIO_new_file(p,"r");\n\t\t\tif (oid_bio == NULL)\n\t\t\t\t{\n\t\t\t\tERR_clear_error();\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tOBJ_create_objects(oid_bio);\n\t\t\t\tBIO_free(oid_bio);\n\t\t\t\t}\n\t\t\t}\n\t\tif(!add_oid_section(conf))\n\t\t\t{\n\t\t\tERR_print_errors(bio_err);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\trandfile = CONF_get_string(conf, BASE_SECTION, "RANDFILE");\n\tapp_RAND_load_file(randfile, bio_err, 0);\n\tin=BIO_new(BIO_s_file());\n\tout=BIO_new(BIO_s_file());\n\tSout=BIO_new(BIO_s_file());\n\tCout=BIO_new(BIO_s_file());\n\tif ((in == NULL) || (out == NULL) || (Sout == NULL) || (Cout == NULL))\n\t\t{\n\t\tERR_print_errors(bio_err);\n\t\tgoto err;\n\t\t}\n\tif ((keyfile == NULL) && ((keyfile=CONF_get_string(conf,\n\t\tsection,ENV_PRIVATE_KEY)) == NULL))\n\t\t{\n\t\tlookup_fail(section,ENV_PRIVATE_KEY);\n\t\tgoto err;\n\t\t}\n\tif (BIO_read_filename(in,keyfile) <= 0)\n\t\t{\n\t\tperror(keyfile);\n\t\tBIO_printf(bio_err,"trying to load CA private key\\n");\n\t\tgoto err;\n\t\t}\n\t\tpkey=PEM_read_bio_PrivateKey(in,NULL,NULL,key);\n\t\tif(key) memset(key,0,strlen(key));\n\tif (pkey == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"unable to load CA private key\\n");\n\t\tgoto err;\n\t\t}\n\tif ((certfile == NULL) && ((certfile=CONF_get_string(conf,\n\t\tsection,ENV_CERTIFICATE)) == NULL))\n\t\t{\n\t\tlookup_fail(section,ENV_CERTIFICATE);\n\t\tgoto err;\n\t\t}\n        if (BIO_read_filename(in,certfile) <= 0)\n\t\t{\n\t\tperror(certfile);\n\t\tBIO_printf(bio_err,"trying to load CA certificate\\n");\n\t\tgoto err;\n\t\t}\n\tx509=PEM_read_bio_X509(in,NULL,NULL,NULL);\n\tif (x509 == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"unable to load CA certificate\\n");\n\t\tgoto err;\n\t\t}\n\tif (!X509_check_private_key(x509,pkey))\n\t\t{\n\t\tBIO_printf(bio_err,"CA certificate and CA private key do not match\\n");\n\t\tgoto err;\n\t\t}\n\tf=CONF_get_string(conf,BASE_SECTION,ENV_PRESERVE);\n\tif ((f != NULL) && ((*f == \'y\') || (*f == \'Y\')))\n\t\tpreserve=1;\n\tf=CONF_get_string(conf,BASE_SECTION,ENV_MSIE_HACK);\n\tif ((f != NULL) && ((*f == \'y\') || (*f == \'Y\')))\n\t\tmsie_hack=1;\n\tif ((outdir == NULL) && (req))\n\t\t{\n\t\tstruct stat sb;\n\t\tif ((outdir=CONF_get_string(conf,section,ENV_NEW_CERTS_DIR))\n\t\t\t== NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"there needs to be defined a directory for new certificate to be placed in\\n");\n\t\t\tgoto err;\n\t\t\t}\n#ifndef VMS\n\t\tif (access(outdir,R_OK|W_OK|X_OK) != 0)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"I am unable to access the %s directory\\n",outdir);\n\t\t\tperror(outdir);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (stat(outdir,&sb) != 0)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"unable to stat(%s)\\n",outdir);\n\t\t\tperror(outdir);\n\t\t\tgoto err;\n\t\t\t}\n#ifdef S_IFDIR\n\t\tif (!(sb.st_mode & S_IFDIR))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"%s need to be a directory\\n",outdir);\n\t\t\tperror(outdir);\n\t\t\tgoto err;\n\t\t\t}\n#endif\n#endif\n\t\t}\n\tif ((dbfile=CONF_get_string(conf,section,ENV_DATABASE)) == NULL)\n\t\t{\n\t\tlookup_fail(section,ENV_DATABASE);\n\t\tgoto err;\n\t\t}\n\tif (BIO_read_filename(in,dbfile) <= 0)\n\t\t{\n\t\tperror(dbfile);\n\t\tBIO_printf(bio_err,"unable to open \'%s\'\\n",dbfile);\n\t\tgoto err;\n\t\t}\n\tdb=TXT_DB_read(in,DB_NUMBER);\n\tif (db == NULL) goto err;\n\tfor (i=0; i<sk_num(db->data); i++)\n\t\t{\n\t\tpp=(char **)sk_value(db->data,i);\n\t\tif ((pp[DB_type][0] != DB_TYPE_REV) &&\n\t\t\t(pp[DB_rev_date][0] != \'\\0\'))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"entry %d: not revoked yet, but has a revocation date\\n",i+1);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif ((pp[DB_type][0] == DB_TYPE_REV) &&\n\t\t\t!check_time_format(pp[DB_rev_date]))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"entry %d: invalid revocation date\\n",\n\t\t\t\ti+1);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (!check_time_format(pp[DB_exp_date]))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"entry %d: invalid expiry date\\n",i+1);\n\t\t\tgoto err;\n\t\t\t}\n\t\tp=pp[DB_serial];\n\t\tj=strlen(p);\n\t\tif ((j&1) || (j < 2))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"entry %d: bad serial number length (%d)\\n",i+1,j);\n\t\t\tgoto err;\n\t\t\t}\n\t\twhile (*p)\n\t\t\t{\n\t\t\tif (!(\t((*p >= \'0\') && (*p <= \'9\')) ||\n\t\t\t\t((*p >= \'A\') && (*p <= \'F\')) ||\n\t\t\t\t((*p >= \'a\') && (*p <= \'f\')))  )\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"entry %d: bad serial number characters, char pos %ld, char is \'%c\'\\n",i+1,(long)(p-pp[DB_serial]),*p);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tp++;\n\t\t\t}\n\t\t}\n\tif (verbose)\n\t\t{\n\t\tBIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);\n\t\tTXT_DB_write(out,db);\n\t\tBIO_printf(bio_err,"%d entries loaded from the database\\n",\n\t\t\tdb->data->num);\n\t\tBIO_printf(bio_err,"generating index\\n");\n\t\t}\n\tif (!TXT_DB_create_index(db,DB_serial,NULL,index_serial_hash,\n\t\tindex_serial_cmp))\n\t\t{\n\t\tBIO_printf(bio_err,"error creating serial number index:(%ld,%ld,%ld)\\n",db->error,db->arg1,db->arg2);\n\t\tgoto err;\n\t\t}\n\tif (!TXT_DB_create_index(db,DB_name,index_name_qual,index_name_hash,\n\t\tindex_name_cmp))\n\t\t{\n\t\tBIO_printf(bio_err,"error creating name index:(%ld,%ld,%ld)\\n",\n\t\t\tdb->error,db->arg1,db->arg2);\n\t\tgoto err;\n\t\t}\n\tif (req || gencrl)\n\t\t{\n\t\tif (outfile != NULL)\n\t\t\t{\n\t\t\tif (BIO_write_filename(Sout,outfile) <= 0)\n\t\t\t\t{\n\t\t\t\tperror(outfile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\tBIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT);\n\t\t}\n\tif (req)\n\t\t{\n\t\tif ((md == NULL) && ((md=CONF_get_string(conf,\n\t\t\tsection,ENV_DEFAULT_MD)) == NULL))\n\t\t\t{\n\t\t\tlookup_fail(section,ENV_DEFAULT_MD);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif ((dgst=EVP_get_digestbyname(md)) == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"%s is an unsupported message digest type\\n",md);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (verbose)\n\t\t\tBIO_printf(bio_err,"message digest is %s\\n",\n\t\t\t\tOBJ_nid2ln(dgst->type));\n\t\tif ((policy == NULL) && ((policy=CONF_get_string(conf,\n\t\t\tsection,ENV_POLICY)) == NULL))\n\t\t\t{\n\t\t\tlookup_fail(section,ENV_POLICY);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (verbose)\n\t\t\tBIO_printf(bio_err,"policy is %s\\n",policy);\n\t\tif ((serialfile=CONF_get_string(conf,section,ENV_SERIAL))\n\t\t\t== NULL)\n\t\t\t{\n\t\t\tlookup_fail(section,ENV_SERIAL);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif(!extensions)\n\t\t\textensions=CONF_get_string(conf,section,ENV_EXTENSIONS);\n\t\tif(extensions) {\n\t\t\tX509V3_CTX ctx;\n\t\t\tX509V3_set_ctx_test(&ctx);\n\t\t\tX509V3_set_conf_lhash(&ctx, conf);\n\t\t\tif(!X509V3_EXT_add_conf(conf, &ctx, extensions, NULL)) {\n\t\t\t\tBIO_printf(bio_err,\n\t\t\t\t "Error Loading extension section %s\\n",\n\t\t\t\t\t\t\t\t extensions);\n\t\t\t\tret = 1;\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tif (startdate == NULL)\n\t\t\t{\n\t\t\tstartdate=CONF_get_string(conf,section,\n\t\t\t\tENV_DEFAULT_STARTDATE);\n\t\t\t}\n\t\tif (startdate && !ASN1_UTCTIME_set_string(NULL,startdate))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (startdate == NULL) startdate="today";\n\t\tif (enddate == NULL)\n\t\t\t{\n\t\t\tenddate=CONF_get_string(conf,section,\n\t\t\t\tENV_DEFAULT_ENDDATE);\n\t\t\t}\n\t\tif (enddate && !ASN1_UTCTIME_set_string(NULL,enddate))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (days == 0)\n\t\t\t{\n\t\t\tdays=(int)CONF_get_number(conf,section,\n\t\t\t\tENV_DEFAULT_DAYS);\n\t\t\t}\n\t\tif (!enddate && (days == 0))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"cannot lookup how many days to certify for\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\tif ((serial=load_serial(serialfile)) == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"error while loading serial number\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (verbose)\n\t\t\t{\n\t\t\tif ((f=BN_bn2hex(serial)) == NULL) goto err;\n\t\t\tBIO_printf(bio_err,"next serial number is %s\\n",f);\n\t\t\tFree(f);\n\t\t\t}\n\t\tif ((attribs=CONF_get_section(conf,policy)) == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"unable to find \'section\' for %s\\n",policy);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif ((cert_sk=sk_new_null()) == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"Malloc failure\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (spkac_file != NULL)\n\t\t\t{\n\t\t\ttotal++;\n\t\t\tj=certify_spkac(&x,spkac_file,pkey,x509,dgst,attribs,db,\n\t\t\t\tserial,startdate,enddate, days,extensions,conf,\n\t\t\t\tverbose);\n\t\t\tif (j < 0) goto err;\n\t\t\tif (j > 0)\n\t\t\t\t{\n\t\t\t\ttotal_done++;\n\t\t\t\tBIO_printf(bio_err,"\\n");\n\t\t\t\tif (!BN_add_word(serial,1)) goto err;\n\t\t\t\tif (!sk_push(cert_sk,(char *)x))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_err,"Malloc failure\\n");\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\tif (outfile)\n\t\t\t\t\t{\n\t\t\t\t\toutput_der = 1;\n\t\t\t\t\tbatch = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tif (ss_cert_file != NULL)\n\t\t\t{\n\t\t\ttotal++;\n\t\t\tj=certify_cert(&x,ss_cert_file,pkey,x509,dgst,attribs,\n\t\t\t\tdb,serial,startdate,enddate,days,batch,\n\t\t\t\textensions,conf,verbose);\n\t\t\tif (j < 0) goto err;\n\t\t\tif (j > 0)\n\t\t\t\t{\n\t\t\t\ttotal_done++;\n\t\t\t\tBIO_printf(bio_err,"\\n");\n\t\t\t\tif (!BN_add_word(serial,1)) goto err;\n\t\t\t\tif (!sk_push(cert_sk,(char *)x))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_err,"Malloc failure\\n");\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tif (infile != NULL)\n\t\t\t{\n\t\t\ttotal++;\n\t\t\tj=certify(&x,infile,pkey,x509,dgst,attribs,db,\n\t\t\t\tserial,startdate,enddate,days,batch,\n\t\t\t\textensions,conf,verbose);\n\t\t\tif (j < 0) goto err;\n\t\t\tif (j > 0)\n\t\t\t\t{\n\t\t\t\ttotal_done++;\n\t\t\t\tBIO_printf(bio_err,"\\n");\n\t\t\t\tif (!BN_add_word(serial,1)) goto err;\n\t\t\t\tif (!sk_push(cert_sk,(char *)x))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_err,"Malloc failure\\n");\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tfor (i=0; i<argc; i++)\n\t\t\t{\n\t\t\ttotal++;\n\t\t\tj=certify(&x,argv[i],pkey,x509,dgst,attribs,db,\n\t\t\t\tserial,startdate,enddate,days,batch,\n\t\t\t\textensions,conf,verbose);\n\t\t\tif (j < 0) goto err;\n\t\t\tif (j > 0)\n\t\t\t\t{\n\t\t\t\ttotal_done++;\n\t\t\t\tBIO_printf(bio_err,"\\n");\n\t\t\t\tif (!BN_add_word(serial,1)) goto err;\n\t\t\t\tif (!sk_push(cert_sk,(char *)x))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_err,"Malloc failure\\n");\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tif (sk_num(cert_sk) > 0)\n\t\t\t{\n\t\t\tif (!batch)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"\\n%d out of %d certificate requests certified, commit? [y/n]",total_done,total);\n\t\t\t\t(void)BIO_flush(bio_err);\n\t\t\t\tbuf[0][0]=\'\\0\';\n\t\t\t\tfgets(buf[0],10,stdin);\n\t\t\t\tif ((buf[0][0] != \'y\') && (buf[0][0] != \'Y\'))\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_err,"CERTIFICATION CANCELED\\n");\n\t\t\t\t\tret=0;\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tBIO_printf(bio_err,"Write out database with %d new entries\\n",sk_num(cert_sk));\n\t\t\tstrncpy(buf[0],serialfile,BSIZE-4);\n#ifdef VMS\n\t\t\tstrcat(buf[0],"-new");\n#else\n\t\t\tstrcat(buf[0],".new");\n#endif\n\t\t\tif (!save_serial(buf[0],serial)) goto err;\n\t\t\tstrncpy(buf[1],dbfile,BSIZE-4);\n#ifdef VMS\n\t\t\tstrcat(buf[1],"-new");\n#else\n\t\t\tstrcat(buf[1],".new");\n#endif\n\t\t\tif (BIO_write_filename(out,buf[1]) <= 0)\n\t\t\t\t{\n\t\t\t\tperror(dbfile);\n\t\t\t\tBIO_printf(bio_err,"unable to open \'%s\'\\n",dbfile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tl=TXT_DB_write(out,db);\n\t\t\tif (l <= 0) goto err;\n\t\t\t}\n\t\tif (verbose)\n\t\t\tBIO_printf(bio_err,"writing new certificates\\n");\n\t\tfor (i=0; i<sk_num(cert_sk); i++)\n\t\t\t{\n\t\t\tint k;\n\t\t\tunsigned char *n;\n\t\t\tx=(X509 *)sk_value(cert_sk,i);\n\t\t\tj=x->cert_info->serialNumber->length;\n\t\t\tp=(char *)x->cert_info->serialNumber->data;\n\t\t\tstrncpy(buf[2],outdir,BSIZE-(j*2)-6);\n#ifndef VMS\n\t\t\tstrcat(buf[2],"/");\n#endif\n\t\t\tn=(unsigned char *)&(buf[2][strlen(buf[2])]);\n\t\t\tif (j > 0)\n\t\t\t\t{\n\t\t\t\tfor (k=0; k<j; k++)\n\t\t\t\t\t{\n\t\t\t\t\tsprintf((char *)n,"%02X",(unsigned char)*(p++));\n\t\t\t\t\tn+=2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t*(n++)=\'0\';\n\t\t\t\t*(n++)=\'0\';\n\t\t\t\t}\n\t\t\t*(n++)=\'.\'; *(n++)=\'p\'; *(n++)=\'e\'; *(n++)=\'m\';\n\t\t\t*n=\'\\0\';\n\t\t\tif (verbose)\n\t\t\t\tBIO_printf(bio_err,"writing %s\\n",buf[2]);\n\t\t\tif (BIO_write_filename(Cout,buf[2]) <= 0)\n\t\t\t\t{\n\t\t\t\tperror(buf[2]);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\twrite_new_certificate(Cout,x, 0, notext);\n\t\t\twrite_new_certificate(Sout,x, output_der, notext);\n\t\t\t}\n\t\tif (sk_num(cert_sk))\n\t\t\t{\n\t\t\tstrncpy(buf[2],serialfile,BSIZE-4);\n#ifdef VMS\n\t\t\tstrcat(buf[2],"-old");\n#else\n\t\t\tstrcat(buf[2],".old");\n#endif\n\t\t\tBIO_free(in);\n\t\t\tBIO_free(out);\n\t\t\tin=NULL;\n\t\t\tout=NULL;\n\t\t\tif (rename(serialfile,buf[2]) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to rename %s to %s\\n",\n\t\t\t\t\tserialfile,buf[2]);\n\t\t\t\tperror("reason");\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tif (rename(buf[0],serialfile) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to rename %s to %s\\n",\n\t\t\t\t\tbuf[0],serialfile);\n\t\t\t\tperror("reason");\n\t\t\t\trename(buf[2],serialfile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tstrncpy(buf[2],dbfile,BSIZE-4);\n#ifdef VMS\n\t\t\tstrcat(buf[2],"-old");\n#else\n\t\t\tstrcat(buf[2],".old");\n#endif\n\t\t\tif (rename(dbfile,buf[2]) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to rename %s to %s\\n",\n\t\t\t\t\tdbfile,buf[2]);\n\t\t\t\tperror("reason");\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tif (rename(buf[1],dbfile) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to rename %s to %s\\n",\n\t\t\t\t\tbuf[1],dbfile);\n\t\t\t\tperror("reason");\n\t\t\t\trename(buf[2],dbfile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tBIO_printf(bio_err,"Data Base Updated\\n");\n\t\t\t}\n\t\t}\n\tif (gencrl)\n\t\t{\n\t\tif(!crl_ext) crl_ext=CONF_get_string(conf,section,ENV_CRLEXT);\n\t\tif(crl_ext) {\n\t\t\tX509V3_CTX ctx;\n\t\t\tX509V3_set_ctx_test(&ctx);\n\t\t\tX509V3_set_conf_lhash(&ctx, conf);\n\t\t\tif(!X509V3_EXT_add_conf(conf, &ctx, crl_ext, NULL)) {\n\t\t\t\tBIO_printf(bio_err,\n\t\t\t\t "Error Loading CRL extension section %s\\n",\n\t\t\t\t\t\t\t\t crl_ext);\n\t\t\t\tret = 1;\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tif ((hex=BIO_new(BIO_s_mem())) == NULL) goto err;\n\t\tif (!crldays && !crlhours)\n\t\t\t{\n\t\t\tcrldays=CONF_get_number(conf,section,\n\t\t\t\tENV_DEFAULT_CRL_DAYS);\n\t\t\tcrlhours=CONF_get_number(conf,section,\n\t\t\t\tENV_DEFAULT_CRL_HOURS);\n\t\t\t}\n\t\tif ((crldays == 0) && (crlhours == 0))\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"cannot lookup how long until the next CRL is issuer\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (verbose) BIO_printf(bio_err,"making CRL\\n");\n\t\tif ((crl=X509_CRL_new()) == NULL) goto err;\n\t\tci=crl->crl;\n\t\tX509_NAME_free(ci->issuer);\n\t\tci->issuer=X509_NAME_dup(x509->cert_info->subject);\n\t\tif (ci->issuer == NULL) goto err;\n\t\tX509_gmtime_adj(ci->lastUpdate,0);\n\t\tif (ci->nextUpdate == NULL)\n\t\t\tci->nextUpdate=ASN1_UTCTIME_new();\n\t\tX509_gmtime_adj(ci->nextUpdate,(crldays*24+crlhours)*60*60);\n\t\tfor (i=0; i<sk_num(db->data); i++)\n\t\t\t{\n\t\t\tpp=(char **)sk_value(db->data,i);\n\t\t\tif (pp[DB_type][0] == DB_TYPE_REV)\n\t\t\t\t{\n\t\t\t\tif ((r=X509_REVOKED_new()) == NULL) goto err;\n\t\t\t\tASN1_STRING_set((ASN1_STRING *)\n\t\t\t\t\tr->revocationDate,\n\t\t\t\t\t(unsigned char *)pp[DB_rev_date],\n\t\t\t\t\tstrlen(pp[DB_rev_date]));\n\t\t\t\t(void)BIO_reset(hex);\n\t\t\t\tif (!BIO_puts(hex,pp[DB_serial]))\n\t\t\t\t\tgoto err;\n\t\t\t\tif (!a2i_ASN1_INTEGER(hex,r->serialNumber,\n\t\t\t\t\tbuf[0],BSIZE)) goto err;\n\t\t\t\tsk_X509_REVOKED_push(ci->revoked,r);\n\t\t\t\t}\n\t\t\t}\n\t\tsk_X509_REVOKED_sort(ci->revoked);\n\t\tfor (i=0; i<sk_X509_REVOKED_num(ci->revoked); i++)\n\t\t\t{\n\t\t\tr=sk_X509_REVOKED_value(ci->revoked,i);\n\t\t\tr->sequence=i;\n\t\t\t}\n\t\tif (verbose) BIO_printf(bio_err,"signing CRL\\n");\n\t\tif (md != NULL)\n\t\t\t{\n\t\t\tif ((dgst=EVP_get_digestbyname(md)) == NULL)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"%s is an unsupported message digest type\\n",md);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t    {\n#ifndef NO_DSA\n\t\t    if (pkey->type == EVP_PKEY_DSA)\n\t\t\tdgst=EVP_dss1();\n\t\t    else\n#endif\n\t\t\tdgst=EVP_md5();\n\t\t    }\n\t\tif(crl_ext) {\n\t\t    X509V3_CTX crlctx;\n\t\t    if (ci->version == NULL)\n\t\t    if ((ci->version=ASN1_INTEGER_new()) == NULL) goto err;\n\t\t    ASN1_INTEGER_set(ci->version,1);\n\t\t    X509V3_set_ctx(&crlctx, x509, NULL, NULL, crl, 0);\n\t\t    X509V3_set_conf_lhash(&crlctx, conf);\n\t\t    if(!X509V3_EXT_CRL_add_conf(conf, &crlctx,\n\t\t\t\t\t\t crl_ext, crl)) goto err;\n\t\t}\n\t\tif (!X509_CRL_sign(crl,pkey,dgst)) goto err;\n\t\tPEM_write_bio_X509_CRL(Sout,crl);\n\t\t}\n\tif (dorevoke)\n\t\t{\n\t\tif (infile == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err,"no input files\\n");\n\t\t\tgoto err;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tX509 *revcert;\n\t\t\tif (BIO_read_filename(in,infile) <= 0)\n\t\t\t\t{\n\t\t\t\tperror(infile);\n\t\t\t\tBIO_printf(bio_err,"error trying to load \'%s\' certificate\\n",infile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\trevcert=PEM_read_bio_X509(in,NULL,NULL,NULL);\n\t\t\tif (revcert == NULL)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to load \'%s\' certificate\\n",infile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tj=do_revoke(revcert,db);\n\t\t\tif (j <= 0) goto err;\n\t\t\tX509_free(revcert);\n\t\t\tstrncpy(buf[0],dbfile,BSIZE-4);\n\t\t\tstrcat(buf[0],".new");\n\t\t\tif (BIO_write_filename(out,buf[0]) <= 0)\n\t\t\t\t{\n\t\t\t\tperror(dbfile);\n\t\t\t\tBIO_printf(bio_err,"unable to open \'%s\'\\n",dbfile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tj=TXT_DB_write(out,db);\n\t\t\tif (j <= 0) goto err;\n\t\t\tstrncpy(buf[1],dbfile,BSIZE-4);\n\t\t\tstrcat(buf[1],".old");\n\t\t\tif (rename(dbfile,buf[1]) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to rename %s to %s\\n", dbfile, buf[1]);\n\t\t\t\tperror("reason");\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tif (rename(buf[0],dbfile) < 0)\n\t\t\t\t{\n\t\t\t\tBIO_printf(bio_err,"unable to rename %s to %s\\n", buf[0],dbfile);\n\t\t\t\tperror("reason");\n\t\t\t\trename(buf[1],dbfile);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tBIO_printf(bio_err,"Data Base Updated\\n");\n\t\t\t}\n\t\t}\n\tret=0;\nerr:\n\tBIO_free(hex);\n\tBIO_free(Cout);\n\tBIO_free(Sout);\n\tBIO_free(out);\n\tBIO_free(in);\n\tsk_pop_free(cert_sk,X509_free);\n\tif (ret) ERR_print_errors(bio_err);\n\tapp_RAND_write_file(randfile, bio_err);\n\tBN_free(serial);\n\tTXT_DB_free(db);\n\tEVP_PKEY_free(pkey);\n\tX509_free(x509);\n\tX509_CRL_free(crl);\n\tCONF_free(conf);\n\tOBJ_cleanup();\n\tEXIT(ret);\n\t}', 'LHASH *CONF_load(LHASH *h, const char *file, long *line)\n\t{\n\tLHASH *ltmp;\n\tBIO *in=NULL;\n#ifdef VMS\n\tin=BIO_new_file(file, "r");\n#else\n\tin=BIO_new_file(file, "rb");\n#endif\n\tif (in == NULL)\n\t\t{\n\t\tCONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB);\n\t\treturn NULL;\n\t\t}\n\tltmp = CONF_load_bio(h, in, line);\n\tBIO_free(in);\n\treturn ltmp;\n}', 'LHASH *CONF_load_bio(LHASH *h, BIO *in, long *line)\n\t{\n\tLHASH *ret=NULL;\n#define BUFSIZE\t512\n\tchar btmp[16];\n\tint bufnum=0,i,ii;\n\tBUF_MEM *buff=NULL;\n\tchar *s,*p,*end;\n\tint again,n;\n\tlong eline=0;\n\tCONF_VALUE *v=NULL,*vv,*tv;\n\tCONF_VALUE *sv=NULL;\n\tchar *section=NULL,*buf;\n\tSTACK_OF(CONF_VALUE) *section_sk=NULL,*ts;\n\tchar *start,*psection,*pname;\n\tif ((buff=BUF_MEM_new()) == NULL)\n\t\t{\n\t\tCONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);\n\t\tgoto err;\n\t\t}\n\tsection=(char *)Malloc(10);\n\tif (section == NULL)\n\t\t{\n\t\tCONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tstrcpy(section,"default");\n\tif (h == NULL)\n\t\t{\n\t\tif ((ret=lh_new(hash,cmp_conf)) == NULL)\n\t\t\t{\n\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\telse\n\t\tret=h;\n\tsv=new_section(ret,section);\n\tif (sv == NULL)\n\t\t{\n\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\tCONF_R_UNABLE_TO_CREATE_NEW_SECTION);\n\t\tgoto err;\n\t\t}\n\tsection_sk=(STACK_OF(CONF_VALUE) *)sv->value;\n\tbufnum=0;\n\tfor (;;)\n\t\t{\n\t\tagain=0;\n\t\tif (!BUF_MEM_grow(buff,bufnum+BUFSIZE))\n\t\t\t{\n\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tp= &(buff->data[bufnum]);\n\t\t*p=\'\\0\';\n\t\tBIO_gets(in, p, BUFSIZE-1);\n\t\tp[BUFSIZE-1]=\'\\0\';\n\t\tii=i=strlen(p);\n\t\tif (i == 0) break;\n\t\twhile (i > 0)\n\t\t\t{\n\t\t\tif ((p[i-1] != \'\\r\') && (p[i-1] != \'\\n\'))\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t\ti--;\n\t\t\t}\n\t\tif (i == ii)\n\t\t\tagain=1;\n\t\telse\n\t\t\t{\n\t\t\tp[i]=\'\\0\';\n\t\t\teline++;\n\t\t\t}\n\t\tbufnum+=i;\n\t\tv=NULL;\n\t\tif (bufnum >= 1)\n\t\t\t{\n\t\t\tp= &(buff->data[bufnum-1]);\n\t\t\tif (\tIS_ESC(p[0]) &&\n\t\t\t\t((bufnum <= 1) || !IS_ESC(p[-1])))\n\t\t\t\t{\n\t\t\t\tbufnum--;\n\t\t\t\tagain=1;\n\t\t\t\t}\n\t\t\t}\n\t\tif (again) continue;\n\t\tbufnum=0;\n\t\tbuf=buff->data;\n\t\tclear_comments(buf);\n\t\tn=strlen(buf);\n\t\ts=eat_ws(buf);\n\t\tif (IS_EOF(*s)) continue;\n\t\tif (*s == \'[\')\n\t\t\t{\n\t\t\tchar *ss;\n\t\t\ts++;\n\t\t\tstart=eat_ws(s);\n\t\t\tss=start;\nagain:\n\t\t\tend=eat_alpha_numeric(ss);\n\t\t\tp=eat_ws(end);\n\t\t\tif (*p != \']\')\n\t\t\t\t{\n\t\t\t\tif (*p != \'\\0\')\n\t\t\t\t\t{\n\t\t\t\t\tss=p;\n\t\t\t\t\tgoto again;\n\t\t\t\t\t}\n\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\tCONF_R_MISSING_CLOSE_SQUARE_BRACKET);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t*end=\'\\0\';\n\t\t\tif (!str_copy(ret,NULL,&section,start)) goto err;\n\t\t\tif ((sv=get_section(ret,section)) == NULL)\n\t\t\t\tsv=new_section(ret,section);\n\t\t\tif (sv == NULL)\n\t\t\t\t{\n\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\tCONF_R_UNABLE_TO_CREATE_NEW_SECTION);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tsection_sk=(STACK_OF(CONF_VALUE) *)sv->value;\n\t\t\tcontinue;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tpname=s;\n\t\t\tpsection=NULL;\n\t\t\tend=eat_alpha_numeric(s);\n\t\t\tif ((end[0] == \':\') && (end[1] == \':\'))\n\t\t\t\t{\n\t\t\t\t*end=\'\\0\';\n\t\t\t\tend+=2;\n\t\t\t\tpsection=pname;\n\t\t\t\tpname=end;\n\t\t\t\tend=eat_alpha_numeric(end);\n\t\t\t\t}\n\t\t\tp=eat_ws(end);\n\t\t\tif (*p != \'=\')\n\t\t\t\t{\n\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\t\tCONF_R_MISSING_EQUAL_SIGN);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t*end=\'\\0\';\n\t\t\tp++;\n\t\t\tstart=eat_ws(p);\n\t\t\twhile (!IS_EOF(*p))\n\t\t\t\tp++;\n\t\t\tp--;\n\t\t\twhile ((p != start) && (IS_WS(*p)))\n\t\t\t\tp--;\n\t\t\tp++;\n\t\t\t*p=\'\\0\';\n\t\t\tif (!(v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))))\n\t\t\t\t{\n\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\t\t\tERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tif (psection == NULL) psection=section;\n\t\t\tv->name=(char *)Malloc(strlen(pname)+1);\n\t\t\tv->value=NULL;\n\t\t\tif (v->name == NULL)\n\t\t\t\t{\n\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\t\t\tERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tstrcpy(v->name,pname);\n\t\t\tif (!str_copy(ret,psection,&(v->value),start)) goto err;\n\t\t\tif (strcmp(psection,section) != 0)\n\t\t\t\t{\n\t\t\t\tif ((tv=get_section(ret,psection))\n\t\t\t\t\t== NULL)\n\t\t\t\t\ttv=new_section(ret,psection);\n\t\t\t\tif (tv == NULL)\n\t\t\t\t\t{\n\t\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\t   CONF_R_UNABLE_TO_CREATE_NEW_SECTION);\n\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\tts=(STACK_OF(CONF_VALUE) *)tv->value;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\ttv=sv;\n\t\t\t\tts=section_sk;\n\t\t\t\t}\n\t\t\tv->section=tv->section;\n\t\t\tif (!sk_CONF_VALUE_push(ts,v))\n\t\t\t\t{\n\t\t\t\tCONFerr(CONF_F_CONF_LOAD_BIO,\n\t\t\t\t\t\t\tERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tvv=(CONF_VALUE *)lh_insert(ret,v);\n\t\t\tif (vv != NULL)\n\t\t\t\t{\n\t\t\t\tsk_CONF_VALUE_delete_ptr(ts,vv);\n\t\t\t\tFree(vv->name);\n\t\t\t\tFree(vv->value);\n\t\t\t\tFree(vv);\n\t\t\t\t}\n\t\t\tv=NULL;\n\t\t\t}\n\t\t}\n\tif (buff != NULL) BUF_MEM_free(buff);\n\tif (section != NULL) Free(section);\n\treturn(ret);\nerr:\n\tif (buff != NULL) BUF_MEM_free(buff);\n\tif (section != NULL) Free(section);\n\tif (line != NULL) *line=eline;\n\tsprintf(btmp,"%ld",eline);\n\tERR_add_error_data(2,"line ",btmp);\n\tif ((h != ret) && (ret != NULL)) CONF_free(ret);\n\tif (v != NULL)\n\t\t{\n\t\tif (v->name != NULL) Free(v->name);\n\t\tif (v->value != NULL) Free(v->value);\n\t\tif (v != NULL) Free(v);\n\t\t}\n\treturn(NULL);\n\t}', 'void CONF_free(LHASH *conf)\n\t{\n\tif (conf == NULL) return;\n\tconf->down_load=0;\n\tlh_doall_arg(conf,(void (*)())value_free_hash,conf);\n\tlh_doall_arg(conf,(void (*)())value_free_stack,conf);\n\tlh_free(conf);\n\t}', 'void lh_doall_arg(LHASH *lh, void (*func)(), void *arg)\n\t{\n\tint i;\n\tLHASH_NODE *a,*n;\n\tfor (i=lh->num_nodes-1; i>=0; i--)\n\t\t{\n\t\ta=lh->b[i];\n\t\twhile (a != NULL)\n\t\t\t{\n\t\t\tn=a->next;\n\t\t\tfunc(a->data,arg);\n\t\t\ta=n;\n\t\t\t}\n\t\t}\n\t}']