~ubuntu-branches/ubuntu/saucy/postfix/saucy

« back to all changes in this revision

Viewing changes to src/util/dict_open.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, Wietse Venema, LaMont Jones
  • Date: 2011-05-10 08:40:13 UTC
  • mfrom: (1.1.30 upstream) (33.1.10 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110510084013-eeoaeuuet3projj7
Tags: 2.8.3-1
[Wietse Venema]

* 2.8.3
  - Cleanup: postscreen(8) and verify(8) daemons now lock their respective
    cache file exclusively upon open, to avoid massive cache corruption
    by unsupported sharing.
  - Bugfix (introduced with Postfix SASL patch 20000314): don't reuse a
    server SASL handle after authentication failure.  CVE-2011-1720

[LaMont Jones]
* Ack ubuntu fixes for multiarch.  Closes: #620326, #625674

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
/* .IP DICT_FLAG_LOCK
83
83
/*      With maps where this is appropriate, acquire an exclusive lock
84
84
/*      before writing, and acquire a shared lock before reading.
 
85
/* .IP DICT_FLAG_OPEN_LOCK
 
86
/*      With maps where this is appropriate, acquire an exclusive
 
87
/*      lock upon open, and report a fatal run-time error if the
 
88
/*      table is already locked.
85
89
/* .IP DICT_FLAG_FOLD_FIX
86
90
/*      With databases whose lookup fields are fixed-case strings,
87
91
/*      fold the search key to lower case before accessing the
218
222
#include <stringops.h>
219
223
#include <split_at.h>
220
224
#include <htable.h>
 
225
#include <myflock.h>
221
226
 
222
227
#ifndef NO_DYNAMIC_MAPS
223
228
#include <load_lib.h>
371
376
        msg_fatal("opening %s:%s %m", dict_type, dict_name);
372
377
    if (msg_verbose)
373
378
        msg_info("%s: %s:%s", myname, dict_type, dict_name);
 
379
    /* XXX the choice between wait-for-lock or no-wait is hard-coded. */
 
380
    if (dict->lock_fd >= 0 && (dict_flags & DICT_FLAG_OPEN_LOCK) != 0) {
 
381
        if (dict_flags & DICT_FLAG_LOCK)
 
382
            msg_panic("%s: attempt to open %s:%s with both \"open\" lock and \"access\" lock",
 
383
                      myname, dict_type, dict_name);
 
384
        if (myflock(dict->lock_fd, INTERNAL_LOCK,
 
385
                    MYFLOCK_OP_EXCLUSIVE | MYFLOCK_OP_NOWAIT) < 0)
 
386
            msg_fatal("%s:%s: unable to get exclusive lock: %m",
 
387
                      dict_type, dict_name);
 
388
    }
374
389
    return (dict);
375
390
}
376
391