From 6673b9539dc9b700449709655ca83efd2d6f0ffb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Thu, 26 Apr 2007 22:30:56 +0000 Subject: [PATCH] * don't use the config to get the hostname anymore, so we don't need to run suid anymore, this has caused trouble in the past once to often. --- citadel/Makefile.in | 4 ++-- citadel/citmail.c | 27 +++++++++++++++++++-------- citadel/debian/citadel-mta.postinst | 2 -- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 9d8e19cea..8c29794cb 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -152,8 +152,8 @@ citserver: $(SERV_OBJS) aidepost: aidepost.o config.o $(CC) aidepost.o config.o citadel_dirs.o $(LDFLAGS) -o aidepost $(LIBS) -citmail: citmail.o config.o citadel_dirs.o - $(CC) citmail.o config.o citadel_dirs.o $(LDFLAGS) -o citmail $(LIBS) +citmail: citmail.o citadel_dirs.o + $(CC) citmail.o citadel_dirs.o $(LDFLAGS) -o citmail $(LIBS) # setup does need LIBS defined, because it uses network functions which are in -lsocket -lnsl on Solaris. setup: setup.o tools.o citadel_dirs.o diff --git a/citadel/citmail.c b/citadel/citmail.c index 09b6c9347..e5e711378 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -26,7 +26,6 @@ #ifndef HAVE_SNPRINTF #include "snprintf.h" #endif -#include "config.h" #include "citadel_dirs.h" /* #define DEBUG */ /* uncomment to get protocol traces */ @@ -161,6 +160,10 @@ void serv_puts(char *buf) void cleanup(int exitcode) { char buf[1024]; + if (exitcode == 1) + printf ("Error while sending mail." + "Check your maildata and make shure " + "citadel is configured properly!"); serv_puts("QUIT"); serv_gets(buf); exit(exitcode); @@ -180,19 +183,30 @@ int main(int argc, char **argv) { int home=0; char relhome[PATH_MAX]=""; char ctdldir[PATH_MAX]=CTDLDIR; + char *sp, *ep; + /* TODO: should we be able to calculate relative dirs? */ calc_dirs_n_files(relh, home, relhome, ctdldir); - get_config(); - pw = getpwuid(getuid()); fp = tmpfile(); if (fp == NULL) return(errno); + serv_sock = uds_connectsock(file_lmtp_socket); + serv_gets(buf); + if (buf[0]!='2') cleanup(1); + + sp = strchr (buf, ' '); + if (sp == NULL) cleanup(1); + sp ++; + ep = strchr (sp, ' '); + if (ep == NULL) cleanup(1); + *ep = '\0'; + snprintf(fromline, sizeof fromline, "From: %s@%s", - pw->pw_name, - config.c_fqdn + pw->pw_name, + sp ); while (fgets(buf, 1024, stdin) != NULL) { if ( ( (buf[0] == 13) || (buf[0] == 10)) && (in_body == 0) ) { @@ -211,9 +225,6 @@ int main(int argc, char **argv) { } strip_trailing_nonprint(fromline); - serv_sock = uds_connectsock(file_lmtp_socket); - serv_gets(buf); - if (buf[0]!='2') cleanup(1); serv_puts("LHLO x"); do { diff --git a/citadel/debian/citadel-mta.postinst b/citadel/debian/citadel-mta.postinst index 84353c473..e8978e44d 100644 --- a/citadel/debian/citadel-mta.postinst +++ b/citadel/debian/citadel-mta.postinst @@ -5,8 +5,6 @@ set -e case "$1" in configure) - chown root:citadel /usr/sbin/sendmail - chmod 4755 /usr/sbin/sendmail ;; abort-upgrade|abort-remove|abort-deconfigure) -- 2.39.2