masqmail
changeset 28:71605f542ecc
flattened conditional nesting
author | meillo@marmaro.de |
---|---|
date | Thu, 06 May 2010 11:52:34 +0200 |
parents | 3654c502a4df |
children | 7cdd30429cc9 |
files | src/conf.c |
diffstat | 1 files changed, 413 insertions(+), 407 deletions(-) [+] |
line diff
1.1 --- a/src/conf.c Thu May 06 11:50:40 2010 +0200 1.2 +++ b/src/conf.c Thu May 06 11:52:34 2010 +0200 1.3 @@ -88,22 +88,22 @@ 1.4 GList *list = NULL; 1.5 FILE *fptr; 1.6 1.7 - if ((fptr = fopen(fname, "rt"))) { 1.8 - gchar buf[256]; 1.9 - 1.10 - while (!feof(fptr)) { 1.11 - fgets(buf, 255, fptr); 1.12 - if (buf[0] && (buf[0] != '#') && (buf[0] != '\n')) { 1.13 - g_strchomp(buf); 1.14 - list = g_list_append(list, g_strdup(buf)); 1.15 - } 1.16 - } 1.17 - fclose(fptr); 1.18 - } else { 1.19 + if ((fptr = fopen(fname, "rt")) == NULL) { 1.20 logwrite(LOG_ALERT, "could not open %s for reading: %s\n", fname, strerror(errno)); 1.21 exit(EXIT_FAILURE); 1.22 } 1.23 1.24 + gchar buf[256]; 1.25 + 1.26 + while (!feof(fptr)) { 1.27 + fgets(buf, 255, fptr); 1.28 + if (buf[0] && (buf[0] != '#') && (buf[0] != '\n')) { 1.29 + g_strchomp(buf); 1.30 + list = g_list_append(list, g_strdup(buf)); 1.31 + } 1.32 + } 1.33 + fclose(fptr); 1.34 + 1.35 return list; 1.36 } 1.37 1.38 @@ -167,25 +167,27 @@ 1.39 GList *res_list = NULL; 1.40 1.41 list = parse_list(line, FALSE); 1.42 - if (list) { 1.43 - foreach(list, list_node) { 1.44 - gchar *item = (gchar *) (list_node->data); 1.45 - if (strcmp(item, "byname") == 0) { 1.46 - res_list = g_list_append(res_list, resolve_byname); 1.47 + if (!list) { 1.48 + return NULL; 1.49 + } 1.50 + 1.51 + foreach(list, list_node) { 1.52 + gchar *item = (gchar *) (list_node->data); 1.53 + if (strcmp(item, "byname") == 0) { 1.54 + res_list = g_list_append(res_list, resolve_byname); 1.55 #ifdef ENABLE_RESOLVER 1.56 - } else if (strcmp(item, "dns_a") == 0) { 1.57 - res_list = g_list_append(res_list, resolve_dns_a); 1.58 - } else if (strcmp(item, "dns_mx") == 0) { 1.59 - res_list = g_list_append(res_list, resolve_dns_mx); 1.60 + } else if (strcmp(item, "dns_a") == 0) { 1.61 + res_list = g_list_append(res_list, resolve_dns_a); 1.62 + } else if (strcmp(item, "dns_mx") == 0) { 1.63 + res_list = g_list_append(res_list, resolve_dns_mx); 1.64 #endif 1.65 - } else { 1.66 - logwrite(LOG_ALERT, "unknown resolver %s\n", item); 1.67 - exit(EXIT_FAILURE); 1.68 - } 1.69 - g_free(item); 1.70 + } else { 1.71 + logwrite(LOG_ALERT, "unknown resolver %s\n", item); 1.72 + exit(EXIT_FAILURE); 1.73 } 1.74 - g_list_free(list); 1.75 + g_free(item); 1.76 } 1.77 + g_list_free(list); 1.78 return res_list; 1.79 } 1.80 1.81 @@ -233,27 +235,27 @@ 1.82 *(q++) = *(p++); 1.83 *q = '\0'; 1.84 1.85 - if ((addr.s_addr = inet_addr(buf)) != INADDR_NONE) { 1.86 - if (*p) { 1.87 - guint i; 1.88 - p++; 1.89 - i = atoi(p); 1.90 - if ((i >= 0) && (i <= 32)) 1.91 - n = i ? ~((1 << (32 - i)) - 1) : 0; 1.92 - else { 1.93 - fprintf(stderr, "'%d' is not a valid net mask (must be >= 0 and <= 32)\n", i); 1.94 - exit(EXIT_FAILURE); 1.95 - } 1.96 - } else 1.97 - n = 0; 1.98 - 1.99 - mask_addr.s_addr = htonl(n); 1.100 - net_addr.s_addr = mask_addr.s_addr & addr.s_addr; 1.101 - } else { 1.102 + if ((addr.s_addr = inet_addr(buf)) == INADDR_NONE) { 1.103 fprintf(stderr, "'%s' is not a valid address (must be ip)\n", buf); 1.104 exit(EXIT_FAILURE); 1.105 } 1.106 1.107 + if (*p) { 1.108 + guint i; 1.109 + p++; 1.110 + i = atoi(p); 1.111 + if ((i >= 0) && (i <= 32)) 1.112 + n = i ? ~((1 << (32 - i)) - 1) : 0; 1.113 + else { 1.114 + fprintf(stderr, "'%d' is not a valid net mask (must be >= 0 and <= 32)\n", i); 1.115 + exit(EXIT_FAILURE); 1.116 + } 1.117 + } else 1.118 + n = 0; 1.119 + 1.120 + mask_addr.s_addr = htonl(n); 1.121 + net_addr.s_addr = mask_addr.s_addr & addr.s_addr; 1.122 + 1.123 p_net_addr = g_malloc(sizeof(struct in_addr)); 1.124 p_net_addr->s_addr = net_addr.s_addr; 1.125 return p_net_addr; 1.126 @@ -295,7 +297,9 @@ 1.127 { 1.128 gint c; 1.129 1.130 - for (c = fgetc(in); c != EOF && isspace(c); c = fgetc(in)); 1.131 + for (c = fgetc(in); c != EOF && isspace(c); c = fgetc(in)) { 1.132 + /* empty */ 1.133 + } 1.134 if (c == EOF) 1.135 return FALSE; 1.136 ungetc(c, in); 1.137 @@ -399,16 +403,18 @@ 1.138 1.139 DEBUG(6) fprintf(stderr, "read_statement() 1\n"); 1.140 1.141 - if (read_lval(in, lval, lsize)) { 1.142 - DEBUG(6) fprintf(stderr, "lval = %s\n", lval); 1.143 - if ((c = fgetc(in) == '=')) { 1.144 - if (read_rval(in, rval, rsize)) { 1.145 - DEBUG(6) fprintf(stderr, "rval = %s\n", rval); 1.146 - return TRUE; 1.147 - } 1.148 - } else { 1.149 - fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, c); 1.150 + if (!read_lval(in, lval, lsize)) { 1.151 + return FALSE; 1.152 + } 1.153 + 1.154 + DEBUG(6) fprintf(stderr, "lval = %s\n", lval); 1.155 + if ((c = fgetc(in) == '=')) { 1.156 + if (read_rval(in, rval, rsize)) { 1.157 + DEBUG(6) fprintf(stderr, "rval = %s\n", rval); 1.158 + return TRUE; 1.159 } 1.160 + } else { 1.161 + fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, c); 1.162 } 1.163 return FALSE; 1.164 } 1.165 @@ -424,176 +430,175 @@ 1.166 conf.alias_local_cmp = strcmp; 1.167 conf.max_defer_time = 86400 * 4; /* 4 days */ 1.168 1.169 - if ((in = fopen(filename, "r"))) { 1.170 - gchar lval[256], rval[2048]; 1.171 - while (read_statement(in, lval, 256, rval, 2048)) { 1.172 - if (strcmp(lval, "debug_level") == 0) 1.173 - conf.debug_level = atoi(rval); 1.174 - else if (strcmp(lval, "run_as_user") == 0) { 1.175 - if (!conf.run_as_user) /* you should not be able to reset that flag */ 1.176 - conf.run_as_user = parse_boolean(rval); 1.177 - } else if (strcmp(lval, "use_syslog") == 0) 1.178 - conf.use_syslog = parse_boolean(rval); 1.179 - else if (strcmp(lval, "mail_dir") == 0) 1.180 - conf.mail_dir = g_strdup(rval); 1.181 - else if (strcmp(lval, "lock_dir") == 0) 1.182 - conf.lock_dir = g_strdup(rval); 1.183 - else if (strcmp(lval, "spool_dir") == 0) 1.184 - conf.spool_dir = g_strdup(rval); 1.185 - else if (strcmp(lval, "log_dir") == 0) 1.186 - conf.log_dir = g_strdup(rval); 1.187 - else if (strcmp(lval, "host_name") == 0) { 1.188 - if (rval[0] != '/') 1.189 - conf.host_name = g_strdup(rval); 1.190 - else { 1.191 - char buf[256]; 1.192 - FILE *fptr = fopen(rval, "rt"); 1.193 - if (fptr) { 1.194 - fgets(buf, 255, fptr); 1.195 - g_strchomp(buf); 1.196 - conf.host_name = g_strdup(buf); 1.197 - fclose(fptr); 1.198 - } else { 1.199 - fprintf(stderr, "could not open %s: %s\n", rval, 1.200 - strerror(errno)); 1.201 - return FALSE; 1.202 - } 1.203 + if ((in = fopen(filename, "r")) == NULL) { 1.204 + fprintf(stderr, "could not open config file %s: %s\n", filename, strerror(errno)); 1.205 + return FALSE; 1.206 + } 1.207 + 1.208 + gchar lval[256], rval[2048]; 1.209 + while (read_statement(in, lval, 256, rval, 2048)) { 1.210 + if (strcmp(lval, "debug_level") == 0) 1.211 + conf.debug_level = atoi(rval); 1.212 + else if (strcmp(lval, "run_as_user") == 0) { 1.213 + if (!conf.run_as_user) /* you should not be able to reset that flag */ 1.214 + conf.run_as_user = parse_boolean(rval); 1.215 + } else if (strcmp(lval, "use_syslog") == 0) 1.216 + conf.use_syslog = parse_boolean(rval); 1.217 + else if (strcmp(lval, "mail_dir") == 0) 1.218 + conf.mail_dir = g_strdup(rval); 1.219 + else if (strcmp(lval, "lock_dir") == 0) 1.220 + conf.lock_dir = g_strdup(rval); 1.221 + else if (strcmp(lval, "spool_dir") == 0) 1.222 + conf.spool_dir = g_strdup(rval); 1.223 + else if (strcmp(lval, "log_dir") == 0) 1.224 + conf.log_dir = g_strdup(rval); 1.225 + else if (strcmp(lval, "host_name") == 0) { 1.226 + if (rval[0] != '/') 1.227 + conf.host_name = g_strdup(rval); 1.228 + else { 1.229 + char buf[256]; 1.230 + FILE *fptr = fopen(rval, "rt"); 1.231 + if (fptr) { 1.232 + fprintf(stderr, "could not open %s: %s\n", rval, strerror(errno)); 1.233 + return FALSE; 1.234 } 1.235 - } else if (strcmp(lval, "remote_port") == 0) { 1.236 - fprintf(stderr, "the remote_port option is now deprecated. Use 'mail_host' in the\n" 1.237 - "route configuration instead. See man masqmail.route\n"); 1.238 - conf.remote_port = atoi(rval); 1.239 - } else if (strcmp(lval, "local_hosts") == 0) 1.240 - conf.local_hosts = parse_list(rval, FALSE); 1.241 - else if (strcmp(lval, "local_addresses") == 0) 1.242 - conf.local_addresses = parse_list(rval, TRUE); 1.243 - else if (strcmp(lval, "not_local_addresses") == 0) 1.244 - conf.not_local_addresses = parse_list(rval, TRUE); 1.245 - else if (strcmp(lval, "local_nets") == 0) 1.246 - conf.local_nets = parse_list(rval, FALSE); 1.247 - else if (strcmp(lval, "do_save_envelope_to") == 0) 1.248 - conf.do_save_envelope_to = parse_boolean(rval); 1.249 - else if (strcmp(lval, "defer_all") == 0) 1.250 - conf.defer_all = parse_boolean(rval); 1.251 - else if (strcmp(lval, "do_relay") == 0) 1.252 - conf.do_relay = parse_boolean(rval); 1.253 - else if (strcmp(lval, "alias_file") == 0) { 1.254 - conf.alias_file = g_strdup(rval); 1.255 - } else if (strcmp(lval, "alias_local_caseless") == 0) { 1.256 - conf.alias_local_cmp = parse_boolean(rval) ? strcasecmp : strcmp; 1.257 - } else if (strcmp(lval, "mbox_default") == 0) { 1.258 - conf.mbox_default = g_strdup(rval); 1.259 - } else if (strcmp(lval, "mbox_users") == 0) { 1.260 - conf.mbox_users = parse_list(rval, TRUE); 1.261 - } else if (strcmp(lval, "mda_users") == 0) { 1.262 - conf.mda_users = parse_list(rval, TRUE); 1.263 - } else if (strcmp(lval, "maildir_users") == 0) { 1.264 - conf.maildir_users = parse_list(rval, TRUE); 1.265 - } else if (strcmp(lval, "mda") == 0) { 1.266 - conf.mda = g_strdup(rval); 1.267 - } else if (strcmp(lval, "mda_fromline") == 0) { 1.268 - conf.mda_fromline = parse_boolean(rval); 1.269 - } else if (strcmp(lval, "mda_fromhack") == 0) { 1.270 - conf.mda_fromhack = parse_boolean(rval); 1.271 - } else if (strcmp(lval, "pipe_fromline") == 0) { 1.272 - conf.pipe_fromline = parse_boolean(rval); 1.273 - } else if (strcmp(lval, "pipe_fromhack") == 0) { 1.274 - conf.pipe_fromhack = parse_boolean(rval); 1.275 - } else if (strcmp(lval, "listen_addresses") == 0) { 1.276 - GList *node; 1.277 - GList *tmp_list = parse_list(rval, FALSE); 1.278 + fgets(buf, 255, fptr); 1.279 + g_strchomp(buf); 1.280 + conf.host_name = g_strdup(buf); 1.281 + fclose(fptr); 1.282 + } 1.283 + } else if (strcmp(lval, "remote_port") == 0) { 1.284 + fprintf(stderr, "the remote_port option is now deprecated. Use 'mail_host' in the\n" 1.285 + "route configuration instead. See man masqmail.route\n"); 1.286 + conf.remote_port = atoi(rval); 1.287 + } else if (strcmp(lval, "local_hosts") == 0) 1.288 + conf.local_hosts = parse_list(rval, FALSE); 1.289 + else if (strcmp(lval, "local_addresses") == 0) 1.290 + conf.local_addresses = parse_list(rval, TRUE); 1.291 + else if (strcmp(lval, "not_local_addresses") == 0) 1.292 + conf.not_local_addresses = parse_list(rval, TRUE); 1.293 + else if (strcmp(lval, "local_nets") == 0) 1.294 + conf.local_nets = parse_list(rval, FALSE); 1.295 + else if (strcmp(lval, "do_save_envelope_to") == 0) 1.296 + conf.do_save_envelope_to = parse_boolean(rval); 1.297 + else if (strcmp(lval, "defer_all") == 0) 1.298 + conf.defer_all = parse_boolean(rval); 1.299 + else if (strcmp(lval, "do_relay") == 0) 1.300 + conf.do_relay = parse_boolean(rval); 1.301 + else if (strcmp(lval, "alias_file") == 0) { 1.302 + conf.alias_file = g_strdup(rval); 1.303 + } else if (strcmp(lval, "alias_local_caseless") == 0) { 1.304 + conf.alias_local_cmp = parse_boolean(rval) ? strcasecmp : strcmp; 1.305 + } else if (strcmp(lval, "mbox_default") == 0) { 1.306 + conf.mbox_default = g_strdup(rval); 1.307 + } else if (strcmp(lval, "mbox_users") == 0) { 1.308 + conf.mbox_users = parse_list(rval, TRUE); 1.309 + } else if (strcmp(lval, "mda_users") == 0) { 1.310 + conf.mda_users = parse_list(rval, TRUE); 1.311 + } else if (strcmp(lval, "maildir_users") == 0) { 1.312 + conf.maildir_users = parse_list(rval, TRUE); 1.313 + } else if (strcmp(lval, "mda") == 0) { 1.314 + conf.mda = g_strdup(rval); 1.315 + } else if (strcmp(lval, "mda_fromline") == 0) { 1.316 + conf.mda_fromline = parse_boolean(rval); 1.317 + } else if (strcmp(lval, "mda_fromhack") == 0) { 1.318 + conf.mda_fromhack = parse_boolean(rval); 1.319 + } else if (strcmp(lval, "pipe_fromline") == 0) { 1.320 + conf.pipe_fromline = parse_boolean(rval); 1.321 + } else if (strcmp(lval, "pipe_fromhack") == 0) { 1.322 + conf.pipe_fromhack = parse_boolean(rval); 1.323 + } else if (strcmp(lval, "listen_addresses") == 0) { 1.324 + GList *node; 1.325 + GList *tmp_list = parse_list(rval, FALSE); 1.326 1.327 - conf.listen_addresses = NULL; 1.328 - foreach(tmp_list, node) { 1.329 - conf.listen_addresses = g_list_append(conf.listen_addresses, parse_interface((gchar *) (node-> data), 25)); 1.330 - g_free(node->data); 1.331 - } 1.332 - g_list_free(tmp_list); 1.333 - } else if (strcmp(lval, "ident_trusted_nets") == 0) { 1.334 + conf.listen_addresses = NULL; 1.335 + foreach(tmp_list, node) { 1.336 + conf.listen_addresses = g_list_append(conf.listen_addresses, parse_interface((gchar *) (node-> data), 25)); 1.337 + g_free(node->data); 1.338 + } 1.339 + g_list_free(tmp_list); 1.340 + } else if (strcmp(lval, "ident_trusted_nets") == 0) { 1.341 #ifdef ENABLE_IDENT 1.342 - GList *node; 1.343 - GList *tmp_list = parse_list(rval, FALSE); 1.344 + GList *node; 1.345 + GList *tmp_list = parse_list(rval, FALSE); 1.346 1.347 - conf.ident_trusted_nets = NULL; 1.348 - foreach(tmp_list, node) { 1.349 - conf.ident_trusted_nets = g_list_append(conf.ident_trusted_nets, parse_network((gchar *) (node->data), 25)); 1.350 - g_free(node->data); 1.351 - } 1.352 - g_list_free(tmp_list); 1.353 + conf.ident_trusted_nets = NULL; 1.354 + foreach(tmp_list, node) { 1.355 + conf.ident_trusted_nets = g_list_append(conf.ident_trusted_nets, parse_network((gchar *) (node->data), 25)); 1.356 + g_free(node->data); 1.357 + } 1.358 + g_list_free(tmp_list); 1.359 #else 1.360 - fprintf(stderr, "%s ignored: not compiled with ident support\n", lval); 1.361 + fprintf(stderr, "%s ignored: not compiled with ident support\n", lval); 1.362 #endif 1.363 - } else if ((strncmp(lval, "connect_route.", 14) == 0) 1.364 - || (strncmp(lval, "online_routes.", 14) == 0)) { 1.365 - GList *file_list = parse_list(rval, FALSE); 1.366 - table_pair *pair = create_pair(&(lval[14]), file_list); 1.367 - conf.connect_routes = g_list_append(conf.connect_routes, pair); 1.368 - } else if (strcmp(lval, "local_net_route") == 0) { 1.369 - conf.local_net_routes = parse_list(rval, FALSE); 1.370 - } else if (strcmp(lval, "online_detect") == 0) 1.371 - conf.online_detect = g_strdup(rval); 1.372 - else if (strcmp(lval, "online_file") == 0) 1.373 - conf.online_file = g_strdup(rval); 1.374 - else if (strcmp(lval, "online_pipe") == 0) 1.375 - conf.online_pipe = g_strdup(rval); 1.376 - else if (strcmp(lval, "mserver_iface") == 0) 1.377 - conf.mserver_iface = parse_interface(rval, 224); 1.378 - else if (strcmp(lval, "do_queue") == 0) 1.379 - conf.do_queue = parse_boolean(rval); 1.380 - else if (strncmp(lval, "get.", 4) == 0) { 1.381 + } else if ((strncmp(lval, "connect_route.", 14) == 0) 1.382 + || (strncmp(lval, "online_routes.", 14) == 0)) { 1.383 + GList *file_list = parse_list(rval, FALSE); 1.384 + table_pair *pair = create_pair(&(lval[14]), file_list); 1.385 + conf.connect_routes = g_list_append(conf.connect_routes, pair); 1.386 + } else if (strcmp(lval, "local_net_route") == 0) { 1.387 + conf.local_net_routes = parse_list(rval, FALSE); 1.388 + } else if (strcmp(lval, "online_detect") == 0) 1.389 + conf.online_detect = g_strdup(rval); 1.390 + else if (strcmp(lval, "online_file") == 0) 1.391 + conf.online_file = g_strdup(rval); 1.392 + else if (strcmp(lval, "online_pipe") == 0) 1.393 + conf.online_pipe = g_strdup(rval); 1.394 + else if (strcmp(lval, "mserver_iface") == 0) 1.395 + conf.mserver_iface = parse_interface(rval, 224); 1.396 + else if (strcmp(lval, "do_queue") == 0) 1.397 + conf.do_queue = parse_boolean(rval); 1.398 + else if (strncmp(lval, "get.", 4) == 0) { 1.399 #ifdef ENABLE_POP3 1.400 - table_pair *pair = create_pair_string(&(lval[4]), rval); 1.401 - conf.get_names = g_list_append(conf.get_names, pair); 1.402 + table_pair *pair = create_pair_string(&(lval[4]), rval); 1.403 + conf.get_names = g_list_append(conf.get_names, pair); 1.404 #else 1.405 - fprintf(stderr, "get.<name> ignored: not compiled with pop support\n"); 1.406 + fprintf(stderr, "get.<name> ignored: not compiled with pop support\n"); 1.407 #endif 1.408 - } else if (strncmp(lval, "online_gets.", 12) == 0) { 1.409 + } else if (strncmp(lval, "online_gets.", 12) == 0) { 1.410 #ifdef ENABLE_POP3 1.411 - GList *file_list = parse_list(rval, FALSE); 1.412 - table_pair *pair = create_pair(&(lval[12]), file_list); 1.413 - conf.online_gets = g_list_append(conf.online_gets, pair); 1.414 + GList *file_list = parse_list(rval, FALSE); 1.415 + table_pair *pair = create_pair(&(lval[12]), file_list); 1.416 + conf.online_gets = g_list_append(conf.online_gets, pair); 1.417 #else 1.418 - fprintf(stderr, "online_gets.<name> ignored: not compiled with pop support\n"); 1.419 + fprintf(stderr, "online_gets.<name> ignored: not compiled with pop support\n"); 1.420 #endif 1.421 - } else if (strcmp(lval, "errmsg_file") == 0) 1.422 - conf.errmsg_file = g_strdup(rval); 1.423 - else if (strcmp(lval, "warnmsg_file") == 0) 1.424 - conf.warnmsg_file = g_strdup(rval); 1.425 - else if (strcmp(lval, "warn_intervals") == 0) 1.426 - conf.warn_intervals = parse_list(rval, FALSE); 1.427 - else if (strcmp(lval, "max_defer_time") == 0) { 1.428 - gint dummy; 1.429 - gint ival = time_interval(rval, &dummy); 1.430 - if (ival < 0) 1.431 - fprintf(stderr, "invalid time interval for 'max_defer_time': %s\n", rval); 1.432 - else 1.433 - conf.max_defer_time = ival; 1.434 - } else if (strcmp(lval, "log_user") == 0) 1.435 - conf.log_user = g_strdup(rval); 1.436 + } else if (strcmp(lval, "errmsg_file") == 0) 1.437 + conf.errmsg_file = g_strdup(rval); 1.438 + else if (strcmp(lval, "warnmsg_file") == 0) 1.439 + conf.warnmsg_file = g_strdup(rval); 1.440 + else if (strcmp(lval, "warn_intervals") == 0) 1.441 + conf.warn_intervals = parse_list(rval, FALSE); 1.442 + else if (strcmp(lval, "max_defer_time") == 0) { 1.443 + gint dummy; 1.444 + gint ival = time_interval(rval, &dummy); 1.445 + if (ival < 0) 1.446 + fprintf(stderr, "invalid time interval for 'max_defer_time': %s\n", rval); 1.447 + else 1.448 + conf.max_defer_time = ival; 1.449 + } else if (strcmp(lval, "log_user") == 0) 1.450 + conf.log_user = g_strdup(rval); 1.451 1.452 - else 1.453 - fprintf(stderr, "var '%s' not (yet) known, ignored\n", lval); 1.454 - } 1.455 - fclose(in); 1.456 + else 1.457 + fprintf(stderr, "var '%s' not (yet) known, ignored\n", lval); 1.458 + } 1.459 + fclose(in); 1.460 1.461 - if (conf.errmsg_file == NULL) 1.462 - conf.errmsg_file = g_strdup(DATA_DIR "/tpl/failmsg.tpl"); 1.463 - if (conf.warnmsg_file == NULL) 1.464 - conf.warnmsg_file = g_strdup(DATA_DIR "/tpl/warnmsg.tpl"); 1.465 + if (conf.errmsg_file == NULL) 1.466 + conf.errmsg_file = g_strdup(DATA_DIR "/tpl/failmsg.tpl"); 1.467 + if (conf.warnmsg_file == NULL) 1.468 + conf.warnmsg_file = g_strdup(DATA_DIR "/tpl/warnmsg.tpl"); 1.469 1.470 - if (conf.lock_dir == NULL) 1.471 - conf.lock_dir = g_strdup_printf("%s/lock/", conf.spool_dir); 1.472 + if (conf.lock_dir == NULL) 1.473 + conf.lock_dir = g_strdup_printf("%s/lock/", conf.spool_dir); 1.474 1.475 - if (conf.mbox_default == NULL) 1.476 - conf.mbox_default = g_strdup("mbox"); 1.477 + if (conf.mbox_default == NULL) 1.478 + conf.mbox_default = g_strdup("mbox"); 1.479 1.480 - if (conf.warn_intervals == NULL) 1.481 - conf.warn_intervals = parse_list("1h;4h;8h;1d;2d;3d", FALSE); 1.482 + if (conf.warn_intervals == NULL) 1.483 + conf.warn_intervals = parse_list("1h;4h;8h;1d;2d;3d", FALSE); 1.484 1.485 - return TRUE; 1.486 - } else 1.487 - fprintf(stderr, "could not open config file %s: %s\n", filename, strerror(errno)); 1.488 - return FALSE; 1.489 + return TRUE; 1.490 } 1.491 1.492 connect_route* 1.493 @@ -617,160 +622,160 @@ 1.494 1.495 route->do_pipelining = TRUE; 1.496 1.497 - if ((in = fopen(route->filename, "r"))) { 1.498 - gchar lval[256], rval[2048]; 1.499 - while (read_statement(in, lval, 256, rval, 2048)) { 1.500 - if (strcmp(lval, "protocol") == 0) 1.501 - route->protocol = g_strdup(rval); 1.502 - else if (strcmp(lval, "mail_host") == 0) 1.503 - route->mail_host = parse_interface(rval, conf.remote_port); 1.504 - else if (strcmp(lval, "helo_name") == 0) 1.505 - route->helo_name = g_strdup(rval); 1.506 - else if (strcmp(lval, "wrapper") == 0) 1.507 - route->wrapper = g_strdup(rval); 1.508 - else if (strcmp(lval, "connect_error_fail") == 0) 1.509 - route->connect_error_fail = parse_boolean(rval); 1.510 - else if (strcmp(lval, "do_correct_helo") == 0) 1.511 - route->do_correct_helo = parse_boolean(rval); 1.512 - else if (strcmp(lval, "do_pipelining") == 0) 1.513 - route->do_pipelining = parse_boolean(rval); 1.514 - else if (strcmp(lval, "allowed_return_paths") == 0) 1.515 - route->allowed_return_paths = parse_address_list(rval, TRUE); 1.516 - else if (strcmp(lval, "allowed_mail_locals") == 0) 1.517 - route->allowed_mail_locals = parse_list(rval, TRUE); 1.518 - else if (strcmp(lval, "not_allowed_return_paths") == 0) 1.519 - route->not_allowed_return_paths = parse_address_list(rval, TRUE); 1.520 - else if (strcmp(lval, "not_allowed_mail_locals") == 0) 1.521 - route->not_allowed_mail_locals = parse_list(rval, TRUE); 1.522 - else if (strcmp(lval, "allowed_rcpt_domains") == 0) 1.523 - route->allowed_rcpt_domains = parse_list(rval, TRUE); 1.524 - else if (strcmp(lval, "not_allowed_rcpt_domains") == 0) 1.525 - route->not_allowed_rcpt_domains = parse_list(rval, TRUE); 1.526 - else if (strcmp(lval, "set_h_from_domain") == 0) 1.527 - route->set_h_from_domain = g_strdup(rval); 1.528 - else if (strcmp(lval, "set_h_reply_to_domain") == 0) 1.529 - route->set_h_reply_to_domain = g_strdup(rval); 1.530 - else if (strcmp(lval, "set_return_path_domain") == 0) 1.531 - route->set_return_path_domain = g_strdup(rval); 1.532 - else if (strcmp(lval, "map_return_path_addresses") == 0) { 1.533 - GList *node, *list; 1.534 + if ((in = fopen(route->filename, "r")) == NULL) { 1.535 + logwrite(LOG_ALERT, "could not open route file %s: %s\n", route->filename, strerror(errno)); 1.536 + g_free(route); 1.537 + return NULL; 1.538 + } 1.539 1.540 - list = parse_list(rval, TRUE); 1.541 - foreach(list, node) { 1.542 - gchar *item = (gchar *) (node->data); 1.543 - table_pair *pair = parse_table_pair(item, ':'); 1.544 - address *addr = create_address((gchar *) (pair->value), TRUE); 1.545 - g_free(pair->value); 1.546 - pair->value = (gpointer *) addr; 1.547 - route->map_return_path_addresses = g_list_append(route->map_return_path_addresses, pair); 1.548 - g_free(item); 1.549 - } 1.550 - g_list_free(list); 1.551 - } else if (strcmp(lval, "map_h_from_addresses") == 0) { 1.552 - GList *list, *node; 1.553 + gchar lval[256], rval[2048]; 1.554 + while (read_statement(in, lval, 256, rval, 2048)) { 1.555 + if (strcmp(lval, "protocol") == 0) 1.556 + route->protocol = g_strdup(rval); 1.557 + else if (strcmp(lval, "mail_host") == 0) 1.558 + route->mail_host = parse_interface(rval, conf.remote_port); 1.559 + else if (strcmp(lval, "helo_name") == 0) 1.560 + route->helo_name = g_strdup(rval); 1.561 + else if (strcmp(lval, "wrapper") == 0) 1.562 + route->wrapper = g_strdup(rval); 1.563 + else if (strcmp(lval, "connect_error_fail") == 0) 1.564 + route->connect_error_fail = parse_boolean(rval); 1.565 + else if (strcmp(lval, "do_correct_helo") == 0) 1.566 + route->do_correct_helo = parse_boolean(rval); 1.567 + else if (strcmp(lval, "do_pipelining") == 0) 1.568 + route->do_pipelining = parse_boolean(rval); 1.569 + else if (strcmp(lval, "allowed_return_paths") == 0) 1.570 + route->allowed_return_paths = parse_address_list(rval, TRUE); 1.571 + else if (strcmp(lval, "allowed_mail_locals") == 0) 1.572 + route->allowed_mail_locals = parse_list(rval, TRUE); 1.573 + else if (strcmp(lval, "not_allowed_return_paths") == 0) 1.574 + route->not_allowed_return_paths = parse_address_list(rval, TRUE); 1.575 + else if (strcmp(lval, "not_allowed_mail_locals") == 0) 1.576 + route->not_allowed_mail_locals = parse_list(rval, TRUE); 1.577 + else if (strcmp(lval, "allowed_rcpt_domains") == 0) 1.578 + route->allowed_rcpt_domains = parse_list(rval, TRUE); 1.579 + else if (strcmp(lval, "not_allowed_rcpt_domains") == 0) 1.580 + route->not_allowed_rcpt_domains = parse_list(rval, TRUE); 1.581 + else if (strcmp(lval, "set_h_from_domain") == 0) 1.582 + route->set_h_from_domain = g_strdup(rval); 1.583 + else if (strcmp(lval, "set_h_reply_to_domain") == 0) 1.584 + route->set_h_reply_to_domain = g_strdup(rval); 1.585 + else if (strcmp(lval, "set_return_path_domain") == 0) 1.586 + route->set_return_path_domain = g_strdup(rval); 1.587 + else if (strcmp(lval, "map_return_path_addresses") == 0) { 1.588 + GList *node, *list; 1.589 1.590 - list = parse_list(rval, TRUE); 1.591 - foreach(list, node) { 1.592 - gchar *item = (gchar *) (node->data); 1.593 - table_pair *pair = parse_table_pair(item, ':'); 1.594 - route->map_h_from_addresses = g_list_append(route->map_h_from_addresses, pair); 1.595 - g_free(item); 1.596 - } 1.597 - g_list_free(list); 1.598 - } else if (strcmp(lval, "map_h_reply_to_addresses") == 0) { 1.599 - GList *list, *node; 1.600 + list = parse_list(rval, TRUE); 1.601 + foreach(list, node) { 1.602 + gchar *item = (gchar *) (node->data); 1.603 + table_pair *pair = parse_table_pair(item, ':'); 1.604 + address *addr = create_address((gchar *) (pair->value), TRUE); 1.605 + g_free(pair->value); 1.606 + pair->value = (gpointer *) addr; 1.607 + route->map_return_path_addresses = g_list_append(route->map_return_path_addresses, pair); 1.608 + g_free(item); 1.609 + } 1.610 + g_list_free(list); 1.611 + } else if (strcmp(lval, "map_h_from_addresses") == 0) { 1.612 + GList *list, *node; 1.613 1.614 - list = parse_list(rval, TRUE); 1.615 - foreach(list, node) { 1.616 - gchar *item = (gchar *) (node->data); 1.617 - table_pair *pair = parse_table_pair(item, ':'); 1.618 - route->map_h_reply_to_addresses = g_list_append(route->map_h_reply_to_addresses, pair); 1.619 - g_free(item); 1.620 - } 1.621 - g_list_free(list); 1.622 - } else if (strcmp(lval, "map_h_mail_followup_to_addresses") == 0) { 1.623 - GList *list, *node; 1.624 + list = parse_list(rval, TRUE); 1.625 + foreach(list, node) { 1.626 + gchar *item = (gchar *) (node->data); 1.627 + table_pair *pair = parse_table_pair(item, ':'); 1.628 + route->map_h_from_addresses = g_list_append(route->map_h_from_addresses, pair); 1.629 + g_free(item); 1.630 + } 1.631 + g_list_free(list); 1.632 + } else if (strcmp(lval, "map_h_reply_to_addresses") == 0) { 1.633 + GList *list, *node; 1.634 1.635 - list = parse_list(rval, TRUE); 1.636 - foreach(list, node) { 1.637 - gchar *item = (gchar *) (node->data); 1.638 - table_pair *pair = parse_table_pair(item, ':'); 1.639 - route->map_h_mail_followup_to_addresses = g_list_append(route->map_h_mail_followup_to_addresses, pair); 1.640 - g_free(item); 1.641 - } 1.642 - g_list_free(list); 1.643 - } else if (strcmp(lval, "expand_h_sender_domain") == 0) { 1.644 - route->expand_h_sender_domain = parse_boolean(rval); 1.645 - } else if (strcmp(lval, "expand_h_sender_address") == 0) { 1.646 - route->expand_h_sender_address = parse_boolean(rval); 1.647 - } else if (strcmp(lval, "resolve_list") == 0) 1.648 - route->resolve_list = parse_resolve_list(rval); 1.649 - else if (strcmp(lval, "do_ssl") == 0) { 1.650 - /* we ignore this. This option is used by sqilconf */ 1.651 - ; 1.652 + list = parse_list(rval, TRUE); 1.653 + foreach(list, node) { 1.654 + gchar *item = (gchar *) (node->data); 1.655 + table_pair *pair = parse_table_pair(item, ':'); 1.656 + route->map_h_reply_to_addresses = g_list_append(route->map_h_reply_to_addresses, pair); 1.657 + g_free(item); 1.658 } 1.659 + g_list_free(list); 1.660 + } else if (strcmp(lval, "map_h_mail_followup_to_addresses") == 0) { 1.661 + GList *list, *node; 1.662 + 1.663 + list = parse_list(rval, TRUE); 1.664 + foreach(list, node) { 1.665 + gchar *item = (gchar *) (node->data); 1.666 + table_pair *pair = parse_table_pair(item, ':'); 1.667 + route->map_h_mail_followup_to_addresses = g_list_append(route->map_h_mail_followup_to_addresses, pair); 1.668 + g_free(item); 1.669 + } 1.670 + g_list_free(list); 1.671 + } else if (strcmp(lval, "expand_h_sender_domain") == 0) { 1.672 + route->expand_h_sender_domain = parse_boolean(rval); 1.673 + } else if (strcmp(lval, "expand_h_sender_address") == 0) { 1.674 + route->expand_h_sender_address = parse_boolean(rval); 1.675 + } else if (strcmp(lval, "resolve_list") == 0) 1.676 + route->resolve_list = parse_resolve_list(rval); 1.677 + else if (strcmp(lval, "do_ssl") == 0) { 1.678 + /* we ignore this. This option is used by sqilconf */ 1.679 + ; 1.680 + } 1.681 #ifdef ENABLE_AUTH 1.682 - else if (strcmp(lval, "auth_name") == 0) { 1.683 - route->auth_name = g_strdup(rval); 1.684 - } else if (strcmp(lval, "auth_login") == 0) { 1.685 - route->auth_login = g_strdup(rval); 1.686 - } else if (strcmp(lval, "auth_secret") == 0) { 1.687 - route->auth_secret = g_strdup(rval); 1.688 - } 1.689 + else if (strcmp(lval, "auth_name") == 0) { 1.690 + route->auth_name = g_strdup(rval); 1.691 + } else if (strcmp(lval, "auth_login") == 0) { 1.692 + route->auth_login = g_strdup(rval); 1.693 + } else if (strcmp(lval, "auth_secret") == 0) { 1.694 + route->auth_secret = g_strdup(rval); 1.695 + } 1.696 #else 1.697 - else if ((strcmp(lval, "auth_name") == 0) 1.698 - || (strcmp(lval, "auth_login") == 0) 1.699 - || (strcmp(lval, "auth_secret") == 0)) { 1.700 - logwrite(LOG_WARNING, "%s ignored: not compiled with auth support.\n", lval); 1.701 - } 1.702 + else if ((strcmp(lval, "auth_name") == 0) 1.703 + || (strcmp(lval, "auth_login") == 0) 1.704 + || (strcmp(lval, "auth_secret") == 0)) { 1.705 + logwrite(LOG_WARNING, "%s ignored: not compiled with auth support.\n", lval); 1.706 + } 1.707 #endif 1.708 - else if (strcmp(lval, "pop3_login") == 0) { 1.709 + else if (strcmp(lval, "pop3_login") == 0) { 1.710 #ifdef ENABLE_POP3 1.711 - route->pop3_login = g_strdup(rval); 1.712 + route->pop3_login = g_strdup(rval); 1.713 #else 1.714 - logwrite(LOG_WARNING, "pop3_login ignored: not compiled with pop support.\n"); 1.715 + logwrite(LOG_WARNING, "pop3_login ignored: not compiled with pop support.\n"); 1.716 #endif 1.717 - } else if (strcmp(lval, "pipe") == 0) { 1.718 - route->pipe = g_strdup(rval); 1.719 - } else if (strcmp(lval, "pipe_fromline") == 0) { 1.720 - route->pipe_fromline = parse_boolean(rval); 1.721 - } else if (strcmp(lval, "pipe_fromhack") == 0) { 1.722 - route->pipe_fromhack = parse_boolean(rval); 1.723 - } else if (strcmp(lval, "last_route") == 0) { 1.724 - route->last_route = parse_boolean(rval); 1.725 - } else 1.726 - logwrite(LOG_WARNING, "var '%s' not (yet) known, ignored\n", lval); 1.727 + } else if (strcmp(lval, "pipe") == 0) { 1.728 + route->pipe = g_strdup(rval); 1.729 + } else if (strcmp(lval, "pipe_fromline") == 0) { 1.730 + route->pipe_fromline = parse_boolean(rval); 1.731 + } else if (strcmp(lval, "pipe_fromhack") == 0) { 1.732 + route->pipe_fromhack = parse_boolean(rval); 1.733 + } else if (strcmp(lval, "last_route") == 0) { 1.734 + route->last_route = parse_boolean(rval); 1.735 + } else 1.736 + logwrite(LOG_WARNING, "var '%s' not (yet) known, ignored\n", lval); 1.737 + } 1.738 + 1.739 + if (route->resolve_list == NULL) { 1.740 + if (is_local_net) { 1.741 + route->resolve_list = g_list_append(NULL, resolve_byname); 1.742 + } else { 1.743 +#ifdef ENABLE_RESOLVER 1.744 + route->resolve_list = g_list_append(route->resolve_list, resolve_dns_mx); 1.745 + route->resolve_list = g_list_append(route->resolve_list, resolve_dns_a); 1.746 +#endif 1.747 + route->resolve_list = g_list_append(route->resolve_list, resolve_byname); 1.748 } 1.749 + } 1.750 + fclose(in); 1.751 + ok = TRUE; 1.752 1.753 - if (route->resolve_list == NULL) { 1.754 - if (is_local_net) { 1.755 - route->resolve_list = g_list_append(NULL, resolve_byname); 1.756 - } else { 1.757 -#ifdef ENABLE_RESOLVER 1.758 - route->resolve_list = g_list_append(route->resolve_list, resolve_dns_mx); 1.759 - route->resolve_list = g_list_append(route->resolve_list, resolve_dns_a); 1.760 -#endif 1.761 - route->resolve_list = g_list_append(route->resolve_list, resolve_byname); 1.762 - } 1.763 - } 1.764 - fclose(in); 1.765 - ok = TRUE; 1.766 - 1.767 - /* warn user about misconfigurations: */ 1.768 - if ((route->map_h_from_addresses != NULL) 1.769 - && (route->set_h_from_domain != NULL)) { 1.770 - logwrite(LOG_WARNING, "'map_h_from_addresses' overrides 'set_h_from_domain'\n"); 1.771 - g_free(route->set_h_from_domain); 1.772 - route->set_h_from_domain = NULL; 1.773 - } 1.774 - if ((route->map_h_reply_to_addresses != NULL) 1.775 - && (route->set_h_reply_to_domain != NULL)) { 1.776 - logwrite(LOG_WARNING, "'map_h_reply_to_addresses' overrides 'set_h_reply_to_domain'\n"); 1.777 - g_free(route->set_h_reply_to_domain); 1.778 - route->set_h_reply_to_domain = NULL; 1.779 - } 1.780 - } else { 1.781 - logwrite(LOG_ALERT, "could not open route file %s: %s\n", route->filename, strerror(errno)); 1.782 + /* warn user about misconfigurations: */ 1.783 + if ((route->map_h_from_addresses != NULL) && (route->set_h_from_domain != NULL)) { 1.784 + logwrite(LOG_WARNING, "'map_h_from_addresses' overrides 'set_h_from_domain'\n"); 1.785 + g_free(route->set_h_from_domain); 1.786 + route->set_h_from_domain = NULL; 1.787 + } 1.788 + if ((route->map_h_reply_to_addresses != NULL) && (route->set_h_reply_to_domain != NULL)) { 1.789 + logwrite(LOG_WARNING, "'map_h_reply_to_addresses' overrides 'set_h_reply_to_domain'\n"); 1.790 + g_free(route->set_h_reply_to_domain); 1.791 + route->set_h_reply_to_domain = NULL; 1.792 } 1.793 1.794 if (!ok) { 1.795 @@ -890,62 +895,62 @@ 1.796 1.797 gc->server_port = 110; 1.798 1.799 - if ((in = fopen(filename, "r"))) { 1.800 - gchar lval[256], rval[2048]; 1.801 - while (read_statement(in, lval, 256, rval, 2048)) { 1.802 - if (strcmp(lval, "protocol") == 0) 1.803 - gc->protocol = g_strdup(rval); 1.804 - else if (strcmp(lval, "server") == 0) 1.805 - gc->server_name = g_strdup(rval); 1.806 - else if (strcmp(lval, "port") == 0) 1.807 - gc->server_port = atoi(rval); 1.808 - else if (strcmp(lval, "wrapper") == 0) 1.809 - gc->wrapper = g_strdup(rval); 1.810 - else if (strcmp(lval, "user") == 0) 1.811 - gc->login_user = g_strdup(rval); 1.812 - else if (strcmp(lval, "pass") == 0) 1.813 - gc->login_pass = g_strdup(rval); 1.814 - else if (strcmp(lval, "address") == 0) 1.815 - gc->address = create_address_qualified(rval, TRUE, conf.host_name); 1.816 - else if (strcmp(lval, "return_path") == 0) 1.817 - gc->return_path = create_address_qualified(rval, TRUE, conf.host_name); 1.818 - else if (strcmp(lval, "do_ssl") == 0) 1.819 - /* we ignore this. This option is used by sqilconf */ 1.820 - ; 1.821 - else if (strcmp(lval, "do_keep") == 0) 1.822 - gc->do_keep = parse_boolean(rval); 1.823 - else if (strcmp(lval, "do_uidl") == 0) 1.824 - gc->do_uidl = parse_boolean(rval); 1.825 - else if (strcmp(lval, "do_uidl_dele") == 0) 1.826 - gc->do_uidl_dele = parse_boolean(rval); 1.827 - else if (strcmp(lval, "max_size") == 0) 1.828 - gc->max_size = atoi(rval); 1.829 - else if (strcmp(lval, "max_size_delete") == 0) 1.830 - gc->max_size = parse_boolean(rval); 1.831 - else if (strcmp(lval, "max_count") == 0) 1.832 - gc->max_count = atoi(rval); 1.833 - else if (strcmp(lval, "resolve_list") == 0) 1.834 - gc->resolve_list = parse_resolve_list(rval); 1.835 - else 1.836 - logwrite(LOG_WARNING, "var '%s' not (yet) known, ignored\n", lval); 1.837 - } 1.838 - fclose(in); 1.839 + if ((in = fopen(filename, "r")) == NULL) { 1.840 + logwrite(LOG_ALERT, "could not open get file %s: %s\n", filename, strerror(errno)); 1.841 + g_free(gc); 1.842 + return NULL; 1.843 + } 1.844 1.845 - if (gc->resolve_list == NULL) { 1.846 + gchar lval[256], rval[2048]; 1.847 + while (read_statement(in, lval, 256, rval, 2048)) { 1.848 + if (strcmp(lval, "protocol") == 0) 1.849 + gc->protocol = g_strdup(rval); 1.850 + else if (strcmp(lval, "server") == 0) 1.851 + gc->server_name = g_strdup(rval); 1.852 + else if (strcmp(lval, "port") == 0) 1.853 + gc->server_port = atoi(rval); 1.854 + else if (strcmp(lval, "wrapper") == 0) 1.855 + gc->wrapper = g_strdup(rval); 1.856 + else if (strcmp(lval, "user") == 0) 1.857 + gc->login_user = g_strdup(rval); 1.858 + else if (strcmp(lval, "pass") == 0) 1.859 + gc->login_pass = g_strdup(rval); 1.860 + else if (strcmp(lval, "address") == 0) 1.861 + gc->address = create_address_qualified(rval, TRUE, conf.host_name); 1.862 + else if (strcmp(lval, "return_path") == 0) 1.863 + gc->return_path = create_address_qualified(rval, TRUE, conf.host_name); 1.864 + else if (strcmp(lval, "do_ssl") == 0) 1.865 + /* we ignore this. This option is used by sqilconf */ 1.866 + ; 1.867 + else if (strcmp(lval, "do_keep") == 0) 1.868 + gc->do_keep = parse_boolean(rval); 1.869 + else if (strcmp(lval, "do_uidl") == 0) 1.870 + gc->do_uidl = parse_boolean(rval); 1.871 + else if (strcmp(lval, "do_uidl_dele") == 0) 1.872 + gc->do_uidl_dele = parse_boolean(rval); 1.873 + else if (strcmp(lval, "max_size") == 0) 1.874 + gc->max_size = atoi(rval); 1.875 + else if (strcmp(lval, "max_size_delete") == 0) 1.876 + gc->max_size = parse_boolean(rval); 1.877 + else if (strcmp(lval, "max_count") == 0) 1.878 + gc->max_count = atoi(rval); 1.879 + else if (strcmp(lval, "resolve_list") == 0) 1.880 + gc->resolve_list = parse_resolve_list(rval); 1.881 + else 1.882 + logwrite(LOG_WARNING, "var '%s' not (yet) known, ignored\n", lval); 1.883 + } 1.884 + fclose(in); 1.885 + 1.886 + if (gc->resolve_list == NULL) { 1.887 #ifdef ENABLE_RESOLVER 1.888 - gc->resolve_list = g_list_append(NULL, resolve_dns_a); 1.889 + gc->resolve_list = g_list_append(NULL, resolve_dns_a); 1.890 #endif 1.891 - gc->resolve_list = g_list_append(NULL, resolve_byname); 1.892 - } 1.893 + gc->resolve_list = g_list_append(NULL, resolve_byname); 1.894 + } 1.895 1.896 - if (gc->protocol == NULL) 1.897 - gc->protocol = g_strdup("pop3"); 1.898 - return gc; 1.899 - } 1.900 - logwrite(LOG_ALERT, "could not open get file %s: %s\n", filename, strerror(errno)); 1.901 - 1.902 - g_free(gc); 1.903 - return NULL; 1.904 + if (gc->protocol == NULL) 1.905 + gc->protocol = g_strdup("pop3"); 1.906 + return gc; 1.907 } 1.908 1.909 void 1.910 @@ -978,14 +983,15 @@ 1.911 connect_route *route; 1.912 1.913 route = g_malloc(sizeof(connect_route)); 1.914 - if (route) { 1.915 - memset(route, 0, sizeof(connect_route)); 1.916 - route->protocol = g_strdup("smtp"); 1.917 - route->is_local_net = TRUE; 1.918 - route->name = g_strdup("local_net (default)"); 1.919 - route->expand_h_sender_address = TRUE; 1.920 - route->resolve_list = g_list_append(NULL, resolve_byname); 1.921 - route->connect_error_fail = TRUE; 1.922 + if (!route) { 1.923 + return NULL; 1.924 } 1.925 + memset(route, 0, sizeof(connect_route)); 1.926 + route->protocol = g_strdup("smtp"); 1.927 + route->is_local_net = TRUE; 1.928 + route->name = g_strdup("local_net (default)"); 1.929 + route->expand_h_sender_address = TRUE; 1.930 + route->resolve_list = g_list_append(NULL, resolve_byname); 1.931 + route->connect_error_fail = TRUE; 1.932 return route; 1.933 }