2006-10-18  Rob Buis <r.buis@ic-s.nl>

	* misc.h, misc.c:
	Backport dm_shellesc function from 2.1.

	* forward.c:
	Use dm_shellesc to escape the from and to strings that are being
	fed to sendmail using popen.

2006-10-06  Aaron Stone  <aaron@serendipity.cx>

	* dbsearch.c:
	Accepted patch from Chris Schwarz (closes bug #423).

2006-07-21  Paul J Stevens <paul@nfg.nl>

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql:
	add missing column in migration script (jnorell)

2006-06-30  Paul J Stevens <paul@nfg.nl>

	* db.c:
	fix slow header retrieval on postgresql (closes #373)
	* sql/mysql/create_tables_innoDB.mysql:
	fix invalid default value for dbmail_pbsp.since (closes #374)

2006-06-25  Aaron Stone  <aaron@serendipity.cx>

	* header.c:
	Fixed get_rfc_size to always set a value to its output argument
	and use matching u64_t types for addition (closes bug #369).

2006-06-17  Aaron Stone  <aaron@serendipity.cx>

	* dbmsgbuf.h, dbmsgbuf.c:
	Changed db_dump_range to return u64_t rather than long, since
	everybody downstream was already assuming it to be u64_t and
	was not checking for negative return values (closes bug #294).

2006-04-28  Paul J Stevens <paul@nfg.nl>

	* serverchild.c:
	catch failed forks
	* debian/control, debian/rules:
	update debian build-deps

2006-04-04  Paul J Stevens <paul@nfg.nl>

	* ChangeLog:
	release 2.0.10
	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql:
	update migrate script for postgresql
	* AUTHORS, ChangeLog, EXTRAS, INSTALL.dbmail, Makefile.in, README, TODO, 
	  aclocal.m4, auth/Makefile.in, buildtools/ltmain.sh, configure, 
	  configure.in, debian/changelog, debian/control, mysql/Makefile.in, 
	  pgsql/Makefile.in, sort/Makefile.in:
	bump the version to 2.0.10 and update some files

2006-03-15  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, db.c:
	escape query in nochildren code (closes: #314)

2006-03-01  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, debian/changelog, imapcommands.c:
	allow iso-8859-1 in imap search
	* ChangeLog, imapcommands.c:
	allow iso-8859-1 in imap search command

2006-02-14  Paul J Stevens <paul@nfg.nl>

	* debian/dbmail.config, debian/dbmail.preinst:
	fix lintian warnings
	* debian/control, debian/dbmail.config, debian/dbmail.postinst:
	fix some packaging issues and bashisms
	* acl.c:
	fix setacl bug with empty mod_rights astring

2006-02-04  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, Makefile.in, auth/Makefile.in, debian/changelog, 
	  mysql/Makefile.in, pgsql/Makefile.in, sort/Makefile.in:
	pre-release commit of regenerated Makefile.in files

2006-01-27  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, Makefile.in, auth/Makefile.in, configure, configure.in, 
	  mysql/Makefile.in, pgsql/Makefile.in, sort/Makefile.in:
	bump version to 2.0.9

2006-01-26  Paul J Stevens <paul@nfg.nl>

	* imapcommands.c:
	fix incorrect processing of LIST command (closes: #293)
	* db.c:
	fix bug in no_children

2006-01-25  Paul J Stevens <paul@nfg.nl>

	* imap4.h:
	enable QUOTA in CAPABILITY
	* ChangeLog, configure.in, debian/changelog, debian/po/es.po:
	bump version to 2.0.8

2006-01-09  Paul J Stevens <paul@nfg.nl>

	* debian/dbmail.postrm:
	fix debian postrm
	* db.c, db.h, imap4.h, imapcommands.c:
	added CHILDREN capability

2005-12-30  Paul J Stevens <paul@nfg.nl>

	* imaputil.c:
	fix incorrect quoting in quoted_string_out (closes: #204)

2005-12-22  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, main.c:
	minor cleanup
	* imapcommands.c, imaputil.c:
	resync git tree
	* debian/patches/04_mailfilter.dpatch:
	update mailfilter patch
	* debian/po/es.po:
	adding spanish translation of debconf files
	* INSTALL, INSTALL.dbmail, Makefile.in, acinclude.m4, aclocal.m4, 
	  auth/Makefile.in, buildtools/install-sh, buildtools/ltmain.sh, 
	  buildtools/missing, buildtools/mkinstalldirs, configure, 
	  configure.in, debian/control, debian/rules, man/Makefile.in, 
	  mysql/Makefile.in, pgsql/Makefile.in, sort/Makefile.in:
	cleanup autotools chain a bit
	* main.c:
	remove redeclaration of global dsnuser (closes: #281)
	* INSTALL, Makefile.in, auth/Makefile.in, buildtools/depcomp, debian/rules, 
	  mysql/Makefile.in, pgsql/Makefile.in, sort/Makefile.in:
	updated autotools for autoconf-1.9

2005-10-26  Paul J Stevens <paul@nfg.nl>

	* dsn.c, main.c, server.c, serverchild.c, sql/mysql/create_tables.mysql, 
	  sql/mysql/create_tables_innoDB.mysql:
	resync tree
	* imapcommands.c, imaputil.c:
	initialize struct tm values before calling strptime (closes: #277)

2005-10-18  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, auth/authsql.c, dsn.c, main.c:
	ignore empty addresses in delivery chain

2005-10-01  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, debian/patches/04_mailfilter.dpatch:
	added postgres table to mailfilter patch
	* debian/changelog, serverchild.c, sql/mysql/create_tables.mysql, 
	  sql/mysql/create_tables_innoDB.mysql:
	change dbmail_messageblks.messageblk from longtext to longblob in mysql
	create scripts

2005-09-27  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, buildtools/config.guess, buildtools/config.sub, 
	  debian/changelog, server.c:
	do not close database connection on startup (closes: #271)

2005-09-23  Paul J Stevens <paul@nfg.nl>

	* debian/control, debian/patches/00list, 
	  debian/patches/04_mailfilter.dpatch:
	added mailfilter dpatch
	* debian/patches/04_mailfilter.dpatch:
	fix some compiler warnings in mailfilter patch

2005-09-14  Paul J Stevens <paul@nfg.nl>

	* debian/control:
	add virtual packages

2005-09-02  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, sql/mysql/create_tables_innoDB.mysql, 
	  sql/postgresql/create_tables.pgsql:
	added ON UPDATE CASCADE to create_table files

2005-08-31  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, configure, configure.in:
	bump the version to 2.0.7
	* debian/changelog:
	updating sarge packages
	* contrib/startup-scripts/debian/dbmail, 
	  contrib/startup-scripts/debian/dbmail-imapd, 
	  contrib/startup-scripts/debian/dbmail-lmtpd, 
	  contrib/startup-scripts/debian/dbmail-pop3d, 
	  contrib/startup-scripts/debian/dbmail.default:
	update the included startup scripts

2005-08-24  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, server.c:
	cleanup the signal handler in server.c
	* pool.c:
	add boundary check in manage_spare_children

2005-08-23  Ilja Booij <ilja@ic-s.nl>

	* pop3.c: AUTH command no longer returns list of supported
	authentication mechanisms when issued without arguments. closes #237    

2005-08-22  Paul J Stevens <paul@nfg.nl>

	* debug.c:
	avoid malloc in debug.c,trace by using a static buffer for debug messages
	* server.c:
	reset alarm after database recovers
	* pool.c:
	non-blocking locking and some fixes in manage_spare_children

2005-08-19  Paul J Stevens <paul@nfg.nl>

	* ChangeLog, aclocal.m4, auth/Makefile.in, buildtools/ltmain.sh, configure, 
	  configure.in, mysql/Makefile.in, pgsql/Makefile.in, sort/Makefile.in:
	bump the version to 2.0.6 and re-run autotools

2005-08-18  Paul J Stevens <paul@nfg.nl>

	* aclocal.m4, auth/Makefile.in, buildtools/ltmain.sh, configure.in, 
	  mysql/Makefile.in, pgsql/Makefile.in, sort/Makefile.in:
	resync git tree

2005-08-17  Aaron Stone <aaron@serendipity.cx>

	* dsn.c: Missing comma in the class status
	codes. (closes #248).
		
2005-08-17  Paul J Stevens <paul@nfg.nl>

	* pool.c:
	make getKey failure non-fatal in scoreboard_release

2005-08-15  Paul J Stevens <paul@nfg.nl>

	* Makefile.in, aclocal.m4, auth/Makefile.in, buildtools/ltmain.sh, 
	  config.in, configure, configure.in, debian/patches/00list, 
	  man/Makefile.in, mysql/Makefile.in, pgsql/Makefile.in, 
	  sort/Makefile.in:
	update autotools files

2005-08-08  Paul Stevens <paul@nfg.nl>

	* mysql/dbmysql.c, pgsql/dbpgsql.c: removed spurious double-free
	warning from db_free_result.
	* pool.c: make getKey failure more verbose, and reorganize locking
	code.

2005-06-23  Paul Stevens <paul@nfg.nl>

	* dsn.c: start auth_check_user_ext with check at zero instead of 
	minus one.
		
2005-06-20  Paul Stevens <paul@nfg.nl>

	* header.c (consume_header_line): applied patch to fix unhandled case
	in logic (closes: #216).
	
2005-06-15  Paul Stevens <paul@nfg.nl>

	* auth/authsql.c (auth_check_user_ext): return 0 instead of -1 in case
	of loop.

2005-06-14  Paul Stevens <paul@nfg.nl>

	* dbmsgbuf.c (db_dump_range): fix lower-bounds check during CRLF cleanup.
	* auth/authsql.c (auth_check_user_ext): use check parameter to guard
	against loops in recursion.

2005-06-05  Paul Stevens <paul@nfg.nl>

	* main.c: fix double free (closes: #214).
	* pop3.c: replace fprintf with ci_write.
	
2005-05-31  Paul Stevens <paul@nfg.nl>

	* imaputils.c (date_sql2imap): revert to old gnuish behaviour which
	should work just fine on bsd and linux (closes #79).
	
2005-05-30  Paul Stevens <paul@nfg.nl>

	* imapcommands.c (_ic_expunge): return non-fatal error in case of NO
	reply.

2005-05-24  Paul Stevens <paul@nfg.nl>

	* server.c: wait for zombies in ParentSigHandler (closes #199).
	* pool.c: guard against sending broadcast signals (closes #198).

2005-04-20  Aaron Stone  <aaron@serendipity.cx>

	* configure.in, acinclude.m4: borrowed a test from rdesktop / curl
	that checks for alternate definitions of socklen_t. Fixes bug #184.

2005-04-19  Paul Stevens <paul@nfg.nl>

	* pool.c, server.c, serverchild.c: make dbmail servers in prefork mode 
	die when the database backend dies (closes #190).
	
2005-04-06  Paul Stevens <paul@nfg.nl>

	* imap4.c: set COMMAND_SHOW_LEVEL to TRACE_INFO
	
2005-04-05  Paul Stevens <paul@nfg.nl>

	* imaputil.c: fix date_sql2imap. Closes #79.
	* server.c, serverchild.c: save and restore errno in signal handlers.
	* auth/authsql.c: prevent loops in auth_check_user_ext where alias ==
	deliver_to.

2005-03-27  Paul Stevens <paul@nfg.nl>

	* imapcommands.c (_ic_fetch): handle parse error as returned from
	db_main_get_header.

2005-03-26  Aaron Stone  <aaron@serendiptiy.cx>

	* dm_getopt.h: reversed the #define's so that all files refer to
	dm_getopt, and dm_getopt switches between the "real" dm_getopt or
	the system's GNU getopt, if available. Closes bug #177, again.
	* dm_getopt.c, imapd.c, lmtpd.c, main.c, maintenance.c, pop3d.c,
	sievecmd.c, timsieved.c, user.c: changed getopt and optarg to
	dm_getopt and dm_optarg according to the changes in dm_getopt.h.

2005-03-23  Paul Stevens <paul@nfg.nl>

	* maintenance.c: change MESSAGE_STATUS_ERROR to MESSAGE_STATUS_PURGE
	so NULL messages get purged.

2005-03-22  Paul Stevens <paul@nfg.nl>

	* pool.c: make shmget failure a bit more verbose using strerror.
	* maintenance.c: remove all references to the old -r switch.

2005-03-21  Aaron Stone <aaron@serendipity.cx>

	* lmtp.c (read_whole_message_network): added arguments to pass the
	envelope sender address for the Return-Path header. Fixes bug #145.

2005-03-17  Paul Stevens <paul@nfg.nl>

	* db.c (db_icheck_isheader): added HAVING clause to query so is_header
	is only updated for records if and when needed.

2005-03-14  Paul Stevens <paul@nfg.nl>

	* user.c, dsn.c, dsn.h, sort.h, pipe.c, sort/sort.c, main.c: return temp
	failure when over-quota (closes: #164).
	* pool.c, pool.h: use separate shm lock-files per process to avoid
	race conditions.

2005-03-10  Paul Stevens <paul@nfg.nl>

	* INSTALL.postfix: minor typo fixed.
	* sql/postgresql/create_tables.pgsql: added some indexes to
	dbmail_messages as needed by db_getmailbox fix.

2005-02-24  Paul Stevens <paul@nfg.nl>

	* db.c (db_getmailbox): use better query to speed up performance on
	postgresql. Thanks Geo.
	
2005-02-06  Aaron Stone  <aaron@serendipity.cx>

	* db.c (db_getmailbox): changed MAX(message_idnr)+1 in a query to
	instead use message_idnr+1 ... DESC LIMIT 1. Fixes bug #171.

2005-01-24  Paul Stevens <paul@nfg.nl>

	* imaputil.c (build_imap_search): back to failing for charset us-ascii
	in sort command.
	* imapcommands.c (_ic_sort): don't use search_optimize for sorting
	just yet.

2005-01-22  Ilja Booij <ilja@ic-s.nl>
	
	* sql/mysql/migrate_from_1.x_to_2.0.mysql: applied patch by
	Christian Haugg to make script work on MySQL 4.1.x

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: applied patch by
	Christian Haugg to make script work on MySQL 4.1.x

2005-01-20  Paul Stevens <paul@nfg.nl>

	* pool.h: include MAX_HARD_CHILDREN to 200
	* dbmailtypes.h, dbsearch.c, dbsearch.h, imapcommands.c, imaputil.c,
	imaputil.h: optimize searching and sorting by weighted sort of
	searchlist.

2005-01-20  Aaron Stone  <aaron@serendipity.cx>

	* dsn.c (dsnuser_resolve): changed the lookup logic to always check
	the aliases table rather than skipping the aliases table if the
	username appears to be the destination address. Fixes bug #159.

2005-01-19  Aaron Stone  <aaron@serendipity.cx>

	* main.c, user.c, pop3d.c, imapd.c, lmtpd.c...: changed include of
	unistd.h to getopt.h, which will be our local getopt if needed.
	* my_getopt.c, my_getopt.h, getopt.h: added Ben Sittler's my_getopt
	version 1.4 into the tree. It is modified-BSD licensed.
	* acinclude.m4: added tests from GNU libiberty which will use the 
	system getopt only if it is a GNU-compatible implementation, otherwise
	we'll use our own my_getopt. Fixes bug #118.
	* db.c (db_delete_mailbox): unowned mailboxes can now be deleted as
	long as you're not trying to update the (nonexistent) owner's quota.
	Fixes bug #153.
	* Makefile.am, configure.in, acinclude.m4: cleanup up the getopt tests
	and renamed my_getopt to dm_getopt.
	* dm_getopt.h, dm_getopt.c: changed the name to avoid MySQL conflicts.

2005-01-19  Ilja Booij <ilja@ic-s.nl>

	* INSTALL.postfix: applied patch to INSTALL.postfix to update 
	information for Postfix 2.0 users.

2005-01-18  Aaron Stone  <aaron@serendipity.cx>

	* user.c (do_show): return -1 if userspec is neither a user nor an
	alias. Fixes bug #163.

2005-01-18  Paul Stevens <paul@nfg.nl>

	* imapcommands.c (_ic_select): fix the plist construction on flags.
	Added untagged response UIDNEXT as required by the rfc.
	* imapcommands.c (_ic_store): treat seq-num of 0xffffffff as '*'
	because outlook express does so (closes #160).

2005-01-15  Paul Stevens <paul@nfg.nl>

	* serverchild.c, pool.c: cleaned up the termination setup (closes
	#158).
	
2005-01-12  Paul Stevens <paul@nfg.nl>

	* db.h, mysql/dbmysql.c, pgsql/dbpgsql.c (db_check_connection): moved
	static function to db.h so we can call db_check_connection from
	serverchild.c.
	* serverchild.c: call db_check_connection before each incoming
	connection (closes #156).
	* imap4.c, pop3.c, lmtp.c: call db_check_connection before handling
	commands.
	* serverchild.c: remove non-functional SIGPIPE handler so we can allow
	libmysql to use it's own handler in mysql_ping.
	* imapcommands.c (perform_imap_search): only resync mailbox if
	out-of-sync detected.

2005-01-07  Paul Stevens <paul@nfg.nl>

	* debug.c: changed all references to my_malloc, my_realloc, my_calloc,
	my_free and my_strdup and replaced the my_ prefix with dm_.
	* user.c: strdup all arguments.
	* imapcommands.c: replace all remaining fprintf call with ci_write.
	* imapcommands.c (_ic_search): reverse the sub_search list back to the
	original order.
	* imapcommands.c (perform_imap_search): always resync mailbox before
	search.

2005-01-05  Paul Stevens <paul@nfg.nl>

	* imaputil.c (perform_imap_search): change return value to -2 if
	searchkey is empty to trigger an error and break the recursion 
	(closes: #110).
	
2004-12-27  Paul Stevens <paul@nfg.nl>

	* sort/Makefile.am: changed CFLAGS in AM_CFLAGS (closes: #143).
	* Makefile.am, config.in, imap4.c, imapd.c, lmtpd.c, pop3d.c,
	server.c, server.h, serverchild.c, serverchild.h, pool.c, pool.h:
	preforking patch (closes: #142).
	* serverchild.c (StartServer): test the database connection before
	forking (closes #114).

2004-12-21  Aaron Stone  <aaron@serendipity.cx>

	* dbmd5.c (makemd5): return NULL if passed NULL.
	* user.c (mkpassword): replaced two instances of strncat with
	null_strncpy, which handles NULL pointers with ease. This resolves
	bug #141.

2004-12-17  Aaron Stone  <aaron@serendipity.cx>

	* db.c (db_icheck_isheader): added a hack into the query
	because group by in sql appears not to guarantee that the
	returned row contains data that is actually together in a row.
	* man/dbmail-util.8: added docs for -b.

2004-12-17  Aaron Stone  <aaron@serendipity.cx>

	* db.c, db.h: added several more error counting functions and 
	two new functions for is_header checking and setting.
	* maintenance.c: added -b option to check for "header/body"
	which does the is_header checking, also did some more cleanups
	so that running "dbmail-util -aq" gives yet more useful messages.

2004-12-17  Paul Stevens <paul@nfg.nl>

	* db.c, pipe.c: added transactional support to message delivery.
	* db.c, db.h, dbmsgbuf.c, dbmsgbuf.h, pipe.c, rfcmsg.c,
	smtp-convert.c: applied the is_header patch so we start filling up the
	is_header field in the insertion chain.

2004-12-06  Aaron Stone  <aaron@serendipity.cx>

	* lmtp.c: changed around a bunch of list handling to alleviate
	memory leaks. Fixes bug #119.

2004-12-03  Paul Stevens <paul@nfg.nl>

	* acinclude.m4, configure.in, debug.h, lmtp.c, main.c, mime.c, misc.c,
	sievecmd.c: adding garbage collection through the configure switch
	--with-gc and map all memory allocation calls to their my_ variants.
	
	* acl.c, config.c, db.c, dbsearch.c, dbsearch.h, debug.c, debug.h,
	imapcommands.c, imaputil.c, imaputil.h, list.c, list.h, main.c,
	mime.c, misc.c, quota.c, sievecmd.c, smtp-convert.c, sort/sortsieve.c,
	timsieve.c, user.c: change all strdup call to my_strdup which uses
	my_malloc.

2004-12-01  Ilja Booij  <ilja@ic-s.nl>

	* imaputil.c (build_args_array): renamed MAX_LINESIZE to
	IMAP_MAX_LINESIZE.

	* imapcommands.c (_ic_authenticate): renamed MAX_LINESIZE to 
	IMAP_MAX_LINESIZE.

	* imap4.h: moved MAX_LINESIZE here and renamed to IMAP_MAX_LINESIZE.

	* imap4.c: removed MAX_LINESIZE definition.
	(IMAPClientHandler): changed MAX_LINESIZE to IMAP_MAX_LINESIZE

2004-12-01  Aaron Stone  <aaron@serendipity.cx>

	* imapd.c, lmtpd.c, main.c, maintenance.c, pop3d.c, timsieved.c, user.c:
	improved -V output to indicate both a CVS revision and a release version,
	this is a small part of Jesse Norell's bug #131.

2004-11-30  Aaron Stone  <aaron@serendipity.cx>

	* maintenance.c: fixed several too-quiet and not-quiet-enough printf's
	according to Blake Mitchell's bug #103.

2004-11-30 Paul Stevens <paul@nfg.nl>

	* pop3.c: inititialize session.messagelst earlier to avoid segfaults

2004-11-29 Paul Stevens <paul@nfg.nl>

	* imapcommands.c (_ic_copy, ic_store): added db_getmailbox call
	to resync mailbox.

2004-11-25 Paul Stevens <paul@nfg.nl>
	
	* list.c (list_init): cleanup
	* imaputil.c (perform_imap_search): memset newset to avoid stack
	corruption.

2004-11-24  Ilja Booij  <ilja@ic-s.nl>

	* pop3.c (pop3): changed AUTH command reponse to return a '.'
	after the list of authentication mechanisms. Fixes bug #111

2004-11-23  Aaron Stone  <aaron@serendipity.cx>

	* main.c: added a check to see if there are any deliveries
	to be made before bothering to store a message not being
	delivered to anybody.
	* main.c: removed the check.
	* dsn.c, dsn.h: added DSN_CLASS_NONE status.
	* pipe.c: avoid changing the delivery status of nonexistant
	users, which are already marked for failure by dsnuser_resolve,
	unless there are valid forwarding addresses that we're happy with.

2004-11-22 Paul Stevens <paul@nfg.nl>

	* dbmsgbuf.c (db_update_msgbuf): fix off by one error.
	* imaputil.c, imaputil.h (mime_unwrap): added call to strip newline
	from string.
	* imaputil.c, imaputil.h (show_body_structure_list): unwrap mimeheader
	field values in construction of bodystructure imap response.

2004-11-22  Ilja Booij  <ilja@Ilja-Booijs-Computer.local>

	* header.c: Reverted back from "Delivered-To" to 
	"Deliver-To".

	* main.c (main): Reverted back from "Delivered-To" to 
	"Deliver-To".
	(showhelp): Reverted back from "Delivered-To" to 
	"Deliver-To".

	* pipe.c (send_reply): Reverted back from "Delivered-To" header
	to "Deliver-To".

2004-11-20  Aaron Stone  <aaron@serendipity.cx>

	* man/dbmail-util.8: put -y and -n back in, took -i out,
	and a bunch of copy edits.

2004-11-19  Aaron Stone  <aaron@serendipity.cx>

	* mysql/dbmysql.c (db_query): mysql_real_query returns -1
	on errors in MySQL 4.0 and 1 in MySQL 4.1, so we now test
	for != 0 rather than < 0.

2004-11-18  Aaron Stone  <aaron@serendipity.cx>

	* mysql/dbmysql.c (db_get_length): applied a missing portion
	of Mikhail Ramendik's dbmysql_v2.patch.

2004-11-16  Aaron Stone  <aaron@serendipity.cx>

	* lmtp.c, pop3.c, timsieve.c: added left, right and double
	quotes to validchars. NOTE: it is absolutely critical that
	SQL escaping is 100% correct from here on out.

2004-11-15  Aaron Stone  <aaron@serendipity.cx>

	* db.c, db.h: added count-only counterparts db_count_iplog
	and db_deleted_count.
	* maintenance.c: basically a rewrite. -n, -y flags are respected,
	-a flag is added. messages are cleaner, -v more useful.

2004-11-15  Paul Stevens <paul@nfg.nl>

	* db.c (db_get_mailbox): applied db_get_mailbox optimization patch.
	* db.c (db_get_mail_header): db_get_mail_header now uses a limit=1 (MR)
	* dbmysql.c: speedup by MR by reusing result set when possible.
	* dbsearch.c: speedup by MR retrieves and searches only main header when
	possible.
	* imapcommands.c (_ic_fetch): speedup by MR prefetches and reuses message 
	data more efficiently.
	* imaputil.c (build_uid_set): oneliner by MR fixes the sylpheed search
	bug.
	* db.c,dbsearch.c: strip unique_id<>'' from queries.
	* lmtp.c (lmtp): fix silly auto_reply bug.
	* dbsearch.h, imap4.c, imap4.h, imapcommands.c, imapcommands.h,
	imaputil.c, imaputil.h, list.c, list.h: applied Leif's sort patch.

2004-11-08  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_deliver_from_alias): alias is now SQL-escaped.

2004-11-05  Aaron Stone  <aaron@serendipity.cx>

	* mysql/dbmysql.c, pgsql/dbpgsql.c: renamed db_escape_string
	to db_escape_direct.
	* db.c, db.h, auth/authsql.c: added db_escape_string function as an
	easy allocating wrapper around db_escape_direct, then went through
	and escaped most all of the %s insertions in the queries.

2004-11-01  Aaron Stone  <aaron@serendipity.cx>

	* INSTALL: couple of minor edits, per Sean Kelly.
	* maintenance.c: changed references to "-f... fix" to "-r... repair"

2004-10-31  Aaron Stone  <aaron@serendipity.cx>

	* user.c (do_delete): now deletes aliases belonging to a user
	before the user is deleted; the prototype to the function now
	includes useridnr.
	* maintenance.c: -q quiet flag is respected.

2004-10-14  Ilja Booij  <ilja@Ilja-Booijs-Computer.local>

	* BUGS: points to bugtracker so we don't have to keep this file
	up to date.

2004-10-14  Ilja Booij  <ilja@ic-s.nl>

	* imapcommands.c (_ic_store): fixed check made by Paul (2004-10-08).
	There was an '=' where there should've been '=='.

2004-10-13  Ilja Booij  <ilja@ic-s.nl>

	* INSTALL.postfix: fixed typo. (closes #101). 

2004-10-08  Paul Stevens <paul@nfg.nl>

	* imapcommands.c: check permission on mailbox before setting flags 
	on messages (closes #98).

2004-09-27  Paul Stevens <paul@nfg.nl>

	* db.c, db.h, main.c, maintenance.c, serverchild.c, sievecmd.c, user.c
	(db_check_version): added a sanity check to make all tools bail out
	if the database layout looks incompatible.

2004-09-20  Ilja Booij  <ilja@ic-s.nl>

	* config.c (ReadConfig): added myfree's to previent memory leaks.
	(config_free): now free()s config_list.

2004-09-17  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_list_mailboxes_by_regex): Fixed queries. I fscked them
	up in the changes make on 2004-09-14. They work now!

2004-09-16  Ilja Booij  <ilja@ic-s.nl>

	* man/dbmail-util.8: commented out -n and -y switch docs.

	* maintenance.c (main): disabled -n switch. Now gives a message
	and stops execution.

	* man/dbmail-users.8: commented out -n and -y switch docs.

	* user.c (main): disabled -n switch. Now gives a message and stops
	execution.

	* imaputil.c (date_sql2imap): add DST information from localtime
	to sqldate.
	(retrieve_structure): fixed whitespace issue in IMAP output.
	
2004-09-15  Ilja Booij  <ilja@ic-s.nl>

	* INSTALL.postfix: host -> hosts in postfix-mysql config.

	* db.c (db_set_deleted): removed db_free_result() call that shouldn't
	have been there.
	(db_imap_append_msg): removed db_free_result() call that shouldn't
	have been there.
	(db_set_rfcsize): added two db_free_result() calls.

	* auth/authsql.c (auth_validate): added a db_free_result() statement
	where one was missing. 

	* pop3.c (pop3_handle_connection): clean up session after user has 
	logged out using db_session_cleanup(). 

2004-09-14  Ilja Booij  <ilja@ic-s.nl>

	* acl.c (acl_has_right): changed ACL_ANYONE_USER to
	DBMAIL_ACL_ANYONE_USER

	* acl.h: moved DBMAIL_ACL_ANYONE_USER to db.h

	* db.h (DBMAIL_ACL_ANYONE_USER): moved to db.h

	* db.c (db_list_mailboxes_by_regex): changed queries to work with
	DBMAIL_ACL_ANYONE_USER. Mailboxes with ACL for anyone can now also
	be listed.

	* INSTALL.postfix: small fix. Changed reference to 'aliases' table
	to 'dbmail_aliases'.

2004-09-09  Paul Stevens <paul@nfg.nl>

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: fixed several
	foreign key constraints that still refered to the old users and
	mailboxes tables.

2004-09-08  Ilja Booij  <ilja@ic-s.nl>

	* INSTALL: added notice about the use of GNU Make to INSTALL.

2004-09-06  Ilja Booij  <ilja@ic-s.nl>

	* imapcommands.c (_ic_list): change in regex to fix "%" operator. It
	does not match "/" now.
	* database creation and migration scripts: added 'anyone' user to
	database creation and migration scripts.

2004-09-03  Ilja Booij  <ilja@ic-s.nl>

	* imaputil.c (date_sql2imap): changed from array magic function to
	function using strptime() and strftime() for data parsing and
	formatting. Now adds timezone to IMAP Internal Date.
	(date_imap2sql): removed array magic and now uses strptime and
	strftime for date parsing and formatting.

2004-09-01  Aaron Stone  <aaron@serendipity.cx>

	* user.c: changed cleartext -> plaintext in the syntax help.
	* man/user.1: changed cleartext -> plaintext in the syntax help.
	* auth/authsql.c: changed cleartext -> plaintext in a debug trace.

2004-08-31  Ilja Booij  <ilja@ic-s.nl>

	* user.c (main): adding support for -u option (change username)
	which was missing.

2004-08-25  Ilja Booij  <ilja@ic-s.nl>

	* user.c (main): if the command fails, return message to command
	line.
	(do_add): returns -1 directly if user already exists.

2004-08-24  Ilja Booij  <ilja@ic-s.nl>

	* user.c (do_add): no also adds aliases if needed.

	* acl.c (acl_has_right): adapted function to also check for rights
	of 'anyone' user. This code also functions if there's no anyone
	user in the database, it just won't find any rights for the anyone
	user.

	* acl.h: added ACL_ANYONE_USER define

	* imapcommands.c (_ic_myrights): removed comma which was send
	after IMAP tag.

2004-08-23  Ilja Booij  <ilja@ic-s.nl>

	* dbmail.conf: moved POSTMASTER address from SMTP section to
	DBMAIL section. Removed DBMAIL_FROM_ADDRESS from config file.

	* rfcmsg.c (db_parse_as_text): now sets the POSTMASTER address
	from the DBMAIL section of the config file as From: address.

	* imap4.c (IMAPClientHandler): reset nfaultyresponses after a
	command was sent to the server that parsed OK.

	* vut2dbmail.c: removed from distribution. Also removed from 
	Makefile.am and ran automake && autoreconf
	
2004-08-23  Aaron Stone  <aaron@serendipity.cx>

	* man/dbmail-users.1: options -s and -S had been left out of part
	of the Synopsis section.

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: fixed faulty
	foreign key reference. Thanks to ville at thesubmachine dot com

2004-08-20  Ilja Booij  <ilja@ic-s.nl>

	* lmtp.c (lmtp): fixed an off-by-one error where the return address
	for a message was put on a list, without copying the final '\0' 
	character.

2004-08-19  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: removed foreign keys
	from auto_replies and auto_notifications. These are added later on.
	Old foreign key messageblks.message_idnr is removed.

2004-08-18  Ilja Booij  <ilja@ic-s.nl>

	* acinclude.m4: added warning to indicate that LDAP authentication
	is not stable yet.

2004-08-16  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: now also renames
	primary keys, which are not automatically renamed when renaming
	a table.

2004-08-06  Ilja Booij  <ilja@ic-s.nl>

	* dbsearch.c (db_search_range): changed query that wasn't using 
	indexes properly in PostgreSQL to one that does.

	* dbmsgbuf.c (db_dump_range): changed query that wasn't using 
	indexes properly in PostgreSQL to one that does.
	(db_init_msgfetch): changed query that wasn't using 
	indexes properly in PostgreSQL to one that does.

2004-08-05  Ilja Booij  <ilja@ic-s.nl>

	* sql/mysql/migrate_from_1.x_to_2.0.mysql:  removed removal
	of same indexes because they're not present in all installations.

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: removed removal
	of same indexes because they're not present in all installations.

	* pipe.c (store_message_temp): changed reference to 
	dbmail-maintenance to dbmail-util.

	* dbmail.conf: changed all references to dbmail-maintenance to 
	dbmail-util

	* db.h: changed all references to dbmail-maintenance to 
	dbmail-util

	* db.c: changed all references to dbmail-maintenance to 
	dbmail-util

	* INSTALL: changed references to dbmail-maintenance to dbmail-util and
	from dbmail-adduser to dbmail-users. Also changed their command lines
	to represent the new getopt() way of doing things.

2004-08-04  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/create_tables.pgsql: changed foreign key definitions
	and removed some unecessary indexes.

	* sql/mysql/create_tables.mysql: all indexes now have the right names.

	* sql/mysql/create_tables_innoDB.mysql: all indexes and foreign keys now have the
	right names.

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: added 'dbmail_'
	prefix to all tables. Changed script to do less copying of data.
	all indexes now have the right names.

	* sql/mysql/migrate_from_1.x_to_2.0.mysql: added 'dbmail_' 
	prefix to all tables. Changed script to do less copying of
	data. all indexes now have the right names.
	

2004-08-03  Ilja Booij  <ilja@ic-s.nl>

	* sql/mysql/create_tables_innoDB.mysql: add 'dbmail_' prefix
	to all tables.

	* sql/mysql/create_tables.mysql: added 'dbmail_' prefix to all
	tables.

	* sql/postgresql/create_tables.pgsql: added 'dbmail_' prefix
	to all tables, sequences and indexes

	* pgsql/dbpgsql.c (db_insert_result): added 'dbmail_' to 
	the sequence identifier.

	* sql/mysql/migrate_from_1.x_to_2.0.mysql:  auto_replies 
	and auto_notifications tables are only created if they don't 
	exist. If they do, an index on user_idnr is added to them.

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: auto_replies 
	and auto_notifications tables are only created if they don't 
	exist. If they do, an index on user_idnr is added to them.

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: auto_replies and 
	auto_notifications tables are only created if they don't exist.
	If they do, an index on user_idnr is added to them.
	Also, more importantly, all tables, sequences and indexes now
	have the 'dbmail_' prefix. 
	Finally, a lot of data copying has been avoided by doing all
	changes in place. This should save a lot of time.
	
2004-08-02  Ilja Booij  <ilja@ic-s.nl>

	* lmtp.c (lmtp): my_free(whole_message) added 
	if (headersize > READ_BLOCK_SIZE)
	(lmtp): my_free(whole_message) added if (mime_readheader() < 0)

	* server.c (StartServer): changed malloc() to my_malloc()
	(StartServer):free() -> my_free()
	
	* quota.c (quota_alloc): changed malloc() to my_malloc()
	(quota_set_root): free() -> my_free()
	(quota_free): free() -> my_free()

	* proctitleutils.c (init_set_proc_title): changed malloc() to 
	my_malloc().

	* config.c (ReadConfig): changed malloc and free to  my_malloc and 
	my_free. Added code to prevent memory leakage in event of errors.
	(config_free): changed free() to my_free()

2004-07-27  Aaron Stone  <aaron@serendipity.cx>

	* main.c: added support for address+mailbox@host syntax, needed for 
	integration with amavis-new and others, also adding the -M option to
	be able to override the "address detail mailbox."

2004-07-24  Aaron Stone  <aaron@serendipity.cx>

	* man/dbmail-users.1, man/dbmail-util.1, man/dbmail-smtp.1: updated
	several options and polished out a few formatting problems.

2004-07-24  Aaron Stone  <aaron@serendipity.cx>

	* main.c, user.c, vut2dbmail.c, maintenance.c: improved handling
	of several common command line options and added more comments.
	* user.c: fixed missing options in the optstring argument to getopt.
	* user.c: added prompt and processing for password on stdin.

2004-07-22  Aaron Stone  <aaron@serendipity.cx>

	* db.c: added acl, pbsp and subscription to the list of tables
	and added the dbmail_ prefix to them in all queries.
	* db.c: also added auto_replies and auto_notifications to the 
	list of tables and added the dbmail_ prefix to them in all queries.
	* contrib/startup-scripts/gentoo/dbmail-lmtpd,imapd,pop3d:
	pidfiles now go into /var/run rather than /var/run/dbmail
	as most people won't have that directory already existing.
	* pidfile.c (pidfile_create): added an fflush call so that filesystems
	like XFS which cache agressively will be forced to write out the pid.
	* pidfile.c (pidfile_remove): added atexit call so that the
	pidfile is cleaned up upon program termination.

2004-07-21  Aaron Stone  <aaron@serendipity.cx>

	* user.c: overhaul of argument handling ended up being a near
	rewrite of the entire utility. possibly added GCC style macro
	dependencies; they should be supplemented with portable code.
	* main.c, maintenance.c, vut2dbmail.c: improved command line
	argument handling.
	* timsieved.c, imapd.c, lmtpd.c, pop3d.c: added pidfile support
	and common command line argument handling.
	* dbmail.h: added pidfile defaults.
	* pidfile.c, pidfile.h: these are borrowed from Samba; heavily
	edited though for better compatibility with DBMail, though.
	* dbmd5.c, dbmd5.h (makemd5): added const keywords.
	* debug.h: removed a previously commented out line.
	* lmtp.c: applied patch that fixes Exim by resetting variables
	after a message has been successfully delivered.
	* db.c, dbmsgbuf.c, dbsearch.c: added dbmail_ table prefixes.
	* auth/authsql.c: added dbmail_ table prefixes.
	* auth.h (auth_adduser): now passing userid and clientid
	numerically as a u64_t rather than as a char string.
	* contrib/startup-scripts/dbmail-imap: deleted.
	* contrib/startup-scripts/dbmail-pop3: deleted.
	* contrib/startup-scripts/dbmail-imapd-gentoo: deleted.
	* contrib/startup-scripts/dbmail-pop3d-gentoo: deleted.
	* contrib/startup-scripts/gentoo/dbmail-imapd: added.
	* contrib/startup-scripts/gentoo/dbmail-lmtpd: added.
	* contrib/startup-scripts/gentoo/dbmail-pop3d: added.
	* contrib/startup-scripts/debian/dbmail-imapd: added.
	* contrib/startup-scripts/debian/dbmail-lmtpd: added.
	* contrib/startup-scripts/debian/dbmail-pop3d: added.
	* contrib/startup-scripts/README: added, to explain the new
	subdirectories of startup-scripts and to ask that those adding
	support for new distribution please contribute their scripts.
	* Makefile.am, man/Makefile.am: renamed dbmail-maintenance to
	dbmail-util and dbmail-addusers to dbmail-users.
	* man/dbmail-imapd.1: edited.
	* man/dbmail-lmtpd.1: added.
	* man/dbmail-pop3d.1: edited.
	* man/dbmail-smtp.1: edited.
	* man/dbmail-adduser.1: renamed to dbmail-users.
	* man/dbmail-users.1: edited.
	* man/dbmail-maintenance.1: renamed to dbmail-util.
	* man/dbmail-util.1: edited.
	* README: edited.

2004-07-15  Ilja Booij  <ilja@ic-s.nl>

	* sql/mysql/create_tables.mysql: messages.status changed
	to default to '0' instead of '000'

	* sql/mysql/create_tables_innoDB.mysql: messages.status changed
	to default to '0' instead of '000'

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql:messages.status 
	changed to default to '0' instead of '000'

	* sql/mysql/migrate_from_1.x_to_2.0.mysql: messages.status changed
	to default to '0' instead of '000'

	* sql/postgresql/create_tables.pgsql: added partial index to messages
	table. Changed psbp.ipnumber to INET type and added transaction 
	statements around creation statements.

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: instead of copying
	all entries from all tables from one table to another, the tables
	are simply renamed. Also, the whole migration happens within a single
	transaction.
	Also added a partial index on the messages table and changed ipnumber
	in pbsp to INET type.

2004-07-14  Ilja Booij  <ilja@ic-s.nl>

	* timsieve.c (tims_handle_connection): memleaks fixed.

	* misc.c (mailbox_add_namespace): possible memleak fixed.

2004-07-13  Ilja Booij  <ilja@ic-s.nl>

	* lmtp.c (lmtp_handle_connection): possible memleak fixed

	* imapcommands.c: added my_free to fix possible memory leak.

	* dsn.c (dsnuser_init): added my_free() to fix possible
	memory leak.

	* dbmsgbuf.c (db_init_msgfetch): fixed some possible memory 
	leaks after reports by Hans Kristian Rosbach.

2004-07-09  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_calculate_quotum_all): added my_free statements for
	freeing user_idnrs when returning with error code.

	* pop3.c (pop3_handle_connection): fixed some possible mem leaks 
	after reports from Hans Kristian Rosbach.

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: changed pbsp.idnr
	FROM BIGINT to INT8.

	* sql/postgresql/create_tables.pgsql: changed pbsp.idnr from BIGINT
	to INT8

2004-07-06  Ilja Booij  <ilja@ic-s.nl>

	* maintenance.c (main): gives more useful help. -f options is now
	used for setting config file, -f for repairing broken integrity.

	* man/dbmail-maintenance.1: updated wrt changes in command line
	options.

2004-06-29  Ilja Booij  <ilja@ic-s.nl>

	* INSTALL.postfix: updated wrt to return path setting.

	* forward.c (forward): now calls the sendmail executable with the
	-f switch to set the return path to the original return path.

2004-06-28  Ilja Booij  <ilja@ic-s.nl>

	* imaputil.c (build_args_array_ext): also accepts {681+} as mail size (not only
	{681} (681 is a random number!). This fixes an IMAP APPEND problem with
	Mozilla Thunderbird.

2004-06-18  Ilja Booij  <ilja@ic-s.nl>

	* main.c (read_whole_message_pipe): added (void *) casts to memcpy's
	arguments.

	* imaputil.c (build_args_array_ext): added (void *) casts to memcpy's
	arguments.
	(build_args_array): added (void *) casts to memcpy's arguments.

	* imapcommands.c (_ic_expunge): added (void *) casts to memcpy's
	arguments.

	* imap4.c (IMAPClientHandler): added (void *) casts to memcpy's
	arguments.

	* db.c (convert_inbox_to_uppercase): added (void *) casts to memcpy's
	arguments.

	* lmtp.c (read_whole_message_network): check if a line that's been
	read has length 0 or 1. If so, step over the line. Secondly, memcpy's
	arguments are now cast to (void *)

2004-06-16  Ilja Booij  <ilja@ic-s.nl>

	* misc.c (ci_write): ci_write() moved here

	* misc.h: ci_write() moved here.

	* lmtp.c: now uses ci_write instead of fprintf to write to socket.

	* imaputil.h: ci_write() removed (moved to misc.h)

	* imaputil.c: ci_write() removed (moved to misc.c)

	* imap4.c: now #includes misc.h for ci_write()

	* dbmail.conf: number of children and maxconnects for LMTP upped
	to 20 and 10000.

2004-06-14  Ilja Booij  <ilja@ic-s.nl>

	* pgsql/dbpgsql.c (db_query): now checks and resets the connection
	by itself. No longer uses db_check_connection.
	(db_check_connection): removed function. Was no longer in use.

2004-06-13 Aaron Stone <aaron@serendipity.cx>

	* main.c (main): initialize the variable 'header' to NULL
	so that it can be conditionally freed without a segfault.
	Thanks to Blake Mitchell for identifying this bug.

2004-06-11  Ilja Booij  <ilja@ic-s.nl>

	* config.c (config_free): fixed memory leaks by really freeing all
	memory in the list.

	* All database files: added is_header flag in messageblks
	table, and index to this flag. The flag is not used in any
	code yet, but is present because we'll need it later on.
	
2004-06-09  Ilja Booij  <ilja@ic-s.nl>

	* dbmsgbuf.c (db_dump_range): changed query to cut down
	on the number of queries. Patch by Paul J Stevens
	(db_init_msgfetch): changed query to cut down
	on the number of queries. Patch by Paul J Stevens

2004-06-03 Aaron Stone <aaron@serendipity.cx>

	* dbmail.h: added macro PRINTF_ARGS as a wrapper around
	__attribute__(format(printf...))), which is GCC specific.
	* debug.h, pop3.c, lmtp.c: now using PRINTF_ARGS.

2004-06-03  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_user_exists): escape user name using
	db_escape_string() before putting it in a query.
	(auth_md5_validate): escape username using db_escape_string()
	before putting it in a query.

	* all_files: changed from __FUNCTION__ preprocessor macro to
	__func__, which is used in C99.

	* serverchild.c (PerformChildTask): changed call to setlinebuf()
	to setvbuf() to make it work on non-BSD and non-GNU systems. The
	new call is functionally completely equivalent, it just looks
	different.

	* lmtp.c (lmtp_error): only add __attribute__ if __GNUC__
	is defined.

	* pop3.c (pop3): uses values from MessageStatus_t instead
	of hard coded values.
	(pop3_error): only add __attribute__ if __GNUC__ is defined.

	* maintenance.c (main): uses MESSAGE_STATUS_ERROR from
	MessageStatus_t instead of hard-coded value.

	* db.c: all queries which use status now use values from
	MessageStatus_t instead of hard-coded values.

	* dbsearch.c: all queries which use status now use values from
	MessageStatus_t instead of hard-coded values.

	* dbmailtypes.h: struct message now hold MessageStatus_t values

	* db.c (db_set_message_status): now accepts a MessageStatus_t
	as argument instead of an int.

	* dbmail.h: added enum MessageStatus_t to hold the different
	statusses a message can have.

2004-06-02 Aaron Stone <aaron@serendipity.cx>

	* INSTALL: reflowed text to 78 columns and consolidated two
	paragraphs about LMTP vs. SMTP into one.
	* auth/authldap.c (__auth_get_config): updated GetConfigValue
	helper macro and ReadConfig calls to new function signature. 

2004-06-01  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_findmailbox_owner): now searches for a literal
	'INBOX' if we're searching for the INBOX. No longer uses 
	lower() to get the lowercase version.
	(convert_inbox_to_uppercase): function to change the first
	5 characters of the mailbox name to INBOX
	(db_begin_transaction): function used to begin a transaction
	(db_commit_transaction): function used to commit a transaction
	(db_rollback_transaction): function used to roll back a transaction
	(db_calculate_quotum_all): now also checks for correct status.

	* pop3.c (pop3): AUTH command changed slightly to give
	X-NONE-SO-USE-APOP as authentication list and return an
	error when another AUTH mechanism is asked.

2004-05-28  Ilja Booij  <ilja@ic-s.nl>

	* db.h (DBMAIL_DELIVERY_USERNAME): define moved here from pipe.c
	
	* db.c (user_idnr_is_delivery_user_idnr): new function: checks if
	the user_idnr that is given is the user_idnr of the internal
	delivery user. Uses local static variables to reduce nr of queries.
	(db_add_quotum_used): now uses user_idnr_is_delivery_user_idnr
	(db_subtract_quotum_used): now uses user_idnr_is_delivery_user_idnr

	* main.c (main): small change. whole_message is initialised to NULL.

2004-05-25  Ilja Booij  <ilja@ic-s.nl>
	* THANKS: added Dan Weber for autoconf work

	* INSTALL: changed after removing install-dbmail.sh

	* install-dbmail.sh: removed file because it's no longer needed.
	
	* Makefile.am (DELIVER): change by Dan Weber: using 'make install'
	executables now install in /usr/local/sbin. This makes 
	install-dbmail.sh obsolete.

	* sort/sort.c: no longer includes bounce.h
	(sort_and_deliver): no longer calls bounce()

	* pipe.c: no longer includes bounce.h

	* forward.c: no longer includes bounce.h

	* lmtp.c (init_session): simple function to initialize an
	LMTP session
	(lmtp_handle_connection): now calls init_session.

	* db.c (db_calculate_quotum_all): changed query. It should now
	work when there are no messages in a user's mailbox. 

2004-05-19  Ilja Booij  <ilja@ic-s.nl>

	* lmtp.c (lmtp): fixed use of list in loop. An element was sometimes
	removed, after which it was still used -> illegal read.

2004-05-14  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (store_message_in_blocks): new function that stores
	the body of a message in several blocks (if necessary).
	(store_message_temp): changed to get message from a string, 
	instead of from a stream.
	(insert_messages): changed to get message from a string instead
	of from a stream.

	* main.c (read_whole_message_pipe): new function to read a
	complete message from a pipe.
	(main): now uses read_whole_message_pipe to get message.

	* lmtp.c (read_whole_message_network): new function to read
	a complete message from a network connection.
	(lmtp): now uses read_whole_message_network() to get the
	message from the network.

	* header.c (split_message): new function for splitting a 
	message in header and body.
	(get_rfc_size): new function for getting the rfc size of
	a message body
	(consume_header_line): new function used to get header size
	and signal end of headers.

	* header.h: removed prototype for read_header()
	(split_message): added function used for splitting message

2004-05-11  Aaron Stone  <aaron@serendipity.cx>

	* imapcommands.c: removed carriage returns and newlines
	from calls to trace (with help of a patch by Thomas Mueller).

2004-05-11  Ilja Booij  <ilja@ic-s.nl>

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: added BINARY to 
	mailboxes.name to be able to use it case sensitively.

	* sql/mysql/migrate_from_1.x_to_2.0.mysql: added BINARY to 
	mailboxes.name to be able to use it case sensitively.

	* sql/mysql/create_tables.mysql: added BINARY to mailboxes.name to
	be able to use it case-sensitively.

	* sql/mysql/create_tables_innoDB.mysql: added BINARY to mailboxes.name
	to be able to use it case sensitively.

	* EXTRAS: removed info on raw-convert and mysql2pgsql

2004-05-10  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_insert_message): added assert() statements for out paramaters.

2004-05-06  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (store_message_temp): makes use of MOD macro to determine
	position in the ringbuf ring buffer.
	(store_message_temp): added extra check to detect empty message body

	* header.c (read_header): changed some trace formats to have
	the right format (e.g. %zd for size_t etc)

	* imaputil.c (stridx): return type is now size_t. It used to
	be unsigned. The prototype already had size_t as return type, 
	but by mistake it wasn't changed in the definition.

2004-05-04  Aaron Stone  <aaron@serendipity.cx>

	* pipe.c (store_message_temp): the ring buffer now only looks
	for \n.\r\n, as some messages are in an "\n-only" format.
	* lmtp.c: changed a debugging message from TRACE_ERROR
	to TRACE_DEBUG.

2004-05-03  Aaron Stone  <aaron@serendipity.cx>

	* pipe.c (store_message_temp): added a small ring buffer to
	keep track of when a message-terminating \r\n.\r\n sequence
	arrives.

2004-04-28  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_adduser): no longer creates the mailbox
	for the new user.

	* user.c (do_add): calls db_createmailbox() to create mailbox
	for the new user.

2004-04-28  Aaron Stone  <aaron@serendipity.cx>

	* header.c (read_header): switched from fread to fgetc.
	* pipe.c (store_message_temp): switched from fread to fgetc.
	* main.c (print_usage): added two spaces to line up the columns.

2004-04-23  Aaron Stone  <aaron@serendipity.cx>

	* dsn.c/dsn.h (dsn_tostring): added new function dsn_tostring,
	which take a delivery_status_t argument and returns corresponding
	text for the class, subject and detail codes.
	* header.c (read_header): switched from fgets to fread.
	* pipe.c (store_message_temp): switched from fgets to fread.

2004-04-22  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_adduser): now adds the current timestamp
	in the last_login field of the users table if a user is added.

2004-04-21  Ilja Booij  <ilja@ic-s.nl>

	* imap4.c (IMAPClientHandler): changed i to size_t

	* imaputil.c (stridx): changed return type to size_t

	* imapcommands.c (_ic_authenticate): no checks return value of
	fgets.

	* header.c (read_header): added some my_free statements for
	freeing tmpheader on unexpected events (read errors etc).

	* forward.c (forward): prevented some buffer overflows by
	using snprintf instead if sprintf.

	* dbsearch.c (db_exec_search): added a return statement
	for case IST_DATA_TEXT. Otherwise, it could fall through
	to IST_DATA_BODY.

	* bounce.c (bounce): changed sprintf to snprintf and added
	free statements for freeing sendmail_command.

	* db.c (db_get_reply_body): fixed a FIXME by replacing complex
	code with a strdup()
	(db_isselectable): fixed a FIXME by adding extra check
	(db_noinferiors):  fixed a FIXME by adding extra check
	(db_getmailboxname): fixed a FIXME by replacing complex
	code with a strdup()
	(db_update_pop): added a check to only calculate the new quotum
	if the user_idnr is set earlier in the function.
	(db_send_message_lines): added check to fwrite. This is needed
	for when fwrite fails.
	(db_list_mailboxes_by_regex): free temporay arrays if malloc
	fails.

2004-04-19  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_deliver_from_alias): now returns strdup() of ""
	instead of the literal itself. Also, we just use strdup() to
	copy the query result to a new string.
	(db_get_notify_address): use strdup instead of complicated stuff..

	* config.c (ReadConfig): added checks to satisfy splint warnings
	(GetConfigValue): corrected some checks that did not work in the
	form they were in (tests for null pointers that were never null!)

	* acl.c (acl_get_acl): added checks and annotations.
	(acl_listrights): changed to return a string that has
	to be freed by caller. added splint annotation.

	* auth.h: (auth_user_exists) added splint annotation to 'out' 
	parameter.

	* pipe.c (send_reply): initialise escaped_send_address to hold only '\0'
	characters before sprintf-inf to it.
	(execute_auto_ran): check if GetConfigValue() actually works.
	(execute_auto_ran): changed some function calls to include checks for
	return values indicating errors.
	(discard_client_input): changed return type to int to be able to signal
	error.
	(discard_client_input): changed handling of fgets to be able to continue
	in case of a failing fgets().
	(store_message_temp): solved some possible memory leaks. Added some extra
	checks for return values.

2004-04-16  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (send_notification): fixed some possible memory leaks
	and error-prone statements (sprintf to snprintf), thanks to
	using splint.
	(send_reply): fixed some possible memory leaks
	and error-prone statements (sprintf to snprintf), thanks to
	using splint. 

	* imap4.c: ci_write() function removed (moved to imap4.c)

	* imaputil.c (ci_write): ci_write function is now added to 
	imaputil.c (was in imap4.c)

	* imapcommands.c: all fprintf statements are replaced by ci_write 
	calls to add error checking.

2004-04-15  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_check_quotum_used): changed query so it also returns 1 if
	over quotum on PostgreSQL (and Oracle). Added db_free_result() to 
	also free result if over quotum. The function now just checks if the
	query returns any rows.
	

2004-04-14  Ilja Booij  <ilja@ic-s.nl>

	* header.c (read_header): use strncat instead of strncpy to add new
	line to message

	* mysql/dbmysql.c: auth_res removed

	* mime.c (mime_readheader): now makes a copy of the block data before
	finding headers. Before, the block data was altered, which it should
	not be doing! The block is now passed a const char*

	* pgsql/dbpgsql.c: auth_res removed

	* db.c (db_get_notify_address): changed query_result to const char*
	(db_get_reply_body): changed query_result to const char*
	(db_get_useridnr): changed query_result to const char*
	(db_icheck_messageblks): changed query_result to const char*
	(db_icheck_messages): changed query_result to const char*
	(db_icheck_mailboxes): changed query_result to const char*
	(db_icheck_null_physmessages): changed query_result to const char*
	(db_send_message_lines): changed query_result to const char*
	(db_createsession): changed query_result to const char*
	(db_listmailboxchildren): changed query_result to const char*
	(db_isselectable): changed query_result to const char*
	(db_noinferiors): changed query_result to const char*
	(db_get_message_size): changed query_result to const char*
	(db_getmailboxname): changed query_result to const char*
	(db_get_msgdate): changed query_result to const char*
	(db_get_main_header): changed query_result to const char*
	(db_get_user_aliases): changed query_result to const char*
	(db_acl_get_identifier): changed query_result to const char*
	(db_get_result_int): changed tmp to const char*
	(db_get_result_bool): changed tmp to const char*
	(db_get_result_u64): changed tmp to const char*

	* dbsearch.c (db_search_range): changed query_result to const char*

	* auth/authsql.c (auth_user_exists): changed query_result to
	const char*
	(auth_get_known_users): changed_query result to const char*
	(auth_getclientid): changed query_result to const char*
	(auth_getmaxmailsize): changed query_result to const char*
	(auth_getencryption): changed query_result to const char*
	(auth_check_user): changed query_result to const char*
	(auth_check_user_ext): changed query_result to const char*
	(auth_validate): changed query_result to const char*
	(auth_md5_validate): changed query_result to const char*
	(auth_get_userid): changed query_result to const char*

	* dbmsgbuf.c (db_init_msgfetch): added a memset() to clear msgbuf before
	anything is written to it.

2004-04-13  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_findmailbox_by_regex): corrected a small error. There was a check to see
	if nchildren == 0, which should of course be *nchildren == 0
	(db_list_mailboxes_by_regex): now stores all info from database before constructing
	full names of mailboxes. 

2004-04-08  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (insert_messages): now does an extra check. If a recipient is bound
	to be labelled with TEMP_FAIL, a final check is made to check if perhaps we
	only need to forward the messages to another server. If this is the case,
	it gets the DSN_CLASS_OK label.

	* auth/authsql.c (auth_user_exists): removed use of 
	db_use_auth_result() and db_store_auth_result().
	(auth_get_known_users): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_getclientid): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_getmaxmailsize): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_getencryption):  removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_check_user): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_check_user_ext): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_adduser): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_delete_user):  removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_change_username): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_change_password): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_change_clientid): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_change_mailboxsize): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_validate): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_md5_validate): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(auth_get_userid): removed use of db_use_auth_result() and 
	db_store_auth_result().
	(__auth_insert_result): removed use of db_use_auth_result() and 
	db_store_auth_result().

	* mysql/dbmysql.c: removed db_store_auth_result(), db_use_auth_result()

	* pgsql/dbpgsql.c: removed db_store_auth_result(), db_use_auth_result()
	
2004-04-05  Ilja Booij  <ilja@ic-s.nl>

	* serverchild.c (SetChildSigHandler): add handler for SIGCHLD
	(ChildSigHandler): add case in switch for handling SIGCHLD, by
	just ignoring it!

	* db.c (db_insert_message_block_physmessage): added a memset() to
	clear the escaped_query string before using it.

	* dbsearch.c (db_search_range): corrected query to use physmessage
	table. This error was found by Paul F. De La Cruz and a fix
	was provided by Paul J Stevens.

2004-04-02  Ilja Booij  <ilja@ic-s.nl>

	* header.c (read_header): at one place, read_header returned -1,
	instead of 0.

	* auth/authsql.c (auth_validate): checks if username or password
	is NULL

	* auth/authldap.c (auth_validate): checks if username or password
	is NULL

2004-04-01  Ilja Booij  <ilja@ic-s.nl>

	* imap4.c (IMAPClientHandler): add ci_cleanup() calls before
	returning from function. All fprintf() calls are exchanged
	for ci_write() calls, which add error checking.

	* lmtp.c (lmtp_handle_connection): initialize session state to
	STRT

	* mysql/dbmysql.c (db_get_length): uses mysql_data_seek() directly
	again, without trying to do smart things which should be resolved
	by the library
	(db_get_result): uses mysql_data_seek() directly
	again, without trying to do smart things which should be resolved
	by the library. 
	(db_query): now always calls mysql_store_result(). This will result
	in res being NULL sometimes, but this should not be a problem, because
	if mysql_store_result() is not called, it will also be NULL.

2004-03-31  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_findmailbox_by_regex): now calls regfree() to free the 
	possibly allocated memory in the preg regex struct. This fixes a 
	memory leak
	(db_listmailboxchildren): Now first makes a strdup() of the mailbox
	name from db_get_result() before freeing the result set. This should
	fix some crashes.

2004-03-22  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_imap_append_msg): use db_insert_message_block_physmessage()
	instead of db_insert_message_block()
	(db_imap_append_msg): now uses db_message_set_unique_id instead
	of db_update_message to set just the unique id of the messages and
	uses db_physmessage_set_sizes for setting message size
	This saves another query!
	(db_physmessage_set_sizes): new function to set messagesize and
	rfcsize of a physmessage.
	(db_update_message): uses db_physmessage_set_sizes

	* imapcommands.c (_ic_list): change to how regex patterns are 
	constructed to allow LIST to work on shared mailboxes

	* main.c (main): now allows two or more arguments to a getopt()
	option.

2004-03-19  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (discard_client_input): new function, used to empty a 
	file stream coming from a client.

	* lmtp.c (lmtp): messages with headers that are bigger than 
	READ_BLOCK_SIZE are rejected. Some changes were made to make sure
	that we don't get anymore data from the client before sending 
	a message indicating the failure.

	* main.c (main): now rejects headers that are bigger than READ_BLOCK_SIZE.
	This lets dbmail-smtp fail with a "data format error".

2004-03-18  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: added pbsp table

	* sql/mysql/migrate_from_1.x_to_2.0.mysql: added pbsp table

	* sql/mysql/migrate_from_1.x_to_2.0_innodb.mysql: added pbsp table.

	* sql/mysql/create_tables.mysql: added pbsp table.

	* sql/postgresql/create_tables.pgsql: added pbsp table.

	* sql/mysql/create_tables_innoDB.mysql: added pbsp table.

	* pipe.c (store_message_temp): the strblock and tmpline buffers
	were not properly initialised, because they were not set to 
	contain only '\0's, which was problematic for messages containing
	an empty body.

2004-03-16  Ilja Booij  <ilja@ic-s.nl>

	* dbmsgbuf.c (db_dump_range): now only adds '\r' to every line
	if no preceeding '\r' has been found before the '\n'.

	* mime.c: removed mime_list() function because it was unused.
	(mime_readheader): now deals correctly with messages that
	have '\r\n' instead of '\n' as end of line markers.
	(is_end_of_header): function for signaling the end of a header

	* mime.h: removed mime_list() function because it was unused.

2004-03-15  Ilja Booij  <ilja@ic-s.nl>

	* mysql/dbmysql.c: added quotes around TO_DATE string

	* db.c (db_insert_physmessage_with_internal_date): removed the
	quotes that Aaron has just put in. They've moved to dbmysql.c to
	make sure PostgreSQL handling does not break.
	(db_send_message_lines): a db_get_length() call asked for the length
	of field 2 (3rd field), while there was only one field in the result
	set.

2004-03-14  Aaron Stone <aaron@serendipity.cx>

	* db.c: MySQL 4.0.14 or higher required for INSERT ... SELECT!

	* db.c (db_imap_append_msg): changed from db_check_sizelimit to
	db_check_quotum_used, eliminating three related queries.
	(db_check_quotum_used): added function to check, in just one
	query, if a user has a maxmail quotum and if a message of the
	specified size would exceed that quotum or not.
	(db_copymsg): rewritten to use the db_check_quotum_used function,
	and to use a single INSERT INTO ... SELECT FROM query, and to use
	the canonical create_unique_id function and rather than its own.
	(db_insert_physmessage_with_internal_date): fixed missing quotes.

	* dsn.c (dsnuser_free_list): added function to free a list
	containing dsnuser structures, followed by freeing the list itself.
	(dsnuser_worstcase_list): added function to find the worst
	delivery condition from a list of dsnusers.
	(dsnuser_worstcase_int): added function to find the worst
	delivery condition from three indicators: OK, TEMP, FAIL.

	* main.c (main): now uses the dsnuser_worstcase functions.

	* pipe.c (insert_messages): now uses the dsnuser_worstcase functions.

	* sort/sort.c (sort_and_deliver): return type is now dsn_class_t,
	which provides a better indicator of the success or failure of
	the delivery.

2004-03-12  Ilja Booij  <ilja@ic-s.nl>

	* acl.c (acl_get_acl): now correctly returns an ACL string with
	the ACL of the owner of the mailbox displayed.

	* imapcommands.c (_ic_getacl): now embeds the mailbox name in
	quotes to correctly deal with mailbox names that have spaces
	(_ic_listrights): now embeds the mailbox name in
	quotes to correctly deal with mailbox names that have spaces
	(_ic_myrights):  now embeds the mailbox name in
	quotes to correctly deal with mailbox names that have spaces
	
	* auth.h (auth_get_userid):  param user_idnr is now a normal
	parameter (call by value)

	* auth/authsql.c (auth_get_userid): param user_idnr is now a normal
	parameter (call by value)

	* auth/authldap.c (auth_get_userid): param user_idnr is now a normal
	parameter (call by value)

2004-03-11  Ilja Booij  <ilja@ic-s.nl>

	* imapcommands.c (_ic_append): passes the internal date through
	to to db_imap_append_msg().
	(_ic_append): sets flags for messages if needed by calling
	db_set_msgflag()

	* db.c (db_imap_append_msg): according to the rfc, the recent flag
	of a message that is append using imap append should always be set.
	this is now taken care of. db_imap_append_msg() used to set the
	\seen flag to '1', but according to the rfc, this should not be done,
	so it's been removed.
	(db_insert_physmessage_with_internal_date): new function to insert
	physmessages with an internal date.
	(db_imap_append_msg): uses db_insert_physmessage_with_internal_date()
	if an internal date is supplied. Otherwise it just uses 
	db_insert_physmessage().

2004-03-10  Ilja Booij  <ilja@ic-s.nl>

	* maintenance.c (main): uses 0 for update_curmail_size.

	* imapcommands.c (_ic_delete): uses db_delete_mailbox() instead
	of db_removemailbox(). Uses 1 for update_curmail_size.
	(_ic_close): calls db_expunge() with the user_idnr
	(_ic_expunge):calls db_expunge() with the user_idnr

	* db.h (db_insert_message_with_physmessage): removed because not used.
	(db_removemailbox): removed because not used.
	(db_rollback_insert): removed because not used

	* db.c (db_subtract_quotum_used): new function. subtract a certain
	amount from the users used quotum.
	(db_get_mailbox_size): new function. gets the total size of all 
	messages in a mailbox.
	(db_removemsg): now updated the used quotum of a user after removing
	the messages.
	(db_insert_message_with_physmessage): removed because not used.
	(db_removemailbox): removed because not used
	(db_delete_mailbox): added parameter update_curmail_size. If this
	parameter is non-zero, the curmail_size of the user has to be
	updated after removing the mailbox (or only emptying it).
	(db_empty_mailbox): uses db_delete_mailbox with 1 for 
	update_curmail_size.
	(db_rollback_insert): removed because not used
	(db_expunge): uses db_subtract_quotum_used to subtract from used quotum.
	has a new parameter. It now expects the user_idnr of the for whom the
	mailbox is expunged. This saves a new lookup of the mailbox owner.

2004-03-09  Ilja Booij  <ilja@ic-s.nl>

	* db.h: removed db_update_message_multiple()

	* sort/sort.c (sort_and_deliver): uses db_message_set_unique_id()
	to set the unique id of a message.

	* db.c (db_copymsg): does not compute the new quotum on a copy, but
	only adds the messagesize to the used quotum, which saves looking
	at all messagesize on every copy.
	(db_add_quotum_used): new functions: add a value to the current
	curmail_size of a user.
	(db_imap_append_msg): uses db_add_quotum_used instead of doing
	a complete recalculation of the used quotum.
	(db_update_message):  uses db_add_quotum_used instead of doing
	a complete recalculation of the used quotum.
	(db_message_set_unique_id): new function that only updates the
	unique id of a message.
	(db_update_message): uses db_message_set_unique_id()
	(db_update_message_multiple): removed function. Was not in use.

	* forward.c (forward): only send header through pipe if there's no
	message to send. Otherwise get the whole message from the database.
	(forward): added __FILE__ and __FUNCTION__ to all trace() calls.

	* rfcmsg.c (db_reverse_msg): changed function calls from list_reverse()
	to dbmail_list_reverse()

	* lmtp.c (lmtp): changed function call from list_reverse() to
	dbmail_list_reverse()

	* imapcommands.c (_ic_fetch): changed function call from list_reverse()
	to dbmail_list_reverse()

	* list.c (dbmail_list_reverse): renamed function from list_reverse()
	to dbmail_list_reverse()

	* list.h: renamed list_reverse() to dbmail_list_reverse() to 
	fix conflict with function exported by some MySQL versions.

2004-03-08  Aaron Stone <aaron@serendipity.cx>

	* lmtp.c: improved compliance with RFC 2033, LMTP, in two key areas:
	proper replies to the DATA command and removal of failed recipients
	from the recipients list, to prevent reporting their failures twice.
	* lmtp.c: allow for zero length envelope senders, which is common
	practice for MTA's sending bounces and other error messages.
	* misc.c (find_bounded): a zero length bounded string is now returned
	as a pointer to a zero length string (exactly one nul character)
	rather than as a NULL pointer to a nonexistant string.

2004-03-06  Aaron Stone <aaron@serendipity.cx>

	* md5.h: removed an old hack that actually broke 32 bit assumptions
	by making wrong assumptions (they may have been correct circa 1993).
	* md5.c: added check for WORDS_BIGENDIAN, corresponding to the
	autoconf script, as a backup in case the system lacks endian.h.
	* configure.in: added AC_C_BIGENDIAN to test the host for endianness.

2004-03-05  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_check_user_ext): uses lower(alias) to find
	the alias. This makes sure that searching for aliases is always done
	case-insensitively.

2004-03-04  Aaron Stone <aaron@serendipity.cx>

	* pipe.c (resolve_deliveries): moved to dsn.c, renamed, not static.
	* dsn.c (dsnuser_resolve_list): newly relocated from pipe.c.
	* dsn.h: added enum types for dsn class, updated structs to match.
	* lmtp.c: modified the delivery resolution loop to first call
	dsnuser_resolve_list and then to directly check for DSN_STATUS_OK
	rather than less reliable heuristics.
	* lmtp.c: replaced clumsy pointer math with a call to find_bounded,
	thereby also fixing a crash bug and a memory leak both relating to
	malformatted "mail from" commands.
	* lmtp.c (lmtp_handle_connection): added calls to lmtp_reset to ensure
	that memory held in the session struct is freed/zeroed when finished.
	* main.c: added a call to dsnuser_resolve_list.

2004-03-03  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_msgdate): uses the date2char function to construct a 
	TO_CHAR (PostgreSQL) or DATE_FORMAT (MySQL) string. 
	(db_get_msginfo_range):  uses the date2char function to construct a 
	TO_CHAR (PostgreSQL) or DATE_FORMAT (MySQL) string. 
	(date2char_str): construct date formatter for use in queries. This
	will always output the same format of date
	(char2date_str): construct date formatter for use in queries. This
	will make the database always handle the same format of date.
	(db_insert_physmessage): inserts the CURRENT_TIMESTAMP instead of
	making the timestamp using libc() calls.

