X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fconf.c;h=951b24a6008c400fa7f1f22ecae8635196507987;hp=bd546c6bd4fc2e1da26c8aebe537f99d5f327c9c;hb=72395f989cb44132d7c756c91b3a6d8ba63517e5;hpb=82e383710980534d38bb9a8ef22f20677cd85861 diff --git a/src/conf.c b/src/conf.c index bd546c6b..951b24a6 100644 --- a/src/conf.c +++ b/src/conf.c @@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: conf.c,v 1.9.4.45 2001/10/27 12:13:17 guus Exp $ + $Id: conf.c,v 1.9.4.48 2001/11/16 00:13:08 zarq Exp $ */ #include "config.h" @@ -126,11 +126,14 @@ cp cfg.line = 0; found = avl_search_closest_greater(config_tree, &cfg); + + if(!found) + return NULL; - if(!strcmp(found->variable, variable)) - return found; - else + if(strcmp(found->variable, variable)) return NULL; + + return found; } config_t *lookup_config_next(avl_tree_t *config_tree, config_t *cfg) @@ -171,7 +174,7 @@ cp } syslog(LOG_ERR, _("\"yes\" or \"no\" expected for configuration variable %s in %s line %d"), - cfg->value, cfg->file, cfg->line); + cfg->variable, cfg->file, cfg->line); return 0; } @@ -186,7 +189,7 @@ cp return 1; syslog(LOG_ERR, _("Integer expected for configuration variable %s in %s line %d"), - cfg->value, cfg->file, cfg->line); + cfg->variable, cfg->file, cfg->line); return 0; } @@ -200,40 +203,6 @@ cp return 1; } -int get_config_ip(config_t *cfg, ip_mask_t **result) -{ - ip_mask_t *ip; -cp - if(!cfg) - return 0; - - ip = strtoip(cfg->value); - - if(ip) - { - *result = ip; - return 1; - } - - syslog(LOG_ERR, _("IP address expected for configuration variable %s in %s line %d"), - cfg->value, cfg->file, cfg->line); - return 0; -} - -int get_config_port(config_t *cfg, port_t *result) -{ -cp - if(!cfg) - return 0; - - if(sscanf(cfg->value, "%hu", result) == 1) - return 1; - - syslog(LOG_ERR, _("Port number expected for configuration variable %s in %s line %d"), - cfg->value, cfg->file, cfg->line); - return 0; -} - int get_config_subnet(config_t *cfg, subnet_t **result) { ip_mask_t *ip; @@ -247,18 +216,18 @@ cp if(!ip) { syslog(LOG_ERR, _("IP address expected for configuration variable %s in %s line %d"), - cfg->value, cfg->file, cfg->line); + cfg->variable, cfg->file, cfg->line); return 0; } /* Teach newbies what subnets are... */ - if((subnet->net.ipv4.address & subnet->net.ipv4.mask) != subnet->net.ipv4.address) + if((ip->address & ip->mask) != ip->address) { syslog(LOG_ERR, _("Network address and subnet mask for configuration variable %s in %s line %d"), - cfg->value, cfg->file, cfg->line); + cfg->variable, cfg->file, cfg->line); free(ip); - return -1; + return 0; } subnet = new_subnet();