masqmail
diff src/masqmail.c @ 367:b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
Now we use:
/*
** comment
*/
This makes the indent style simpler, too.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 20 Oct 2011 10:20:59 +0200 |
parents | 41958685480d |
children | 5781ba87df95 |
line diff
1.1 --- a/src/masqmail.c Thu Sep 22 15:07:40 2011 +0200 1.2 +++ b/src/masqmail.c Thu Oct 20 10:20:59 2011 +0200 1.3 @@ -1,20 +1,21 @@ 1.4 -/* MasqMail 1.5 - Copyright (C) 1999-2001 Oliver Kurth 1.6 - Copyright (C) 2010 markus schnalke <meillo@marmaro.de> 1.7 - 1.8 - This program is free software; you can redistribute it and/or modify 1.9 - it under the terms of the GNU General Public License as published by 1.10 - the Free Software Foundation; either version 2 of the License, or 1.11 - (at your option) any later version. 1.12 - 1.13 - This program is distributed in the hope that it will be useful, 1.14 - but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 - GNU General Public License for more details. 1.17 - 1.18 - You should have received a copy of the GNU General Public License 1.19 - along with this program; if not, write to the Free Software 1.20 - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1.21 +/* 1.22 +** MasqMail 1.23 +** Copyright (C) 1999-2001 Oliver Kurth 1.24 +** Copyright (C) 2010 markus schnalke <meillo@marmaro.de> 1.25 +** 1.26 +** This program is free software; you can redistribute it and/or modify 1.27 +** it under the terms of the GNU General Public License as published by 1.28 +** the Free Software Foundation; either version 2 of the License, or 1.29 +** (at your option) any later version. 1.30 +** 1.31 +** This program is distributed in the hope that it will be useful, 1.32 +** but WITHOUT ANY WARRANTY; without even the implied warranty of 1.33 +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.34 +** GNU General Public License for more details. 1.35 +** 1.36 +** You should have received a copy of the GNU General Public License 1.37 +** along with this program; if not, write to the Free Software 1.38 +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1.39 */ 1.40 1.41 #include <stdio.h> 1.42 @@ -34,9 +35,11 @@ 1.43 1.44 #include "masqmail.h" 1.45 1.46 -/* mutually exclusive modes. Note that there is no 'queue daemon' mode. 1.47 - It, as well as the distinction beween the two (non exclusive) daemon 1.48 - (queue and listen) modes, is handled by flags.*/ 1.49 +/* 1.50 +** mutually exclusive modes. Note that there is no 'queue daemon' mode. 1.51 +** It, as well as the distinction beween the two (non exclusive) daemon 1.52 +** (queue and listen) modes, is handled by flags. 1.53 +*/ 1.54 enum mta_mode { 1.55 MODE_NONE = 0, /* to check if a mode was set */ 1.56 MODE_ACCEPT, /* accept message on stdin (fallback mode) */ 1.57 @@ -95,11 +98,11 @@ 1.58 #endif 1.59 1.60 /* 1.61 -argv: the original argv 1.62 -argp: number of arg (may get modified!) 1.63 -cp: pointing to the char after the option 1.64 - e.g. `-d 6' `-d6' 1.65 - ^ ^ 1.66 +** argv: the original argv 1.67 +** argp: number of arg (may get modified!) 1.68 +** cp: pointing to the char after the option 1.69 +** e.g. `-d 6' `-d6' 1.70 +** ^ ^ 1.71 */ 1.72 gchar* 1.73 get_optarg(char *argv[], gint *argp, char *cp) 1.74 @@ -161,9 +164,10 @@ 1.75 1.76 conf.do_verbose = FALSE; 1.77 1.78 - /* closing and reopening the log ensures that it is open afterwards 1.79 - because it is possible that the log is assigned to fd 1 and gets 1.80 - thus closes by fclose(stdout). Similar for the debugfile. 1.81 + /* 1.82 + ** closing and reopening the log ensures that it is open afterwards 1.83 + ** because it is possible that the log is assigned to fd 1 and gets 1.84 + ** thus closes by fclose(stdout). Similar for the debugfile. 1.85 */ 1.86 logclose(); 1.87 fclose(stdin); 1.88 @@ -204,7 +208,8 @@ 1.89 1.90 /* default mode if address args or -t is specified, or called as rmail */ 1.91 static void 1.92 -mode_accept(address *return_path, gchar *full_sender_name, guint accept_flags, char **addresses, int addr_cnt) 1.93 +mode_accept(address *return_path, gchar *full_sender_name, guint accept_flags, 1.94 + char **addresses, int addr_cnt) 1.95 { 1.96 /* accept message on stdin */ 1.97 accept_error err; 1.98 @@ -293,11 +298,11 @@ 1.99 exit(0); 1.100 } else { 1.101 /* 1.102 - TODO: 1.103 - Should we really fail here? Because the mail is queued 1.104 - already. If we fail the client might submit it again. 1.105 - If at-once-delivery is seen as an additional best-effort 1.106 - service, then we should still exit successful here. 1.107 + ** TODO: Should we really fail here? Because the 1.108 + ** mail is queued already. If we fail the client 1.109 + ** might submit it again. If at-once-delivery 1.110 + ** is seen as an additional best-effort service, 1.111 + ** then we should still exit successful here. 1.112 */ 1.113 exit(1); 1.114 } 1.115 @@ -305,11 +310,11 @@ 1.116 } 1.117 1.118 /* 1.119 -if -Mrm is given 1.120 - 1.121 -currently only the `rm' command is supported 1.122 -until this changes, we don't need any facility for further commands 1.123 -return success if at least one message had been deleted 1.124 +** if -Mrm is given 1.125 +** 1.126 +** currently only the `rm' command is supported 1.127 +** until this changes, we don't need any facility for further commands 1.128 +** return success if at least one message had been deleted 1.129 */ 1.130 static int 1.131 manipulate_queue(char *cmd, char *id[]) 1.132 @@ -387,8 +392,10 @@ 1.133 if (route_name) { 1.134 conf.online_query = g_strdup_printf("/bin/echo %s", route_name); 1.135 } 1.136 - /* TODO: change behavior of `-qo without argument'? 1.137 - Because that behavior is included in -q. */ 1.138 + /* 1.139 + ** TODO: change behavior of `-qo without argument'? 1.140 + ** Because that behavior is included in -q. 1.141 + */ 1.142 ret = queue_run_online(); 1.143 } 1.144 return ret; 1.145 @@ -412,7 +419,8 @@ 1.146 with_ident = " +ident"; 1.147 #endif 1.148 1.149 - printf("%s %s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_auth, with_ident); 1.150 + printf("%s %s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_auth, 1.151 + with_ident); 1.152 } 1.153 1.154 void 1.155 @@ -462,9 +470,11 @@ 1.156 } else if (strcmp(progname, "newaliases") == 0) { 1.157 mta_mode = MODE_BI; 1.158 } else if (strcmp(progname, "rmail") == 0) { 1.159 - /* the `rmail' alias should probably be removed now 1.160 - that we have the rmail script. But let's keep it 1.161 - for some while for compatibility. 2010-06-19 */ 1.162 + /* 1.163 + ** the `rmail' alias should probably be removed now 1.164 + ** that we have the rmail script. But let's keep it 1.165 + ** for some while for compatibility. 2010-06-19 1.166 + */ 1.167 mta_mode = MODE_ACCEPT; 1.168 opt_i = TRUE; 1.169 } else if (strcmp(progname, "runq") == 0) { 1.170 @@ -601,10 +611,10 @@ 1.171 1.172 if (!mta_mode && arg==argc && !opt_t) { 1.173 /* 1.174 - In this case no rcpts can be found, thus no mail 1.175 - can be sent, thus masqmail will always fail. We 1.176 - rather do something better instead. This covers 1.177 - also the case of calling masqmail without args. 1.178 + ** In this case no rcpts can be found, thus no mail 1.179 + ** can be sent, thus masqmail will always fail. We 1.180 + ** rather do something better instead. This covers 1.181 + ** also the case of calling masqmail without args. 1.182 */ 1.183 mode_version(); 1.184 exit(0); 1.185 @@ -638,13 +648,14 @@ 1.186 1.187 init_conf(); 1.188 1.189 - /* if we are not privileged, and the config file was changed we 1.190 - implicetely set the the run_as_user flag and give up all 1.191 - privileges. 1.192 - 1.193 - So it is possible for a user to run his own daemon without 1.194 - breaking security. 1.195 - */ 1.196 + /* 1.197 + ** if we are not privileged, and the config file was changed we 1.198 + ** implicetely set the the run_as_user flag and give up all 1.199 + ** privileges. 1.200 + ** 1.201 + ** So it is possible for a user to run his own daemon without 1.202 + ** breaking security. 1.203 + */ 1.204 if ((strcmp(conf_file, CONF_FILE) != 0) && (conf.orig_uid != 0)) { 1.205 conf.run_as_user = TRUE; 1.206 set_euidgid(conf.orig_uid, conf.orig_gid, NULL, NULL); 1.207 @@ -677,12 +688,13 @@ 1.208 conf.debug_level = debug_level; 1.209 } 1.210 1.211 - /* It appears that changing to / ensures that we are never in 1.212 - a directory which we cannot access. This situation could be 1.213 - possible after changing identity. 1.214 - Maybe we should only change to / if we not run as user, to 1.215 - allow relative paths for log files in test setups for 1.216 - instance. 1.217 + /* 1.218 + ** It appears that changing to / ensures that we are never in 1.219 + ** a directory which we cannot access. This situation could be 1.220 + ** possible after changing identity. 1.221 + ** Maybe we should only change to / if we not run as user, to 1.222 + ** allow relative paths for log files in test setups for 1.223 + ** instance. 1.224 */ 1.225 chdir("/"); 1.226