SOURCES: tpop3d-cvs20051026.patch (NEW), tpop3d-cvs20050822.patch ...
arekm
arekm at pld-linux.org
Wed Oct 26 12:09:31 CEST 2005
Author: arekm Date: Wed Oct 26 10:09:31 2005 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- up to 20051026
---- Files affected:
SOURCES:
tpop3d-cvs20051026.patch (NONE -> 1.1) (NEW), tpop3d-cvs20050822.patch (1.1 -> NONE) (REMOVED)
---- Diffs:
================================================================
Index: SOURCES/tpop3d-cvs20051026.patch
diff -u /dev/null SOURCES/tpop3d-cvs20051026.patch:1.1
--- /dev/null Wed Oct 26 12:09:31 2005
+++ SOURCES/tpop3d-cvs20051026.patch Wed Oct 26 12:09:26 2005
@@ -0,0 +1,3220 @@
+diff -urNbB tpop3d-1.5.3.org/auth_flatfile.c tpop3d-1.5.3/auth_flatfile.c
+--- tpop3d-1.5.3.org/auth_flatfile.c 2003-02-18 00:18:32.000000000 +0100
++++ tpop3d-1.5.3/auth_flatfile.c 2004-06-20 02:06:30.000000000 +0200
+@@ -11,7 +11,7 @@
+ #endif /* HAVE_CONFIG_H */
+
+ #ifdef AUTH_FLATFILE
+-static const char rcsid[] = "$Id$";
++static const char rcsid[] = "$Id$";
+
+ #include <sys/types.h>
+
+@@ -86,7 +86,7 @@
+ * second field to the password hash. Any subsequent fields are ignored. */
+ static char *read_user_passwd(const char *local_part, const char *domain) {
+ FILE *fp = NULL;
+- char *filename = NULL;
++ char *filename = NULL, *result = NULL;
+ struct sverr err;
+ static char *buf, *pwhash;
+ static size_t buflen;
+@@ -149,6 +149,8 @@
+ if ((end = strchr(pwhash, ':')))
+ *end = 0;
+
++ result = pwhash;
++
+ break;
+ }
+
+@@ -159,7 +161,7 @@
+ if (filename)
+ xfree(filename);
+
+- return pwhash;
++ return result;
+ }
+
+ /* auth_flatfile_new_user_pass:
+diff -urNbB tpop3d-1.5.3.org/auth_gdbm.c tpop3d-1.5.3/auth_gdbm.c
+--- tpop3d-1.5.3.org/auth_gdbm.c 1970-01-01 01:00:00.000000000 +0100
++++ tpop3d-1.5.3/auth_gdbm.c 2005-08-05 16:48:22.000000000 +0200
+@@ -0,0 +1,196 @@
++/*
++ * auth_gdbm.c:
++ * Authenticate users using a GNU dbm file
++ *
++ * Based on auth_flatfile.h by Angel Marin, designed for tpop3d by
++ * Daniel Tiefnig at Inode, Austria. <d.tiefnig at inode.at>
++ *
++ * Copyright (c) 2004 Daniel Tiefnig. All rights reserved. This
++ * software is free software, you can modify and/or redistribute
++ * it as tpop3d itself. See the file COPYING in the base directory
++ * of your tpop3d distribution.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "configuration.h"
++#endif /* HAVE_CONFIG_H */
++
++#ifdef AUTH_GDBM
++
++#include <sys/types.h>
++
++#ifdef HAVE_CRYPT_H /* XXX */
++#include <crypt.h>
++#endif
++
++#include <unistd.h>
++#include <grp.h>
++#include <pwd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <syslog.h>
++#include <gdbm.h>
++
++#include "auth_gdbm.h"
++#include "authswitch.h"
++#include "password.h"
++#include "config.h"
++#include "util.h"
++
++static gid_t virtual_gid;
++static uid_t virtual_uid;
++static char *user_passwd_file;
++GDBM_FILE dbf;
++int persistent;
++
++/* auth_gdbm_init:
++ * Initialise the driver. Reads the config directives. */
++int auth_gdbm_init() {
++ char *s;
++
++ /* Obtain uid to use */
++ if ((s = config_get_string("auth-gdbm-mail-user"))) {
++ if (!parse_uid(s, &virtual_uid)) {
++ log_print(LOG_ERR, _("auth_gdbm_init: auth-gdbm-mail-user directive `%s' does not make sense"), s);
++ return 0;
++ }
++ } else {
++ log_print(LOG_ERR, _("auth_gdbm_init: no auth-gdbm-mail-user directive in config"));
++ return 0;
++ }
++
++ /* Obtain gid to use */
++ if ((s = config_get_string("auth-gdbm-mail-group"))) {
++ if (!parse_gid(s, &virtual_gid)) {
++ log_print(LOG_ERR, _("auth_gdbm_init: auth-gdbm-mail-group directive `%s' does not make sense"), s);
++ return 0;
++ }
++ } else {
++ log_print(LOG_ERR, _("auth_gdbm_init: no auth-gdbm-mail-group directive in config"));
++ return 0;
++ }
++
++ /* Obtain path to passwd file */
++ if ((s = config_get_string("auth-gdbm-passwd-file"))) {
++ user_passwd_file = s;
++ } else {
++ log_print(LOG_ERR, _("auth_gdbm_init: no auth-gdbm-passwd-file directive in config"));
++ return 0;
++ }
++
++ /* persistent GDBM filehandle? */
++ if (config_get_bool("auth-gdbm-persistent")) {
++ persistent = 1;
++ if((dbf=gdbm_open(user_passwd_file, 0, GDBM_READER, 0644, 0)) == NULL) {
++ log_print(LOG_ERR, _("auth_gdbm_init: could not open GNU dbm file"));
++ return 0;
++ }
++ } else {
++ persistent = 0;
++ }
++
++ return 1;
++}
++
++/* auth_gdbm_new_user_pass:
++ * Attempt to authenticate user and pass using a GNU dbm file,
++ * as configured at compile-time.
++ * This is a virtual-domains authenticator. */
++authcontext auth_gdbm_new_user_pass(const char *user, const char *local_part, const char *domain, const char *pass, const char *clienthost /* unused */, const char *serverhost /* unused */) {
++ authcontext a = NULL;
++ char *who, *address;
++ datum key, value;
++
++ if (!local_part) return NULL;
++
++ who = username_string(user, local_part, domain);
++
++ address = xmalloc(strlen(local_part) + strlen(domain) +2);
++ sprintf(address, "%s@%s", local_part, domain);
++ key.dptr = address;
++ key.dsize = strlen(address);
++
++ if (persistent) {
++ value = gdbm_fetch(dbf,key);
++ } else {
++ if((dbf=gdbm_open(user_passwd_file, 0, GDBM_READER, 0644, 0)) == NULL) {
++ log_print(LOG_ERR, _("auth_gdbm_init: could not open GNU dbm file"));
++ return 0;
++ }
++ value = gdbm_fetch(dbf,key);
++ gdbm_close(dbf);
++ }
++
++ xfree(address);
++ if(value.dptr == NULL) {
++ log_print(LOG_ERR, _("auth_gdbm_new_user_pass: could not find user %s"), who);
++ return a;
++ }
++
++ if (check_password(who, value.dptr, pass, "{crypt}"))
++ a = authcontext_new(virtual_uid, virtual_gid, NULL, NULL, NULL);
++ else
++ log_print(LOG_ERR, _("auth_gdbm_new_user_pass: failed login for %s"), who);
++
++ xfree(value.dptr);
++
++ return a;
++}
++
++/* auth_gdbm_new_apop:
++ * Attempt to authenticate user via APOP using a GNU dbm file,
++ * as configured at compile-time.
++ * This is a virtual-domains authenticator. */
++authcontext auth_gdbm_new_apop(const char *user, const char *local_part, const char *domain, const char *timestamp, const unsigned char *digest, const char *clienthost /* unused */, const char *serverhost /* unused */) {
++ authcontext a = NULL;
++ char *who, *address;
++ datum key, value;
++
++ if (!local_part) return NULL;
++
++ who = username_string(user, local_part, domain);
++
++ address = xmalloc(strlen(local_part) + strlen(domain) +2);
++ sprintf(address, "%s@%s", local_part, domain);
++ key.dptr = address;
++ key.dsize = strlen(address);
++
++ if (persistent) {
++ value = gdbm_fetch(dbf,key);
++ } else {
++ if((dbf=gdbm_open(user_passwd_file, 0, GDBM_READER, 0644, 0)) == NULL) {
++ log_print(LOG_ERR, _("auth_gdbm_init: could not open GNU dbm file"));
++ return 0;
++ }
++ value = gdbm_fetch(dbf,key);
++ gdbm_close(dbf);
++ }
++
++ xfree(address);
++ if(value.dptr == NULL) {
++ log_print(LOG_ERR, _("auth_gdbm_new_apop: could not find user %s"), who);
++ return a;
++ }
++
++ if (check_password_apop(who, value.dptr, timestamp, digest))
++ a = authcontext_new(virtual_uid, virtual_gid, NULL, NULL, NULL);
++ else
++ log_print(LOG_ERR, _("auth_gdbm_new_apop: failed login for %s"), who);
++
++ xfree(value.dptr);
++
++ return a;
++}
++
++void auth_gdbm_postfork() {
++ if (persistent)
++ gdbm_close(dbf);
++}
++
++void auth_gdbm_close() {
++ if (persistent)
++ gdbm_close(dbf);
++}
++
++#endif /* AUTH_GDBM */
+diff -urNbB tpop3d-1.5.3.org/auth_gdbm.h tpop3d-1.5.3/auth_gdbm.h
+--- tpop3d-1.5.3.org/auth_gdbm.h 1970-01-01 01:00:00.000000000 +0100
++++ tpop3d-1.5.3/auth_gdbm.h 2005-08-05 16:48:22.000000000 +0200
+@@ -0,0 +1,35 @@
++/*
++ * auth_gdbm.h:
++ * Authenticate users using a GNU dbm file
++ *
++ * Based on auth_flatfile.h by Angel Marin, designed for tpop3d by
++ * Daniel Tiefnig at Inode, Austria. <d.tiefnig at inode.at>
++ *
++ * Copyright (c) 2004 Daniel Tiefnig. All rights reserved. This
++ * software is free software, you can modify and/or redistribute
++ * it as tpop3d itself. See the file COPYING in the base directory
++ * of your tpop3d distribution.
++ */
++
++#ifndef __AUTH_GDBM_H_ /* include guard */
++#define __AUTH_GDBM_H_
++
++#ifdef HAVE_CONFIG_H
++#include "configuration.h"
++#endif /* HAVE_CONFIG_H */
++
++#ifdef AUTH_GDBM
++
++#include "authswitch.h"
++
++/* auth_gdbm.c */
++int auth_gdbm_init(void);
++authcontext auth_gdbm_new_user_pass(const char *user, const char *local_part, const char *domain, const char *pass, const char *clienthost, const char *serverhost);
++authcontext auth_gdbm_new_apop(const char *user, const char *local_part, const char *domain, const char *timestamp, const unsigned char *digest, const char *clienthost, const char *serverhost);
++void auth_gdbm_postfork(void);
++void auth_gdbm_close(void);
++
++
++#endif /* AUTH_GDBM */
++
++#endif /* __AUTH_GDBM_H_ */
+diff -urNbB tpop3d-1.5.3.org/auth_mysql.c tpop3d-1.5.3/auth_mysql.c
+--- tpop3d-1.5.3.org/auth_mysql.c 2003-07-15 01:31:20.000000000 +0200
++++ tpop3d-1.5.3/auth_mysql.c 2004-08-20 01:57:05.000000000 +0200
+@@ -11,7 +11,7 @@
+ #endif /* HAVE_CONFIG_H */
+
+ #ifdef AUTH_MYSQL
+-static const char rcsid[] = "$Id$";
++static const char rcsid[] = "$Id$";
+
+ #include <sys/types.h> /* BSD needs this here, apparently. */
+
+@@ -44,7 +44,7 @@
+ * [2] unix user
+ * [3] mailbox type
+ */
+-char *user_pass_query_template =
++static char *user_pass_query_template =
+ "SELECT concat(domain.path, '/', popbox.mbox_name), popbox.password_hash, "
+ "domain.unix_user, 'bsd' "
+ "FROM popbox, domain "
+@@ -52,7 +52,7 @@
+ "AND popbox.domain_name = '$(domain)' "
+ "AND popbox.domain_name = domain.domain_name";
+
+-char *apop_query_template =
++static char *apop_query_template =
+ "SELECT concat(domain.path, '/', popbox.mbox_name), popbox.password_hash, "
+ "domain.unix_user, 'bsd' "
+ "FROM popbox, domain "
+@@ -60,20 +60,20 @@
+ "AND popbox.domain_name = '$(domain)' "
+ "AND popbox.domain_name = domain.domain_name";
+
+-char *onlogin_query_template = NULL;
++static char *onlogin_query_template = NULL;
+
+ /* GID used to access mail spool (if any). */
+-int use_gid;
+-gid_t mail_gid;
++static int use_gid;
++static gid_t mail_gid;
+
+ static char *substitute_query_params(const char *temp, const char *user, const char *local_part, const char *domain, const char *clienthost, const char *serverhost);
+
+ /*
+ * Connection to the MySQL server.
+ */
+-MYSQL *mysql = NULL;
+-tokens mysql_servers;
+-char mysql_driver_active = 0;
++static MYSQL *mysql = NULL;
++static tokens mysql_servers;
++static char mysql_driver_active = 0;
+
+ /* get_mysql_server:
+ * If we are not currently connected to a MySQL server, or if the current MySQL
+@@ -267,7 +267,7 @@
+
+ /* User was not lying (about her password) */
+ if (!parse_uid((const char*)row[2], &uid)) {
+- log_print(LOG_ERR, _("auth_mysql_new_apop: unix user `%s' for %s does not make sense"), row[3], who);
++ log_print(LOG_ERR, _("auth_mysql_new_apop: unix user `%s' for %s does not make sense"), row[2], who);
+ break;
+ }
+
+@@ -367,7 +367,7 @@
+ }
+
+ if (!parse_uid((const char*)row[2], &uid)) {
+- log_print(LOG_ERR, _("auth_mysql_new_user_pass: unix user `%s' for %s does not make sense"), row[3], who);
++ log_print(LOG_ERR, _("auth_mysql_new_user_pass: unix user `%s' for %s does not make sense"), row[2], who);
+ break;
+ }
+
+diff -urNbB tpop3d-1.5.3.org/auth_pgsql.c tpop3d-1.5.3/auth_pgsql.c
+--- tpop3d-1.5.3.org/auth_pgsql.c 2003-07-15 01:31:20.000000000 +0200
++++ tpop3d-1.5.3/auth_pgsql.c 2004-08-20 01:57:05.000000000 +0200
+@@ -13,7 +13,7 @@
+ #endif /* HAVE_CONFIG_H */
+
+ #ifdef AUTH_PGSQL
+-static const char rcsid[] = "$Id$";
++static const char rcsid[] = "$Id$";
+
+ #include <sys/types.h> /* BSD needs this here, apparently. */
+
+@@ -105,7 +105,7 @@
+ * [2] unix user
+ * [3] mailbox type
+ */
+-char *user_pass_query_template =
++static char *user_pass_query_template =
+ "SELECT domain.path || '/' || popbox.mbox_name, popbox.password_hash, "
+ "domain.unix_user, 'bsd' "
+ "FROM popbox, domain "
+@@ -113,7 +113,7 @@
+ "AND popbox.domain_name = '$(domain)' "
+ "AND popbox.domain_name = domain.domain_name";
+
+-char *apop_query_template =
++static char *apop_query_template =
+ "SELECT domain.path || '/' || popbox.mbox_name, popbox.password_hash, "
+ "domain.unix_user, 'bsd' "
+ "FROM popbox, domain "
+@@ -121,11 +121,11 @@
+ "AND popbox.domain_name = '$(domain)' "
+ "AND popbox.domain_name = domain.domain_name";
+
+-char *onlogin_query_template = NULL;
++static char *onlogin_query_template = NULL;
+
+ /* GID used to access mail spool (if any). */
+-int use_gid;
+-gid_t mail_gid;
++static int use_gid;
++static gid_t mail_gid;
+
+ static char *substitute_query_params(const char *temp, const char *user, const char *local_part, const char *domain, const char *clienthost, const char *serverhost);
+
+@@ -148,7 +148,7 @@
+ * Initialise the database connection driver. Clears the config directives
+ * associated with the database so that a user cannot recover them with a
+ * debugger. */
+-PGconn *pg_conn;
++static PGconn *pg_conn;
+
+ int auth_pgsql_init(void) {
+ char *username = NULL, *password = NULL, *hostname = NULL, *database = NULL, *localhost = "localhost", *s;
+diff -urNbB tpop3d-1.5.3.org/authswitch.c tpop3d-1.5.3/authswitch.c
+--- tpop3d-1.5.3.org/authswitch.c 2003-11-24 20:58:28.000000000 +0100
++++ tpop3d-1.5.3/authswitch.c 2005-10-26 12:04:39.000000000 +0200
+@@ -6,7 +6,7 @@
+ *
+ */
+
+-static const char rcsid[] = "$Id$";
++static const char rcsid[] = "$Id$";
+
+ #ifdef HAVE_CONFIG_H
+ #include "configuration.h"
+@@ -19,6 +19,7 @@
+
+ #include <unistd.h>
+ #include <sys/types.h>
++#include <ctype.h>
+
+ #ifdef AUTH_LDAP
+ #include "auth_ldap.h"
+@@ -52,6 +53,10 @@
+ #include "auth_passwd.h"
+ #endif /* AUTH_PASSWD */
+
++#ifdef AUTH_GDBM
++#include "auth_gdbm.h"
++#endif /* AUTH_GDBM */
++
+ #ifdef USE_WHOSON
+ #include <whoson.h>
+ #endif
+@@ -122,6 +127,13 @@
+ "flatfile",
+ _X("Uses /etc/passwd-style flat files")},
+ #endif /* AUTH_FLATFILE */
++
++#ifdef AUTH_GDBM
++ /* Authenticate against GNU dbm files. */
++ {auth_gdbm_init, auth_gdbm_new_apop, auth_gdbm_new_user_pass, NULL, auth_gdbm_postfork, auth_gdbm_close,
++ "gdbm",
++ _X("Uses GNU dbm files")},
++#endif /* AUTH_GDBM */
+ };
+
+ int *auth_drivers_running;
+@@ -290,10 +302,9 @@
+ l = NULL;
+ }
+
+- if ((a = authcache_new_user_pass(user, l, d, pass, clienthost, serverhost)))
+- return a;
+-
+- for (aa = auth_drivers, aar = auth_drivers_running; aa < auth_drivers_end; ++aa, ++aar)
++ /* Try auth cache, then actual auth drivers. */
++ if (!(a = authcache_new_user_pass(user, l, d, pass, clienthost, serverhost))) {
++ for (aa = auth_drivers, aar = auth_drivers_running; aa < auth_drivers_end; ++aa, ++aar) {
+ if (*aar && aa->auth_new_user_pass && (a = aa->auth_new_user_pass(user, l, d, pass, clienthost, serverhost))) {
+ a->auth = xstrdup(aa->name);
+ a->user = xstrdup(user);
+@@ -309,6 +320,8 @@
+ log_print(LOG_INFO, _("authcontext_new_user_pass: began session for `%s' with %s; uid %d, gid %d"), a->user, a->auth, a->uid, a->gid);
+ break;
+ }
++ }
++ }
+
+ xfree(x);
+
+@@ -330,7 +343,7 @@
+ #ifdef USE_WHOSON
+ char buf[128] = {0};
+ /* Notify whoson server the user has logged in correctly */
+- if (wso_login(clienthost, A->user, buf, sizeof(buf)) == -1)
++ if (whoson_enable && wso_login(clienthost, A->user, buf, sizeof(buf)) == -1)
+ log_print(LOG_ERR, "authswitch_onlogin: wso_login: %s", buf);
+ #endif /* USE_WHOSON */
+
+@@ -377,6 +390,7 @@
+ * Fill in a new authentication context structure with the given information. */
+ authcontext authcontext_new(const uid_t uid, const gid_t gid, const char *mboxdrv, const char *mailbox, const char *home) {
+ authcontext a;
++ char *mp;
+
+ alloc_struct(_authcontext, a);
+
+@@ -385,8 +399,13 @@
+
+ if (mboxdrv)
+ a->mboxdrv = xstrdup(mboxdrv);
+- if (mailbox)
++ if (mailbox) {
+ a->mailbox = xstrdup(mailbox);
++ if (config_get_bool("lowercase-mailbox"))
++ for (mp = a->mailbox; *mp; *mp++)
++ *mp = tolower(*mp);
++ }
++
+
+ a->auth = NULL;
+ a->user = NULL;
+diff -urNbB tpop3d-1.5.3.org/cfgdirectives.c tpop3d-1.5.3/cfgdirectives.c
+--- tpop3d-1.5.3.org/cfgdirectives.c 2003-11-24 20:58:28.000000000 +0100
++++ tpop3d-1.5.3/cfgdirectives.c 2005-10-26 12:04:39.000000000 +0200
+@@ -9,7 +9,7 @@
+ *
+ */
+
+-static const char rcsid[] = "$Id$";
++static const char rcsid[] = "$Id$";
+
+ #ifdef HAVE_CONFIG_H
+ #include "configuration.h"
+@@ -25,6 +25,7 @@
+ "append-domain",
+ "strip-domain",
+ "timeout-seconds",
++ "tcp-send-buffer",
+ "log-facility",
+ "log-stderr",
+ "apop-only",
+@@ -33,6 +34,10 @@
+ "permit-empty-passwords",
+ "onlogin-child-wait",
+ "log-bad-passwords",
++ "no-commit-on-early-close",
++ "lowercase-user",
++ "lowercase-mailbox",
++ "uidl-style",
+
+ #if defined(MBOX_BSD) && defined(MBOX_BSD_SAVE_INDICES)
+ "mailspool-index",
+@@ -52,6 +57,10 @@
+
+ #ifdef MBOX_MAILDIR
+ "maildir-exclusive-lock",
++ "maildir-recursion",
++ "maildir-ignore-folders",
++ "maildir-evaluate-filename",
++ "maildir-size-string",
+ #endif
+
+ #ifdef USE_TLS
+@@ -145,6 +154,14 @@
+ "auth-flatfile-passwd-file",
+ #endif /* AUTH_FLATFILE */
+
++#ifdef AUTH_GDBM
++ "auth-gdbm-enable",
++ "auth-gdbm-mail-user",
++ "auth-gdbm-mail-group",
++ "auth-gdbm-passwd-file",
++ "auth-gdbm-persistent",
++#endif
++
+ /* final entry must be NULL */
+ NULL};
+
+diff -urNbB tpop3d-1.5.3.org/CHANGES tpop3d-1.5.3/CHANGES
+--- tpop3d-1.5.3.org/CHANGES 2003-11-24 21:26:07.000000000 +0100
++++ tpop3d-1.5.3/CHANGES 2005-10-26 12:04:38.000000000 +0200
+@@ -1,5 +1,27 @@
+ Changes for tpop3d
+-$Id$
++$Id$
++
++Removed the test which ignored messages in a maildir having modification times
++in the future, replacing it with a warning about possible clock synchronisation
++errors, following a suggestion of Matthew Trent. Fixed a (recently-introduced)
++bug in the maildir code which could cause a segmentation fault on misconfigured
++systems. Made a minor change to the way multi-line responses are transmitted,
++which may help some broken clients to work with tpop3d. Made some changes to
++the transmission of messages which may improve performance for clients on very
++fast networks, and added a tcp-send-buffer configuration option to control the
++SO_SNDBUF socket parameter. Fixed a couple of memory leaks; thanks to Richard
++Fuchs and Daniel Tiefnig from Inode for identifying those and supplying a
++patch. The same authors also supplied code to enable recursion into subfolders
++of a maildir mailbox (maildir-recursion config option). Added support for SHA1
++passwords, and fixed a bug in the MD5 base64 password code. By default, commit
++changes on close-after-QUIT (`Microsoft Outlook bug' workaround), with an
++option to restore the previous, correct, behaviour. Added support for
++intelligent filenames in maildirs (maildir-evaluate-filename config option) to
++avoid calls to stat(). New authenticator auth_gdbm added. Fixed bug with PID
++file handling after HUP signals. Added lowercase options for POP3 USER command
++and maildir database lookups. Added support for qmail-pop3d style UIDLs. (Adds
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list