Просмотр исходного кода

defect 714
if checkpoint doesn't have write permissions in section delete, return error


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@752 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
5544f69462
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      lib/ckpt.c

+ 7 - 1
lib/ckpt.c

@@ -1018,6 +1018,11 @@ saCkptSectionDelete (
 		return (error);
 	}
 
+	if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
+		error = SA_AIS_ERR_ACCESS;
+		goto error_put;
+	}
+
 	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
 	req_lib_ckpt_sectiondelete.header.size = sizeof (struct req_lib_ckpt_sectiondelete) + sectionId->idLen; 
@@ -1046,9 +1051,10 @@ saCkptSectionDelete (
 		sizeof (struct res_lib_ckpt_sectiondelete),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
+error_exit:
 	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
-error_exit:
+error_put:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 	return (error == SA_AIS_OK ? res_lib_ckpt_sectiondelete.header.error : error);
 }