From 67f4425dd42bd8b1506695f75f940deba2aef531 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 17 Jan 2000 05:14:18 +0000 Subject: [PATCH] *** empty log message *** --- citadel/citserver.c | 5 ++++- citadel/msgbase.h | 7 +++++++ citadel/serv_pop3.c | 50 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/citadel/citserver.c b/citadel/citserver.c index 43c466b85..14ab423b3 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -166,7 +166,10 @@ void RemoveContext (struct CitContext *con) unlink(con->temp); lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid); - /* Run any cleanup routines registered by loadable modules */ + /* Run any cleanup routines registered by loadable modules. + * (Must occur *before* deallocate_user_data() because the cleanup + * functions might touch dynamic session data) + */ PerformSessionHooks(EVT_STOP); syslog(LOG_NOTICE,"session %d ended", con->cs_pid); diff --git a/citadel/msgbase.h b/citadel/msgbase.h index b6c817848..d9a5cf325 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -84,3 +84,10 @@ int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int flags); char *CtdlReadMessageBody(char *terminator, size_t maxlen, char *exist); char *CtdlGetSysConfig(char *sysconfname); void CtdlPutSysConfig(char *sysconfname, char *sysconfdata); +int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */ + int mode, /* how would you like that message? */ + int headers_only, /* eschew the message body? */ + int do_proto, /* do Citadel protocol responses? */ + FILE *outfp, + int outsock +); diff --git a/citadel/serv_pop3.c b/citadel/serv_pop3.c index dfd93087c..150993f24 100644 --- a/citadel/serv_pop3.c +++ b/citadel/serv_pop3.c @@ -30,8 +30,16 @@ #include "internet_addressing.h" +struct pop3msg { + long msgnum; + size_t rfc822_length; + int deleted; + FILE *temp; +}; + struct citpop3 { /* Information about the current session */ - char FIX[3]; + struct pop3msg *msgs; + int num_msgs; }; #define POP3 ((struct citpop3 *)CtdlGetUserData(SYM_POP3)) @@ -39,6 +47,19 @@ struct citpop3 { /* Information about the current session */ long SYM_POP3; +void pop3_cleanup_function(void) { + int i; + + lprintf(9, "Performing POP3 cleanup hook\n"); + + if (POP3->num_msgs > 0) for (i=0; inum_msgs; ++i) { + fclose(POP3->msgs[i].temp); + } + if (POP3->msgs != NULL) phree(POP3->msgs); +} + + + /* * Here's where our POP3 session begins its happy day. */ @@ -47,6 +68,8 @@ void pop3_greeting(void) { strcpy(CC->cs_clientname, "POP3 session"); CC->internal_pgm = 1; CtdlAllocUserData(SYM_POP3, sizeof(struct citpop3)); + POP3->msgs = NULL; + POP3->num_msgs = 0; cprintf("+OK Welcome to the Citadel/UX POP3 server at %s\r\n", config.c_fqdn); @@ -88,8 +111,14 @@ void pop3_pass(char *argbuf) { lprintf(9, "Trying <%s>\n", password); if (CtdlTryPassword(password) == pass_ok) { - cprintf("+OK %s is logged in!\r\n", CC->usersupp.fullname); - lprintf(9, "POP3 password login successful\n"); + if (getroom(&CC->quickroom, MAILROOM) == 0) { + cprintf("+OK %s is logged in!\r\n", + CC->usersupp.fullname); + lprintf(9, "POP3 password login successful\n"); + } + else { + cprintf("-ERR can't find your mailbox\r\n"); + } } else { cprintf("-ERR That is NOT the password! Go away!\r\n"); @@ -98,6 +127,16 @@ void pop3_pass(char *argbuf) { +/* + * list available msgs + */ +void pop3_list(char *argbuf) { + cprintf("-ERR oops, not finished\r\n"); +} + + + + /* * Main command loop for POP3 sessions. */ @@ -136,6 +175,10 @@ void pop3_command_loop(void) { cprintf("-ERR Not logged in.\r\n"); } + else if (!strncasecmp(cmdbuf, "LIST", 4)) { + pop3_list(&cmdbuf[5]); + } + else { cprintf("500 I'm afraid I can't do that, Dave.\r\n"); } @@ -150,5 +193,6 @@ char *Dynamic_Module_Init(void) CtdlRegisterServiceHook(POP3_PORT, pop3_greeting, pop3_command_loop); + CtdlRegisterSessionHook(pop3_cleanup_function, EVT_STOP); return "$Id$"; } -- 2.39.2