Exemplo n.º 1
0
int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd)
{
    if (ssl_conf_cmd_skip_prefix(cctx, &cmd)) {
        const ssl_conf_cmd_tbl *runcmd;
        runcmd = ssl_conf_cmd_lookup(cctx, cmd);
        if (runcmd)
            return runcmd->value_type;
    }
    return SSL_CONF_TYPE_UNKNOWN;
}
Exemplo n.º 2
0
int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value)
	{
	const ssl_conf_cmd_tbl *runcmd;
	if (cmd == NULL)
		{
		SSLerr(SSL_F_SSL_CONF_CMD, SSL_R_INVALID_NULL_CMD_NAME);
		return 0;
		}

	if (!ssl_conf_cmd_skip_prefix(cctx, &cmd))
		return -2;

	runcmd = ssl_conf_cmd_lookup(cctx, cmd);

	if (runcmd)
		{
		int rv;
		if (value == NULL)
			return -3;
		rv = runcmd->cmd(cctx, value);
		if (rv > 0)
			return 2;
		if (rv == -2)
			return -2;
		if (cctx->flags & SSL_CONF_FLAG_SHOW_ERRORS)
			{
			SSLerr(SSL_F_SSL_CONF_CMD, SSL_R_BAD_VALUE);
			ERR_add_error_data(4, "cmd=", cmd, ", value=", value);
			}
		return 0;
		}

	if (cctx->flags & SSL_CONF_FLAG_CMDLINE)
		{
		if (ctrl_str_option(cctx, cmd))
			return 1;
		}

	if (cctx->flags & SSL_CONF_FLAG_SHOW_ERRORS)
		{
		SSLerr(SSL_F_SSL_CONF_CMD, SSL_R_UNKNOWN_CMD_NAME);
		ERR_add_error_data(2, "cmd=", cmd);
		}

	return -2;
	}