2004-03-02  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/migrate_from_1.x_to_2.0.pgsql: alter internal_date 
	field in physmessage. This is now a TIMESTAMP WITHOUT TIME ZONE column.

	* sql/postgresql/create_tables.pgsql: alter internal_date field in
	physmessage. This is now a TIMESTAMP WITHOUT TIME ZONE column.

2004-03-01  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_copymsg): always set Recent flag of new message to '1'. The
	RFC states that this should always be the case.

2004-02-26  Ilja Booij  <ilja@ic-s.nl>

	* sql/mysql/create_tables_innoDB.mysql: removed a comma after the
	last directive in a table.

	* bounce.c (bounce): fixed a type which caused crashes when doing a
	trace.

2004-02-24  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (store_message_temp): change made by Chingson Chen 
	<chingson@msquaretech.com> to also accept messages larger than 512 kB.
	patch was altered slightly by Ilja to make it really work :)

2004-02-02  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_getmailboxname): fixed bugs with strncpy's, which resulted
	in segfaults.

	* misc.c: added missing #include <time.h>

2004-01-29  Ilja Booij  <ilja@ic-s.nl>

	* imap4.c (IMAPClientHandler): No only rebuilds mailbox_t structure
	after a NOOP, CHECK, SELECT or EXPUNGE

	* mysql/dbmysql.c (db_connect): added auto reconnect flag to MYSQL 
	structure.
	(db_check_connection): added attempt to reconnect to database.

	* db.c (db_delete_message): added db_free_result() statements to
	always free result set.
	(db_send_message_lines): added a db_free_result statements to always
	free result set.
	(db_delete_mailbox): change from getting the owner of the mailbox to 
	the beginning of the function. The owner_idnr is now found using
	the db_get_mailbox_owner() function.
	(db_listmailboxchildren): now does a check to see if any mailboxes
	can be found instead of using db_get_result() without this check.

