| 1702 | */ |
| 1703 | |
| 1704 | int /* O - 1 if value OK, 0 otherwise */ |
| 1705 | cupsdSetAuthInfoRequired( |
| 1706 | cupsd_printer_t *p, /* I - Printer */ |
| 1707 | const char *values, /* I - Plain text value (or NULL) */ |
| 1708 | ipp_attribute_t *attr) /* I - IPP attribute value (or NULL) */ |
| 1709 | { |
| 1710 | int i; /* Looping var */ |
| 1711 | |
| 1712 | |
| 1713 | p->num_auth_info_required = 0; |
| 1714 | |
| 1715 | /* |
| 1716 | * Do we have a plain text value? |
| 1717 | */ |
| 1718 | |
| 1719 | if (values) |
| 1720 | { |
| 1721 | /* |
| 1722 | * Yes, grab the keywords... |
| 1723 | */ |
| 1724 | |
| 1725 | const char *end; /* End of current value */ |
| 1726 | |
| 1727 | |
| 1728 | while (*values && p->num_auth_info_required < 4) |
| 1729 | { |
| 1730 | if ((end = strchr(values, ',')) == NULL) |
| 1731 | end = values + strlen(values); |
| 1732 | |
| 1733 | if ((end - values) == 4 && !strncmp(values, "none", 4)) |
| 1734 | { |
| 1735 | if (p->num_auth_info_required != 0 || *end) |
| 1736 | return (0); |
| 1737 | |
| 1738 | p->auth_info_required[p->num_auth_info_required] = "none"; |
| 1739 | p->num_auth_info_required ++; |
| 1740 | |
| 1741 | return (1); |
| 1742 | } |
| 1743 | else if ((end - values) == 9 && !strncmp(values, "negotiate", 9)) |
| 1744 | { |
| 1745 | if (p->num_auth_info_required != 0 || *end) |
| 1746 | return (0); |
| 1747 | |
| 1748 | p->auth_info_required[p->num_auth_info_required] = "negotiate"; |
| 1749 | p->num_auth_info_required ++; |
| 1750 | |
| 1751 | /* |
| 1752 | * Don't allow sharing of queues that require Kerberos authentication. |
| 1753 | */ |
| 1754 | |
| 1755 | if (p->shared) |
| 1756 | { |
| 1757 | cupsdDeregisterPrinter(p, 1); |
| 1758 | p->shared = 0; |
| 1759 | } |
| 1760 | } |
| 1761 | else if ((end - values) == 6 && !strncmp(values, "domain", 6)) |
no test coverage detected