diff options
-rw-r--r-- | CHANGES.md | 5 | ||||
-rw-r--r-- | backend/snmp-supplies.c | 15 | ||||
-rw-r--r-- | cups/snmp.c | 8 | ||||
-rw-r--r-- | man/cups-snmp.conf.man | 3 |
4 files changed, 22 insertions, 9 deletions
diff --git a/CHANGES.md b/CHANGES.md index 8d9a55612..e4689c8a1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.3b6 - 2018-11-07 +CHANGES - 2.3b6 - 2018-11-08 ============================ Changes in CUPS v2.3b6 @@ -21,6 +21,9 @@ Changes in CUPS v2.3b6 - The IPP Everywhere "driver" now properly supports face-up printers (Issue #5345) - Fixed some typos in the label printer drivers (Issue #5350) +- Setting the `Community` name to the empty string in `snmp.conf` now disables + SNMP supply level monitoring by all the standard network backends + (Issue #5354) - Multi-file jobs could get stuck if the backend failed (Issue #5359, Issue #5413) - The IPP Everywhere "driver" no longer does local filtering when printing to diff --git a/backend/snmp-supplies.c b/backend/snmp-supplies.c index 40fefcc9f..687e7ae35 100644 --- a/backend/snmp-supplies.c +++ b/backend/snmp-supplies.c @@ -440,6 +440,7 @@ backend_init_supplies( { int i, /* Looping var */ type; /* Current marker type */ + const char *community; /* SNMP community name */ cups_file_t *cachefile; /* Cache file */ const char *cachedir; /* CUPS_CACHEDIR value */ char addrstr[1024], /* Address string */ @@ -507,6 +508,10 @@ backend_init_supplies( * See if we should be getting supply levels via SNMP... */ + community = _cupsSNMPDefaultCommunity(); + if (!*community) + return; + if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL || ((ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL && ppdattr->value && _cups_strcasecmp(ppdattr->value, "true"))) @@ -528,7 +533,7 @@ backend_init_supplies( */ if (!_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1, - _cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1, + community, CUPS_ASN1_GET_REQUEST, 1, hrDeviceDescr)) return; @@ -605,7 +610,7 @@ backend_init_supplies( if (!_cupsSNMPWrite(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1, - _cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1, + community, CUPS_ASN1_GET_REQUEST, 1, prtGeneralCurrentLocalization)) return; @@ -626,7 +631,7 @@ backend_init_supplies( if (!_cupsSNMPWrite(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1, - _cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1, + community, CUPS_ASN1_GET_REQUEST, 1, oid)) return; @@ -651,7 +656,7 @@ backend_init_supplies( */ _cupsSNMPWalk(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1, - _cupsSNMPDefaultCommunity(), prtMarkerSuppliesEntry, + community, prtMarkerSuppliesEntry, CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL); } @@ -685,7 +690,7 @@ backend_init_supplies( strlcpy(supplies[i].color, "none", sizeof(supplies[i].color)); _cupsSNMPWalk(snmp_fd, ¤t_addr, CUPS_SNMP_VERSION_1, - _cupsSNMPDefaultCommunity(), prtMarkerColorantValue, + community, prtMarkerColorantValue, CUPS_SUPPLY_TIMEOUT, backend_walk_cb, NULL); /* diff --git a/cups/snmp.c b/cups/snmp.c index 10eca15c5..5cefee454 100644 --- a/cups/snmp.c +++ b/cups/snmp.c @@ -129,9 +129,13 @@ _cupsSNMPDefaultCommunity(void) { linenum = 0; while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) - if (!_cups_strcasecmp(line, "Community") && value) + if (!_cups_strcasecmp(line, "Community")) { - strlcpy(cg->snmp_community, value, sizeof(cg->snmp_community)); + if (value) + strlcpy(cg->snmp_community, value, sizeof(cg->snmp_community)); + else + cg->snmp_community[0] = '\0'; + break; } diff --git a/man/cups-snmp.conf.man b/man/cups-snmp.conf.man index 25137eee8..23e7eb849 100644 --- a/man/cups-snmp.conf.man +++ b/man/cups-snmp.conf.man @@ -6,7 +6,7 @@ .\" .\" Licensed under Apache License v2.0. See the file "LICENSE" for more information. .\" -.TH snmp.conf 5 "CUPS" "10 June 2014" "Apple Inc." +.TH snmp.conf 5 "CUPS" "8 November 2018" "Apple Inc." .SH NAME snmp.conf \- snmp configuration file for cups .SH DESCRIPTION @@ -32,6 +32,7 @@ There is no default for the broadcast address. Specifies the community name to use. Only a single community name may be specified. The default community name is "public". +If no name is specified, all SNMP functions are disabled. .TP 5 \fBDebugLevel \fInumber\fR Specifies the logging level from 0 (none) to 3 (everything). |