Fix bug 7297 - smbd crashes with CUPS printers and no [printers] share defined.
authorJeremy Allison <jra@samba.org>
Fri, 26 Mar 2010 00:09:23 +0000 (17:09 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 May 2010 12:08:34 +0000 (14:08 +0200)
Ensure we don't dereference an array with an index of -1.

Jeremy.
(cherry picked from commit e4127ab299e654777c43d983b2e0a158baa7d79a)
(cherry picked from commit fcb4c51e79f648ae02f77784d46bcc9c7331d3cb)

source3/smbd/service.c

index 8490f17deaeffe88c69131867ca58974fb3ad37e..88a5f3c22ac3e6118c44c49557600460cbe00ad0 100644 (file)
@@ -338,7 +338,7 @@ int find_service(fstring service)
                if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) < 0) {
                        iPrinterService = load_registry_service(PRINTERS_NAME);
                }
-               if (iPrinterService) {
+               if (iPrinterService >= 0) {
                        DEBUG(3,("checking whether %s is a valid printer name...\n", service));
                        if (pcap_printername_ok(service)) {
                                DEBUG(3,("%s is a valid printer name\n", service));