Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144609806
D48935.1775746267.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D48935.1775746267.diff
View Options
diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c
--- a/usr.sbin/ctld/uclparse.c
+++ b/usr.sbin/ctld/uclparse.c
@@ -420,66 +420,90 @@
}
if (strcmp(key, "chap") == 0) {
- if (obj->type != UCL_ARRAY) {
- log_warnx("\"chap\" property of "
- "auth-group \"%s\" is not an array",
+ if (obj->type == UCL_OBJECT) {
+ if (!uclparse_chap(name, obj))
+ goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ it2 = NULL;
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ if (!uclparse_chap(name, tmp))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"chap\" property of auth-group "
+ "\"%s\" is not an array or object",
name);
goto fail;
}
-
- it2 = NULL;
- while ((tmp = ucl_iterate_object(obj, &it2, true))) {
- if (!uclparse_chap(name, tmp))
- goto fail;
- }
}
if (strcmp(key, "chap-mutual") == 0) {
- if (obj->type != UCL_ARRAY) {
+ if (obj->type == UCL_OBJECT) {
+ if (!uclparse_chap_mutual(name, obj))
+ goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ it2 = NULL;
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ if (!uclparse_chap_mutual(name, tmp))
+ goto fail;
+ }
+ } else {
log_warnx("\"chap-mutual\" property of "
- "auth-group \"%s\" is not an array",
+ "auth-group \"%s\" is not an array or object",
name);
goto fail;
}
-
- it2 = NULL;
- while ((tmp = ucl_iterate_object(obj, &it2, true))) {
- if (!uclparse_chap_mutual(name, tmp))
- goto fail;
- }
}
if (strcmp(key, "initiator-name") == 0) {
- if (obj->type != UCL_ARRAY) {
- log_warnx("\"initiator-name\" property of "
- "auth-group \"%s\" is not an array",
- name);
- goto fail;
- }
-
- it2 = NULL;
- while ((tmp = ucl_iterate_object(obj, &it2, true))) {
- const char *value = ucl_object_tostring(tmp);
+ if (obj->type == UCL_STRING) {
+ const char *value = ucl_object_tostring(obj);
if (!auth_group_add_initiator_name(value))
goto fail;
- }
- }
+ } else if (obj->type == UCL_ARRAY) {
+ it2 = NULL;
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ const char *value =
+ ucl_object_tostring(tmp);
- if (strcmp(key, "initiator-portal") == 0) {
- if (obj->type != UCL_ARRAY) {
- log_warnx("\"initiator-portal\" property of "
- "auth-group \"%s\" is not an array",
+ if (!auth_group_add_initiator_name(
+ value))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"initiator-name\" property of "
+ "auth-group \"%s\" is not an array or string",
name);
goto fail;
}
+ }
- it2 = NULL;
- while ((tmp = ucl_iterate_object(obj, &it2, true))) {
- const char *value = ucl_object_tostring(tmp);
+ if (strcmp(key, "initiator-portal") == 0) {
+ if (obj->type == UCL_STRING) {
+ const char *value = ucl_object_tostring(obj);
if (!auth_group_add_initiator_portal(value))
goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ it2 = NULL;
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ const char *value =
+ ucl_object_tostring(tmp);
+
+ if (!auth_group_add_initiator_portal(
+ value))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"initiator-portal\" property of "
+ "auth-group \"%s\" is not an array or string",
+ name);
+ goto fail;
}
}
}
@@ -746,25 +770,80 @@
}
if (strcmp(key, "chap") == 0) {
- if (!uclparse_target_chap(name, obj))
+ if (obj->type == UCL_OBJECT) {
+ if (!uclparse_target_chap(name, obj))
+ goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ if (!uclparse_target_chap(name, tmp))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"chap\" property of target "
+ "\"%s\" is not an array or object",
+ name);
goto fail;
+ }
}
if (strcmp(key, "chap-mutual") == 0) {
- if (!uclparse_target_chap_mutual(name, obj))
+ if (obj->type == UCL_OBJECT) {
+ if (!uclparse_target_chap_mutual(name, obj))
+ goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ if (!uclparse_target_chap_mutual(name,
+ tmp))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"chap-mutual\" property of target "
+ "\"%s\" is not an array or object",
+ name);
goto fail;
+ }
}
if (strcmp(key, "initiator-name") == 0) {
- if (!target_add_initiator_name(
- ucl_object_tostring(obj)))
+ if (obj->type == UCL_STRING) {
+ if (!target_add_initiator_name(
+ ucl_object_tostring(obj)))
+ goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ if (!target_add_initiator_name(
+ ucl_object_tostring(tmp)))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"initiator-name\" property of "
+ "target \"%s\" is not an array or string",
+ name);
goto fail;
+ }
}
if (strcmp(key, "initiator-portal") == 0) {
- if (!target_add_initiator_portal(
- ucl_object_tostring(obj)))
+ if (obj->type == UCL_STRING) {
+ if (!target_add_initiator_portal(
+ ucl_object_tostring(obj)))
+ goto fail;
+ } else if (obj->type == UCL_ARRAY) {
+ while ((tmp = ucl_iterate_object(obj, &it2,
+ true))) {
+ if (!target_add_initiator_portal(
+ ucl_object_tostring(tmp)))
+ goto fail;
+ }
+ } else {
+ log_warnx("\"initiator-portal\" property of "
+ "target \"%s\" is not an array or string",
+ name);
goto fail;
+ }
}
if (strcmp(key, "portal-group") == 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 9, 2:51 PM (16 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28309127
Default Alt Text
D48935.1775746267.diff (5 KB)
Attached To
Mode
D48935: ctld: Be more consistent for auth parameters in the UCL config
Attached
Detach File
Event Timeline
Log In to Comment