X-Git-Url: https://git.syn-net.org/?p=debian%2Fuanytun.git;a=blobdiff_plain;f=src%2Foptions.c;h=df32b1b4aa303f6f081d7edf476cc5f10feb4b5a;hp=331a3c3cceb8c1639702b918e2586ae17cb80d90;hb=71f6f666a3d69c6e1e7a77e238362c5bbe288e66;hpb=aa74a4fd24d8e8537f76531e6257fa90145355d3 diff --git a/src/options.c b/src/options.c index 331a3c3..df32b1b 100644 --- a/src/options.c +++ b/src/options.c @@ -10,12 +10,12 @@ * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel * mode and allows tunneling of every ETHER TYPE protocol (e.g. * ethernet, ip, arp ...). satp directly includes cryptography and - * message authentication based on the methodes used by SRTP. It is + * message authentication based on the methods used by SRTP. It is * intended to deliver a generic, scaleable and secure solution for * tunneling and relaying of packets of any protocol. - * * - * Copyright (C) 2007-2010 Christian Pointner + * + * Copyright (C) 2007-2014 Christian Pointner * * This file is part of uAnytun. * @@ -31,6 +31,19 @@ * * You should have received a copy of the GNU General Public License * along with uAnytun. If not, see . + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. If you + * do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source + * files in the program, then also delete it here. */ #include "datatypes.h" @@ -152,9 +165,9 @@ int options_parse_hex_string(const char* hex, buffer_t* buffer) if(hex_len%2) return 1; - if(buffer->buf_) + if(buffer->buf_) free(buffer->buf_); - + buffer->length_ = hex_len/2; buffer->buf_ = malloc(buffer->length_); if(!buffer->buf_) { @@ -189,7 +202,7 @@ int options_parse_ifconfig(const char* arg, ifconfig_param_t* ifcfg) free(str); return 1; } - + ifcfg->prefix_length_ = atoi(ptr); ifcfg->net_addr_ = strdup(str); free(str); @@ -209,7 +222,6 @@ int options_parse_ifconfig(const char* arg, ifconfig_param_t* ifcfg) return 1; } - int options_parse(options_t* opt, int argc, char* argv[]) { if(!opt) @@ -225,7 +237,9 @@ int options_parse(options_t* opt, int argc, char* argv[]) argc--; +#ifndef NO_CRYPT char* role = NULL; +#endif int i, ipv4_only = 0, ipv6_only = 0; for(i=1; argc > 0; ++i) { @@ -268,7 +282,7 @@ int options_parse(options_t* opt, int argc, char* argv[]) PARSE_STRING_PARAM("-a","--auth-algo", opt->auth_algo_) PARSE_INT_PARAM("-b","--auth-tag-length", opt->auth_tag_length_) #endif - else + else return i; } if(ipv4_only && ipv6_only) @@ -308,13 +322,13 @@ void options_parse_post(options_t* opt) return; #ifndef NO_CRYPT - if(!strcmp(opt->cipher_, "null") && !strcmp(opt->auth_algo_, "null") && + if(!strcmp(opt->cipher_, "null") && !strcmp(opt->auth_algo_, "null") && strcmp(opt->kd_prf_, "null")) { if(opt->kd_prf_) free(opt->kd_prf_); opt->kd_prf_ = strdup("null"); } - if((strcmp(opt->cipher_, "null") || strcmp(opt->auth_algo_, "null")) && + if((strcmp(opt->cipher_, "null") || strcmp(opt->auth_algo_, "null")) && !strcmp(opt->kd_prf_, "null")) { log_printf(WARNING, "using NULL key derivation with encryption and or authentication enabled!"); }