masqmail

changeset 408:f609a05ddff8

Broke long lines.
author markus schnalke <meillo@marmaro.de>
date Wed, 29 Feb 2012 10:41:51 +0100
parents 164468dd0953
children 6874a4f265c1
files src/local.c
diffstat 1 files changed, 45 insertions(+), 21 deletions(-) [+]
line diff
     1.1 --- a/src/local.c	Wed Feb 29 10:37:21 2012 +0100
     1.2 +++ b/src/local.c	Wed Feb 29 10:41:51 2012 +0100
     1.3 @@ -31,7 +31,8 @@
     1.4  	GList *node;
     1.5  
     1.6  	if (flags & MSGSTR_FROMLINE) {
     1.7 -		fprintf(out, "From <%s@%s> %s", msg->return_path->local_part, msg->return_path->domain, ctime(&now));
     1.8 +		fprintf(out, "From <%s@%s> %s", msg->return_path->local_part,
     1.9 +				msg->return_path->domain, ctime(&now));
    1.10  	}
    1.11  
    1.12  	foreach(hdr_list, node) {
    1.13 @@ -66,7 +67,8 @@
    1.14  		hdr_list = msg->hdr_list;
    1.15  
    1.16  	if (!(pw = getpwnam(user))) {
    1.17 -		logwrite(LOG_ALERT, "could not find password entry for user %s\n", user);
    1.18 +		logwrite(LOG_ALERT, "could not find password entry for "
    1.19 +				"user %s\n", user);
    1.20  		errno = ENOENT;  /* getpwnam does not set errno correctly */
    1.21  		return FALSE;
    1.22  	}
    1.23 @@ -78,7 +80,9 @@
    1.24  			uid_ok = (seteuid(pw->pw_uid) == 0);
    1.25  		}
    1.26  		if (!uid_ok || !gid_ok) {
    1.27 -			logwrite(LOG_ALERT, "could not set uid or gid for local delivery, uid = %d: %s\n", pw->pw_uid, strerror(errno));
    1.28 +			logwrite(LOG_ALERT, "could not set uid or gid for "
    1.29 +					"local delivery, uid = %d: %s\n",
    1.30 +					pw->pw_uid, strerror(errno));
    1.31  			return FALSE;
    1.32  		}
    1.33  	}
    1.34 @@ -87,7 +91,8 @@
    1.35  
    1.36  	filename = g_strdup_printf("%s/%s", conf.mail_dir, user);
    1.37  	if (!(out = fopen(filename, "a"))) {
    1.38 -		logwrite(LOG_ALERT, "could not open file %s: %s\n", filename, strerror(errno));
    1.39 +		logwrite(LOG_ALERT, "could not open file %s: %s\n",
    1.40 +				filename, strerror(errno));
    1.41  	} else {
    1.42  #ifdef USE_LIBLOCKFILE
    1.43  		gint err;
    1.44 @@ -103,7 +108,8 @@
    1.45  		if (fcntl(fileno(out), F_SETLK, &lock) != -1) {
    1.46  #endif
    1.47  			fchmod(fileno(out), 0600);
    1.48 -			message_stream(out, msg, hdr_list, MSGSTR_FROMLINE | MSGSTR_FROMHACK);
    1.49 +			message_stream(out, msg, hdr_list,
    1.50 +					MSGSTR_FROMLINE | MSGSTR_FROMHACK);
    1.51  			ok = TRUE;
    1.52  
    1.53  			/* close when still user */
    1.54 @@ -114,10 +120,12 @@
    1.55  		} else {
    1.56  			fclose(out);
    1.57  #ifdef USE_LIBLOCKFILE
    1.58 -			DEBUG(3) debugf("could not lock file %s: error %d\n", filename, err);
    1.59 +			DEBUG(3) debugf("could not lock file %s: error %d\n",
    1.60 +					filename, err);
    1.61  		}  /* XEmacs indenting convenience... */
    1.62  #else
    1.63 -			DEBUG(3) debugf("could not lock file %s: %s\n", filename, strerror(errno));
    1.64 +			DEBUG(3) debugf("could not lock file %s: %s\n",
    1.65 +					filename, strerror(errno));
    1.66  		}
    1.67  #endif
    1.68  	}
    1.69 @@ -138,10 +146,14 @@
    1.70  		**  this message will not be finished, so the user will get
    1.71  		**  the message again next time a delivery is attempted...
    1.72  		*/
    1.73 -		logwrite(LOG_ALERT, "could not set back uid or gid after local delivery: %s\n", strerror(errno));
    1.74 -		logwrite(LOG_ALERT, "uid=%d, gid=%d, euid=%d, egid=%d, want = %d, %d\n",
    1.75 -		         getuid(), getgid(), geteuid(), getegid(), saved_uid, saved_gid);
    1.76 -		logwrite(LOG_ALERT, "In case of trouble, see local.c:append_file() for details.\n", strerror(errno));
    1.77 +		logwrite(LOG_ALERT, "could not set back uid or gid after "
    1.78 +				"local delivery: %s\n", strerror(errno));
    1.79 +		logwrite(LOG_ALERT, "uid=%d, gid=%d, euid=%d, egid=%d, "
    1.80 +				"want = %d, %d\n", getuid(), getgid(),
    1.81 +				geteuid(), getegid(), saved_uid, saved_gid);
    1.82 +		logwrite(LOG_ALERT, "In case of trouble, see "
    1.83 +				"local.c:append_file() for details.\n",
    1.84 +				strerror(errno));
    1.85  		exit(1);
    1.86  	}
    1.87  	return ok;
    1.88 @@ -163,18 +175,27 @@
    1.89  
    1.90  	/* set uid and gid to the mail ids */
    1.91  	if (!conf.run_as_user) {
    1.92 -		set_euidgid(conf.mail_uid, conf.mail_gid, &saved_uid, &saved_gid);
    1.93 +		set_euidgid(conf.mail_uid, conf.mail_gid,
    1.94 +				&saved_uid, &saved_gid);
    1.95  	}
    1.96  
    1.97  	/* set environment */
    1.98  	n = 0;
    1.99 -	envp[n++] = g_strdup_printf("SENDER=%s@%s", msg->return_path->local_part, msg->return_path->domain);
   1.100 -	envp[n++] = g_strdup_printf("SENDER_DOMAIN=%s", msg->return_path->domain);
   1.101 -	envp[n++] = g_strdup_printf("SENDER_LOCAL=%s", msg->return_path->local_part);
   1.102 -	envp[n++] = g_strdup_printf("RECEIVED_HOST=%s", msg->received_host ? msg->received_host : "");
   1.103 +	envp[n++] = g_strdup_printf("SENDER=%s@%s",
   1.104 +			msg->return_path->local_part,
   1.105 +			msg->return_path->domain);
   1.106 +	envp[n++] = g_strdup_printf("SENDER_DOMAIN=%s",
   1.107 +			msg->return_path->domain);
   1.108 +	envp[n++] = g_strdup_printf("SENDER_LOCAL=%s",
   1.109 +			msg->return_path->local_part);
   1.110 +	envp[n++] = g_strdup_printf("RECEIVED_HOST=%s",
   1.111 +			msg->received_host ? msg->received_host : "");
   1.112  
   1.113 -	envp[n++] = g_strdup_printf("RETURN_PATH=%s@%s", msg->return_path->local_part, msg->return_path->domain);
   1.114 -	envp[n++] = g_strdup_printf("DOMAIN=%s", ancestor->domain);
   1.115 +	envp[n++] = g_strdup_printf("RETURN_PATH=%s@%s",
   1.116 +			msg->return_path->local_part,
   1.117 +			msg->return_path->domain);
   1.118 +	envp[n++] = g_strdup_printf("DOMAIN=%s",
   1.119 +			ancestor->domain);
   1.120  
   1.121  	envp[n++] = g_strdup_printf("LOCAL_PART=%s", ancestor->local_part);
   1.122  	envp[n++] = g_strdup_printf("USER=%s", ancestor->local_part);
   1.123 @@ -189,7 +210,8 @@
   1.124  
   1.125  	out = peidopen(cmd, "w", envp, &pid, conf.mail_uid, conf.mail_gid);
   1.126  	if (!out) {
   1.127 -		logwrite(LOG_ALERT, "could not open pipe '%s': %s\n", cmd, strerror(errno));
   1.128 +		logwrite(LOG_ALERT, "could not open pipe '%s': %s\n",
   1.129 +				cmd, strerror(errno));
   1.130  	} else {
   1.131  		message_stream(out, msg, hdr_list, flags);
   1.132  
   1.133 @@ -199,10 +221,12 @@
   1.134  
   1.135  		if (WEXITSTATUS(status) != 0) {
   1.136  			int exstat = WEXITSTATUS(status);
   1.137 -			logwrite(LOG_ALERT, "process returned %d (%s)\n", exstat, ext_strerror(1024 + exstat));
   1.138 +			logwrite(LOG_ALERT, "process returned %d (%s)\n",
   1.139 +					exstat, ext_strerror(1024 + exstat));
   1.140  			errno = 1024 + exstat;
   1.141  		} else if (WIFSIGNALED(status)) {
   1.142 -			logwrite(LOG_ALERT, "process got signal %d\n", WTERMSIG(status));
   1.143 +			logwrite(LOG_ALERT, "process got signal %d\n",
   1.144 +					WTERMSIG(status));
   1.145  		} else
   1.146  			ok = TRUE;
   1.147