@@ -69,6 +69,9 @@ typedef struct {
6969static void construct (orte_data_object_t * ptr )
7070{
7171 ptr -> index = -1 ;
72+ ptr -> uid = UINT32_MAX ;
73+ ptr -> range = OPAL_PMIX_RANGE_UNDEF ;
74+ ptr -> persistence = OPAL_PMIX_PERSIST_SESSION ;
7275 OBJ_CONSTRUCT (& ptr -> values , opal_list_t );
7376}
7477
@@ -172,9 +175,10 @@ void orte_data_server(int status, orte_process_name_t* sender,
172175 char * * keys = NULL , * str ;
173176 bool ret_packed = false, wait = false, data_added ;
174177 int room_number ;
175- uint32_t uid ;
178+ uint32_t uid = UINT32_MAX ;
176179 opal_pmix_data_range_t range ;
177180 orte_data_req_t * req , * rqnext ;
181+ orte_jobid_t jobid ;
178182
179183 OPAL_OUTPUT_VERBOSE ((1 , orte_debug_output ,
180184 "%s data server got message from %s" ,
@@ -206,7 +210,7 @@ void orte_data_server(int status, orte_process_name_t* sender,
206210 switch (command ) {
207211 case ORTE_PMIX_PUBLISH_CMD :
208212 data = OBJ_NEW (orte_data_object_t );
209- /* unpack the requestor */
213+ /* unpack the publisher */
210214 count = 1 ;
211215 if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & data -> owner , & count , OPAL_NAME ))) {
212216 ORTE_ERROR_LOG (rc );
@@ -221,7 +225,7 @@ void orte_data_server(int status, orte_process_name_t* sender,
221225
222226 /* unpack the range */
223227 count = 1 ;
224- if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & data -> range , & count , OPAL_INT ))) {
228+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & data -> range , & count , OPAL_PMIX_DATA_RANGE ))) {
225229 ORTE_ERROR_LOG (rc );
226230 OBJ_RELEASE (data );
227231 goto SEND_ERROR ;
@@ -261,8 +265,13 @@ void orte_data_server(int status, orte_process_name_t* sender,
261265 if (req -> uid != data -> uid ) {
262266 continue ;
263267 }
264- if (req -> range != data -> range ) {
265- continue ;
268+ /* if the published range is constrained to namespace, then only
269+ * consider this data if the publisher is
270+ * in the same namespace as the requestor */
271+ if (OPAL_PMIX_RANGE_NAMESPACE == data -> range ) {
272+ if (jobid != data -> owner .jobid ) {
273+ continue ;
274+ }
266275 }
267276 for (i = 0 ; NULL != req -> keys [i ]; i ++ ) {
268277 /* cycle thru the data keys for matches */
@@ -344,9 +353,16 @@ void orte_data_server(int status, orte_process_name_t* sender,
344353 ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ),
345354 ORTE_NAME_PRINT (sender )));
346355
356+ /* unpack the requestor's jobid */
357+ count = 1 ;
358+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & jobid , & count , ORTE_JOBID ))) {
359+ ORTE_ERROR_LOG (rc );
360+ goto SEND_ERROR ;
361+ }
362+
347363 /* unpack the range - this sets some constraints on the range of data to be considered */
348364 count = 1 ;
349- if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & range , & count , OPAL_INT ))) {
365+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & range , & count , OPAL_PMIX_DATA_RANGE ))) {
350366 ORTE_ERROR_LOG (rc );
351367 goto SEND_ERROR ;
352368 }
@@ -409,13 +425,17 @@ void orte_data_server(int status, orte_process_name_t* sender,
409425 if (NULL == data ) {
410426 continue ;
411427 }
412- /* can only access data posted by the same user id */
428+ /* for security reasons, can only access data posted by the same user id */
413429 if (uid != data -> uid ) {
414430 continue ;
415431 }
416- /* if the range doesn't match, then we cannot consider it */
417- if (range != data -> range ) {
418- continue ;
432+ /* if the published range is constrained to namespace, then only
433+ * consider this data if the publisher is
434+ * in the same namespace as the requestor */
435+ if (OPAL_PMIX_RANGE_NAMESPACE == data -> range ) {
436+ if (jobid != data -> owner .jobid ) {
437+ continue ;
438+ }
419439 }
420440 /* see if we have this key */
421441 OPAL_LIST_FOREACH (iptr , & data -> values , opal_value_t ) {
0 commit comments