~ubuntu-branches/debian/sid/postfix/sid

« back to all changes in this revision

Viewing changes to src/postmap/postmap.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2012-03-20 13:47:16 UTC
  • mfrom: (1.1.34) (39.1.16 trunk)
  • Revision ID: package-import@ubuntu.com-20120320134716-o62kosz3odzt1rh6
Tags: 2.9.1-2
Drop unnecessary openssl check, since sonames will save us.

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
/* .IP \fBhash\fR
182
182
/*      The output file is a hashed file, named \fIfile_name\fB.db\fR.
183
183
/*      This is available on systems with support for \fBdb\fR databases.
 
184
/* .IP \fBfail\fR
 
185
/*      A table that reliably fails all requests. The lookup table
 
186
/*      name is used for logging only. This table exists to simplify
 
187
/*      Postfix error tests.
184
188
/* .IP \fBsdbm\fR
185
189
/*      The output consists of two files, named \fIfile_name\fB.pag\fR and
186
190
/*      \fIfile_name\fB.dir\fR.
279
283
#include <split_at.h>
280
284
#include <vstring_vstream.h>
281
285
#include <set_eugid.h>
 
286
#include <warn_stat.h>
282
287
 
283
288
/* Global library. */
284
289
 
413
418
         * Store the value under a case-insensitive key.
414
419
         */
415
420
        mkmap_append(mkmap, key, value);
 
421
        if (mkmap->dict->error)
 
422
            msg_fatal("table %s:%s: write error: %m",
 
423
                      mkmap->dict->type, mkmap->dict->name);
416
424
    }
417
425
 
418
426
    /*
460
468
            state->found = 1;
461
469
            break;
462
470
        }
 
471
        if (dicts[n]->error)
 
472
            msg_fatal("table %s:%s: query error: %m",
 
473
                      dicts[n]->type, dicts[n]->name);
463
474
    }
464
475
}
465
476
 
537
548
                    found = 1;
538
549
                    break;
539
550
                }
 
551
                if (dicts[n]->error)
 
552
                    msg_fatal("table %s:%s: query error: %m",
 
553
                              dicts[n]->type, dicts[n]->name);
540
554
            }
541
555
        }
542
556
    } else {
618
632
        }
619
633
        vstream_printf("%s\n", value);
620
634
    }
 
635
    if (dict->error)
 
636
        msg_fatal("table %s:%s: query error: %m", dict->type, dict->name);
621
637
    vstream_fflush(VSTREAM_OUT);
622
638
    dict_close(dict);
623
639
    return (value != 0);
659
675
    /*
660
676
     * Perform all requests.
661
677
     */
662
 
    while (vstring_get_nonl(keybuf, in) != VSTREAM_EOF)
663
 
        for (n = 0; n < map_count; n++)
 
678
    while (vstring_get_nonl(keybuf, in) != VSTREAM_EOF) {
 
679
        for (n = 0; n < map_count; n++) {
664
680
            found |= (dict_del(dicts[n], STR(keybuf)) == 0);
 
681
            if (dicts[n]->error)
 
682
                msg_fatal("table %s:%s: delete error: %m",
 
683
                          dicts[n]->type, dicts[n]->name);
 
684
        }
 
685
    }
665
686
 
666
687
    /*
667
688
     * Cleanup.
690
711
        open_flags = O_RDWR;
691
712
    dict = dict_open3(map_type, map_name, open_flags, dict_flags);
692
713
    status = dict_del(dict, key);
 
714
    if (dict->error)
 
715
        msg_fatal("table %s:%s: delete error: %m", dict->type, dict->name);
693
716
    dict_close(dict);
694
717
    return (status == 0);
695
718
}
721
744
        }
722
745
        vstream_printf("%s      %s\n", key, value);
723
746
    }
 
747
    if (dict->error)
 
748
        msg_fatal("table %s:%s: sequence error: %m", dict->type, dict->name);
724
749
    vstream_fflush(VSTREAM_OUT);
725
750
    dict_close(dict);
726
751
}
803
828
    msg_syslog_init(mail_task(argv[0]), LOG_PID, LOG_FACILITY);
804
829
 
805
830
    /*
 
831
     * Check the Postfix library version as soon as we enable logging.
 
832
     */
 
833
    MAIL_VERSION_CHECK;
 
834
 
 
835
    /*
806
836
     * Parse JCL.
807
837
     */
808
838
    while ((ch = GETOPT(argc, argv, "Nbc:d:fhimnopq:rsuvw")) > 0) {
880
910
    if (strcmp(var_syslog_name, DEF_SYSLOG_NAME) != 0)
881
911
        msg_syslog_init(mail_task(argv[0]), LOG_PID, LOG_FACILITY);
882
912
    mail_dict_init();
883
 
    if ((query == 0 || strcmp(query, "-") != 0) 
 
913
    if ((query == 0 || strcmp(query, "-") != 0)
884
914
        && (postmap_flags & POSTMAP_FLAG_ANY_KEY))
885
915
        msg_fatal("specify -b -h or -m only with \"-q -\"");
886
916