int nid,min,max;
int nid; long n_min,n_max;
static int prompt_info(X509_REQ *req,		STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,		STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs)	{	int i;	char *p,*q;	char buf[100];	int nid,min,max;	char *type,*def,*value;	CONF_VALUE *v;	X509_NAME *subj;	subj = X509_REQ_get_subject_name(req);	if(!batch)		{		BIO_printf(bio_err,"You are about to be asked to enter information that will be incorporated\n");		BIO_printf(bio_err,"into your certificate request.\n");		BIO_printf(bio_err,"What you are about to enter is what is called a Distinguished Name or a DN.\n");		BIO_printf(bio_err,"There are quite a few fields but you can leave some blank\n");		BIO_printf(bio_err,"For some fields there will be a default value,\n");		BIO_printf(bio_err,"If you enter '.', the field will be left blank.\n");		BIO_printf(bio_err,"-----\n");		}	if (sk_CONF_VALUE_num(dn_sk))		{		i= -1;start:		for (;;)			{			i++;			if (sk_CONF_VALUE_num(dn_sk) <= i) break;			v=sk_CONF_VALUE_value(dn_sk,i);			p=q=NULL;			type=v->name;			if(!check_end(type,"_min") || !check_end(type,"_max") ||				!check_end(type,"_default") ||					 !check_end(type,"_value")) continue;			/* Skip past any leading X. X: X, etc to allow for			 * multiple instances 			 */			for(p = v->name; *p ; p++) 				if ((*p == ':') || (*p == ',') ||							 (*p == '.')) {					p++;					if(*p) type = p;					break;				}			/* If OBJ not recognised ignore it */			if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;			sprintf(buf,"%s_default",v->name);			if ((def=CONF_get_string(req_conf,dn_sect,buf)) == NULL)				{				ERR_clear_error();				def="";				}							sprintf(buf,"%s_value",v->name);			if ((value=CONF_get_string(req_conf,dn_sect,buf)) == NULL)				{				ERR_clear_error();				value=NULL;				}			sprintf(buf,"%s_min",v->name);			min=(int)CONF_get_number(req_conf,dn_sect,buf);			sprintf(buf,"%s_max",v->name);			max=(int)CONF_get_number(req_conf,dn_sect,buf);			if (!add_DN_object(subj,v->value,def,value,nid,				min,max))				return 0;			}		if (X509_NAME_entry_count(subj) == 0)			{			BIO_printf(bio_err,"error, no objects specified in config file\n");			return 0;			}		if (attribs)			{			if ((attr_sk != NULL) && (sk_CONF_VALUE_num(attr_sk) > 0) && (!batch))				{				BIO_printf(bio_err,"\nPlease enter the following 'extra' attributes\n");				BIO_printf(bio_err,"to be sent with your certificate request\n");				}			i= -1;start2:			for (;;)				{				i++;				if ((attr_sk == NULL) ||					    (sk_CONF_VALUE_num(attr_sk) <= i))					break;				v=sk_CONF_VALUE_value(attr_sk,i);				type=v->name;				if ((nid=OBJ_txt2nid(type)) == NID_undef)					goto start2;				sprintf(buf,"%s_default",type);				if ((def=CONF_get_string(req_conf,attr_sect,buf))					== NULL)					{					ERR_clear_error();					def="";					}												sprintf(buf,"%s_value",type);				if ((value=CONF_get_string(req_conf,attr_sect,buf))					== NULL)					{					ERR_clear_error();					value=NULL;					}				sprintf(buf,"%s_min",type);				min=(int)CONF_get_number(req_conf,attr_sect,buf);				sprintf(buf,"%s_max",type);				max=(int)CONF_get_number(req_conf,attr_sect,buf);				if (!add_attribute_object(req,					v->value,def,value,nid,min,max))					return 0;				}			}		}	else		{		BIO_printf(bio_err,"No template, please set one up.\n");		return 0;		}	return 1;	}