- i= -1;
-start: for (;;)
- {
- i++;
- if (sk_CONF_VALUE_num(sk) <= i) break;
-
- v=sk_CONF_VALUE_value(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,tmp,buf)) == NULL)
- def="";
-
- sprintf(buf,"%s_value",v->name);
- if ((value=CONF_get_string(req_conf,tmp,buf)) == NULL)
- value=NULL;
-
- sprintf(buf,"%s_min",v->name);
- min=(int)CONF_get_number(req_conf,tmp,buf);
-
- sprintf(buf,"%s_max",v->name);
- max=(int)CONF_get_number(req_conf,tmp,buf);
-
- if (!add_DN_object(ri->subject,v->value,def,value,nid,
- min,max))
- goto err;
- }
- if (sk_X509_NAME_ENTRY_num(ri->subject->entries) == 0)
- {
- BIO_printf(bio_err,"error, no objects specified in config file\n");
- goto err;
- }
-
- if (attribs)
- {
- if ((attr != NULL) && (sk_CONF_VALUE_num(attr) > 0))
- {
- BIO_printf(bio_err,"\nPlease enter the following 'extra' attributes\n");
- BIO_printf(bio_err,"to be sent with your certificate request\n");
- }
+ if (subj)
+ i = build_subject(req, subj, chtype, multirdn);
+ else
+ i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs, chtype);
+ }
+ if(!i) goto err;