Ignore:
Timestamp:
Jul 2, 2011, 4:01:14 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update vendor to version 3.5.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/printing/pcap.c

    r414 r597  
    126126}
    127127
    128 void pcap_cache_reload(void)
     128void pcap_cache_reload(void (*post_cache_fill_fn)(void))
    129129{
    130130        const char *pcap_name = lp_printcapname();
     
    133133        XFILE *pcap_file;
    134134        char *pcap_line;
     135        bool post_cache_fill_fn_handled = false;
    135136
    136137        DEBUG(3, ("reloading printcap cache\n"));
     
    147148#ifdef HAVE_CUPS
    148149        if (strequal(pcap_name, "cups")) {
    149                 pcap_reloaded = cups_cache_reload();
     150                pcap_reloaded = cups_cache_reload(post_cache_fill_fn);
     151                /*
     152                 * cups_cache_reload() is async and calls post_cache_fill_fn()
     153                 * on successful completion
     154                 */
     155                post_cache_fill_fn_handled = true;
    150156                goto done;
    151157        }
     
    204210                        has_punctuation = (strchr_m(p, ' ') ||
    205211                                           strchr_m(p, '\t') ||
     212                                           strchr_m(p, '"') ||
     213                                           strchr_m(p, '\'') ||
     214                                           strchr_m(p, ';') ||
     215                                           strchr_m(p, ',') ||
    206216                                           strchr_m(p, '(') ||
    207217                                           strchr_m(p, ')'));
     
    212222                        }
    213223
    214                         if (strlen(p) <= MAXPRINTERLEN &&
    215                             strlen(p) > strlen(name) && !has_punctuation) {
     224                        if (strlen(p) <= MAXPRINTERLEN && *name == '\0' && !has_punctuation) {
    216225                                if (!*comment) {
    217226                                        strlcpy(comment, name, sizeof(comment));
     
    228237                }
    229238
    230                 comment[60] = 0;
    231                 name[MAXPRINTERLEN] = 0;
    232 
    233239                if (*name && !pcap_cache_add(name, comment)) {
    234240                        x_fclose(pcap_file);
     
    243249        DEBUG(3, ("reload status: %s\n", (pcap_reloaded) ? "ok" : "error"));
    244250
    245         if (pcap_reloaded)
     251        if (pcap_reloaded) {
    246252                pcap_cache_destroy_specific(&tmp_cache);
    247         else {
     253                if ((post_cache_fill_fn_handled == false)
     254                 && (post_cache_fill_fn != NULL)) {
     255                        post_cache_fill_fn();
     256                }
     257        } else {
    248258                pcap_cache_destroy_specific(&pcap_cache);
    249259                pcap_cache = tmp_cache;
Note: See TracChangeset for help on using the changeset viewer.