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));
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_type") == 0) {
751 if ((strcmp(value,
"nss") != 0) &&
752 (strcmp(value,
"aes256") != 0) &&
753 (strcmp(value,
"aes192") != 0) &&
754 (strcmp(value,
"aes128") != 0) &&
755 (strcmp(value,
"3des") != 0)) {
756 *error_string =
"Invalid crypto type";
761 if (strcmp(path,
"totem.crypto_cipher") == 0) {
762 if ((strcmp(value,
"none") != 0) &&
763 (strcmp(value,
"aes256") != 0) &&
764 (strcmp(value,
"aes192") != 0) &&
765 (strcmp(value,
"aes128") != 0) &&
766 (strcmp(value,
"3des") != 0)) {
767 *error_string =
"Invalid cipher type";
772 if (strcmp(path,
"totem.crypto_hash") == 0) {
773 if ((strcmp(value,
"none") != 0) &&
774 (strcmp(value,
"md5") != 0) &&
775 (strcmp(value,
"sha1") != 0) &&
776 (strcmp(value,
"sha256") != 0) &&
777 (strcmp(value,
"sha384") != 0) &&
778 (strcmp(value,
"sha512") != 0)) {
779 *error_string =
"Invalid hash type";
787 if (strcmp(path,
"system.qb_ipc_type") == 0) {
788 if ((strcmp(value,
"native") != 0) &&
789 (strcmp(value,
"shm") != 0) &&
790 (strcmp(value,
"socket") != 0)) {
791 *error_string =
"Invalid system.qb_ipc_type";
796 if (strcmp(path,
"system.sched_rr") == 0) {
797 if ((strcmp(value,
"yes") != 0) &&
798 (strcmp(value,
"no") != 0)) {
799 *error_string =
"Invalid system.sched_rr value";
804 if (strcmp(path,
"system.move_to_root_cgroup") == 0) {
805 if ((strcmp(value,
"yes") != 0) &&
806 (strcmp(value,
"no") != 0)) {
807 *error_string =
"Invalid system.move_to_root_cgroup";
815 if (strcmp(path,
"totem.interface.linknumber") == 0) {
817 if (safe_atoq(value, &val, val_type) != 0) {
824 if (strcmp(path,
"totem.interface.bindnetaddr") == 0) {
828 if (strcmp(path,
"totem.interface.mcastaddr") == 0) {
832 if (strcmp(path,
"totem.interface.broadcast") == 0) {
836 if (strcmp(path,
"totem.interface.mcastport") == 0) {
838 if (safe_atoq(value, &val, val_type) != 0) {
844 if (strcmp(path,
"totem.interface.ttl") == 0) {
846 if (safe_atoq(value, &val, val_type) != 0) {
852 if (strcmp(path,
"totem.interface.knet_link_priority") == 0) {
854 if (safe_atoq(value, &val, val_type) != 0) {
860 if (strcmp(path,
"totem.interface.knet_ping_interval") == 0) {
862 if (safe_atoq(value, &val, val_type) != 0) {
868 if (strcmp(path,
"totem.interface.knet_ping_timeout") == 0) {
870 if (safe_atoq(value, &val, val_type) != 0) {
876 if (strcmp(path,
"totem.interface.knet_ping_precision") == 0) {
878 if (safe_atoq(value, &val, val_type) != 0) {
884 if (strcmp(path,
"totem.interface.knet_pong_count") == 0) {
886 if (safe_atoq(value, &val, val_type) != 0) {
892 if (strcmp(path,
"totem.interface.knet_transport") == 0) {
899 if (strcmp(key,
"subsys") == 0) {
900 data->
subsys = strdup(value);
901 if (data->
subsys == NULL) {
902 *error_string =
"Can't alloc memory";
907 kv_item = malloc(
sizeof(*kv_item));
908 if (kv_item == NULL) {
909 *error_string =
"Can't alloc memory";
913 memset(kv_item, 0,
sizeof(*kv_item));
915 kv_item->
key = strdup(key);
916 kv_item->
value = strdup(value);
917 if (kv_item->
key == NULL || kv_item->
value == NULL) {
919 *error_string =
"Can't alloc memory";
923 qb_list_init(&kv_item->
list);
929 if (strcmp(key,
"subsys") == 0) {
930 data->
subsys = strdup(value);
931 if (data->
subsys == NULL) {
932 *error_string =
"Can't alloc memory";
936 }
else if (strcmp(key,
"name") == 0) {
939 *error_string =
"Can't alloc memory";
944 kv_item = malloc(
sizeof(*kv_item));
945 if (kv_item == NULL) {
946 *error_string =
"Can't alloc memory";
950 memset(kv_item, 0,
sizeof(*kv_item));
952 kv_item->
key = strdup(key);
953 kv_item->
value = strdup(value);
954 if (kv_item->
key == NULL || kv_item->
value == NULL) {
956 *error_string =
"Can't alloc memory";
960 qb_list_init(&kv_item->
list);
966 if (strcmp(key,
"uid") == 0) {
967 uid = uid_determine(value);
969 *error_string = error_string_response;
975 goto icmap_set_error;
978 }
else if (strcmp(key,
"gid") == 0) {
979 gid = gid_determine(value);
981 *error_string = error_string_response;
987 goto icmap_set_error;
991 *error_string =
"uidgid: Only uid and gid are allowed items";
996 if (strcmp(key,
"memberaddr") != 0) {
997 *error_string =
"Only memberaddr is allowed in member section";
1002 kv_item = malloc(
sizeof(*kv_item));
1003 if (kv_item == NULL) {
1004 *error_string =
"Can't alloc memory";
1008 memset(kv_item, 0,
sizeof(*kv_item));
1010 kv_item->
key = strdup(key);
1011 kv_item->
value = strdup(value);
1012 if (kv_item->
key == NULL || kv_item->
value == NULL) {
1014 *error_string =
"Can't alloc memory";
1018 qb_list_init(&kv_item->
list);
1026 if ((strcmp(key,
"nodeid") == 0) ||
1027 (strcmp(key,
"quorum_votes") == 0)) {
1029 if (safe_atoq(value, &val, val_type) != 0) {
1034 goto icmap_set_error;
1039 if (add_as_string) {
1041 goto icmap_set_error;
1047 if (strcmp(key,
"watchdog_timeout") == 0) {
1049 if (safe_atoq(value, &val, val_type) != 0) {
1053 goto icmap_set_error;
1060 if (strcmp(key,
"poll_period") == 0) {
1061 if (str_to_ull(value, &ull) != 0) {
1065 goto icmap_set_error;
1072 if (strcmp(key,
"poll_period") == 0) {
1073 if (str_to_ull(value, &ull) != 0) {
1077 goto icmap_set_error;
1084 if (add_as_string) {
1086 goto icmap_set_error;
1091 if (strcmp(path,
"totem.interface") == 0) {
1104 if (strcmp(path,
"totem") == 0) {
1107 if (strcmp(path,
"system") == 0) {
1110 if (strcmp(path,
"logging.logger_subsys") == 0) {
1115 if (strcmp(path,
"logging.logging_daemon") == 0) {
1121 if (strcmp(path,
"uidgid") == 0) {
1124 if (strcmp(path,
"totem.interface.member") == 0) {
1127 if (strcmp(path,
"quorum") == 0) {
1130 if (strcmp(path,
"quorum.device") == 0) {
1133 if (strcmp(path,
"nodelist") == 0) {
1137 if (strcmp(path,
"nodelist.node") == 0) {
1140 if (strcmp(path,
"resources") == 0) {
1143 if (strcmp(path,
"resources.system") == 0) {
1146 if (strcmp(path,
"resources.system.memory_used") == 0) {
1149 if (strcmp(path,
"resources.process") == 0) {
1152 if (strcmp(path,
"resources.process.memory_used") == 0) {
1170 if (cs_err !=
CS_OK) {
1171 goto icmap_set_error;
1183 if (cs_err !=
CS_OK) {
1184 goto icmap_set_error;
1196 if (cs_err !=
CS_OK) {
1197 goto icmap_set_error;
1206 goto icmap_set_error;
1210 if (data->
ttl > -1) {
1214 goto icmap_set_error;
1222 goto icmap_set_error;
1230 goto icmap_set_error;
1238 goto icmap_set_error;
1246 goto icmap_set_error;
1254 goto icmap_set_error;
1263 if (cs_err !=
CS_OK) {
1264 goto icmap_set_error;
1277 free(kv_item->
value);
1282 if (cs_err !=
CS_OK) {
1283 goto icmap_set_error;
1289 if (data->
subsys == NULL) {
1290 *error_string =
"No subsys key in logger_subsys directive";
1302 free(kv_item->
value);
1306 if (cs_err !=
CS_OK) {
1307 goto icmap_set_error;
1317 if (cs_err !=
CS_OK) {
1318 goto icmap_set_error;
1323 *error_string =
"No name key in logging_daemon directive";
1331 if (data->
subsys == NULL) {
1338 "logging.logging_daemon.%s.%s",
1344 "logging.logger_subsys.%s.%s",
1349 "logging.logging_daemon.%s.%s.%s",
1356 free(kv_item->
value);
1360 if (cs_err !=
CS_OK) {
1361 goto icmap_set_error;
1365 if (data->
subsys == NULL) {
1382 if (cs_err !=
CS_OK) {
1386 goto icmap_set_error;
1397 if (cs_err !=
CS_OK) {
1398 goto icmap_set_error;
1436 min_val = max_val = 0;
1441 assert(safe_atoq_range(val_type, &min_val, &max_val) == 0);
1443 if (snprintf(formated_err,
sizeof(formated_err),
1444 "Value of key \"%s\" is expected to be integer in range (%lld..%lld), but \"%s\" was given",
1445 key_name, min_val, max_val, value) >=
sizeof(formated_err)) {
1446 *error_string =
"Can't format parser error message";
1448 *error_string = formated_err;
1454 if (snprintf(formated_err,
sizeof(formated_err),
1455 "Can't store key \"%s\" into icmap, returned error is %s",
1456 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1457 *error_string =
"Can't format parser error message";
1459 *error_string = formated_err;
1465 static int uidgid_config_parser_cb(
const char *path,
1470 const char **error_string,
1476 static char formated_err[256];
1485 if (strcmp(path,
"uidgid.uid") == 0) {
1486 uid = uid_determine(value);
1488 *error_string = error_string_response;
1494 goto icmap_set_error;
1496 }
else if (strcmp(path,
"uidgid.gid") == 0) {
1497 gid = gid_determine(value);
1499 *error_string = error_string_response;
1505 goto icmap_set_error;
1508 *error_string =
"uidgid: Only uid and gid are allowed items";
1513 if (strcmp(path,
"uidgid") != 0) {
1514 *error_string =
"uidgid: Can't add subsection different than uidgid";
1525 if (snprintf(formated_err,
sizeof(formated_err),
1526 "Can't store key \"%s\" into icmap, returned error is %s",
1527 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1528 *error_string =
"Can't format parser error message";
1530 *error_string = formated_err;
1536 static int read_uidgid_files_into_icmap(
1537 const char **error_string,
1543 struct dirent *dirent;
1544 char filename[PATH_MAX + FILENAME_MAX + 1];
1545 char uidgid_dirname[PATH_MAX + FILENAME_MAX + 1];
1547 struct stat stat_buf;
1555 res = snprintf(filename,
sizeof(filename),
"%s",
1557 if (res >=
sizeof(filename)) {
1558 *error_string =
"uidgid.d path too long";
1563 dirname_res = dirname(filename);
1565 res = snprintf(uidgid_dirname,
sizeof(uidgid_dirname),
"%s/%s",
1566 dirname_res,
"uidgid.d");
1567 if (res >=
sizeof(uidgid_dirname)) {
1568 *error_string =
"uidgid.d path too long";
1573 dp = opendir (uidgid_dirname);
1578 for (dirent = readdir(dp);
1580 dirent = readdir(dp)) {
1582 res = snprintf(filename,
sizeof (filename),
"%s/%s", uidgid_dirname, dirent->d_name);
1583 if (res >=
sizeof(filename)) {
1585 *error_string =
"uidgid.d dirname path too long";
1589 res = stat (filename, &stat_buf);
1590 if (res == 0 && S_ISREG(stat_buf.st_mode)) {
1592 fp = fopen (filename,
"r");
1593 if (fp == NULL)
continue;
1598 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1599 uidgid_config_parser_cb, config_map, NULL);
1616 static int read_config_file_into_icmap(
1617 const char **error_string,
1621 const char *filename;
1622 char *error_reason = error_string_response;
1631 fp = fopen (filename,
"r");
1633 char error_str[100];
1634 const char *error_ptr = qb_strerror_r(errno, error_str,
sizeof(error_str));
1635 snprintf (error_reason,
sizeof(error_string_response),
1636 "Can't read file %s: %s",
1637 filename, error_ptr);
1638 *error_string = error_reason;
1645 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1646 main_config_parser_cb, config_map, &data);
1651 res = read_uidgid_files_into_icmap(error_string, config_map);
1655 snprintf (error_reason,
sizeof(error_string_response),
1656 "Successfully read main configuration file '%s'.", filename);
1657 *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.