svn commit: r263725 - stable/10/usr.sbin/ctld
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Mar 25 12:14:48 UTC 2014
Author: trasz
Date: Tue Mar 25 12:14:48 2014
New Revision: 263725
URL: http://svnweb.freebsd.org/changeset/base/263725
Log:
MFC r261759:
Make it possible to redefine portal-group "default".
Sponsored by: The FreeBSD Foundation
Modified:
stable/10/usr.sbin/ctld/ctld.h
stable/10/usr.sbin/ctld/parse.y
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/usr.sbin/ctld/ctld.h
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.h Tue Mar 25 12:12:37 2014 (r263724)
+++ stable/10/usr.sbin/ctld/ctld.h Tue Mar 25 12:14:48 2014 (r263725)
@@ -146,6 +146,9 @@ struct conf {
uint16_t conf_last_portal_group_tag;
struct pidfh *conf_pidfh;
+
+ bool conf_default_pg_defined;
+ bool conf_default_ag_defined;
};
#define CONN_SESSION_TYPE_NONE 0
Modified: stable/10/usr.sbin/ctld/parse.y
==============================================================================
--- stable/10/usr.sbin/ctld/parse.y Tue Mar 25 12:12:37 2014 (r263724)
+++ stable/10/usr.sbin/ctld/parse.y Tue Mar 25 12:14:48 2014 (r263725)
@@ -224,7 +224,17 @@ portal_group: PORTAL_GROUP portal_group_
portal_group_name: STR
{
- portal_group = portal_group_new(conf, $1);
+ /*
+ * Make it possible to redefine default
+ * portal-group. but only once.
+ */
+ if (strcmp($1, "default") == 0 &&
+ conf->conf_default_pg_defined == false) {
+ portal_group = portal_group_find(conf, $1);
+ conf->conf_default_pg_defined = true;
+ } else {
+ portal_group = portal_group_new(conf, $1);
+ }
free($1);
if (portal_group == NULL)
return (1);
@@ -703,6 +713,7 @@ conf_new_from_file(const char *path)
conf = conf_new();
ag = auth_group_new(conf, "no-authentication");
+ assert(ag != NULL);
ag->ag_type = AG_TYPE_NO_AUTHENTICATION;
/*
@@ -710,11 +721,11 @@ conf_new_from_file(const char *path)
* any entries and thus will always deny access.
*/
ag = auth_group_new(conf, "no-access");
+ assert(ag != NULL);
ag->ag_type = AG_TYPE_CHAP;
pg = portal_group_new(conf, "default");
- portal_group_add_listen(pg, "0.0.0.0:3260", false);
- portal_group_add_listen(pg, "[::]:3260", false);
+ assert(pg != NULL);
yyin = fopen(path, "r");
if (yyin == NULL) {
@@ -736,6 +747,15 @@ conf_new_from_file(const char *path)
return (NULL);
}
+ if (conf->conf_default_pg_defined == false) {
+ log_debugx("portal-group \"default\" not defined; "
+ "going with defaults");
+ pg = portal_group_find(conf, "default");
+ assert(pg != NULL);
+ portal_group_add_listen(pg, "0.0.0.0:3260", false);
+ portal_group_add_listen(pg, "[::]:3260", false);
+ }
+
error = conf_verify(conf);
if (error != 0) {
conf_delete(conf);
More information about the svn-src-stable
mailing list