2004-01-28  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_users_from_clientid): added db_free_result() 
	statements to always free result set.
	(db_get_notify_address): added db_free_result() statement.

	* auth/authsql.c (auth_validate): added to free() statements to
	always free the memory allocated for escuser

2004-01-27  Ilja Booij  <ilja@ic-s.nl>

	* sql/mysql/create_tables_innoDB.mysql: tables shared_mailbox and
	shared_mailbox_access removed.

	* sql/mysql/create_tables.mysql: tables shared_mailbox and 
	shared_mailbox_access removed.

	* misc.c (mailbox_remove_namespace): new function which makes a 
	simple mailbox name from a mailbox name with namespace information 

	* db.c (db_createmailbox): uses the mailbox_remove_namespace() function
	to remove possible namespace information from the mailbox name.
	(db_calculate_quotum_all): changed query. Now also counts mailbox
	size for user '0'.

	* imap4.c (imap_handler_functions): added _ic_namespace
	added IMAP_COMM_NAMESPACE to commands

	* imap4.h (IMAP_CAPABILITY_STRING): added NAMESPACE

	* imapcommands.c (_ic_namespace): added namespace command
	(_ic_create): _ic_create now uses namespace information for
	creation of mailboxes.

2004-01-26  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_get_userid): fixed a bug. a strncpy was called
	with strlen(query_result) instead of strlen(query_result) + 1

	* db.c (db_get_mailbox_owner): added function which can be used to get
	the user_idnr of the user owning the mailbox.

