The branch, v3-5-test has been updated
       via  ef1a0c1 Fix bug #8157 - std_pcap_cache_reload() fails to parse a 
cups printcap file correctly.
      from  a88126d s3-printing: remove pcap_cache_loaded asserts

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit ef1a0c14ab41c87f133d310c5f976548caf15b9a
Author: Jeremy Allison <[email protected]>
Date:   Fri May 20 12:36:56 2011 -0700

    Fix bug #8157 - std_pcap_cache_reload() fails to parse a cups printcap file 
correctly.
    
    The parsing code made some strange assumptions about what is a printer
    name, and what is a comment.

-----------------------------------------------------------------------

Summary of changes:
 source3/printing/pcap.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
index 0d6480c..dbfbac7 100644
--- a/source3/printing/pcap.c
+++ b/source3/printing/pcap.c
@@ -209,6 +209,10 @@ void pcap_cache_reload(void (*post_cache_fill_fn)(void))
 
                        has_punctuation = (strchr_m(p, ' ') ||
                                           strchr_m(p, '\t') ||
+                                          strchr_m(p, '"') ||
+                                          strchr_m(p, '\'') ||
+                                          strchr_m(p, ';') ||
+                                          strchr_m(p, ',') ||
                                           strchr_m(p, '(') ||
                                           strchr_m(p, ')'));
 
@@ -217,8 +221,7 @@ void pcap_cache_reload(void (*post_cache_fill_fn)(void))
                                continue;
                        }
 
-                       if (strlen(p) <= MAXPRINTERLEN &&
-                           strlen(p) > strlen(name) && !has_punctuation) {
+                       if (strlen(p) <= MAXPRINTERLEN && *name == '\0' && 
!has_punctuation) {
                                if (!*comment) {
                                        strlcpy(comment, name, sizeof(comment));
                                }
@@ -233,9 +236,6 @@ void pcap_cache_reload(void (*post_cache_fill_fn)(void))
                        }
                }
 
-               comment[60] = 0;
-               name[MAXPRINTERLEN] = 0;
-
                if (*name && !pcap_cache_add(name, comment)) {
                        x_fclose(pcap_file);
                        goto done;


-- 
Samba Shared Repository

Reply via email to