38 #include <sys/types.h> 40 #include <sys/socket.h> 43 #include <netinet/in.h> 44 #include <arpa/inet.h> 58 #include <qb/qblist.h> 59 #include <qb/qbutil.h> 60 #define LOGSYS_UTILS_ONLY 1 101 const char **error_string,
126 struct qb_list_head logger_subsys_items_head;
129 struct qb_list_head member_items_head;
134 static int read_config_file_into_icmap(
135 const char **error_string,
icmap_map_t config_map);
136 static char error_string_response[512];
138 static int uid_determine (
const char *req_user)
141 struct passwd passwd;
142 struct passwd* pwdptr = &passwd;
143 struct passwd* temp_pwd_pt;
149 id = strtol(req_user, &ep, 10);
150 if (*req_user !=
'\0' && *ep ==
'\0' &&
id >= 0 &&
id <= UINT_MAX) {
154 pwdlinelen = sysconf (_SC_GETPW_R_SIZE_MAX);
156 if (pwdlinelen == -1) {
160 pwdbuffer = malloc (pwdlinelen);
162 while ((rc = getpwnam_r (req_user, pwdptr, pwdbuffer, pwdlinelen, &temp_pwd_pt)) == ERANGE) {
166 if (pwdlinelen <= 32678) {
167 n = realloc (pwdbuffer, pwdlinelen);
176 sprintf (error_string_response,
"getpwnam_r(): %s", strerror(rc));
179 if (temp_pwd_pt == NULL) {
181 sprintf (error_string_response,
182 "The '%s' user is not found in /etc/passwd, please read the documentation.",
186 pw_uid = passwd.pw_uid;
192 static int gid_determine (
const char *req_group)
194 int corosync_gid = 0;
196 struct group * grpptr = &group;
197 struct group * temp_grp_pt;
203 id = strtol(req_group, &ep, 10);
204 if (*req_group !=
'\0' && *ep ==
'\0' &&
id >= 0 &&
id <= UINT_MAX) {
208 grplinelen = sysconf (_SC_GETGR_R_SIZE_MAX);
210 if (grplinelen == -1) {
214 grpbuffer = malloc (grplinelen);
216 while ((rc = getgrnam_r (req_group, grpptr, grpbuffer, grplinelen, &temp_grp_pt)) == ERANGE) {
220 if (grplinelen <= 32678) {
221 n = realloc (grpbuffer, grplinelen);
230 sprintf (error_string_response,
"getgrnam_r(): %s", strerror(rc));
233 if (temp_grp_pt == NULL) {
235 sprintf (error_string_response,
236 "The '%s' group is not found in /etc/group, please read the documentation.",
240 corosync_gid = group.gr_gid;
245 static char *strchr_rs (
const char *haystack,
int byte)
247 const char *end_address = strchr (haystack, byte);
251 while (*end_address ==
' ' || *end_address ==
'\t')
255 return ((
char *) end_address);
260 if (read_config_file_into_icmap(error_string, config_map)) {
267 static char *remove_whitespace(
char *
string,
int remove_colon_and_brace)
273 while (*start ==
' ' || *start ==
'\t')
276 end = start+(strlen(start))-1;
277 while ((*end ==
' ' || *end ==
'\t' || (remove_colon_and_brace && (*end ==
':' || *end ==
'{'))) && end > start)
287 static int parse_section(FILE *fp,
291 const char **error_string,
303 static char formated_err[384];
304 const char *tmp_error_string;
306 if (strcmp(path,
"") == 0) {
307 parser_cb(
"", NULL, NULL, &state,
PARSER_CB_START, error_string, config_map, user_data);
310 tmp_error_string = NULL;
312 while (fgets (line,
sizeof (line), fp)) {
315 if (strlen(line) > 0) {
320 if ((line[strlen(line) - 1] !=
'\n') && !feof(fp)) {
321 tmp_error_string =
"Line too long";
325 if (line[strlen(line) - 1] ==
'\n')
326 line[strlen(line) - 1] =
'\0';
327 if (strlen (line) > 0 && line[strlen(line) - 1] ==
'\r')
328 line[strlen(line) - 1] =
'\0';
333 for (i = strlen (line) - 1; i > -1; i--) {
334 if (line[i] ==
'\t' || line[i] ==
' ') {
342 for (i = 0; i < strlen (line); i++) {
343 if (line[i] !=
'\t' && line[i] !=
' ') {
358 if ((loc = strchr_rs (line,
'{'))) {
364 section = remove_whitespace(line, 1);
365 after_section = remove_whitespace(loc, 0);
367 if (strcmp(section,
"") == 0) {
368 tmp_error_string =
"Missing section name before opening bracket '{'";
372 if (strcmp(after_section,
"") != 0) {
373 tmp_error_string =
"Extra characters after opening bracket '{'";
378 tmp_error_string =
"Start of section makes total cmap path too long";
381 strcpy(new_keyname, path);
382 if (strcmp(path,
"") != 0) {
383 strcat(new_keyname,
".");
385 strcat(new_keyname, section);
390 &tmp_error_string, config_map, user_data)) {
394 if (parse_section(fp, fname, line_no, new_keyname, error_string, depth + 1, newstate,
395 parser_cb, config_map, user_data))
402 if ((loc = strchr_rs (line,
':'))) {
407 key = remove_whitespace(line, 1);
408 value = remove_whitespace(loc, 0);
411 tmp_error_string =
"New key makes total cmap path too long";
414 strcpy(new_keyname, path);
415 if (strcmp(path,
"") != 0) {
416 strcat(new_keyname,
".");
418 strcat(new_keyname, key);
420 if (!parser_cb(new_keyname, key, value, &state,
PARSER_CB_ITEM, &tmp_error_string,
421 config_map, user_data)) {
428 if (strchr_rs (line,
'}')) {
430 trimmed_line = remove_whitespace(line, 0);
432 if (strcmp(trimmed_line,
"}") != 0) {
433 tmp_error_string =
"Extra characters before or after closing bracket '}'";
438 tmp_error_string =
"Unexpected closing brace";
444 config_map, user_data)) {
454 tmp_error_string =
"Line is not opening or closing section or key value";
458 if (strcmp(path,
"") != 0) {
459 tmp_error_string =
"Missing closing brace";
463 if (strcmp(path,
"") == 0) {
464 parser_cb(
"", NULL, NULL, &state,
PARSER_CB_END, error_string, config_map, user_data);
470 if (snprintf(formated_err,
sizeof(formated_err),
"parser error: %s:%u: %s", fname, *line_no,
471 tmp_error_string) >=
sizeof(formated_err)) {
472 *error_string =
"Can't format parser error message";
474 *error_string = formated_err;
480 static int safe_atoq_range(
icmap_value_types_t value_type,
long long int *min_val,
long long int *max_val)
482 switch (value_type) {
504 long long int min_val, max_val;
509 val = strtoll(str, &endptr, 10);
510 if (errno == ERANGE) {
518 if (*endptr !=
'\0') {
522 if (safe_atoq_range(target_type, &min_val, &max_val) != 0) {
526 if (val < min_val || val > max_val) {
534 static int str_to_ull(
const char *str,
unsigned long long int *res)
536 unsigned long long int val;
541 val = strtoull(str, &endptr, 10);
542 if (errno == ERANGE) {
550 if (*endptr !=
'\0') {
558 static int handle_crypto_model(
const char *val,
const char **error_string)
562 "Invalid crypto model. Should be ", error_string) == 1) {
569 static int handle_compress_model(
const char *val,
const char **error_string)
573 "Invalid compression model. Should be ", error_string) == 1) {
580 static int main_config_parser_cb(
const char *path,
585 const char **error_string,
591 long long int min_val, max_val;
593 unsigned long long int ull;
596 static char formated_err[256];
599 struct qb_list_head *iter, *tmp_iter;
608 if (strlen(path) >=
sizeof(key_name)) {
609 if (snprintf(formated_err,
sizeof(formated_err),
610 "Can't store path \"%s\" into key_name", path) >=
sizeof(formated_err)) {
611 *error_string =
"Can't format path into key_name error message";
613 *error_string = formated_err;
621 strncpy(key_name, path,
sizeof(key_name) - 1);
637 if ((strcmp(path,
"pload.count") == 0) ||
638 (strcmp(path,
"pload.size") == 0)) {
640 if (safe_atoq(value, &val, val_type) != 0) {
644 goto icmap_set_error;
650 if ((strcmp(path,
"quorum.expected_votes") == 0) ||
651 (strcmp(path,
"quorum.votes") == 0) ||
652 (strcmp(path,
"quorum.last_man_standing_window") == 0) ||
653 (strcmp(path,
"quorum.leaving_timeout") == 0)) {
655 if (safe_atoq(value, &val, val_type) != 0) {
659 goto icmap_set_error;
664 if ((strcmp(path,
"quorum.two_node") == 0) ||
665 (strcmp(path,
"quorum.expected_votes_tracking") == 0) ||
666 (strcmp(path,
"quorum.allow_downscale") == 0) ||
667 (strcmp(path,
"quorum.wait_for_all") == 0) ||
668 (strcmp(path,
"quorum.auto_tie_breaker") == 0) ||
669 (strcmp(path,
"quorum.last_man_standing") == 0)) {
671 if (safe_atoq(value, &val, val_type) != 0) {
675 goto icmap_set_error;
681 if ((strcmp(path,
"quorum.device.timeout") == 0) ||
682 (strcmp(path,
"quorum.device.sync_timeout") == 0) ||
683 (strcmp(path,
"quorum.device.votes") == 0)) {
685 if (safe_atoq(value, &val, val_type) != 0) {
689 goto icmap_set_error;
693 if ((strcmp(path,
"quorum.device.master_wins") == 0)) {
695 if (safe_atoq(value, &val, val_type) != 0) {
699 goto icmap_set_error;
705 if ((strcmp(path,
"totem.version") == 0) ||
706 (strcmp(path,
"totem.nodeid") == 0) ||
707 (strcmp(path,
"totem.threads") == 0) ||
708 (strcmp(path,
"totem.token") == 0) ||
709 (strcmp(path,
"totem.token_coefficient") == 0) ||
710 (strcmp(path,
"totem.token_retransmit") == 0) ||
711 (strcmp(path,
"totem.token_warning") == 0) ||
712 (strcmp(path,
"totem.hold") == 0) ||
713 (strcmp(path,
"totem.token_retransmits_before_loss_const") == 0) ||
714 (strcmp(path,
"totem.join") == 0) ||
715 (strcmp(path,
"totem.send_join") == 0) ||
716 (strcmp(path,
"totem.consensus") == 0) ||
717 (strcmp(path,
"totem.merge") == 0) ||
718 (strcmp(path,
"totem.downcheck") == 0) ||
719 (strcmp(path,
"totem.fail_recv_const") == 0) ||
720 (strcmp(path,
"totem.seqno_unchanged_const") == 0) ||
721 (strcmp(path,
"totem.rrp_token_expired_timeout") == 0) ||
722 (strcmp(path,
"totem.rrp_problem_count_timeout") == 0) ||
723 (strcmp(path,
"totem.rrp_problem_count_threshold") == 0) ||
724 (strcmp(path,
"totem.rrp_problem_count_mcast_threshold") == 0) ||
725 (strcmp(path,
"totem.rrp_autorecovery_check_timeout") == 0) ||
726 (strcmp(path,
"totem.heartbeat_failures_allowed") == 0) ||
727 (strcmp(path,
"totem.max_network_delay") == 0) ||
728 (strcmp(path,
"totem.window_size") == 0) ||
729 (strcmp(path,
"totem.max_messages") == 0) ||
730 (strcmp(path,
"totem.miss_count_const") == 0) ||
731 (strcmp(path,
"totem.knet_pmtud_interval") == 0) ||
732 (strcmp(path,
"totem.knet_compression_threshold") == 0) ||
733 (strcmp(path,
"totem.netmtu") == 0)) {
735 if (safe_atoq(value, &val, val_type) != 0) {
739 goto icmap_set_error;
743 if (strcmp(path,
"totem.knet_compression_level") == 0) {
745 if (safe_atoq(value, &val, val_type) != 0) {
749 goto icmap_set_error;
753 if (strcmp(path,
"totem.config_version") == 0) {
754 if (str_to_ull(value, &ull) != 0) {
758 goto icmap_set_error;
762 if (strcmp(path,
"totem.ip_version") == 0) {
763 if ((strcmp(value,
"ipv4") != 0) &&
764 (strcmp(value,
"ipv6") != 0) &&
765 (strcmp(value,
"ipv6-4") != 0) &&
766 (strcmp(value,
"ipv4-6") != 0)) {
767 *error_string =
"Invalid ip_version type";
772 if (strcmp(path,
"totem.crypto_model") == 0) {
773 if (handle_crypto_model(value, error_string) != 0) {
778 if (strcmp(path,
"totem.crypto_cipher") == 0) {
779 if ((strcmp(value,
"none") != 0) &&
780 (strcmp(value,
"aes256") != 0) &&
781 (strcmp(value,
"aes192") != 0) &&
782 (strcmp(value,
"aes128") != 0)) {
783 *error_string =
"Invalid cipher type. " 784 "Should be none, aes256, aes192 or aes128";
789 if (strcmp(path,
"totem.crypto_hash") == 0) {
790 if ((strcmp(value,
"none") != 0) &&
791 (strcmp(value,
"md5") != 0) &&
792 (strcmp(value,
"sha1") != 0) &&
793 (strcmp(value,
"sha256") != 0) &&
794 (strcmp(value,
"sha384") != 0) &&
795 (strcmp(value,
"sha512") != 0)) {
796 *error_string =
"Invalid hash type. " 797 "Should be none, md5, sha1, sha256, sha384 or sha512";
803 if (strcmp(path,
"totem.knet_compression_model") == 0) {
804 if (handle_compress_model(value, error_string) != 0) {
812 if (strcmp(path,
"system.qb_ipc_type") == 0) {
813 if ((strcmp(value,
"native") != 0) &&
814 (strcmp(value,
"shm") != 0) &&
815 (strcmp(value,
"socket") != 0)) {
816 *error_string =
"Invalid system.qb_ipc_type";
821 if (strcmp(path,
"system.sched_rr") == 0) {
822 if ((strcmp(value,
"yes") != 0) &&
823 (strcmp(value,
"no") != 0)) {
824 *error_string =
"Invalid system.sched_rr value";
829 if (strcmp(path,
"system.move_to_root_cgroup") == 0) {
830 if ((strcmp(value,
"yes") != 0) &&
831 (strcmp(value,
"no") != 0) &&
832 (strcmp(value,
"auto") != 0)) {
833 *error_string =
"Invalid system.move_to_root_cgroup";
838 if (strcmp(path,
"system.allow_knet_handle_fallback") == 0) {
839 if ((strcmp(value,
"yes") != 0) &&
840 (strcmp(value,
"no") != 0)) {
841 *error_string =
"Invalid system.allow_knet_handle_fallback";
849 if (strcmp(path,
"totem.interface.linknumber") == 0) {
851 if (safe_atoq(value, &val, val_type) != 0) {
858 if (strcmp(path,
"totem.interface.bindnetaddr") == 0) {
862 if (strcmp(path,
"totem.interface.mcastaddr") == 0) {
866 if (strcmp(path,
"totem.interface.broadcast") == 0) {
870 if (strcmp(path,
"totem.interface.mcastport") == 0) {
872 if (safe_atoq(value, &val, val_type) != 0) {
878 if (strcmp(path,
"totem.interface.ttl") == 0) {
880 if (safe_atoq(value, &val, val_type) != 0) {
886 if (strcmp(path,
"totem.interface.knet_link_priority") == 0) {
888 if (safe_atoq(value, &val, val_type) != 0) {
894 if (strcmp(path,
"totem.interface.knet_ping_interval") == 0) {
896 if (safe_atoq(value, &val, val_type) != 0) {
902 if (strcmp(path,
"totem.interface.knet_ping_timeout") == 0) {
904 if (safe_atoq(value, &val, val_type) != 0) {
910 if (strcmp(path,
"totem.interface.knet_ping_precision") == 0) {
912 if (safe_atoq(value, &val, val_type) != 0) {
918 if (strcmp(path,
"totem.interface.knet_pong_count") == 0) {
920 if (safe_atoq(value, &val, val_type) != 0) {
926 if (strcmp(path,
"totem.interface.knet_transport") == 0) {
933 if (strcmp(key,
"subsys") == 0) {
934 data->
subsys = strdup(value);
935 if (data->
subsys == NULL) {
936 *error_string =
"Can't alloc memory";
941 kv_item = malloc(
sizeof(*kv_item));
942 if (kv_item == NULL) {
943 *error_string =
"Can't alloc memory";
947 memset(kv_item, 0,
sizeof(*kv_item));
949 kv_item->
key = strdup(key);
950 kv_item->
value = strdup(value);
951 if (kv_item->
key == NULL || kv_item->
value == NULL) {
953 *error_string =
"Can't alloc memory";
957 qb_list_init(&kv_item->
list);
963 if (strcmp(key,
"subsys") == 0) {
964 data->
subsys = strdup(value);
965 if (data->
subsys == NULL) {
966 *error_string =
"Can't alloc memory";
970 }
else if (strcmp(key,
"name") == 0) {
973 *error_string =
"Can't alloc memory";
978 kv_item = malloc(
sizeof(*kv_item));
979 if (kv_item == NULL) {
980 *error_string =
"Can't alloc memory";
984 memset(kv_item, 0,
sizeof(*kv_item));
986 kv_item->
key = strdup(key);
987 kv_item->
value = strdup(value);
988 if (kv_item->
key == NULL || kv_item->
value == NULL) {
990 *error_string =
"Can't alloc memory";
994 qb_list_init(&kv_item->
list);
1000 if (strcmp(key,
"uid") == 0) {
1001 uid = uid_determine(value);
1003 *error_string = error_string_response;
1009 goto icmap_set_error;
1012 }
else if (strcmp(key,
"gid") == 0) {
1013 gid = gid_determine(value);
1015 *error_string = error_string_response;
1021 goto icmap_set_error;
1025 *error_string =
"uidgid: Only uid and gid are allowed items";
1030 if (strcmp(key,
"memberaddr") != 0) {
1031 *error_string =
"Only memberaddr is allowed in member section";
1036 kv_item = malloc(
sizeof(*kv_item));
1037 if (kv_item == NULL) {
1038 *error_string =
"Can't alloc memory";
1042 memset(kv_item, 0,
sizeof(*kv_item));
1044 kv_item->
key = strdup(key);
1045 kv_item->
value = strdup(value);
1046 if (kv_item->
key == NULL || kv_item->
value == NULL) {
1048 *error_string =
"Can't alloc memory";
1052 qb_list_init(&kv_item->
list);
1060 if ((strcmp(key,
"nodeid") == 0) ||
1061 (strcmp(key,
"quorum_votes") == 0)) {
1063 if (safe_atoq(value, &val, val_type) != 0) {
1068 goto icmap_set_error;
1073 if (add_as_string) {
1075 goto icmap_set_error;
1081 if (strcmp(key,
"watchdog_timeout") == 0) {
1083 if (safe_atoq(value, &val, val_type) != 0) {
1087 goto icmap_set_error;
1094 if (strcmp(key,
"poll_period") == 0) {
1095 if (str_to_ull(value, &ull) != 0) {
1099 goto icmap_set_error;
1106 if (strcmp(key,
"poll_period") == 0) {
1107 if (str_to_ull(value, &ull) != 0) {
1111 goto icmap_set_error;
1118 if (add_as_string) {
1120 goto icmap_set_error;
1125 if (strcmp(path,
"totem.interface") == 0) {
1138 if (strcmp(path,
"totem") == 0) {
1141 if (strcmp(path,
"system") == 0) {
1144 if (strcmp(path,
"logging.logger_subsys") == 0) {
1149 if (strcmp(path,
"logging.logging_daemon") == 0) {
1155 if (strcmp(path,
"uidgid") == 0) {
1158 if (strcmp(path,
"totem.interface.member") == 0) {
1161 if (strcmp(path,
"quorum") == 0) {
1164 if (strcmp(path,
"quorum.device") == 0) {
1167 if (strcmp(path,
"nodelist") == 0) {
1171 if (strcmp(path,
"nodelist.node") == 0) {
1174 if (strcmp(path,
"resources") == 0) {
1177 if (strcmp(path,
"resources.system") == 0) {
1180 if (strcmp(path,
"resources.system.memory_used") == 0) {
1183 if (strcmp(path,
"resources.process") == 0) {
1186 if (strcmp(path,
"resources.process.memory_used") == 0) {
1204 if (cs_err !=
CS_OK) {
1205 goto icmap_set_error;
1217 if (cs_err !=
CS_OK) {
1218 goto icmap_set_error;
1230 if (cs_err !=
CS_OK) {
1231 goto icmap_set_error;
1240 goto icmap_set_error;
1244 if (data->
ttl > -1) {
1248 goto icmap_set_error;
1256 goto icmap_set_error;
1264 goto icmap_set_error;
1272 goto icmap_set_error;
1280 goto icmap_set_error;
1288 goto icmap_set_error;
1297 if (cs_err !=
CS_OK) {
1298 goto icmap_set_error;
1311 free(kv_item->
value);
1316 if (cs_err !=
CS_OK) {
1317 goto icmap_set_error;
1323 if (data->
subsys == NULL) {
1324 *error_string =
"No subsys key in logger_subsys directive";
1336 free(kv_item->
value);
1340 if (cs_err !=
CS_OK) {
1341 goto icmap_set_error;
1351 if (cs_err !=
CS_OK) {
1352 goto icmap_set_error;
1357 *error_string =
"No name key in logging_daemon directive";
1365 if (data->
subsys == NULL) {
1372 "logging.logging_daemon.%s.%s",
1378 "logging.logger_subsys.%s.%s",
1383 "logging.logging_daemon.%s.%s.%s",
1390 free(kv_item->
value);
1394 if (cs_err !=
CS_OK) {
1395 goto icmap_set_error;
1399 if (data->
subsys == NULL) {
1416 if (cs_err !=
CS_OK) {
1420 goto icmap_set_error;
1431 if (cs_err !=
CS_OK) {
1432 goto icmap_set_error;
1470 min_val = max_val = 0;
1475 assert(safe_atoq_range(val_type, &min_val, &max_val) == 0);
1477 if (snprintf(formated_err,
sizeof(formated_err),
1478 "Value of key \"%s\" is expected to be integer in range (%lld..%lld), but \"%s\" was given",
1479 key_name, min_val, max_val, value) >=
sizeof(formated_err)) {
1480 *error_string =
"Can't format parser error message";
1482 *error_string = formated_err;
1488 if (snprintf(formated_err,
sizeof(formated_err),
1489 "Can't store key \"%s\" into icmap, returned error is %s",
1490 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1491 *error_string =
"Can't format parser error message";
1493 *error_string = formated_err;
1499 static int uidgid_config_parser_cb(
const char *path,
1504 const char **error_string,
1510 static char formated_err[256];
1519 if (strcmp(path,
"uidgid.uid") == 0) {
1520 uid = uid_determine(value);
1522 *error_string = error_string_response;
1528 goto icmap_set_error;
1530 }
else if (strcmp(path,
"uidgid.gid") == 0) {
1531 gid = gid_determine(value);
1533 *error_string = error_string_response;
1539 goto icmap_set_error;
1542 *error_string =
"uidgid: Only uid and gid are allowed items";
1547 if (strcmp(path,
"uidgid") != 0) {
1548 *error_string =
"uidgid: Can't add subsection different than uidgid";
1559 if (snprintf(formated_err,
sizeof(formated_err),
1560 "Can't store key \"%s\" into icmap, returned error is %s",
1561 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1562 *error_string =
"Can't format parser error message";
1564 *error_string = formated_err;
1570 static int read_uidgid_files_into_icmap(
1571 const char **error_string,
1577 struct dirent *dirent;
1578 char filename[PATH_MAX + FILENAME_MAX + 1];
1579 char uidgid_dirname[PATH_MAX + FILENAME_MAX + 1];
1581 struct stat stat_buf;
1589 res = snprintf(filename,
sizeof(filename),
"%s",
1591 if (res >=
sizeof(filename)) {
1592 *error_string =
"uidgid.d path too long";
1597 dirname_res = dirname(filename);
1599 res = snprintf(uidgid_dirname,
sizeof(uidgid_dirname),
"%s/%s",
1600 dirname_res,
"uidgid.d");
1601 if (res >=
sizeof(uidgid_dirname)) {
1602 *error_string =
"uidgid.d path too long";
1607 dp = opendir (uidgid_dirname);
1612 for (dirent = readdir(dp);
1614 dirent = readdir(dp)) {
1616 res = snprintf(filename,
sizeof (filename),
"%s/%s", uidgid_dirname, dirent->d_name);
1617 if (res >=
sizeof(filename)) {
1619 *error_string =
"uidgid.d dirname path too long";
1623 res = stat (filename, &stat_buf);
1624 if (res == 0 && S_ISREG(stat_buf.st_mode)) {
1626 fp = fopen (filename,
"r");
1627 if (fp == NULL)
continue;
1632 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1633 uidgid_config_parser_cb, config_map, NULL);
1650 static int read_config_file_into_icmap(
1651 const char **error_string,
1655 const char *filename;
1656 char *error_reason = error_string_response;
1665 fp = fopen (filename,
"r");
1667 char error_str[100];
1668 const char *error_ptr = qb_strerror_r(errno, error_str,
sizeof(error_str));
1669 snprintf (error_reason,
sizeof(error_string_response),
1670 "Can't read file %s: %s",
1671 filename, error_ptr);
1672 *error_string = error_reason;
1679 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1680 main_config_parser_cb, config_map, &data);
1685 res = read_uidgid_files_into_icmap(error_string, config_map);
1689 snprintf (error_reason,
sizeof(error_string_response),
1690 "Successfully read main configuration file '%s'.", filename);
1691 *error_string = error_reason;
char * logging_daemon_name
struct qb_list_head member_items_head
const char * cs_strerror(cs_error_t err)
cs_strerror
int coroparse_configparse(icmap_map_t config_map, const char **error_string)
cs_error_t icmap_set_uint64_r(const icmap_map_t map, const char *key_name, uint64_t value)
struct qb_list_head logger_subsys_items_head
cs_error_t icmap_set_int32_r(const icmap_map_t map, const char *key_name, int32_t value)
int util_is_valid_knet_compress_model(const char *val, const char **list_str, int machine_parseable_str, const char *error_string_prefix, const char **error_string)
cs_error_t icmap_set_string_r(const icmap_map_t map, const char *key_name, const char *value)
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
cs_error_t icmap_set_uint8_r(const icmap_map_t map, const char *key_name, uint8_t value)
const char * corosync_get_config_file(void)
cs_error_t icmap_set_uint32_r(const icmap_map_t map, const char *key_name, uint32_t value)
cs_error_t
The cs_error_t enum.
cs_error_t icmap_set_uint16_r(const icmap_map_t map, const char *key_name, uint16_t value)
int(* parser_cb_f)(const char *path, char *key, char *value, enum main_cp_cb_data_state *state, enum parser_cb_type type, const char **error_string, icmap_map_t config_map, void *user_data)
icmap_value_types_t
Possible types of value.
int util_is_valid_knet_crypto_model(const char *val, const char **list_str, int machine_parseable_str, const char *error_string_prefix, const char **error_string)