2004-01-23  Ilja Booij  <ilja@ic-s.nl>

	* imapcommands.c (_ic_store): checks ACLs. does different checks
	for the store of different flags. \Deleted needs 'd', \Seen needs 's'
	and other flags need 'w' permissions.
	(_ic_create): checks ACLs. Currently only checks acl of parent mailboxes.
	This should be enhanced by adding checks for namespaces when adding
	namespace stuff.

	* imap4.h (imap_store_flag_t): new enum to denote store flags.

	* db.c (db_list_mailboxes_by_regex): subscribed mailbox already looks
	at all mailboxes a user is subscribed to (probably it should only look
	at mailboxes the user has access to via ACL's!)
	(db_subscribe): uses the new subscription table.
	(db_unsubscribe): uses the new subscription table.
	(db_list_mailboxes_by_regex): updated to make sure it only looks at
	mailboxes the user has access to using ACLs. This makes for some
	very interesting, complex queries (Performance..?)

2004-01-21  Ilja Booij  <ilja@ic-s.nl>

	* imapcommands.c (_ic_select): uses ACLs
	(_ic_examine): uses ACLs
	(_ic_delete): checks if user is owner of mailbox
	(_ic_rename): checks if user is owner of mailbox
	(_ic_subscribe): checks ACL_RIGHT_LOOKUP
	(_ic_unsubscribe): checks ACL_RIGHT_LOOKUP
	(_ic_status): checks ACL_RIGHT_READ
	(_ic_append): checks ACL_RIGHT_INSERT
	(_ic_check): checks ACL_RIGHT_READ
	(_ic_close): checks ACL_RIGHT_DELETE
	(_ic_expunge): checks ACL_RIGHT_DELETE
	(_ic_search): checks ACL_RIGHT_READ
	(_ic_fetch): checks ACL_RIGHT_READ

	* imap4.h (IMAP_CAPABILITY_STRING): added ACL

2004-01-20  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_findmailbox): now functions correctly by returning 0 if
	no mailbox found.

