#include <pwd.h>
#include <errno.h>
#include <sys/types.h>
-#include <sys/time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include <time.h>
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
}
imap_free_transmitted_message(); /* just in case. */
- IMAP->transmitted_message = mallok(literal_length);
+ IMAP->transmitted_message = mallok(literal_length + 1);
if (IMAP->transmitted_message == NULL) {
cprintf("%s NO Cannot allocate memory.\r\n", parms[0]);
return;
cprintf("+ Transmit message now.\r\n");
ret = client_read(IMAP->transmitted_message, literal_length);
+ IMAP->transmitted_message[literal_length] = 0;
if (ret != 1) {
cprintf("%s NO Read failed.\r\n", parms[0]);
return;
lprintf(9, "Converting message...\n");
msg = convert_internet_message(IMAP->transmitted_message);
+ IMAP->transmitted_message = NULL;
+ IMAP->transmitted_length = 0;
/* If the user is locally authenticated, FORCE the From: header to
* show up as the real sender. FIXME do we really want to do this?
+ * Probably should make it site-definable or even room-definable.
*/
if (CC->logged_in) {
if (msg->cm_fields['A'] != NULL) phree(msg->cm_fields['A']);