* 0 - Processed an SSL set * >0 - Failed to process an SSL set * <0 - Not an SSL set */
| 4121 | * <0 - Not an SSL set |
| 4122 | */ |
| 4123 | static int process_ssl_set_command(cdb2_hndl_tp *hndl, const char *cmd) |
| 4124 | { |
| 4125 | int rc = 0; |
| 4126 | const char *p = &cmd[sizeof("SET") - 1]; |
| 4127 | p = cdb2_skipws(p); |
| 4128 | |
| 4129 | if (strncasecmp(p, "SSL_MODE", sizeof("SSL_MODE") - 1) == 0) { |
| 4130 | p += sizeof("SSL_MODE"); |
| 4131 | p = cdb2_skipws(p); |
| 4132 | hndl->c_sslmode = ssl_string_to_mode(p, &hndl->nid_dbname); |
| 4133 | } else if (strncasecmp(p, SSL_CERT_PATH_OPT, |
| 4134 | sizeof(SSL_CERT_PATH_OPT) - 1) == 0) { |
| 4135 | p += sizeof(SSL_CERT_PATH_OPT); |
| 4136 | p = cdb2_skipws(p); |
| 4137 | free(hndl->sslpath); |
| 4138 | hndl->sslpath = strdup(p); |
| 4139 | if (hndl->sslpath == NULL) |
| 4140 | rc = ENOMEM; |
| 4141 | } else if (strncasecmp(p, SSL_CERT_OPT, sizeof(SSL_CERT_OPT) - 1) == 0) { |
| 4142 | p += sizeof(SSL_CERT_OPT); |
| 4143 | p = cdb2_skipws(p); |
| 4144 | free(hndl->cert); |
| 4145 | hndl->cert = strdup(p); |
| 4146 | if (hndl->cert == NULL) |
| 4147 | rc = ENOMEM; |
| 4148 | } else if (strncasecmp(p, SSL_KEY_OPT, sizeof(SSL_KEY_OPT) - 1) == 0) { |
| 4149 | p += sizeof(SSL_KEY_OPT); |
| 4150 | p = cdb2_skipws(p); |
| 4151 | free(hndl->key); |
| 4152 | hndl->key = strdup(p); |
| 4153 | if (hndl->key == NULL) |
| 4154 | rc = ENOMEM; |
| 4155 | } else if (strncasecmp(p, SSL_CA_OPT, sizeof(SSL_CA_OPT) - 1) == 0) { |
| 4156 | p += sizeof(SSL_CA_OPT); |
| 4157 | p = cdb2_skipws(p); |
| 4158 | free(hndl->ca); |
| 4159 | hndl->ca = strdup(p); |
| 4160 | if (hndl->ca == NULL) |
| 4161 | rc = ENOMEM; |
| 4162 | #if HAVE_CRL |
| 4163 | } else if (strncasecmp(p, SSL_CRL_OPT, sizeof(SSL_CRL_OPT) - 1) == 0) { |
| 4164 | p += sizeof(SSL_CRL_OPT); |
| 4165 | p = cdb2_skipws(p); |
| 4166 | free(hndl->crl); |
| 4167 | hndl->crl = strdup(p); |
| 4168 | if (hndl->crl == NULL) |
| 4169 | rc = ENOMEM; |
| 4170 | #endif /* HAVE_CRL */ |
| 4171 | } else if (strncasecmp(p, "SSL_SESSION_CACHE", |
| 4172 | sizeof("SSL_SESSION_CACHE") - 1) == 0) { |
| 4173 | p += sizeof("SSL_SESSION_CACHE"); |
| 4174 | p = cdb2_skipws(p); |
| 4175 | hndl->cache_ssl_sess = (strncasecmp(p, "ON", 2) == 0); |
| 4176 | if (hndl->cache_ssl_sess) |
| 4177 | cdb2_set_ssl_sessions(hndl, cdb2_get_ssl_sessions(hndl)); |
| 4178 | } else if (strncasecmp(p, SSL_MIN_TLS_VER_OPT, |
| 4179 | sizeof(SSL_MIN_TLS_VER_OPT) - 1) == 0) { |
| 4180 | p += sizeof(SSL_MIN_TLS_VER_OPT); |
no test coverage detected