2004-01-15  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_validate): use create_current_timestring
	to get timestring

	* auth/authldap.c (auth_validate): use create_current_timestring
	to get timestring

	* misc.c (create_current_timestring): added implementation
	of functions create_current_timestring.

	* misc.h (create_current_timestring): added function 
	create_current_timestring() which creates the timestrings used
	throughout DBMail.

	* db.c (db_insert_physmessage): use create_current_timestring to 
	get timestring

	* dbmail.h: created the timestring_t typedef, which is used
	for storing timestrings.

	* imapcommands.c (_ic_logout): use create_current_timestring to 
	get timestring
	(_ic_login): use create_current_timestring to get timestring
	(_ic_authenticate): use create_current_timestring to get timestring

2003-12-15  Ilja Booij  <ilja@ic-s.nl>

	* db.h (db_get_user_from_alias): removed function. It was not
	in use

	* db.c (db_get_main_header): added an ORDER BY clause to the 
	query getting the messageblocks. When this is omitted, no can 
	tell which block will come first, when, of course, the first
	block, with the headers, should come first. This gave nasty 
	behaviour on PostgreSQL, which did not always return the blocks 
	in the right order. This PostgreSQL behaviour is completely
	compliant with SQL by the way.
	(db_get_user_from_alias): removed function. It was not in use

