瀏覽代碼

Fix segfault if rrp_mode: MODE isn't set in configuration file.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1047 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 20 年之前
父節點
當前提交
a8c449fbae
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      exec/totemconfig.c

+ 11 - 0
exec/totemconfig.c

@@ -139,6 +139,8 @@ extern int totem_config_read (
 
 	totem_config->secauth = 1;
 
+	strcpy (totem_config->rrp_mode, "none");
+
 	objdb->object_find_reset (OBJECT_PARENT_HANDLE);
 
 	if (objdb->object_find (
@@ -420,6 +422,15 @@ int totem_config_validate (
 		goto parse_error;
 	}
 
+	/*
+	 * RRP values validation
+	 */
+	if (strcmp (totem_config->rrp_mode, "none") &&
+		strcmp (totem_config->rrp_mode, "active") &&
+		strcmp (totem_config->rrp_mode, "passive")) {
+		sprintf (local_error_reason, "The RRP mode \"%s\" specified is invalid.  It must be none, active, or passive.\n", totem_config->rrp_mode);
+		goto parse_error;
+	}
 	if (totem_config->rrp_problem_count_timeout == 0) {
 		totem_config->rrp_problem_count_timeout = RRP_PROBLEM_COUNT_TIMEOUT;
 	}