passdb-vpopmail.c revision 47fed6b26c51ee17588d41ffe6a8a11271893faf
/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
/* Thanks to Courier-IMAP for showing how the vpopmail API should be used */
#include "auth-common.h"
#include "passdb.h"
#ifdef PASSDB_VPOPMAIL
#include "safe-memset.h"
#include "password-scheme.h"
#include "auth-cache.h"
#include "userdb-vpopmail.h"
#include <stdlib.h>
#define VPOPMAIL_DEFAULT_PASS_SCHEME "CRYPT"
/* pw_flags was added in vpopmail 5.4, olders use pw_gid field */
#ifndef VQPASSWD_HAS_PW_FLAGS
#endif
struct vpopmail_passdb_module {
struct passdb_module module;
struct ip_addr webmail_ip;
};
{
struct vpopmail_passdb_module *module =
(struct vpopmail_passdb_module *)_module;
/* IMAP from webmail IP may still be allowed */
return TRUE;
}
return TRUE;
}
}
return TRUE;
return FALSE;
}
static char *
enum passdb_result *result_r)
{
char *password;
return NULL;
}
"%s disabled in vpopmail for this user",
} else {
}
}
return password;
}
{
enum passdb_result result;
char *password;
return;
}
}
static void
{
enum passdb_result result;
char *crypted_pass;
int ret;
if (crypted_pass == NULL) {
return;
}
if (ret <= 0) {
return;
}
/* use putenv() directly rather than env_put() which
would leak memory every time we got here. use a
static buffer for putenv() as SUSv2 requirements
would otherwise corrupt our environment later. */
static char ip_env[256];
"TCPREMOTEIP=%s", host);
}
}
#endif
}
static struct passdb_module *
{
static bool vauth_load_initialized = FALSE;
struct vpopmail_passdb_module *module;
const char *const *tmp;
i_fatal("vpopmail: Invalid webmail IP address");
} else {
}
}
if (!vauth_load_initialized) {
if (vauth_open(0) != 0)
i_fatal("vpopmail: vauth_open() failed");
}
}
{
vclose();
}
struct passdb_module_interface passdb_vpopmail = {
"vpopmail",
NULL,
};
#else
struct passdb_module_interface passdb_vpopmail = {
.name = "vpopmail"
};
#endif