2003-12-11  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_main_header): changed query to do away with an
	error generated by the wrong use of an aggregate function without
	a GROUP BY. Thanks to Thomas Mueller <dbmail@mueller.com> for
	reporting this bug

	* sql/postgresql/create_tables.pgsql: added is_subscribed to 
	shared_mailbox_acc. It was missing. Thanks to Thomas Mueller
	<dbmail@mueller.com> for reporting this bug.

2003-12-04  Ilja Booij  <ilja@ic-s.nl>
	* Makefile.am: removed raw-convert and mini-injector from 
	programs and sources lists.

	* raw-convert.c: removed

	* mini-injector.c: removed
	
2003-12-01  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_imap_append_msg): fixed a bug. db_insert_result() asked
	for "physmessages_id" instead of "physmessage_id". Thanks to
	Thomas Mueller <dbmail@tmueller.com> for this fix.
	(db_calculate_quotum_all): added a column to group by in the
	query. "usr.currmail_size" has to be in here. In MySQL, this does
	not have to be here, but PostgreSQL demands it (and rightly so)
	Thanks to Thomas Mueller <dbmail@tmueller.com> for pointing
	out this problem.

2003-11-27  Ilja Booij  <ilja@ic-s.nl>

	* pgsql/dbpgsql.c (db_connect): the connectionstring now only has
	the port number in it if the user has explicitely given the port
	number in dbmail.conf

	* maintenance.c (main): adding check for physmessages without 
	messageblocks, if the -n switch is used.

	* db.c (db_icheck_messageblks): now checks for messageblks that are 
	linked to a non-existent physmessage entry.
	(db_icheck_null_messages): now checks for messages that are linked
	to a non-existent physmessage entry
	(db_icheck_null_physmessages): checks for physmessage entries that
	are not linked to messageblocks

