Lines Matching +full:int +full:- +full:property
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
65 if (!user || user->type != UCL_STRING) {
66 log_warnx("chap section in auth-group \"%s\" is missing "
67 "\"user\" string key", auth_group->ag_name);
72 if (!secret || secret->type != UCL_STRING) {
73 log_warnx("chap section in auth-group \"%s\" is missing "
74 "\"secret\" string key", auth_group->ag_name);
96 if (!user || user->type != UCL_STRING) {
97 log_warnx("chap-mutual section in auth-group \"%s\" is missing "
98 "\"user\" string key", auth_group->ag_name);
103 if (!secret || secret->type != UCL_STRING) {
104 log_warnx("chap-mutual section in auth-group \"%s\" is missing "
105 "\"secret\" string key", auth_group->ag_name);
109 mutual_user = ucl_object_find_key(obj, "mutual-user");
110 if (!user || user->type != UCL_STRING) {
111 log_warnx("chap-mutual section in auth-group \"%s\" is missing "
112 "\"mutual-user\" string key", auth_group->ag_name);
116 mutual_secret = ucl_object_find_key(obj, "mutual-secret");
117 if (!secret || secret->type != UCL_STRING) {
118 log_warnx("chap-mutual section in auth-group \"%s\" is missing "
119 "\"mutual-secret\" string key", auth_group->ag_name);
144 if (!portal_group || portal_group->type != UCL_STRING) {
145 log_warnx("portal-group section in target \"%s\" is missing "
146 "\"name\" string key", target->t_name);
150 auth_group = ucl_object_find_key(obj, "auth-group-name");
151 if (auth_group && auth_group->type != UCL_STRING) {
152 log_warnx("portal-group section in target \"%s\" is missing "
153 "\"auth-group-name\" string key", target->t_name);
160 log_warnx("unknown portal-group \"%s\" for target "
161 "\"%s\"", ucl_object_tostring(portal_group), target->t_name);
168 log_warnx("unknown auth-group \"%s\" for target "
170 target->t_name);
177 log_warnx("can't link portal-group \"%s\" to target "
178 "\"%s\"", ucl_object_tostring(portal_group), target->t_name);
181 tp->p_auth_group = tag;
192 if (obj->type == UCL_INT) {
198 tmp, target->t_name);
202 asprintf(&name, "%s,lun,%ju", target->t_name, tmp);
208 target->t_luns[tmp] = lun;
212 if (obj->type == UCL_OBJECT) {
216 if (num == NULL || num->type != UCL_INT) {
218 "\"number\" integer property", target->t_name);
224 tmp, target->t_name);
228 if (name == NULL || name->type != UCL_STRING) {
230 "\"name\" string property", target->t_name);
238 target->t_luns[tmp] = lun;
249 int err = 0;
251 /* Pass 1 - everything except targets */
256 if (obj->type == UCL_INT)
257 conf->conf_debug = ucl_object_toint(obj);
259 log_warnx("\"debug\" property value is not integer");
265 if (obj->type == UCL_INT)
266 conf->conf_timeout = ucl_object_toint(obj);
268 log_warnx("\"timeout\" property value is not integer");
274 if (obj->type == UCL_INT)
275 conf->conf_maxproc = ucl_object_toint(obj);
277 log_warnx("\"maxproc\" property value is not integer");
283 if (obj->type == UCL_STRING)
284 conf->conf_pidfile_path = strdup(
287 log_warnx("\"pidfile\" property value is not string");
292 if (!strcmp(key, "isns-server")) {
293 if (obj->type == UCL_ARRAY) {
297 if (child->type != UCL_STRING)
307 log_warnx("\"isns-server\" property value is "
313 if (!strcmp(key, "isns-period")) {
314 if (obj->type == UCL_INT)
315 conf->conf_timeout = ucl_object_toint(obj);
317 log_warnx("\"isns-period\" property value is not integer");
322 if (!strcmp(key, "isns-timeout")) {
323 if (obj->type == UCL_INT)
324 conf->conf_timeout = ucl_object_toint(obj);
326 log_warnx("\"isns-timeout\" property value is not integer");
331 if (!strcmp(key, "auth-group")) {
332 if (obj->type == UCL_OBJECT) {
338 log_warnx("\"auth-group\" section is not an object");
343 if (!strcmp(key, "portal-group")) {
344 if (obj->type == UCL_OBJECT) {
350 log_warnx("\"portal-group\" section is not an object");
356 if (obj->type == UCL_OBJECT) {
368 /* Pass 2 - targets */
374 if (obj->type == UCL_OBJECT) {
400 int err;
403 conf->conf_default_ag_defined == false) {
405 conf->conf_default_ag_defined = true;
416 if (!strcmp(key, "auth-type")) {
425 if (obj->type != UCL_ARRAY) {
426 log_warnx("\"chap\" property of "
427 "auth-group \"%s\" is not an array",
439 if (!strcmp(key, "chap-mutual")) {
440 if (obj->type != UCL_ARRAY) {
441 log_warnx("\"chap-mutual\" property of "
442 "auth-group \"%s\" is not an array",
454 if (!strcmp(key, "initiator-name")) {
455 if (obj->type != UCL_ARRAY) {
456 log_warnx("\"initiator-name\" property of "
457 "auth-group \"%s\" is not an array",
472 if (!strcmp(key, "initiator-portal")) {
473 if (obj->type != UCL_ARRAY) {
474 log_warnx("\"initiator-portal\" property of "
475 "auth-group \"%s\" is not an array",
503 conf->conf_default_pg_defined == false) {
505 conf->conf_default_pg_defined = true;
516 if (!strcmp(key, "discovery-auth-group")) {
517 portal_group->pg_discovery_auth_group =
519 if (portal_group->pg_discovery_auth_group == NULL) {
520 log_warnx("unknown discovery-auth-group \"%s\" "
521 "for portal-group \"%s\"",
523 portal_group->pg_name);
528 if (!strcmp(key, "discovery-filter")) {
529 if (obj->type != UCL_STRING) {
530 log_warnx("\"discovery-filter\" property of "
531 "portal-group \"%s\" is not a string",
532 portal_group->pg_name);
542 if (obj->type == UCL_STRING) {
546 } else if (obj->type == UCL_ARRAY) {
556 log_warnx("\"listen\" property of "
557 "portal-group \"%s\" is not a string",
558 portal_group->pg_name);
563 if (!strcmp(key, "listen-iser")) {
564 if (obj->type == UCL_STRING) {
568 } else if (obj->type == UCL_ARRAY) {
578 log_warnx("\"listen\" property of "
579 "portal-group \"%s\" is not a string",
580 portal_group->pg_name);
586 if (obj->type != UCL_STRING) {
587 log_warnx("\"listen\" property of "
588 "portal-group \"%s\" is not a string",
589 portal_group->pg_name);
599 if (obj->type != UCL_OBJECT) {
600 log_warnx("\"options\" property of portal group "
601 "\"%s\" is not an object", portal_group->pg_name);
607 option_new(&portal_group->pg_options,
614 if ((obj->type != UCL_STRING) && (obj->type != UCL_INT)) {
615 log_warnx("\"dscp\" property of portal group "
616 "\"%s\" is not a string or integer", portal_group->pg_name);
619 if (obj->type == UCL_INT)
620 portal_group->pg_dscp = ucl_object_toint(obj);
624 portal_group->pg_dscp = strtol(key + 2, NULL, 16);
626 portal_group->pg_dscp = IPTOS_DSCP_CS0 >> 2;
628 portal_group->pg_dscp = IPTOS_DSCP_EF >> 2;
630 portal_group->pg_dscp = IPTOS_DSCP_CS0 >> 2;
632 portal_group->pg_dscp = IPTOS_DSCP_CS1 >> 2;
634 portal_group->pg_dscp = IPTOS_DSCP_CS2 >> 2;
636 portal_group->pg_dscp = IPTOS_DSCP_CS3 >> 2;
638 portal_group->pg_dscp = IPTOS_DSCP_CS4 >> 2;
640 portal_group->pg_dscp = IPTOS_DSCP_CS5 >> 2;
642 portal_group->pg_dscp = IPTOS_DSCP_CS6 >> 2;
644 portal_group->pg_dscp = IPTOS_DSCP_CS7 >> 2;
646 portal_group->pg_dscp = IPTOS_DSCP_AF11 >> 2;
648 portal_group->pg_dscp = IPTOS_DSCP_AF12 >> 2;
650 portal_group->pg_dscp = IPTOS_DSCP_AF13 >> 2;
652 portal_group->pg_dscp = IPTOS_DSCP_AF21 >> 2;
654 portal_group->pg_dscp = IPTOS_DSCP_AF22 >> 2;
656 portal_group->pg_dscp = IPTOS_DSCP_AF23 >> 2;
658 portal_group->pg_dscp = IPTOS_DSCP_AF31 >> 2;
660 portal_group->pg_dscp = IPTOS_DSCP_AF32 >> 2;
662 portal_group->pg_dscp = IPTOS_DSCP_AF33 >> 2;
664 portal_group->pg_dscp = IPTOS_DSCP_AF41 >> 2;
666 portal_group->pg_dscp = IPTOS_DSCP_AF42 >> 2;
668 portal_group->pg_dscp = IPTOS_DSCP_AF43 >> 2;
670 log_warnx("\"dscp\" property value is not a supported textual value");
677 if (obj->type != UCL_INT) {
678 log_warnx("\"pcp\" property of portal group "
679 "\"%s\" is not an integer", portal_group->pg_name);
682 portal_group->pg_pcp = ucl_object_toint(obj);
683 if (!((portal_group->pg_pcp >= 0) && (portal_group->pg_pcp <= 7))) {
684 log_warnx("invalid \"pcp\" value %d, using default", portal_group->pg_pcp);
685 portal_group->pg_pcp = -1;
709 if (obj->type != UCL_STRING) {
710 log_warnx("\"alias\" property of target "
711 "\"%s\" is not a string", target->t_name);
715 target->t_alias = strdup(ucl_object_tostring(obj));
718 if (!strcmp(key, "auth-group")) {
721 if (target->t_auth_group != NULL) {
722 if (target->t_auth_group->ag_name != NULL)
723 log_warnx("auth-group for target \"%s\" "
725 target->t_name);
727 log_warnx("cannot use both auth-group "
729 "target \"%s\"", target->t_name);
734 log_warnx("auth-group must be a string");
737 target->t_auth_group = auth_group_find(conf, ag);
738 if (target->t_auth_group == NULL) {
739 log_warnx("unknown auth-group \"%s\" for target "
741 target->t_name);
746 if (!strcmp(key, "auth-type")) {
747 int error;
749 if (target->t_auth_group != NULL) {
750 if (target->t_auth_group->ag_name != NULL) {
751 log_warnx("cannot use both auth-group and "
752 "auth-type for target \"%s\"",
753 target->t_name);
757 target->t_auth_group = auth_group_new(conf, NULL);
758 if (target->t_auth_group == NULL)
761 target->t_auth_group->ag_target = target;
763 error = auth_group_set_type(target->t_auth_group,
770 if (target->t_auth_group != NULL) {
771 if (target->t_auth_group->ag_name != NULL) {
772 log_warnx("cannot use both auth-group "
774 target->t_name);
778 target->t_auth_group = auth_group_new(conf, NULL);
779 if (target->t_auth_group == NULL) {
782 target->t_auth_group->ag_target = target;
784 if (!uclparse_chap(target->t_auth_group, obj))
788 if (!strcmp(key, "chap-mutual")) {
789 if (!uclparse_chap_mutual(target->t_auth_group, obj))
793 if (!strcmp(key, "initiator-name")) {
796 if (target->t_auth_group != NULL) {
797 if (target->t_auth_group->ag_name != NULL) {
798 log_warnx("cannot use both auth-group and "
799 "initiator-name for target \"%s\"",
800 target->t_name);
804 target->t_auth_group = auth_group_new(conf, NULL);
805 if (target->t_auth_group == NULL)
808 target->t_auth_group->ag_target = target;
810 an = auth_name_new(target->t_auth_group,
816 if (!strcmp(key, "initiator-portal")) {
819 if (target->t_auth_group != NULL) {
820 if (target->t_auth_group->ag_name != NULL) {
821 log_warnx("cannot use both auth-group and "
822 "initiator-portal for target \"%s\"",
823 target->t_name);
827 target->t_auth_group = auth_group_new(conf, NULL);
828 if (target->t_auth_group == NULL)
831 target->t_auth_group->ag_target = target;
833 ap = auth_portal_new(target->t_auth_group,
839 if (!strcmp(key, "portal-group")) {
840 if (obj->type == UCL_OBJECT) {
845 if (obj->type == UCL_ARRAY) {
859 target->t_pport = strdup(value);
863 if (obj->type != UCL_STRING) {
864 log_warnx("\"redirect\" property of target "
865 "\"%s\" is not a string", target->t_name);
901 if (obj->type != UCL_STRING) {
902 log_warnx("\"backend\" property of lun "
904 lun->l_name);
912 if (obj->type != UCL_INT) {
913 log_warnx("\"blocksize\" property of lun "
914 "\"%s\" is not an integer", lun->l_name);
921 if (!strcmp(key, "device-id")) {
922 if (obj->type != UCL_STRING) {
923 log_warnx("\"device-id\" property of lun "
924 "\"%s\" is not an integer", lun->l_name);
932 if (obj->type != UCL_OBJECT) {
933 log_warnx("\"options\" property of lun "
934 "\"%s\" is not an object", lun->l_name);
940 option_new(&lun->l_options,
947 if (obj->type != UCL_STRING) {
948 log_warnx("\"path\" property of lun "
949 "\"%s\" is not a string", lun->l_name);
957 if (obj->type != UCL_STRING) {
958 log_warnx("\"serial\" property of lun "
959 "\"%s\" is not a string", lun->l_name);
967 if (obj->type != UCL_INT) {
968 log_warnx("\"size\" property of lun "
969 "\"%s\" is not an integer", lun->l_name);
980 int