ctld.c (263723) | ctld.c (263724) |
---|---|
1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: stable/10/usr.sbin/ctld/ctld.c 263723 2014-03-25 12:10:30Z trasz $ | 29 * $FreeBSD: stable/10/usr.sbin/ctld/ctld.c 263724 2014-03-25 12:12:37Z trasz $ |
30 */ 31 32#include <sys/types.h> 33#include <sys/time.h> 34#include <sys/socket.h> 35#include <sys/wait.h> 36#include <netinet/in.h> 37#include <assert.h> --- 374 unchanged lines hidden (view full) --- 412 TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) { 413 if (ag->ag_name != NULL && strcmp(ag->ag_name, name) == 0) 414 return (ag); 415 } 416 417 return (NULL); 418} 419 | 30 */ 31 32#include <sys/types.h> 33#include <sys/time.h> 34#include <sys/socket.h> 35#include <sys/wait.h> 36#include <netinet/in.h> 37#include <assert.h> --- 374 unchanged lines hidden (view full) --- 412 TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) { 413 if (ag->ag_name != NULL && strcmp(ag->ag_name, name) == 0) 414 return (ag); 415 } 416 417 return (NULL); 418} 419 |
420static int 421auth_group_set_type(struct auth_group *ag, int type) 422{ 423 424 if (ag->ag_type == AG_TYPE_UNKNOWN) { 425 ag->ag_type = type; 426 return (0); 427 } 428 429 if (ag->ag_type == type) 430 return (0); 431 432 return (1); 433} 434 435int 436auth_group_set_type_str(struct auth_group *ag, const char *str) 437{ 438 int error, type; 439 440 if (strcmp(str, "none") == 0) { 441 type = AG_TYPE_NO_AUTHENTICATION; 442 } else if (strcmp(str, "chap") == 0) { 443 type = AG_TYPE_CHAP; 444 } else if (strcmp(str, "chap-mutual") == 0) { 445 type = AG_TYPE_CHAP_MUTUAL; 446 } else { 447 if (ag->ag_name != NULL) 448 log_warnx("invalid auth-type \"%s\" for auth-group " 449 "\"%s\"", str, ag->ag_name); 450 else 451 log_warnx("invalid auth-type \"%s\" for target " 452 "\"%s\"", str, ag->ag_target->t_name); 453 return (1); 454 } 455 456 error = auth_group_set_type(ag, type); 457 if (error != 0) { 458 if (ag->ag_name != NULL) 459 log_warnx("cannot set auth-type to \"%s\" for " 460 "auth-group \"%s\"; already has a different " 461 "type", str, ag->ag_name); 462 else 463 log_warnx("cannot set auth-type to \"%s\" for target " 464 "\"%s\"; already has a different type", 465 str, ag->ag_target->t_name); 466 return (1); 467 } 468 469 return (error); 470} 471 |
|
420static struct portal * 421portal_new(struct portal_group *pg) 422{ 423 struct portal *portal; 424 425 portal = calloc(1, sizeof(*portal)); 426 if (portal == NULL) 427 log_err(1, "calloc"); --- 1403 unchanged lines hidden --- | 472static struct portal * 473portal_new(struct portal_group *pg) 474{ 475 struct portal *portal; 476 477 portal = calloc(1, sizeof(*portal)); 478 if (portal == NULL) 479 log_err(1, "calloc"); --- 1403 unchanged lines hidden --- |