2003-11-26  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_delete_physmessage): new. deletes a physmessage and 
	messageblocks
	(db_delete_message): now uses db_delete_physmessage()
	(db_delete_message): now uses db_get_physmessage_id()

2003-11-24  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_insert_message_with_physmessage): inserts a message into the
	messages table for a given physmessage
	(db_insert_physmessage): insert a new physmessage record
	(db_update_physmessage): update physmessage record
	(db_insert_message_block_physmessage): inserts a messageblock for a
	given physmessage
	(db_insert_message): now uses db_insert_physmessage
	(db_update_message): now uses db_update_physmessage
	(db_insert_message_block): now uses 
	db_insert_message_block_physmessage()

2003-11-21  Ilja Booij  <ilja@ic-s.nl>

	* shared_mailbox.c (shared_mailbox_list_by_regex): same change as
	made by Alex Wheeler's patch to db_list_mailboxes_by_regex() in db.c

	* db.c (db_list_mailboxes_by_regex): patch by Alex Wheeler 
	<awheeler@royall.com>. If no mailboxes match the pattern, realloc would
	yield a NULL pointer. The function has been changed to return 0 when
	there is no matching mailbox. The patch has been changed slightly to
	also free the tmp-pointer before returning.
	(db_findmailbox_by_regex): now only calls my_free() on normal_mailboxes
	and shared_mailboxes if these are non-NULL.
	(db_findmailbox_by_regex): if no matching mailboxes are found, 0
	is returned, and *nchildren is set to 0.

	* mysql/dbmysql.c (db_get_result): patch by Alex Wheeler
	<awheeler@royall.com>. mysql_data_seek causes performance penalty. 
	Changed to use a mysql_fetch_row() instead of mysql_data_seek() when
	possible.
	(db_get_length): same patch by Alex Wheeler as db_get_result()

2003-11-20  Ilja Booij  <ilja@ic-s.nl>

	* imaputil.c (binary_search): bugfix. high could become a maxint-1 
	when high = mid-1 would be calculated if mid == 0.

2003-11-12  Ilja Booij  <ilja@ic-s.nl>

	* auth/authsql.c (auth_validate): changed interface of auth_validate
	to return int instead of u64_t. 

	* auth/authldap.c (auth_validate): changed interface of auth_validate
	to return int instead of u64_t.

	* imaputil.c (binary_search): changed function. The binary search did
	a check that was not needed. Interface of function has also changed
	to return int instead of unsigned int.

	* imap4.c (IMAPClientHandler): removed two compiler warnings by casting
	the result from strlen to an int.

	* pop3.c (pop3): included some extra checks to verify that two numbers
	given to the POP-server are actually unsigned ints in a string.
	(pop3): change call to auth_validate because of interface change

	* quota.c: changed call to db_findmailbox()

	* imapcommands.c (_ic_examine): changed call to db_findmailbox()
	(_ic_select): changed call to db_findmailbox()
	(_ic_copy): changed call to db_findmailbox()
	(_ic_create): changed calls to db_findmailbox()
	(_ic_delete): changed call to db_findmailbox()
	(_ic_rename): changed calls to db_findmailbox()
	(_ic_subscribe): changed call to db_findmailbox()
	(_ic_unsubscribe): changed call to db_findmailbox()
	(_ic_status): changed call to db_findmailbox()
	(_ic_append): changed call to db_findmailbox()
	(_ic_authenticate): changed call to auth_validate()
	(_ic_login): changed call to auth_validate()
	(_ic_fetch): changed call to db_getrfcsize()
	(_ic_fetch): casted some variables to stop warnings. This probably a 
	bit error prone (as was the original code), so this should be fixed
	in the near future.

	* db.c (db_findmailbox): changed interface to return int instead of
	u64_t.
	(db_createsession): changed call to db_findmailbox()
	(db_insert_message): changed call to db_findmailbox()
	(db_get_rfcsize): changed interface. now returns int instead of u64_t

