1%{ 2/*- 3 * Copyright (c) 2012 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * This software was developed by Edward Tomasz Napierala under sponsorship 7 * from the FreeBSD Foundation. 8 * --- 13 unchanged lines hidden (view full) --- 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * |
30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 263726 2014-03-25 12:16:52Z trasz $ |
31 */ 32 33#include <sys/queue.h> 34#include <sys/types.h> 35#include <sys/stat.h> 36#include <assert.h> 37#include <stdio.h> 38#include <stdint.h> --- 88 unchanged lines hidden (view full) --- 127 OPENING_BRACKET auth_group_entries CLOSING_BRACKET 128 { 129 auth_group = NULL; 130 } 131 ; 132 133auth_group_name: STR 134 { |
135 /* 136 * Make it possible to redefine default 137 * auth-group. but only once. 138 */ 139 if (strcmp($1, "default") == 0 && 140 conf->conf_default_ag_defined == false) { 141 auth_group = auth_group_find(conf, $1); 142 conf->conf_default_ag_defined = true; 143 } else { 144 auth_group = auth_group_new(conf, $1); 145 } |
146 free($1); 147 if (auth_group == NULL) 148 return (1); 149 } 150 ; 151 152auth_group_entries: 153 | --- 563 unchanged lines hidden (view full) --- 717 struct auth_group *ag; 718 struct portal_group *pg; 719 int error; 720 721 log_debugx("obtaining configuration from %s", path); 722 723 conf = conf_new(); 724 |
725 ag = auth_group_new(conf, "default"); 726 assert(ag != NULL); 727 |
728 ag = auth_group_new(conf, "no-authentication"); 729 assert(ag != NULL); 730 ag->ag_type = AG_TYPE_NO_AUTHENTICATION; 731 732 /* 733 * Here, the type doesn't really matter, as the group doesn't contain 734 * any entries and thus will always deny access. 735 */ --- 19 unchanged lines hidden (view full) --- 755 target = NULL; 756 lun = NULL; 757 fclose(yyin); 758 if (error != 0) { 759 conf_delete(conf); 760 return (NULL); 761 } 762 |
763 if (conf->conf_default_ag_defined == false) { 764 log_debugx("auth-group \"default\" not defined; " 765 "going with defaults"); 766 ag = auth_group_find(conf, "default"); 767 assert(ag != NULL); 768 ag->ag_type = AG_TYPE_CHAP; 769 } 770 |
771 if (conf->conf_default_pg_defined == false) { 772 log_debugx("portal-group \"default\" not defined; " 773 "going with defaults"); 774 pg = portal_group_find(conf, "default"); 775 assert(pg != NULL); 776 portal_group_add_listen(pg, "0.0.0.0:3260", false); 777 portal_group_add_listen(pg, "[::]:3260", false); 778 } 779 780 error = conf_verify(conf); 781 if (error != 0) { 782 conf_delete(conf); 783 return (NULL); 784 } 785 786 return (conf); 787} |