MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cups_set_ssl_options

Function cups_set_ssl_options

cups/usersys.c:1547–1620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1545
1546#ifdef HAVE_TLS
1547static void
1548cups_set_ssl_options(
1549 _cups_client_conf_t *cc, /* I - client.conf values */
1550 const char *value) /* I - Value */
1551{
1552 /*
1553 * SSLOptions [AllowRC4] [AllowSSL3] [AllowDH] [DenyTLS1.0] [None]
1554 */
1555
1556 int options = _HTTP_TLS_NONE, /* SSL/TLS options */
1557 min_version = _HTTP_TLS_1_0, /* Minimum SSL/TLS version */
1558 max_version = _HTTP_TLS_MAX; /* Maximum SSL/TLS version */
1559 char temp[256], /* Copy of value */
1560 *start, /* Start of option */
1561 *end; /* End of option */
1562
1563
1564 strlcpy(temp, value, sizeof(temp));
1565
1566 for (start = temp; *start; start = end)
1567 {
1568 /*
1569 * Find end of keyword...
1570 */
1571
1572 end = start;
1573 while (*end && !_cups_isspace(*end))
1574 end ++;
1575
1576 if (*end)
1577 *end++ = '\0';
1578
1579 /*
1580 * Compare...
1581 */
1582
1583 if (!_cups_strcasecmp(start, "AllowRC4"))
1584 options |= _HTTP_TLS_ALLOW_RC4;
1585 else if (!_cups_strcasecmp(start, "AllowSSL3"))
1586 min_version = _HTTP_TLS_SSL3;
1587 else if (!_cups_strcasecmp(start, "AllowDH"))
1588 options |= _HTTP_TLS_ALLOW_DH;
1589 else if (!_cups_strcasecmp(start, "DenyCBC"))
1590 options |= _HTTP_TLS_DENY_CBC;
1591 else if (!_cups_strcasecmp(start, "DenyTLS1.0"))
1592 min_version = _HTTP_TLS_1_1;
1593 else if (!_cups_strcasecmp(start, "MaxTLS1.0"))
1594 max_version = _HTTP_TLS_1_0;
1595 else if (!_cups_strcasecmp(start, "MaxTLS1.1"))
1596 max_version = _HTTP_TLS_1_1;
1597 else if (!_cups_strcasecmp(start, "MaxTLS1.2"))
1598 max_version = _HTTP_TLS_1_2;
1599 else if (!_cups_strcasecmp(start, "MaxTLS1.3"))
1600 max_version = _HTTP_TLS_1_3;
1601 else if (!_cups_strcasecmp(start, "MinTLS1.0"))
1602 min_version = _HTTP_TLS_1_0;
1603 else if (!_cups_strcasecmp(start, "MinTLS1.1"))
1604 min_version = _HTTP_TLS_1_1;

Callers 2

cups_init_client_confFunction · 0.85
cups_read_client_confFunction · 0.85

Calls 2

_cups_isspaceFunction · 0.85
_cups_strcasecmpFunction · 0.85

Tested by

no test coverage detected