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 main_config_parser_cb(
const char *path,
563 const char **error_string,
569 long long int min_val, max_val;
571 unsigned long long int ull;
574 static char formated_err[256];
577 struct qb_list_head *iter, *tmp_iter;
586 if (strlen(path) >=
sizeof(key_name)) {
587 if (snprintf(formated_err,
sizeof(formated_err),
588 "Can't store path \"%s\" into key_name", path) >=
sizeof(formated_err)) {
589 *error_string =
"Can't format path into key_name error message";
591 *error_string = formated_err;
599 strncpy(key_name, path,
sizeof(key_name) - 1);
615 if ((strcmp(path,
"pload.count") == 0) ||
616 (strcmp(path,
"pload.size") == 0)) {
618 if (safe_atoq(value, &val, val_type) != 0) {
622 goto icmap_set_error;
628 if ((strcmp(path,
"quorum.expected_votes") == 0) ||
629 (strcmp(path,
"quorum.votes") == 0) ||
630 (strcmp(path,
"quorum.last_man_standing_window") == 0) ||
631 (strcmp(path,
"quorum.leaving_timeout") == 0)) {
633 if (safe_atoq(value, &val, val_type) != 0) {
637 goto icmap_set_error;
642 if ((strcmp(path,
"quorum.two_node") == 0) ||
643 (strcmp(path,
"quorum.expected_votes_tracking") == 0) ||
644 (strcmp(path,
"quorum.allow_downscale") == 0) ||
645 (strcmp(path,
"quorum.wait_for_all") == 0) ||
646 (strcmp(path,
"quorum.auto_tie_breaker") == 0) ||
647 (strcmp(path,
"quorum.last_man_standing") == 0)) {
649 if (safe_atoq(value, &val, val_type) != 0) {
653 goto icmap_set_error;
659 if ((strcmp(path,
"quorum.device.timeout") == 0) ||
660 (strcmp(path,
"quorum.device.sync_timeout") == 0) ||
661 (strcmp(path,
"quorum.device.votes") == 0)) {
663 if (safe_atoq(value, &val, val_type) != 0) {
667 goto icmap_set_error;
671 if ((strcmp(path,
"quorum.device.master_wins") == 0)) {
673 if (safe_atoq(value, &val, val_type) != 0) {
677 goto icmap_set_error;
683 if ((strcmp(path,
"totem.version") == 0) ||
684 (strcmp(path,
"totem.nodeid") == 0) ||
685 (strcmp(path,
"totem.threads") == 0) ||
686 (strcmp(path,
"totem.token") == 0) ||
687 (strcmp(path,
"totem.token_coefficient") == 0) ||
688 (strcmp(path,
"totem.token_retransmit") == 0) ||
689 (strcmp(path,
"totem.token_warning") == 0) ||
690 (strcmp(path,
"totem.hold") == 0) ||
691 (strcmp(path,
"totem.token_retransmits_before_loss_const") == 0) ||
692 (strcmp(path,
"totem.join") == 0) ||
693 (strcmp(path,
"totem.send_join") == 0) ||
694 (strcmp(path,
"totem.consensus") == 0) ||
695 (strcmp(path,
"totem.merge") == 0) ||
696 (strcmp(path,
"totem.downcheck") == 0) ||
697 (strcmp(path,
"totem.fail_recv_const") == 0) ||
698 (strcmp(path,
"totem.seqno_unchanged_const") == 0) ||
699 (strcmp(path,
"totem.rrp_token_expired_timeout") == 0) ||
700 (strcmp(path,
"totem.rrp_problem_count_timeout") == 0) ||
701 (strcmp(path,
"totem.rrp_problem_count_threshold") == 0) ||
702 (strcmp(path,
"totem.rrp_problem_count_mcast_threshold") == 0) ||
703 (strcmp(path,
"totem.rrp_autorecovery_check_timeout") == 0) ||
704 (strcmp(path,
"totem.heartbeat_failures_allowed") == 0) ||
705 (strcmp(path,
"totem.max_network_delay") == 0) ||
706 (strcmp(path,
"totem.window_size") == 0) ||
707 (strcmp(path,
"totem.max_messages") == 0) ||
708 (strcmp(path,
"totem.miss_count_const") == 0) ||
709 (strcmp(path,
"totem.knet_pmtud_interval") == 0) ||
710 (strcmp(path,
"totem.knet_compression_threshold") == 0) ||
711 (strcmp(path,
"totem.netmtu") == 0)) {
713 if (safe_atoq(value, &val, val_type) != 0) {
717 goto icmap_set_error;
721 if (strcmp(path,
"totem.knet_compression_level") == 0) {
723 if (safe_atoq(value, &val, val_type) != 0) {
727 goto icmap_set_error;
731 if (strcmp(path,
"totem.config_version") == 0) {
732 if (str_to_ull(value, &ull) != 0) {
736 goto icmap_set_error;
740 if (strcmp(path,
"totem.ip_version") == 0) {
741 if ((strcmp(value,
"ipv4") != 0) &&
742 (strcmp(value,
"ipv6") != 0) &&
743 (strcmp(value,
"ipv6-4") != 0) &&
744 (strcmp(value,
"ipv4-6") != 0)) {
745 *error_string =
"Invalid ip_version type";
750 if (strcmp(path,
"totem.crypto_model") == 0) {
751 if ((strcmp(value,
"nss") != 0) &&
752 (strcmp(value,
"openssl") != 0)) {
753 *error_string =
"Invalid crypto model. " 754 "Should be nss or openssl";
759 if (strcmp(path,
"totem.crypto_cipher") == 0) {
760 if ((strcmp(value,
"none") != 0) &&
761 (strcmp(value,
"aes256") != 0) &&
762 (strcmp(value,
"aes192") != 0) &&
763 (strcmp(value,
"aes128") != 0)) {
764 *error_string =
"Invalid cipher type. " 765 "Should be none, aes256, aes192 or aes128";
770 if (strcmp(path,
"totem.crypto_hash") == 0) {
771 if ((strcmp(value,
"none") != 0) &&
772 (strcmp(value,
"md5") != 0) &&
773 (strcmp(value,
"sha1") != 0) &&
774 (strcmp(value,
"sha256") != 0) &&
775 (strcmp(value,
"sha384") != 0) &&
776 (strcmp(value,
"sha512") != 0)) {
777 *error_string =
"Invalid hash type. " 778 "Should be none, md5, sha1, sha256, sha384 or sha512";
786 if (strcmp(path,
"system.qb_ipc_type") == 0) {
787 if ((strcmp(value,
"native") != 0) &&
788 (strcmp(value,
"shm") != 0) &&
789 (strcmp(value,
"socket") != 0)) {
790 *error_string =
"Invalid system.qb_ipc_type";
795 if (strcmp(path,
"system.sched_rr") == 0) {
796 if ((strcmp(value,
"yes") != 0) &&
797 (strcmp(value,
"no") != 0)) {
798 *error_string =
"Invalid system.sched_rr value";
803 if (strcmp(path,
"system.move_to_root_cgroup") == 0) {
804 if ((strcmp(value,
"yes") != 0) &&
805 (strcmp(value,
"no") != 0)) {
806 *error_string =
"Invalid system.move_to_root_cgroup";
814 if (strcmp(path,
"totem.interface.linknumber") == 0) {
816 if (safe_atoq(value, &val, val_type) != 0) {
823 if (strcmp(path,
"totem.interface.bindnetaddr") == 0) {
827 if (strcmp(path,
"totem.interface.mcastaddr") == 0) {
831 if (strcmp(path,
"totem.interface.broadcast") == 0) {
835 if (strcmp(path,
"totem.interface.mcastport") == 0) {
837 if (safe_atoq(value, &val, val_type) != 0) {
843 if (strcmp(path,
"totem.interface.ttl") == 0) {
845 if (safe_atoq(value, &val, val_type) != 0) {
851 if (strcmp(path,
"totem.interface.knet_link_priority") == 0) {
853 if (safe_atoq(value, &val, val_type) != 0) {
859 if (strcmp(path,
"totem.interface.knet_ping_interval") == 0) {
861 if (safe_atoq(value, &val, val_type) != 0) {
867 if (strcmp(path,
"totem.interface.knet_ping_timeout") == 0) {
869 if (safe_atoq(value, &val, val_type) != 0) {
875 if (strcmp(path,
"totem.interface.knet_ping_precision") == 0) {
877 if (safe_atoq(value, &val, val_type) != 0) {
883 if (strcmp(path,
"totem.interface.knet_pong_count") == 0) {
885 if (safe_atoq(value, &val, val_type) != 0) {
891 if (strcmp(path,
"totem.interface.knet_transport") == 0) {
898 if (strcmp(key,
"subsys") == 0) {
899 data->
subsys = strdup(value);
900 if (data->
subsys == NULL) {
901 *error_string =
"Can't alloc memory";
906 kv_item = malloc(
sizeof(*kv_item));
907 if (kv_item == NULL) {
908 *error_string =
"Can't alloc memory";
912 memset(kv_item, 0,
sizeof(*kv_item));
914 kv_item->
key = strdup(key);
915 kv_item->
value = strdup(value);
916 if (kv_item->
key == NULL || kv_item->
value == NULL) {
918 *error_string =
"Can't alloc memory";
922 qb_list_init(&kv_item->
list);
928 if (strcmp(key,
"subsys") == 0) {
929 data->
subsys = strdup(value);
930 if (data->
subsys == NULL) {
931 *error_string =
"Can't alloc memory";
935 }
else if (strcmp(key,
"name") == 0) {
938 *error_string =
"Can't alloc memory";
943 kv_item = malloc(
sizeof(*kv_item));
944 if (kv_item == NULL) {
945 *error_string =
"Can't alloc memory";
949 memset(kv_item, 0,
sizeof(*kv_item));
951 kv_item->
key = strdup(key);
952 kv_item->
value = strdup(value);
953 if (kv_item->
key == NULL || kv_item->
value == NULL) {
955 *error_string =
"Can't alloc memory";
959 qb_list_init(&kv_item->
list);
965 if (strcmp(key,
"uid") == 0) {
966 uid = uid_determine(value);
968 *error_string = error_string_response;
974 goto icmap_set_error;
977 }
else if (strcmp(key,
"gid") == 0) {
978 gid = gid_determine(value);
980 *error_string = error_string_response;
986 goto icmap_set_error;
990 *error_string =
"uidgid: Only uid and gid are allowed items";
995 if (strcmp(key,
"memberaddr") != 0) {
996 *error_string =
"Only memberaddr is allowed in member section";
1001 kv_item = malloc(
sizeof(*kv_item));
1002 if (kv_item == NULL) {
1003 *error_string =
"Can't alloc memory";
1007 memset(kv_item, 0,
sizeof(*kv_item));
1009 kv_item->
key = strdup(key);
1010 kv_item->
value = strdup(value);
1011 if (kv_item->
key == NULL || kv_item->
value == NULL) {
1013 *error_string =
"Can't alloc memory";
1017 qb_list_init(&kv_item->
list);
1025 if ((strcmp(key,
"nodeid") == 0) ||
1026 (strcmp(key,
"quorum_votes") == 0)) {
1028 if (safe_atoq(value, &val, val_type) != 0) {
1033 goto icmap_set_error;
1038 if (add_as_string) {
1040 goto icmap_set_error;
1046 if (strcmp(key,
"watchdog_timeout") == 0) {
1048 if (safe_atoq(value, &val, val_type) != 0) {
1052 goto icmap_set_error;
1059 if (strcmp(key,
"poll_period") == 0) {
1060 if (str_to_ull(value, &ull) != 0) {
1064 goto icmap_set_error;
1071 if (strcmp(key,
"poll_period") == 0) {
1072 if (str_to_ull(value, &ull) != 0) {
1076 goto icmap_set_error;
1083 if (add_as_string) {
1085 goto icmap_set_error;
1090 if (strcmp(path,
"totem.interface") == 0) {
1103 if (strcmp(path,
"totem") == 0) {
1106 if (strcmp(path,
"system") == 0) {
1109 if (strcmp(path,
"logging.logger_subsys") == 0) {
1114 if (strcmp(path,
"logging.logging_daemon") == 0) {
1120 if (strcmp(path,
"uidgid") == 0) {
1123 if (strcmp(path,
"totem.interface.member") == 0) {
1126 if (strcmp(path,
"quorum") == 0) {
1129 if (strcmp(path,
"quorum.device") == 0) {
1132 if (strcmp(path,
"nodelist") == 0) {
1136 if (strcmp(path,
"nodelist.node") == 0) {
1139 if (strcmp(path,
"resources") == 0) {
1142 if (strcmp(path,
"resources.system") == 0) {
1145 if (strcmp(path,
"resources.system.memory_used") == 0) {
1148 if (strcmp(path,
"resources.process") == 0) {
1151 if (strcmp(path,
"resources.process.memory_used") == 0) {
1169 if (cs_err !=
CS_OK) {
1170 goto icmap_set_error;
1182 if (cs_err !=
CS_OK) {
1183 goto icmap_set_error;
1195 if (cs_err !=
CS_OK) {
1196 goto icmap_set_error;
1205 goto icmap_set_error;
1209 if (data->
ttl > -1) {
1213 goto icmap_set_error;
1221 goto icmap_set_error;
1229 goto icmap_set_error;
1237 goto icmap_set_error;
1245 goto icmap_set_error;
1253 goto icmap_set_error;
1262 if (cs_err !=
CS_OK) {
1263 goto icmap_set_error;
1276 free(kv_item->
value);
1281 if (cs_err !=
CS_OK) {
1282 goto icmap_set_error;
1288 if (data->
subsys == NULL) {
1289 *error_string =
"No subsys key in logger_subsys directive";
1301 free(kv_item->
value);
1305 if (cs_err !=
CS_OK) {
1306 goto icmap_set_error;
1316 if (cs_err !=
CS_OK) {
1317 goto icmap_set_error;
1322 *error_string =
"No name key in logging_daemon directive";
1330 if (data->
subsys == NULL) {
1337 "logging.logging_daemon.%s.%s",
1343 "logging.logger_subsys.%s.%s",
1348 "logging.logging_daemon.%s.%s.%s",
1355 free(kv_item->
value);
1359 if (cs_err !=
CS_OK) {
1360 goto icmap_set_error;
1364 if (data->
subsys == NULL) {
1381 if (cs_err !=
CS_OK) {
1385 goto icmap_set_error;
1396 if (cs_err !=
CS_OK) {
1397 goto icmap_set_error;
1435 min_val = max_val = 0;
1440 assert(safe_atoq_range(val_type, &min_val, &max_val) == 0);
1442 if (snprintf(formated_err,
sizeof(formated_err),
1443 "Value of key \"%s\" is expected to be integer in range (%lld..%lld), but \"%s\" was given",
1444 key_name, min_val, max_val, value) >=
sizeof(formated_err)) {
1445 *error_string =
"Can't format parser error message";
1447 *error_string = formated_err;
1453 if (snprintf(formated_err,
sizeof(formated_err),
1454 "Can't store key \"%s\" into icmap, returned error is %s",
1455 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1456 *error_string =
"Can't format parser error message";
1458 *error_string = formated_err;
1464 static int uidgid_config_parser_cb(
const char *path,
1469 const char **error_string,
1475 static char formated_err[256];
1484 if (strcmp(path,
"uidgid.uid") == 0) {
1485 uid = uid_determine(value);
1487 *error_string = error_string_response;
1493 goto icmap_set_error;
1495 }
else if (strcmp(path,
"uidgid.gid") == 0) {
1496 gid = gid_determine(value);
1498 *error_string = error_string_response;
1504 goto icmap_set_error;
1507 *error_string =
"uidgid: Only uid and gid are allowed items";
1512 if (strcmp(path,
"uidgid") != 0) {
1513 *error_string =
"uidgid: Can't add subsection different than uidgid";
1524 if (snprintf(formated_err,
sizeof(formated_err),
1525 "Can't store key \"%s\" into icmap, returned error is %s",
1526 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1527 *error_string =
"Can't format parser error message";
1529 *error_string = formated_err;
1535 static int read_uidgid_files_into_icmap(
1536 const char **error_string,
1542 struct dirent *dirent;
1543 char filename[PATH_MAX + FILENAME_MAX + 1];
1544 char uidgid_dirname[PATH_MAX + FILENAME_MAX + 1];
1546 struct stat stat_buf;
1554 res = snprintf(filename,
sizeof(filename),
"%s",
1556 if (res >=
sizeof(filename)) {
1557 *error_string =
"uidgid.d path too long";
1562 dirname_res = dirname(filename);
1564 res = snprintf(uidgid_dirname,
sizeof(uidgid_dirname),
"%s/%s",
1565 dirname_res,
"uidgid.d");
1566 if (res >=
sizeof(uidgid_dirname)) {
1567 *error_string =
"uidgid.d path too long";
1572 dp = opendir (uidgid_dirname);
1577 for (dirent = readdir(dp);
1579 dirent = readdir(dp)) {
1581 res = snprintf(filename,
sizeof (filename),
"%s/%s", uidgid_dirname, dirent->d_name);
1582 if (res >=
sizeof(filename)) {
1584 *error_string =
"uidgid.d dirname path too long";
1588 res = stat (filename, &stat_buf);
1589 if (res == 0 && S_ISREG(stat_buf.st_mode)) {
1591 fp = fopen (filename,
"r");
1592 if (fp == NULL)
continue;
1597 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1598 uidgid_config_parser_cb, config_map, NULL);
1615 static int read_config_file_into_icmap(
1616 const char **error_string,
1620 const char *filename;
1621 char *error_reason = error_string_response;
1630 fp = fopen (filename,
"r");
1632 char error_str[100];
1633 const char *error_ptr = qb_strerror_r(errno, error_str,
sizeof(error_str));
1634 snprintf (error_reason,
sizeof(error_string_response),
1635 "Can't read file %s: %s",
1636 filename, error_ptr);
1637 *error_string = error_reason;
1644 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1645 main_config_parser_cb, config_map, &data);
1650 res = read_uidgid_files_into_icmap(error_string, config_map);
1654 snprintf (error_reason,
sizeof(error_string_response),
1655 "Successfully read main configuration file '%s'.", filename);
1656 *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)
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.