#ifdef RL_DEBUG
BIO_printf(bio_err, "DEBUG[load_index]: unique_subject = \"%s\"\n", p);
#endif
- switch(*p)
- {
- case 'f': /* false */
- case 'F': /* FALSE */
- case 'n': /* no */
- case 'N': /* NO */
- retdb->attributes.unique_subject = 0;
- break;
- case 't': /* true */
- case 'T': /* TRUE */
- case 'y': /* yes */
- case 'Y': /* YES */
- default:
- retdb->attributes.unique_subject = 1;
- break;
- }
+ retdb->attributes.unique_subject = parse_yesno(p,1);
}
}
}
}
+int parse_yesno(char *str, int def)
+ {
+ int ret = def;
+ if (str)
+ {
+ switch (*str)
+ {
+ case 'f': /* false */
+ case 'F': /* FALSE */
+ case 'n': /* no */
+ case 'N': /* NO */
+ case '0': /* 0 */
+ ret = 0;
+ break;
+ case 't': /* true */
+ case 'T': /* TRUE */
+ case 'y': /* yes */
+ case 'Y': /* YES */
+ case '1': /* 1 */
+ ret = 0;
+ break;
+ default:
+ ret = def;
+ break;
+ }
+ }
+ return ret;
+ }
+
/*
* subject is expected to be in the format /type0=value0/type1=value1/type2=...
* where characters may be escaped by \
int rotate_index(char *dbfile, char *new_suffix, char *old_suffix);
void free_index(CA_DB *db);
int index_name_cmp(const char **a, const char **b);
+int parse_yesno(char *str, int def);
X509_NAME *parse_name(char *str, long chtype, int multirdn);
#define ENV_NAMEOPT "name_opt"
#define ENV_CERTOPT "cert_opt"
#define ENV_EXTCOPY "copy_extensions"
+#define ENV_UNIQUE_SUBJECT "unique_subject"
#define ENV_DATABASE "database"
app_RAND_load_file(randfile, bio_err, 0);
db_attr.unique_subject = 1;
- p = NCONF_get_string(conf, section, "unique_subject");
+ p = NCONF_get_string(conf, section, ENV_UNIQUE_SUBJECT);
if (p)
{
#ifdef RL_DEBUG
BIO_printf(bio_err, "DEBUG: unique_subject = \"%s\"\n", p);
#endif
- switch(*p)
- {
- case 'f': /* false */
- case 'F': /* FALSE */
- case 'n': /* no */
- case 'N': /* NO */
- db_attr.unique_subject = 0;
- break;
- case 't': /* true */
- case 'T': /* TRUE */
- case 'y': /* yes */
- case 'Y': /* YES */
- default:
- db_attr.unique_subject = 1;
- break;
- }
+ db_attr.unique_subject = parse_yesno(p,1);
}
#ifdef RL_DEBUG
else