userinfo-vpopmail.c revision 555ebb032f9b8f0cdb66f27ce7374734833e7cac
/* Copyright (C) 2002 Timo Sirainen */
/* Thanks to Courier-IMAP for showing how the vpopmail API should be used */
#include "config.h"
#ifdef USERINFO_VPOPMAIL
#include "userinfo-passwd.h"
#include "mycrypt.h"
#include <stdio.h>
#include <vpopmail.h>
#include <vauth.h>
#define I_DEBUG(x) /* i_warning x */
/* Limit user and domain to 80 chars each (+1 for \0). I wouldn't recommend
raising this limit at least much, vpopmail is full of potential buffer
overflows. */
#define VPOPMAIL_LIMIT 81
{
int result;
/* vpop_user must be zero-filled or parse_email() leaves an extra
character after the user name. we'll fill vpop_domain as well
just to be sure... */
sizeof(vpop_user)-1) < 0) {
return FALSE;
}
struct vqpasswd isn't really gid at all but just some flags... */
return FALSE;
}
/* user's homedir doesn't exist yet, create it */
I_DEBUG(("vpopmail: pw_dir isn't set, creating"));
i_error("vpopmail: make_user_dir(%s, %s) failed",
return FALSE;
}
}
I_DEBUG(("vpopmail: vauth_getpw(%s, %s) failed",
vpop_user, vpop_domain));
return FALSE;
}
I_DEBUG(("vpopmail: IMAP disabled for %s@%s",
vpop_user, vpop_domain));
return FALSE;
}
/* verify password */
if (!result) {
I_DEBUG(("vpopmail: password mismatch for user %s@%s",
vpop_user, vpop_domain));
return FALSE;
}
sizeof(reply->system_user)) < 0) {
i_panic("Username too large (%u > %u)",
}
sizeof(reply->virtual_user)) < 0) {
i_panic("Username too large (%u > %u)",
}
i_panic("Home directory too large (%u > %u)",
}
return TRUE;
}
static void vpopmail_deinit(void)
{
vclose();
}
NULL,
};
#endif