#include <arpa/inet.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "snprintf.h"
#endif
+
+#include "ctdl_module.h"
+
+
+
struct citsmtp { /* Information about the current session */
int command_state;
char helo_node[SIZ];
CtdlDecodeBase64(username, argbuf, SIZ);
/* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
- if (CtdlLoginExistingUser(username) == login_ok) {
+ if (CtdlLoginExistingUser(NULL, username) == login_ok) {
CtdlEncodeBase64(buf, "Password:", 9);
cprintf("334 %s\r\n", buf);
SMTP->command_state = smtp_password;
char ident[256];
char user[256];
char pass[256];
+ int result;
- CtdlDecodeBase64(decoded_authstring,
- encoded_authstring,
- strlen(encoded_authstring) );
+ CtdlDecodeBase64(decoded_authstring, encoded_authstring, strlen(encoded_authstring) );
safestrncpy(ident, decoded_authstring, sizeof ident);
safestrncpy(user, &decoded_authstring[strlen(ident) + 1], sizeof user);
safestrncpy(pass, &decoded_authstring[strlen(ident) + strlen(user) + 2], sizeof pass);
SMTP->command_state = smtp_command;
- if (CtdlLoginExistingUser(user) == login_ok) {
+
+ if (strlen(ident) > 0) {
+ result = CtdlLoginExistingUser(user, ident);
+ }
+ else {
+ result = CtdlLoginExistingUser(NULL, user);
+ }
+
+ if (result == login_ok) {
if (CtdlTryPassword(pass) == pass_ok) {
smtp_auth_greeting();
return;
-char *serv_smtp_init(void)
+CTDL_MODULE_INIT(smtp)
{
-
CtdlRegisterServiceHook(config.c_smtp_port, /* SMTP MTA */
NULL,
smtp_mta_greeting,
NULL);
CtdlRegisterServiceHook(0, /* local LMTP */
- file_lmtp_socket,
- lmtp_greeting,
- smtp_command_loop,
- NULL);
+ file_lmtp_socket,
+ lmtp_greeting,
+ smtp_command_loop,
+ NULL);
CtdlRegisterServiceHook(0, /* local LMTP */
- file_lmtp_unfiltered_socket,
- lmtp_unfiltered_greeting,
- smtp_command_loop,
- NULL);
+ file_lmtp_unfiltered_socket,
+ lmtp_unfiltered_greeting,
+ smtp_command_loop,
+ NULL);
smtp_init_spoolout();
CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);
CtdlRegisterSessionHook(smtp_cleanup_function, EVT_STOP);
CtdlRegisterProtoHook(cmd_smtp, "SMTP", "SMTP utility commands");
+
+ /* return our Subversion id for the Log */
return "$Id$";
}