ASN1_STRING *dest;
unsigned char *p;
int nchar;
- char strbuf[32];
int (*cpyfunc)(unsigned long, void *) = NULL;
if (len == -1)
if ((minsize > 0) && (nchar < minsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
- snprintf(strbuf, sizeof strbuf, "%ld", minsize);
- ERR_add_error_data(2, "minsize=", strbuf);
+ ERR_asprintf_error_data("minsize=%ld", minsize);
return -1;
}
if ((maxsize > 0) && (nchar > maxsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG);
- snprintf(strbuf, sizeof strbuf, "%ld", maxsize);
- ERR_add_error_data(2, "maxsize=", strbuf);
+ ERR_asprintf_error_data("maxsize=%ld", maxsize);
return -1;
}
if (utype == -1) {
ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKNOWN_TAG);
- ERR_add_error_data(2, "tag=", elem);
+ ERR_asprintf_error_data("tag=%s", elem);
return -1;
}
static int
parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
{
- char erch[2];
long tag_num;
char *eptr;
break;
default:
- erch[0] = *eptr;
- erch[1] = 0;
ASN1err(ASN1_F_PARSE_TAGGING, ASN1_R_INVALID_MODIFIER);
- ERR_add_error_data(2, "Char=", erch);
+ ERR_asprintf_error_data("Char=%c", *eptr);
return 0;
break;
return atmp;
bad_str:
- ERR_add_error_data(2, "string=", str);
+ ERR_asprintf_error_data("string=%s", str);
bad_form:
ASN1_TYPE_free(atmp);
return NULL;
void
asn1_add_error(const unsigned char *address, int offset)
{
- char tmp[128];
- (void) snprintf(tmp, sizeof(tmp), "address=%p offset=%d",
- address, offset);
- ERR_add_error_data(1, tmp);
+ ERR_asprintf_error_data("address=%p offset=%d", address, offset);
}
int
strcmp(hdr->value, "application/pkcs7-signature")) {
ASN1err(ASN1_F_SMIME_READ_ASN1,
ASN1_R_SIG_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_asprintf_error_data("type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
sk_BIO_pop_free(parts, BIO_vfree);
return NULL;
if (strcmp (hdr->value, "application/x-pkcs7-mime") &&
strcmp (hdr->value, "application/pkcs7-mime")) {
ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_asprintf_error_data("type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
return NULL;
}
}
if (strcmp (hdr->value, "text/plain")) {
ASN1err(ASN1_F_SMIME_TEXT, ASN1_R_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_asprintf_error_data("type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
return 0;
}
err:
ASN1_item_ex_free(pval, it);
if (errtt)
- ERR_add_error_data(4, "Field=", errtt->field_name,
- ", Type=", it->sname);
+ ERR_asprintf_error_data("Field=%s, Type=%s", errtt->field_name,
+ it->sname);
else
- ERR_add_error_data(2, "Type=", it->sname);
+ ERR_asprintf_error_data("Type=%s", it->sname);
return 0;
}
if (locked)
CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
if (err) {
- ERR_add_error_data(2, "host=", str);
+ ERR_asprintf_error_data("host=%s", str);
return 0;
} else
return 1;
*port_ptr = 70;
else {
SYSerr(SYS_F_GETSERVBYNAME, errno);
- ERR_add_error_data(3, "service='", str, "'");
+ ERR_asprintf_error_data("service='%s'", str);
return (0);
}
}
s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL);
if (s == -1) {
SYSerr(SYS_F_SOCKET, errno);
- ERR_add_error_data(3, "port='", host, "'");
+ ERR_asprintf_error_data("port='%s'", host);
BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET);
goto err;
}
}
#endif
SYSerr(SYS_F_BIND, err_num);
- ERR_add_error_data(3, "port='", host, "'");
+ ERR_asprintf_error_data("port='%s'", host);
BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET);
goto err;
}
if (listen(s, MAX_LISTEN) == -1) {
SYSerr(SYS_F_BIND, errno);
- ERR_add_error_data(3, "port='", host, "'");
+ ERR_asprintf_error_data("port='%s'", host);
BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET);
goto err;
}
if (c->param_port == NULL) {
BIOerr(BIO_F_CONN_STATE, BIO_R_NO_PORT_SPECIFIED);
- ERR_add_error_data(2, "host=", c->param_hostname);
+ ERR_asprintf_error_data("host=%s",
+ c->param_hostname);
goto exit_loop;
}
c->state = BIO_CONN_S_GET_IP;
ret = socket(AF_INET, SOCK_STREAM, SOCKET_PROTOCOL);
if (ret == -1) {
SYSerr(SYS_F_SOCKET, errno);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":", c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE,
BIO_R_UNABLE_TO_CREATE_SOCKET);
goto exit_loop;
if (!BIO_socket_nbio(b->num, 1)) {
BIOerr(BIO_F_CONN_STATE,
BIO_R_ERROR_SETTING_NBIO);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":",
- c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
goto exit_loop;
}
}
i = setsockopt(b->num, SOL_SOCKET, SO_KEEPALIVE,(char *)&i, sizeof(i));
if (i < 0) {
SYSerr(SYS_F_SOCKET, errno);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":", c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE, BIO_R_KEEPALIVE);
goto exit_loop;
}
b->retry_reason = BIO_RR_CONNECT;
} else {
SYSerr(SYS_F_CONNECT, errno);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":",
- c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE,
BIO_R_CONNECT_ERROR);
}
if (i) {
BIO_clear_retry_flags(b);
SYSerr(SYS_F_CONNECT, i);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":", c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE,
BIO_R_NBIO_CONNECT_ERROR);
ret = 0;
if (file == NULL) {
SYSerr(SYS_F_FOPEN, errno);
- ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')");
+ ERR_asprintf_error_data("fopen('%s', '%s')", filename, mode);
if (errno == ENOENT)
BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
else
fp = fopen(ptr, p);
if (fp == NULL) {
SYSerr(SYS_F_FOPEN, errno);
- ERR_add_error_data(5, "fopen('", ptr, "', '", p, "')");
+ ERR_asprintf_error_data("fopen('%s', '%s')", ptr, p);
BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB);
ret = 0;
break;
j = X509_STORE_CTX_get_error(&ctx);
CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CERT,
CMS_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(j));
goto err;
}
if ((ret != Z_OK) && (ret != Z_STREAM_END)) {
COMPerr(COMP_F_BIO_ZLIB_READ,
COMP_R_ZLIB_INFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:",
+ ERR_asprintf_error_data("zlib error:%s",
zError(ret));
return 0;
}
if (ret != Z_OK) {
COMPerr(COMP_F_BIO_ZLIB_WRITE,
COMP_R_ZLIB_DEFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_asprintf_error_data("zlib error:%s", zError(ret));
return 0;
}
ctx->ocount = ctx->obufsize - zout->avail_out;
else if (ret != Z_OK) {
COMPerr(COMP_F_BIO_ZLIB_FLUSH,
COMP_R_ZLIB_DEFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_asprintf_error_data("zlib error:%s", zError(ret));
return 0;
}
ctx->ocount = ctx->obufsize - zout->avail_out;
char *s, *p, *end;
int again;
long eline = 0;
- char btmp[DECIMAL_SIZE(eline) + 1];
CONF_VALUE *v = NULL, *tv;
CONF_VALUE *sv = NULL;
char *section = NULL, *buf;
free(section);
if (line != NULL)
*line = eline;
- snprintf(btmp, sizeof btmp, "%ld", eline);
- ERR_add_error_data(2, "line ", btmp);
+ ERR_asprintf_error_data("line %ld", eline);
if ((h != conf->data) && (conf->data != NULL)) {
CONF_free(conf->data);
conf->data = NULL;
return NULL;
}
CONFerr(CONF_F_NCONF_GET_STRING, CONF_R_NO_VALUE);
- ERR_add_error_data(4, "group=", group, " name=", name);
+ ERR_asprintf_error_data("group=%s name=%s", group, name);
return NULL;
}
if (!md) {
if (!(flags & CONF_MFLAGS_SILENT)) {
CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME);
- ERR_add_error_data(2, "module=", name);
+ ERR_asprintf_error_data("module=%s", name);
}
return -1;
}
if (ret <= 0) {
if (!(flags & CONF_MFLAGS_SILENT)) {
- char rcode[DECIMAL_SIZE(ret) + 1];
CONFerr(CONF_F_MODULE_RUN,
CONF_R_MODULE_INITIALIZATION_ERROR);
- snprintf(rcode, sizeof rcode, "%-8d", ret);
- ERR_add_error_data(6, "module=", name, ", value=",
- value, ", retcode=", rcode);
+ ERR_asprintf_error_data
+ ("module=%s, value=%s, retcode=%-8d",
+ name, value, ret);
}
}
if (dso)
DSO_free(dso);
CONFerr(CONF_F_MODULE_LOAD_DSO, errcode);
- ERR_add_error_data(4, "module=", name, ", path=", path);
+ ERR_asprintf_error_data("module=%s, path=%s", name, path);
return NULL;
}
ptr = dlopen(filename, flags);
if (ptr == NULL) {
DSOerr(DSO_F_DLFCN_LOAD, DSO_R_LOAD_FAILED);
- ERR_add_error_data(4, "filename(", filename, "): ", dlerror());
+ ERR_asprintf_error_data("filename(%s): %s", filename,
+ dlerror());
goto err;
}
if (!sk_void_push(dso->meth_data, (char *)ptr)) {
sym = dlsym(ptr, symname);
if (sym == NULL) {
DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_SYM_FAILURE);
- ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
+ ERR_asprintf_error_data("symname(%s): %s", symname, dlerror());
return (NULL);
}
return (sym);
u.dlret = dlsym(ptr, symname);
if (u.dlret == NULL) {
DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_SYM_FAILURE);
- ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
+ ERR_asprintf_error_data("symname(%s): %s", symname, dlerror());
return (NULL);
}
return u.sym;
return len;
}
- ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror());
+ ERR_asprintf_error_data("dlfcn_pathbyaddr(): %s", dlerror());
return -1;
}
{
ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, ENGINE_R_ENGINE_CONFIGURATION_ERROR);
if (ecmd)
- ERR_add_error_data(6, "section=", ecmd->section,
- ", name=", ecmd->name,
- ", value=", ecmd->value);
+ ERR_asprintf_error_data
+ ("section=%s, name=%s, value=%s",
+ ecmd->section, ecmd->name, ecmd->value);
}
if (e)
ENGINE_free(e);
{
ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING,
ENGINE_R_INVALID_STRING);
- ERR_add_error_data(2, "str=",def_list);
+ ERR_asprintf_error_data("str=%s",def_list);
return 0;
}
return ENGINE_set_default(e, flags);
{
ENGINEerr(ENGINE_F_ENGINE_BY_ID,
ENGINE_R_NO_SUCH_ENGINE);
- ERR_add_error_data(2, "id=", id);
+ ERR_asprintf_error_data("id=%s", id);
}
return iterator;
#else
notfound:
ENGINE_free(iterator);
ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE);
- ERR_add_error_data(2, "id=", id);
+ ERR_asprintf_error_data("id=%s", id);
return NULL;
/* EEK! Experimental code ends */
#endif
EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);
if (!pbe_obj) strlcpy (obj_tmp, "NULL", sizeof obj_tmp);
else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj);
- ERR_add_error_data(2, "TYPE=", obj_tmp);
+ ERR_asprintf_error_data("TYPE=%s", obj_tmp);
return 0;
}
{
EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
i2t_ASN1_OBJECT(obj_tmp, 80, algoid);
- ERR_add_error_data(2, "TYPE=", obj_tmp);
+ ERR_asprintf_error_data("TYPE=%s", obj_tmp);
goto error;
}
{
OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_ERROR);
if(!*q)
- ERR_add_error_data(2, "Code=", p);
+ ERR_asprintf_error_data("Code=%s", p);
else
- ERR_add_error_data(4, "Code=", p, ",Reason=", q);
+ ERR_asprintf_error_data("Code=%s,Reason=%s", p, q);
return 0;
}
X509_STORE_CTX_cleanup(&ctx);
if (ret <= 0)
{
- i = X509_STORE_CTX_get_error(&ctx);
+ i = X509_STORE_CTX_get_error(&ctx);
OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,OCSP_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(i));
goto end;
}
{
ret = X509_STORE_CTX_get_error(&ctx);
OCSPerr(OCSP_F_OCSP_REQUEST_VERIFY,OCSP_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(ret));
return 0;
}
if (!PEM_read_bio(bp, &nm, &header, &data, &len)) {
if (ERR_GET_REASON(ERR_peek_error()) ==
PEM_R_NO_START_LINE)
- ERR_add_error_data(2, "Expecting: ", name);
+ ERR_asprintf_error_data("Expecting: %s", name);
return 0;
}
if (check_pem(nm, name))
int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx)
{
- char buf[64];
int i,j,n;
int ret;
unsigned char *p;
if ((ctx->tag >= 0) && (ctx->tag != tag))
{
BIOerr(BIO_F_BIO_BER_GET_HEADER,BIO_R_TAG_MISMATCH);
- sprintf(buf,"tag=%d, got %d",ctx->tag,tag);
- ERR_add_error_data(1,buf);
+ ERR_asprintf_error_data("tag=%d, got %d", ctx->tag, tag);
return(-1);
}
if (ret & 0x01)
X509_STORE_CTX_cleanup(&cert_ctx);
if (i <= 0) {
PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(j));
sk_X509_free(signers);
return 0;
if (!ret) {
TSerr(TS_F_TS_CONF_SET_DEFAULT_ENGINE,
TS_R_COULD_NOT_SET_ENGINE);
- ERR_add_error_data(2, "engine:", name);
+ ERR_asprintf_error_data("engine:%s", name);
}
if (e)
ENGINE_free(e);
if (i <= 0) {
int j = X509_STORE_CTX_get_error(&cert_ctx);
TSerr(TS_F_TS_VERIFY_CERT, TS_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(j));
ret = 0;
} else {
/* Making up the error string. */
TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN);
- ERR_add_error_data(6,
- "status code: ", status_text,
- ", status text: ", embedded_status_text ?
- embedded_status_text : "unspecified",
- ", failure codes: ", failure_text);
+ ERR_asprintf_error_data
+ ("status code: %s, status text: %s, failure codes: %s",
+ status_text,
+ embedded_status_text ? embedded_status_text : "unspecified",
+ failure_text);
free(embedded_status_text);
return 0;
switch (uis->type) {
case UIT_PROMPT:
case UIT_VERIFY:
- {
- char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize) + 1];
- char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize) + 1];
-
- (void) snprintf(number1, sizeof(number1), "%d",
- uis->_.string_data.result_minsize);
- (void) snprintf(number2, sizeof(number2), "%d",
- uis->_.string_data.result_maxsize);
-
- if (l < uis->_.string_data.result_minsize) {
- ui->flags |= UI_FLAG_REDOABLE;
- UIerr(UI_F_UI_SET_RESULT, UI_R_RESULT_TOO_SMALL);
- ERR_add_error_data(5, "You must type in ",
- number1, " to ", number2, " characters");
- return -1;
- }
- if (l > uis->_.string_data.result_maxsize) {
- ui->flags |= UI_FLAG_REDOABLE;
- UIerr(UI_F_UI_SET_RESULT, UI_R_RESULT_TOO_LARGE);
- ERR_add_error_data(5, "You must type in ",
- number1, " to ", number2, " characters");
- return -1;
- }
+ if (l < uis->_.string_data.result_minsize) {
+ ui->flags |= UI_FLAG_REDOABLE;
+ UIerr(UI_F_UI_SET_RESULT,
+ UI_R_RESULT_TOO_SMALL);
+ ERR_asprintf_error_data
+ ("You must type in %d to %d characters",
+ uis->_.string_data.result_minsize,
+ uis->_.string_data.result_maxsize);
+ return -1;
+ }
+ if (l > uis->_.string_data.result_maxsize) {
+ ui->flags |= UI_FLAG_REDOABLE;
+ UIerr(UI_F_UI_SET_RESULT,
+ UI_R_RESULT_TOO_LARGE);
+ ERR_asprintf_error_data
+ ("You must type in %d to %d characters",
+ uis->_.string_data.result_minsize,
+ uis->_.string_data.result_maxsize);
+ return -1;
}
-
if (!uis->result_buf) {
UIerr(UI_F_UI_SET_RESULT, UI_R_NO_RESULT_BUFFER);
return -1;
if (obj == NULL) {
X509err(X509_F_X509_ATTRIBUTE_CREATE_BY_TXT,
X509_R_INVALID_FIELD_NAME);
- ERR_add_error_data(2, "name=", atrname);
+ ERR_asprintf_error_data("name=%s", atrname);
return (NULL);
}
nattr = X509_ATTRIBUTE_create_by_OBJ(attr, obj, type, bytes, len);
if (obj == NULL) {
X509err(X509_F_X509_NAME_ENTRY_CREATE_BY_TXT,
X509_R_INVALID_FIELD_NAME);
- ERR_add_error_data(2, "name=", field);
+ ERR_asprintf_error_data("name=%s", field);
return (NULL);
}
nentry = X509_NAME_ENTRY_create_by_OBJ(ne, obj, type, bytes, len);
} else {
X509V3err(X509V3_F_V2I_AUTHORITY_KEYID,
X509V3_R_UNKNOWN_OPTION);
- ERR_add_error_data(2, "name=", cnf->name);
+ ERR_asprintf_error_data("name=%s", cnf->name);
return NULL;
}
}
if (!(obj = OBJ_txt2obj(value, 0))) {
X509V3err(X509V3_F_A2I_GENERAL_NAME,
X509V3_R_BAD_OBJECT);
- ERR_add_error_data(2, "value=", value);
+ ERR_asprintf_error_data("value=%s", value);
goto err;
}
gen->d.rid = obj;
if (gen->d.ip == NULL) {
X509V3err(X509V3_F_A2I_GENERAL_NAME,
X509V3_R_BAD_IP_ADDRESS);
- ERR_add_error_data(2, "value=", value);
+ ERR_asprintf_error_data("value=%s", value);
goto err;
}
break;
else {
X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,
X509V3_R_UNSUPPORTED_OPTION);
- ERR_add_error_data(2, "name=", name);
+ ERR_asprintf_error_data("name=%s", name);
return NULL;
}
sk = X509V3_get_section(ctx, value);
if (!sk) {
X509V3err(X509V3_F_DO_DIRNAME, X509V3_R_SECTION_NOT_FOUND);
- ERR_add_error_data(2, "section=", value);
+ ERR_asprintf_error_data("section=%s", value);
X509_NAME_free(nm);
return 0;
}
if (!ret) {
X509V3err(X509V3_F_X509V3_EXT_NCONF,
X509V3_R_ERROR_IN_EXTENSION);
- ERR_add_error_data(4, "name=", name, ", value=", value);
+ ERR_asprintf_error_data("name=%s, value=%s", name, value);
}
return ret;
}
if (sk_CONF_VALUE_num(nval) <= 0) {
X509V3err(X509V3_F_DO_EXT_NCONF,
X509V3_R_INVALID_EXTENSION_STRING);
- ERR_add_error_data(4, "name=", OBJ_nid2sn(ext_nid),
- ",section=", value);
+ ERR_asprintf_error_data("name=%s,section=%s",
+ OBJ_nid2sn(ext_nid), value);
return NULL;
}
ext_struc = method->v2i(method, ctx, nval);
} else {
X509V3err(X509V3_F_DO_EXT_NCONF,
X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED);
- ERR_add_error_data(2, "name=", OBJ_nid2sn(ext_nid));
+ ERR_asprintf_error_data("name=%s", OBJ_nid2sn(ext_nid));
return NULL;
}
if (!(obj = OBJ_txt2obj(ext, 0))) {
X509V3err(X509V3_F_V3_GENERIC_EXTENSION,
X509V3_R_EXTENSION_NAME_ERROR);
- ERR_add_error_data(2, "name=", ext);
+ ERR_asprintf_error_data("name=%s", ext);
goto err;
}
if (ext_der == NULL) {
X509V3err(X509V3_F_V3_GENERIC_EXTENSION,
X509V3_R_EXTENSION_VALUE_ERROR);
- ERR_add_error_data(2, "value=", value);
+ ERR_asprintf_error_data("value=%s", value);
goto err;
}
if (!acc->method) {
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,
X509V3_R_BAD_OBJECT);
- ERR_add_error_data(2, "value=", objtmp);
- free(objtmp);
+ ERR_asprintf_error_data("value=%s", objtmp);
goto err;
}
free(objtmp);
-
}
return ainfo;
/* onlysomereasons present */
#define IDP_REASONS 0x40
-#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
-",name:", val->name, ",value:", val->value);
+#define X509V3_conf_err(val) ERR_asprintf_error_data( \
+ "section:%s,name:%s,value:%s", val->section, \
+ val->name, val->value);
#define X509V3_set_ctx_test(ctx) \
X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
#endif
} else if (alert_level == 2) /* fatal */
{
- char tmp[16];
-
s->rwstate = SSL_NOTHING;
s->s3->fatal_alert = alert_descr;
SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr);
- (void) snprintf(tmp,sizeof tmp,"%d",alert_descr);
- ERR_add_error_data(2, "SSL alert number ", tmp);
+ ERR_asprintf_error_data("SSL alert number %d",
+ alert_descr);
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
SSL_CTX_remove_session(s->ctx, s->session);
return (0);
#endif
} else if (alert_level == 2) {
/* fatal */
- char tmp[16];
-
s->rwstate = SSL_NOTHING;
s->s3->fatal_alert = alert_descr;
SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr);
- (void) snprintf(tmp, sizeof tmp, "%d", alert_descr);
- ERR_add_error_data(2, "SSL alert number ", tmp);
+ ERR_asprintf_error_data("SSL alert number %d",
+ alert_descr);
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
SSL_CTX_remove_session(s->ctx, s->session);
return (0);
ASN1_STRING *dest;
unsigned char *p;
int nchar;
- char strbuf[32];
int (*cpyfunc)(unsigned long, void *) = NULL;
if (len == -1)
if ((minsize > 0) && (nchar < minsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
- snprintf(strbuf, sizeof strbuf, "%ld", minsize);
- ERR_add_error_data(2, "minsize=", strbuf);
+ ERR_asprintf_error_data("minsize=%ld", minsize);
return -1;
}
if ((maxsize > 0) && (nchar > maxsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG);
- snprintf(strbuf, sizeof strbuf, "%ld", maxsize);
- ERR_add_error_data(2, "maxsize=", strbuf);
+ ERR_asprintf_error_data("maxsize=%ld", maxsize);
return -1;
}
if (utype == -1) {
ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKNOWN_TAG);
- ERR_add_error_data(2, "tag=", elem);
+ ERR_asprintf_error_data("tag=%s", elem);
return -1;
}
static int
parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
{
- char erch[2];
long tag_num;
char *eptr;
break;
default:
- erch[0] = *eptr;
- erch[1] = 0;
ASN1err(ASN1_F_PARSE_TAGGING, ASN1_R_INVALID_MODIFIER);
- ERR_add_error_data(2, "Char=", erch);
+ ERR_asprintf_error_data("Char=%c", *eptr);
return 0;
break;
return atmp;
bad_str:
- ERR_add_error_data(2, "string=", str);
+ ERR_asprintf_error_data("string=%s", str);
bad_form:
ASN1_TYPE_free(atmp);
return NULL;
void
asn1_add_error(const unsigned char *address, int offset)
{
- char tmp[128];
- (void) snprintf(tmp, sizeof(tmp), "address=%p offset=%d",
- address, offset);
- ERR_add_error_data(1, tmp);
+ ERR_asprintf_error_data("address=%p offset=%d", address, offset);
}
int
strcmp(hdr->value, "application/pkcs7-signature")) {
ASN1err(ASN1_F_SMIME_READ_ASN1,
ASN1_R_SIG_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_asprintf_error_data("type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
sk_BIO_pop_free(parts, BIO_vfree);
return NULL;
if (strcmp (hdr->value, "application/x-pkcs7-mime") &&
strcmp (hdr->value, "application/pkcs7-mime")) {
ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_asprintf_error_data("type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
return NULL;
}
}
if (strcmp (hdr->value, "text/plain")) {
ASN1err(ASN1_F_SMIME_TEXT, ASN1_R_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_asprintf_error_data("type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
return 0;
}
err:
ASN1_item_ex_free(pval, it);
if (errtt)
- ERR_add_error_data(4, "Field=", errtt->field_name,
- ", Type=", it->sname);
+ ERR_asprintf_error_data("Field=%s, Type=%s", errtt->field_name,
+ it->sname);
else
- ERR_add_error_data(2, "Type=", it->sname);
+ ERR_asprintf_error_data("Type=%s", it->sname);
return 0;
}
if (locked)
CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
if (err) {
- ERR_add_error_data(2, "host=", str);
+ ERR_asprintf_error_data("host=%s", str);
return 0;
} else
return 1;
*port_ptr = 70;
else {
SYSerr(SYS_F_GETSERVBYNAME, errno);
- ERR_add_error_data(3, "service='", str, "'");
+ ERR_asprintf_error_data("service='%s'", str);
return (0);
}
}
s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL);
if (s == -1) {
SYSerr(SYS_F_SOCKET, errno);
- ERR_add_error_data(3, "port='", host, "'");
+ ERR_asprintf_error_data("port='%s'", host);
BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET);
goto err;
}
}
#endif
SYSerr(SYS_F_BIND, err_num);
- ERR_add_error_data(3, "port='", host, "'");
+ ERR_asprintf_error_data("port='%s'", host);
BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET);
goto err;
}
if (listen(s, MAX_LISTEN) == -1) {
SYSerr(SYS_F_BIND, errno);
- ERR_add_error_data(3, "port='", host, "'");
+ ERR_asprintf_error_data("port='%s'", host);
BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET);
goto err;
}
if (c->param_port == NULL) {
BIOerr(BIO_F_CONN_STATE, BIO_R_NO_PORT_SPECIFIED);
- ERR_add_error_data(2, "host=", c->param_hostname);
+ ERR_asprintf_error_data("host=%s",
+ c->param_hostname);
goto exit_loop;
}
c->state = BIO_CONN_S_GET_IP;
ret = socket(AF_INET, SOCK_STREAM, SOCKET_PROTOCOL);
if (ret == -1) {
SYSerr(SYS_F_SOCKET, errno);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":", c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE,
BIO_R_UNABLE_TO_CREATE_SOCKET);
goto exit_loop;
if (!BIO_socket_nbio(b->num, 1)) {
BIOerr(BIO_F_CONN_STATE,
BIO_R_ERROR_SETTING_NBIO);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":",
- c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
goto exit_loop;
}
}
i = setsockopt(b->num, SOL_SOCKET, SO_KEEPALIVE,(char *)&i, sizeof(i));
if (i < 0) {
SYSerr(SYS_F_SOCKET, errno);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":", c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE, BIO_R_KEEPALIVE);
goto exit_loop;
}
b->retry_reason = BIO_RR_CONNECT;
} else {
SYSerr(SYS_F_CONNECT, errno);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":",
- c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE,
BIO_R_CONNECT_ERROR);
}
if (i) {
BIO_clear_retry_flags(b);
SYSerr(SYS_F_CONNECT, i);
- ERR_add_error_data(4, "host=",
- c->param_hostname, ":", c->param_port);
+ ERR_asprintf_error_data("host=%s:%s",
+ c->param_hostname, c->param_port);
BIOerr(BIO_F_CONN_STATE,
BIO_R_NBIO_CONNECT_ERROR);
ret = 0;
if (file == NULL) {
SYSerr(SYS_F_FOPEN, errno);
- ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')");
+ ERR_asprintf_error_data("fopen('%s', '%s')", filename, mode);
if (errno == ENOENT)
BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
else
fp = fopen(ptr, p);
if (fp == NULL) {
SYSerr(SYS_F_FOPEN, errno);
- ERR_add_error_data(5, "fopen('", ptr, "', '", p, "')");
+ ERR_asprintf_error_data("fopen('%s', '%s')", ptr, p);
BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB);
ret = 0;
break;
j = X509_STORE_CTX_get_error(&ctx);
CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CERT,
CMS_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(j));
goto err;
}
if ((ret != Z_OK) && (ret != Z_STREAM_END)) {
COMPerr(COMP_F_BIO_ZLIB_READ,
COMP_R_ZLIB_INFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:",
+ ERR_asprintf_error_data("zlib error:%s",
zError(ret));
return 0;
}
if (ret != Z_OK) {
COMPerr(COMP_F_BIO_ZLIB_WRITE,
COMP_R_ZLIB_DEFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_asprintf_error_data("zlib error:%s", zError(ret));
return 0;
}
ctx->ocount = ctx->obufsize - zout->avail_out;
else if (ret != Z_OK) {
COMPerr(COMP_F_BIO_ZLIB_FLUSH,
COMP_R_ZLIB_DEFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_asprintf_error_data("zlib error:%s", zError(ret));
return 0;
}
ctx->ocount = ctx->obufsize - zout->avail_out;
char *s, *p, *end;
int again;
long eline = 0;
- char btmp[DECIMAL_SIZE(eline) + 1];
CONF_VALUE *v = NULL, *tv;
CONF_VALUE *sv = NULL;
char *section = NULL, *buf;
free(section);
if (line != NULL)
*line = eline;
- snprintf(btmp, sizeof btmp, "%ld", eline);
- ERR_add_error_data(2, "line ", btmp);
+ ERR_asprintf_error_data("line %ld", eline);
if ((h != conf->data) && (conf->data != NULL)) {
CONF_free(conf->data);
conf->data = NULL;
return NULL;
}
CONFerr(CONF_F_NCONF_GET_STRING, CONF_R_NO_VALUE);
- ERR_add_error_data(4, "group=", group, " name=", name);
+ ERR_asprintf_error_data("group=%s name=%s", group, name);
return NULL;
}
if (!md) {
if (!(flags & CONF_MFLAGS_SILENT)) {
CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME);
- ERR_add_error_data(2, "module=", name);
+ ERR_asprintf_error_data("module=%s", name);
}
return -1;
}
if (ret <= 0) {
if (!(flags & CONF_MFLAGS_SILENT)) {
- char rcode[DECIMAL_SIZE(ret) + 1];
CONFerr(CONF_F_MODULE_RUN,
CONF_R_MODULE_INITIALIZATION_ERROR);
- snprintf(rcode, sizeof rcode, "%-8d", ret);
- ERR_add_error_data(6, "module=", name, ", value=",
- value, ", retcode=", rcode);
+ ERR_asprintf_error_data
+ ("module=%s, value=%s, retcode=%-8d",
+ name, value, ret);
}
}
if (dso)
DSO_free(dso);
CONFerr(CONF_F_MODULE_LOAD_DSO, errcode);
- ERR_add_error_data(4, "module=", name, ", path=", path);
+ ERR_asprintf_error_data("module=%s, path=%s", name, path);
return NULL;
}
ptr = dlopen(filename, flags);
if (ptr == NULL) {
DSOerr(DSO_F_DLFCN_LOAD, DSO_R_LOAD_FAILED);
- ERR_add_error_data(4, "filename(", filename, "): ", dlerror());
+ ERR_asprintf_error_data("filename(%s): %s", filename,
+ dlerror());
goto err;
}
if (!sk_void_push(dso->meth_data, (char *)ptr)) {
sym = dlsym(ptr, symname);
if (sym == NULL) {
DSOerr(DSO_F_DLFCN_BIND_VAR, DSO_R_SYM_FAILURE);
- ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
+ ERR_asprintf_error_data("symname(%s): %s", symname, dlerror());
return (NULL);
}
return (sym);
u.dlret = dlsym(ptr, symname);
if (u.dlret == NULL) {
DSOerr(DSO_F_DLFCN_BIND_FUNC, DSO_R_SYM_FAILURE);
- ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
+ ERR_asprintf_error_data("symname(%s): %s", symname, dlerror());
return (NULL);
}
return u.sym;
return len;
}
- ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror());
+ ERR_asprintf_error_data("dlfcn_pathbyaddr(): %s", dlerror());
return -1;
}
{
ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, ENGINE_R_ENGINE_CONFIGURATION_ERROR);
if (ecmd)
- ERR_add_error_data(6, "section=", ecmd->section,
- ", name=", ecmd->name,
- ", value=", ecmd->value);
+ ERR_asprintf_error_data
+ ("section=%s, name=%s, value=%s",
+ ecmd->section, ecmd->name, ecmd->value);
}
if (e)
ENGINE_free(e);
{
ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING,
ENGINE_R_INVALID_STRING);
- ERR_add_error_data(2, "str=",def_list);
+ ERR_asprintf_error_data("str=%s",def_list);
return 0;
}
return ENGINE_set_default(e, flags);
{
ENGINEerr(ENGINE_F_ENGINE_BY_ID,
ENGINE_R_NO_SUCH_ENGINE);
- ERR_add_error_data(2, "id=", id);
+ ERR_asprintf_error_data("id=%s", id);
}
return iterator;
#else
notfound:
ENGINE_free(iterator);
ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE);
- ERR_add_error_data(2, "id=", id);
+ ERR_asprintf_error_data("id=%s", id);
return NULL;
/* EEK! Experimental code ends */
#endif
EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);
if (!pbe_obj) strlcpy (obj_tmp, "NULL", sizeof obj_tmp);
else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj);
- ERR_add_error_data(2, "TYPE=", obj_tmp);
+ ERR_asprintf_error_data("TYPE=%s", obj_tmp);
return 0;
}
{
EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
i2t_ASN1_OBJECT(obj_tmp, 80, algoid);
- ERR_add_error_data(2, "TYPE=", obj_tmp);
+ ERR_asprintf_error_data("TYPE=%s", obj_tmp);
goto error;
}
{
OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_ERROR);
if(!*q)
- ERR_add_error_data(2, "Code=", p);
+ ERR_asprintf_error_data("Code=%s", p);
else
- ERR_add_error_data(4, "Code=", p, ",Reason=", q);
+ ERR_asprintf_error_data("Code=%s,Reason=%s", p, q);
return 0;
}
X509_STORE_CTX_cleanup(&ctx);
if (ret <= 0)
{
- i = X509_STORE_CTX_get_error(&ctx);
+ i = X509_STORE_CTX_get_error(&ctx);
OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,OCSP_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(i));
goto end;
}
{
ret = X509_STORE_CTX_get_error(&ctx);
OCSPerr(OCSP_F_OCSP_REQUEST_VERIFY,OCSP_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(ret));
return 0;
}
if (!PEM_read_bio(bp, &nm, &header, &data, &len)) {
if (ERR_GET_REASON(ERR_peek_error()) ==
PEM_R_NO_START_LINE)
- ERR_add_error_data(2, "Expecting: ", name);
+ ERR_asprintf_error_data("Expecting: %s", name);
return 0;
}
if (check_pem(nm, name))
int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx)
{
- char buf[64];
int i,j,n;
int ret;
unsigned char *p;
if ((ctx->tag >= 0) && (ctx->tag != tag))
{
BIOerr(BIO_F_BIO_BER_GET_HEADER,BIO_R_TAG_MISMATCH);
- sprintf(buf,"tag=%d, got %d",ctx->tag,tag);
- ERR_add_error_data(1,buf);
+ ERR_asprintf_error_data("tag=%d, got %d", ctx->tag, tag);
return(-1);
}
if (ret & 0x01)
X509_STORE_CTX_cleanup(&cert_ctx);
if (i <= 0) {
PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(j));
sk_X509_free(signers);
return 0;
if (!ret) {
TSerr(TS_F_TS_CONF_SET_DEFAULT_ENGINE,
TS_R_COULD_NOT_SET_ENGINE);
- ERR_add_error_data(2, "engine:", name);
+ ERR_asprintf_error_data("engine:%s", name);
}
if (e)
ENGINE_free(e);
if (i <= 0) {
int j = X509_STORE_CTX_get_error(&cert_ctx);
TSerr(TS_F_TS_VERIFY_CERT, TS_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
+ ERR_asprintf_error_data("Verify error:%s",
X509_verify_cert_error_string(j));
ret = 0;
} else {
/* Making up the error string. */
TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN);
- ERR_add_error_data(6,
- "status code: ", status_text,
- ", status text: ", embedded_status_text ?
- embedded_status_text : "unspecified",
- ", failure codes: ", failure_text);
+ ERR_asprintf_error_data
+ ("status code: %s, status text: %s, failure codes: %s",
+ status_text,
+ embedded_status_text ? embedded_status_text : "unspecified",
+ failure_text);
free(embedded_status_text);
return 0;
switch (uis->type) {
case UIT_PROMPT:
case UIT_VERIFY:
- {
- char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize) + 1];
- char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize) + 1];
-
- (void) snprintf(number1, sizeof(number1), "%d",
- uis->_.string_data.result_minsize);
- (void) snprintf(number2, sizeof(number2), "%d",
- uis->_.string_data.result_maxsize);
-
- if (l < uis->_.string_data.result_minsize) {
- ui->flags |= UI_FLAG_REDOABLE;
- UIerr(UI_F_UI_SET_RESULT, UI_R_RESULT_TOO_SMALL);
- ERR_add_error_data(5, "You must type in ",
- number1, " to ", number2, " characters");
- return -1;
- }
- if (l > uis->_.string_data.result_maxsize) {
- ui->flags |= UI_FLAG_REDOABLE;
- UIerr(UI_F_UI_SET_RESULT, UI_R_RESULT_TOO_LARGE);
- ERR_add_error_data(5, "You must type in ",
- number1, " to ", number2, " characters");
- return -1;
- }
+ if (l < uis->_.string_data.result_minsize) {
+ ui->flags |= UI_FLAG_REDOABLE;
+ UIerr(UI_F_UI_SET_RESULT,
+ UI_R_RESULT_TOO_SMALL);
+ ERR_asprintf_error_data
+ ("You must type in %d to %d characters",
+ uis->_.string_data.result_minsize,
+ uis->_.string_data.result_maxsize);
+ return -1;
+ }
+ if (l > uis->_.string_data.result_maxsize) {
+ ui->flags |= UI_FLAG_REDOABLE;
+ UIerr(UI_F_UI_SET_RESULT,
+ UI_R_RESULT_TOO_LARGE);
+ ERR_asprintf_error_data
+ ("You must type in %d to %d characters",
+ uis->_.string_data.result_minsize,
+ uis->_.string_data.result_maxsize);
+ return -1;
}
-
if (!uis->result_buf) {
UIerr(UI_F_UI_SET_RESULT, UI_R_NO_RESULT_BUFFER);
return -1;
if (obj == NULL) {
X509err(X509_F_X509_ATTRIBUTE_CREATE_BY_TXT,
X509_R_INVALID_FIELD_NAME);
- ERR_add_error_data(2, "name=", atrname);
+ ERR_asprintf_error_data("name=%s", atrname);
return (NULL);
}
nattr = X509_ATTRIBUTE_create_by_OBJ(attr, obj, type, bytes, len);
if (obj == NULL) {
X509err(X509_F_X509_NAME_ENTRY_CREATE_BY_TXT,
X509_R_INVALID_FIELD_NAME);
- ERR_add_error_data(2, "name=", field);
+ ERR_asprintf_error_data("name=%s", field);
return (NULL);
}
nentry = X509_NAME_ENTRY_create_by_OBJ(ne, obj, type, bytes, len);
} else {
X509V3err(X509V3_F_V2I_AUTHORITY_KEYID,
X509V3_R_UNKNOWN_OPTION);
- ERR_add_error_data(2, "name=", cnf->name);
+ ERR_asprintf_error_data("name=%s", cnf->name);
return NULL;
}
}
if (!(obj = OBJ_txt2obj(value, 0))) {
X509V3err(X509V3_F_A2I_GENERAL_NAME,
X509V3_R_BAD_OBJECT);
- ERR_add_error_data(2, "value=", value);
+ ERR_asprintf_error_data("value=%s", value);
goto err;
}
gen->d.rid = obj;
if (gen->d.ip == NULL) {
X509V3err(X509V3_F_A2I_GENERAL_NAME,
X509V3_R_BAD_IP_ADDRESS);
- ERR_add_error_data(2, "value=", value);
+ ERR_asprintf_error_data("value=%s", value);
goto err;
}
break;
else {
X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,
X509V3_R_UNSUPPORTED_OPTION);
- ERR_add_error_data(2, "name=", name);
+ ERR_asprintf_error_data("name=%s", name);
return NULL;
}
sk = X509V3_get_section(ctx, value);
if (!sk) {
X509V3err(X509V3_F_DO_DIRNAME, X509V3_R_SECTION_NOT_FOUND);
- ERR_add_error_data(2, "section=", value);
+ ERR_asprintf_error_data("section=%s", value);
X509_NAME_free(nm);
return 0;
}
if (!ret) {
X509V3err(X509V3_F_X509V3_EXT_NCONF,
X509V3_R_ERROR_IN_EXTENSION);
- ERR_add_error_data(4, "name=", name, ", value=", value);
+ ERR_asprintf_error_data("name=%s, value=%s", name, value);
}
return ret;
}
if (sk_CONF_VALUE_num(nval) <= 0) {
X509V3err(X509V3_F_DO_EXT_NCONF,
X509V3_R_INVALID_EXTENSION_STRING);
- ERR_add_error_data(4, "name=", OBJ_nid2sn(ext_nid),
- ",section=", value);
+ ERR_asprintf_error_data("name=%s,section=%s",
+ OBJ_nid2sn(ext_nid), value);
return NULL;
}
ext_struc = method->v2i(method, ctx, nval);
} else {
X509V3err(X509V3_F_DO_EXT_NCONF,
X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED);
- ERR_add_error_data(2, "name=", OBJ_nid2sn(ext_nid));
+ ERR_asprintf_error_data("name=%s", OBJ_nid2sn(ext_nid));
return NULL;
}
if (!(obj = OBJ_txt2obj(ext, 0))) {
X509V3err(X509V3_F_V3_GENERIC_EXTENSION,
X509V3_R_EXTENSION_NAME_ERROR);
- ERR_add_error_data(2, "name=", ext);
+ ERR_asprintf_error_data("name=%s", ext);
goto err;
}
if (ext_der == NULL) {
X509V3err(X509V3_F_V3_GENERIC_EXTENSION,
X509V3_R_EXTENSION_VALUE_ERROR);
- ERR_add_error_data(2, "value=", value);
+ ERR_asprintf_error_data("value=%s", value);
goto err;
}
if (!acc->method) {
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,
X509V3_R_BAD_OBJECT);
- ERR_add_error_data(2, "value=", objtmp);
- free(objtmp);
+ ERR_asprintf_error_data("value=%s", objtmp);
goto err;
}
free(objtmp);
-
}
return ainfo;
/* onlysomereasons present */
#define IDP_REASONS 0x40
-#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
-",name:", val->name, ",value:", val->value);
+#define X509V3_conf_err(val) ERR_asprintf_error_data( \
+ "section:%s,name:%s,value:%s", val->section, \
+ val->name, val->value);
#define X509V3_set_ctx_test(ctx) \
X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
#endif
} else if (alert_level == 2) /* fatal */
{
- char tmp[16];
-
s->rwstate = SSL_NOTHING;
s->s3->fatal_alert = alert_descr;
SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr);
- (void) snprintf(tmp,sizeof tmp,"%d",alert_descr);
- ERR_add_error_data(2, "SSL alert number ", tmp);
+ ERR_asprintf_error_data("SSL alert number %d",
+ alert_descr);
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
SSL_CTX_remove_session(s->ctx, s->session);
return (0);
#endif
} else if (alert_level == 2) {
/* fatal */
- char tmp[16];
-
s->rwstate = SSL_NOTHING;
s->s3->fatal_alert = alert_descr;
SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr);
- (void) snprintf(tmp, sizeof tmp, "%d", alert_descr);
- ERR_add_error_data(2, "SSL alert number ", tmp);
+ ERR_asprintf_error_data("SSL alert number %d",
+ alert_descr);
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
SSL_CTX_remove_session(s->ctx, s->session);
return (0);
}
if (!ret) {
SYSerr(SYS_F_OPENDIR, errno);
- ERR_add_error_data(3, "opendir ('", dir, "')");
+ ERR_asprintf_error_data("opendir ('%s')", dir);
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,
ERR_R_SYS_LIB);
}
}
if (!ret) {
SYSerr(SYS_F_OPENDIR, errno);
- ERR_add_error_data(3, "opendir ('", dir, "')");
+ ERR_asprintf_error_data("opendir ('%s')", dir);
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,
ERR_R_SYS_LIB);
}