2003-11-11  Ilja Booij  <ilja@ic-s.nl>

	* quota.c (quota_get_quota): changed call to auth_get_maxmail_size()
	to reflect change in interface.

	* auth/authldap.c (auth_user_exists): changed implementation to reflect
	change in interface.

	* vut2dbmail.c (process_piece): changed call to auth_user_exists() 
	to reflect change in interface.

	* user.c (do_empty):changed call to auth_user_exists() to reflect 
	change in interface. 
	(do_add): changed call to auth_user_exists() to reflect 
	change in interface.
	(do_change): changed call to auth_user_exists() to reflect 
	change in interface.
	(do_show): changed call to db_get_quotum_used to reflect change
	in interface.

	* pop3.c (pop3): changed call to auth_user_exists() to reflect 
	change in interface.

	* mini-injector.c (main): changed call to db_insert_message_block
	to reflect change in interfave of this function.

	* pipe.c (insert_messages): changed call to db_insert_message_block
	to reflect change in interfave of this function.
	(insert_messages): changed call to auth_user_exists() to reflect 
	change in interface.

	* db.c (db_update_message):  changed call to db_get_physmessage_id()
	to reflect change in interface of this function
	(db_get_physmessage_id): changed interface of this function to return
	a signed int instead of an u64_t.
	(db_imap_append_msg): changed calls to db_insert_message_block to 
	reflect change in interface of this function.
	(db_insert_message_block): changed interface of this function to
	return signed int instead of u64_t.
	(db_copymsg): changed call to db_get_quotum_used to reflect change
	in interface.
	(db_get_quotum_used): changed interface of this function to return
	signed int interface of u64_t.

	* dbmsgbuf.c (db_dump_range): changed call to db_get_physmessage_id()
	to reflect change in interface of this function
	(db_init_msgfetch):  changed call to db_get_physmessage_id()
	to reflect change in interface of this function

	* mime.c (mime_readheader): fixed comparison between signed and 
	unsigned by changing variables fieldlen and vallen from unsigned
	int to int

	* auth/authsql.c (auth_check_user_ext): fixed comparison between signed
	and unsigned
	(auth_check_user): fixed comparison between signed and unsigned
	(auth_getmaxmailsize): change interface, now returns int instead
	of u64_t.

	* maintenance.c (main): changed direct printf's of time values to 
	use difftime(). This is used to fix warnings on some compilers.

2003-11-07  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/create_tables.pgsql: added shared mailbox tables
	
	* sql/mysqlsql/create_tables.mysql: added shared mailbox tables

	* sql/mysqlsql/create_tables_innodb.mysql: added shared mailbox tables

	* pipe.c: changed send_notification() and send_reply to static 
	because these are local functions.

	* imap4.c (IMAPClientHandler): changed call to db_getmailbox(), 
	because interface has changed.

	* quota.c (quota_get_quotaroot): changed call db_get_mailboxid() to
	db_findmailbox()
	(quota_get_quota): fixed use of maxmail_size to not compare it to 
	'>0' because that's always true

2003-11-06  Ilja Booij  <ilja@ic-s.nl>

	* dbsearch.h: also removed db_search_messages from the prototypes

	* dbsearch.c: removed function db_search_messages because it looked
	buggy and was not used.

	* pipe.h: removed prototype of create_unique_id(), which is now 
	prototyped and implemented in misc.h & misc.c

2003-10-29  Ilja Booij  <ilja@ic-s.nl>

	* db.h, db.c (db_getmailbox_id): removed function. The same
	functionality is already handled by db_findmailbox()

	* pipe.c (send_reply): removed a erronous my_free() that was triggered
	only when no address was found to reply to.

2003-10-28  Ilja Booij  <ilja@ic-s.nl>

	* db.c, db.h (db_getmailbox): removed owner_idnr from parameter
	list. Also removed these from all calls to db_getmailbox

2003-10-24  Ilja Booij  <ilja@ic-s.nl>

	* misc.c: added create_unique_id and changed name of 
	drop_priviledges to drop_privileges (also changed calls to this
	function in imapd.c and pop3d.c

	* misc.h: added create_unique_id and doxygen comments and changed 
	drop_priviledges to drop_privileges

	* smtp-convert.c (process_mboxfile): use create_unique_id from misc.h

	* raw-convert.c (add_msg): use create_unique_id from misc.h

	* pipe.c (insert_messages): use create_unique_id() from misc.h

	* mini-injector.c (main): use create_unique_id() from misc.h

	* pop3.c (pop3_handle_connection): use create_unique_id for construc-
	ting APOP stamp

	* injector.c (main): now uses create_unique_id function from misc.h

	* pop3d.c (main): use getopt for command line options. from patch 
	against dbmail 1.2 by Jesse Norell

2003-10-23  Ilja Booij  <ilja@ic-s.nl>

	* pipe.c (send_reply): now sends an escaped command to the shell. fixes a security risk where arbitrary commands could be sent to the shell.

2003-10-22  Ilja Booij  <ilja@ic-s.nl>
    * acinclude.m4, configure.in: changed to use mysql_config and pg_config
    for getting include and lib paths

    * bounce.h (bounce): added doxygen comment

    * config.c: changed some parameter names

    * dbmail.h: added doxygen comment. removed FIELDLEN define.

    * pop3d.c, serverchild.c, imapd.c: changed to use FIELDSIZE instead of
    FIELDLEN

    * dbmailtypes.h: added enum Pop3State_t which holds the different states
    of a POP3 connection. Added PopSession_t accordingly

    * pop3.c, pop3.h: added enum Pop3Cmd_t to replace list of defines.

    * sql/postgresql/create_tables.pgsql: added foreign key constraints and
    extra indexes

2003-10-14  Ilja Booij  <ilja@ic-s.nl>

	* server.c (CreateSocket): added '= 1' to int so_reuseaddress, so a socket can now be created, even if a port is used.

	* db.c (db_get_main_header): changed query to only yield one row.

	* user.c (main): update to match new GetDBParams function 

	* maintenance.c (main): update to match new GetDBParams function 

	* main.c (main): update to match new GetDBParams function 

	* pop3d.c (main): update to match new GetDBParams function

	* imapd.c (main): update to match new GetDBParams function

	* pgsql/dbpgsql.c: use db_param_t instead of seperate field_t variables for connection
	(db_connect): use db_param_t instead of seperate field_t variables for connection. db_param_t.sock is not used at the moment.

	* mysql/dbmysql.c:
	(db_connect):  use db_param_t instead of seperate field_t variables for connection

	* dbmail.h (GetDBParams): changed database paramaters to use a struct instead of seperate field_t parameters. Also added port and socket to this db_param_t
	
2003-10-13  Ilja Booij  <ilja@ic-s.nl>

	* bounce.h (bounce): added doxygen comment. now uses bounce_reason_t to signal which reason the bounce has
	(bounce_reason_t): created this enumeration which holds all reasons why a message can be bounced. This replaces the old #defines which were used here.

	* bounce.c (bounce): improved trace messages. now uses bounce_reason_t to signal which reason the bounce has

	* dbmd5.h (makemd5): added doxygen comments

2003-10-10  Ilja Booij  <ilja@ic-s.nl>

	* pop3.c (pop3): added case for POP3_CAPA command (patch by Ryan Buttler)
	(commands): add capa command in command list (patch by Ryan Buttler)

	* pop3.h: added POP3_CAPA to command defines.

	* db.c (db_expunge): fixed segfault. *msg_idnrs array was used in the wrong way (syntax mistake). 
	(db_get_main_header): changed query to return only the messageblk (SELECT messageblk instead of SELECT *) and adapted db_get_result() call accordingly
	(db_get_reply_body): changed sprintf to snprintf
	(db_get_notify_address): changed sprintf to snprintf
	(db_send_message_lines): removed use of sprintf for filling buffer. Now use the buffer as an array instead of a string. This looks ugly but should speed things up a bit. It will also make sure we do not have to use sprintf.

2003-10-08  Ilja Booij  <ilja@ic-s.nl>

	* db.h: removed the database enumerations. They were ugly and were not used in any of the code.

2003-10-06  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_msginfo_range): corrected error: (*result)[i].uid was never set. 
	* db.c (db_copymsg): now returns id of newly inserted message

2003-10-02  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_get_physmessage_id): corrected doing query. 
	(db_update_message): corrected query: added missing space

2003-10-01  Ilja Booij  <ilja@ic-s.nl>

	* acinclude.m4 (DBMAIL_CHECK_SQL_LIBS): now use mysql_config and pg_config to find location of library files. finding of include files is still done in the "old" way. This should be fixed. 

	* maintenance.c (main): now recalculates quota when set_deleted is set (when messages that are deleted (status=2) are being set to status=3).

	* sql/postgresql/create_tables.pgsql: added currmail_size to users table

	* sql/mysql/create_tables_innoDB.mysql: added currmail_size to users table

	* sql/mysql/create_tables.mysql: added currmail_size to users table

	* db.h: (db_calculate_quotum_all): added prototype for this function

	* db.c (db_calculate_quotum_all): finds out which users need to have their quotums updated and calls db_set_quotum() to update them
	(db_set_quotum_used): sets a used quotum (currmail_size) for a user
	(db_update_message): changed return type to int

2003-09-30  Ilja Booij  <ilja@ic-s.nl>

	* sql/postgresql/create_tables.pgsql:  added physmessage table. changed messages and messageblks tables.

	* sql/mysql/create_tables_innoDB.mysql: added physmessage table. changed messages and messageblks tables. removed tmpmessage and tmpmessageblks.
	
	* db.h: (db_get_physmessage_id): prototype added

	* db.c (db_get_physmessage_id): added. finds the physmessage_id of a message_idnr
	(db_get_quotum_used): added. Reads the used_quotum value from the users table
	(db_calculate_quotum_used): renamed from db_get_quotum_used. 
	(db_update_message): now calls db_calculate_quotum_used.
	(db_imap_append_msg): calls db_calculate_quotum_used to update quotum
	(db_delete_mailbox):  calls db_calculate_quotum_used to update quotum

	* dbmsgbuf.c (db_dump_range): added use of physmessage entry.
	(db_init_msgfetch): added use of physmessage entry.

	* sql/mysql/create_tables.mysql: added physmessage table. changed messages and messageblks table. removed tmpmessage and tmpmessageblks table

2003-09-29  Ilja Booij  <ilja@ic-s.nl>

	* db.c: added physmessage to DB_TABLENAMES array
	(db_get_quotum_used): changed to fit addition of physmessage table
	(db_insert_message): now inserts an entry into the physmessage table as well as one into the messages table
	(db_update_message): now inserts information into messages table and into physmessage table
	(db_insert_message_block): finds the right physmessage_id with a message_idnr and inserts the message block
	(db_insert_message_block_multiple): updated to support physmessage table
	(db_rollback_insert): use db_delete_message() to remove the message instead of copying code..
	(db_icheck_null_messages): updated to support physmessage table
	(db_icheck_messageblks): updated to support physmessage table
	(db_delete_message): deletes message. if this was the last message with a certain physmessage_id, the physmessage and message blocks are also deleted.
	(db_delete_mailbox): deletes mailbox and call db_delete_message for all messages in it.
	(db_createsession): updated to support physmessage table.
	(db_update_pop): corrected omission of quotes around value in query
	(db_set_deleted): corrected omission of quotes around value in query
	(db_removemsg): corrected omission of quotes around value in query
	(db_copymsg): radically changed. copy now only copies an entry in the messages table and gives that entry a new unique_id. messageblocks are untouched.
	(db_get_msgflag): corrected omission of quotes around value in query
	(db_set_msgflag_range): corrected omission of quotes around value in query
	(db_get_main_header): changed to also use physmessage table
	(db_get_msginfo_range): changed to also use physmessage table
	(db_get_rfcsize): changed to also use physmessage table
	(db_set_rfcsize): changed to also use physmessage table
	(db_get_msgdate): changed to also use physmessage table
	(db_get_msgflag_all): changed to also use physmessage table

	* db.h (enum table_message): removed entries that were added in enum table_physmessage
	(enum table_physmessage): created this enum. Will hold physical message info
	(enum table_messageblk): changed link to table_message to link to table_physmessage
	(db_insert_message): changed doxygen comment

2003-09-26  Ilja Booij  <ilja@ic-s.nl>

	* db.c (db_do_cleanup): changed to a static local function
	(db_get_message_mailboxid): removed because function was unused
	
	* db.h (db_do_cleanup): removed function declaration
	(db_get_message_mailboxid): removed, because function was unused
	(db_get_msgflag_all_range): removed, because function was unused

2003-09-19	Ilja Booij <ilja@ic-s.nl>

* pgsql/dbpgsql.c (db_check_connection()): fixed a typo
	(db_use_auth_result, db_store_auth_result): added.. were missing

* THANKS: addition of the GNU THANKS file