Fix double-free in mailbox_read_header

in some obscure error paths involving corruption of the cyrus.header.
Coverity CID 984621.
Fix memory leak in NNTP delivery

Mbentries are leaked if there are more than one destination folder and
at least one already has the article.  Coverity CID 204106.
util: more tweaking for buf_ensure()

This time we try and convince Coverity that if buf->len > 0
then buf->s cannot be NULL.  This issue is generating lots of
"Explicit NULL dereferenced" and "Dereference after NULL check"
errors.
isieve: handle base64 decode failure

during SASL authentication.
Fix fd leak in smmapd

on the error handling path if connect() fails.
Coverity CID 981079.
master: fix buffer overrun with partial reads

from service children, not clients!  The person who wrote this code
understood about partial read()s but not about C pointer arithmetic.
Coverity CID 204001.
dlist: int != char

getword() et al return an int so that they have the full 8 bit range to
return a byte, *and* also return EOF which is not the same as 0xff.  So
we shouldn't throw that information away by using a char variable.
Coverity CID 204060.
master: fix memleak on misconfiguration

Coverity CID 204119.
sync: fix memleak in do_getfullmailbox

in error path when the local mailbox couldn't be opened.
Coverity CID 204116.
sync: fix memleak in do_fetchsieve()

Coverity CID 204115.
sync: fix mem leak in sync_getflags

on error path.  Coverity CID 204108.
Fix configure summary for MySQL

which was broken in a subtle merge conflict by commit
"cedf154 configure checks for MySQL sensibly"
Normalise use of #include "assert.h"

by removing the few errant #include <assert.h>s.
Ensure strncpy() destination is NUL-terminated

using a wrapper macro xstrndup().  See comment in header for why we
don't just use strlcpy().

Coverity CIDs 204003-204017.
Fix prefix matching in BDB foreach

Two problems:

 - the erroneous case prefix=NULL prefixlen>0 would crash
   Coverity CID 204055.

 - a long prefix and a short key could result in a memcmp()
   call with an invalid length.  This is never a problem in
   practice because the key ordering semantics ensure the
   memcmp() will always return before reading invalid bytes.
   But it's better to be safe.
nntp: be more careful in parserange

Don't dereference 'ret' without checking it.  In practice this cannot
happen, but only due to an obscure set of accidents involving the global
variable 'backend_current'.  Changed to play it safer.

Coverity CID 204053.
Whitespace cleanup in signals.c
[IRIS-1784] more useful graceful shutdown syslogs

Instead of master printing something like

Jul 27 14:43:22 gnb-desktop master[5505]: process type:SERVICE
name:imap path:/usr/cyrus/bin/imapd age:33.158s pid:5539 exited, status 75

we get one of two behaviours.  If the master process sent the signal,
no message is emitted - we are doing a proper Cyrus-wide graceful
shutdown.  If any other process sent the signal, we work out which
process that was and emit a syslog message describing that process,
like this:

Jul 30 17:19:56 gnb-desktop imap[21627]: graceful shutdown
initiated by unexpected process 21636 (/usr/bin/perl /root/shutdown.pl)
deny: remove unused argument from denydb_open()
deny: move defines into the .c file

They're not needed in the header as they're only used internally.