@@ -3058,6 +3058,79 @@ static void _slurm_rpc_job_sbcast_cred(slurm_msg_t *msg)
30583058#endif
30593059}
30603060
3061+ static void _slurm_rpc_sbcast_cred_no_job (slurm_msg_t * msg )
3062+ {
3063+ #ifdef HAVE_FRONT_END
3064+ slurm_send_rc_msg (msg , ESLURM_NOT_SUPPORTED );
3065+ return ;
3066+ #endif
3067+ job_sbcast_cred_msg_t * cred_resp_msg = NULL ;
3068+ sbcast_cred_req_msg_t * cred_req_msg = msg -> data ;
3069+ sbcast_cred_arg_t sbcast_arg = { 0 };
3070+ sbcast_cred_t * sbcast_cred ;
3071+ hostlist_t * req_node_list ;
3072+ char * node_name ;
3073+ bool node_exists = false;
3074+ int rc ;
3075+
3076+ DEF_TIMERS ;
3077+ START_TIMER ;
3078+
3079+ if (!validate_slurm_user (msg -> auth_uid )) {
3080+ error ("%s: sbcast --no-allocation/-Z credential requested from uid '%u' which is not root/SlurmUser" ,
3081+ __func__ , msg -> auth_uid );
3082+ rc = ESLURM_USER_ID_MISSING ;
3083+ goto fail ;
3084+ }
3085+
3086+ req_node_list = hostlist_create (cred_req_msg -> node_list );
3087+ while ((node_name = hostlist_shift (req_node_list ))) {
3088+ node_exists = find_node_record (node_name );
3089+
3090+ if (!node_exists ) {
3091+ debug ("%s: sbcast --nodelist contains at least one invalid node '%s'" ,
3092+ __func__ , node_name );
3093+ free (node_name );
3094+ break ;
3095+ }
3096+ free (node_name );
3097+ }
3098+ FREE_NULL_HOSTLIST (req_node_list );
3099+
3100+ if (!node_exists ) {
3101+ (void ) slurm_send_rc_msg (msg , ESLURM_INVALID_NODE_NAME );
3102+ return ;
3103+ }
3104+
3105+ sbcast_arg .nodes = cred_req_msg -> node_list ;
3106+ sbcast_arg .expiration = time (NULL ) + HOUR_SECONDS ;
3107+
3108+ if (!(sbcast_cred = create_sbcast_cred (& sbcast_arg , msg -> auth_uid ,
3109+ msg -> auth_gid ,
3110+ msg -> protocol_version ))) {
3111+ error ("%s: Could not create sbcast cred for --no-allocate/-Z request" ,
3112+ __func__ );
3113+ rc = SLURM_ERROR ;
3114+ goto fail ;
3115+ }
3116+ END_TIMER2 (__func__ );
3117+
3118+ cred_resp_msg = xmalloc (sizeof (* cred_resp_msg ));
3119+ cred_resp_msg -> job_id = NO_VAL ;
3120+ cred_resp_msg -> node_list = xstrdup (cred_req_msg -> node_list );
3121+ cred_resp_msg -> sbcast_cred = sbcast_cred ;
3122+
3123+ (void ) send_msg_response (msg , RESPONSE_JOB_SBCAST_CRED , cred_resp_msg );
3124+
3125+ slurm_free_sbcast_cred_msg (cred_resp_msg );
3126+
3127+ return ;
3128+
3129+ fail :
3130+ END_TIMER2 (__func__ );
3131+ (void ) slurm_send_rc_msg (msg , rc );
3132+ }
3133+
30613134/* _slurm_rpc_ping - process ping RPC */
30623135static void _slurm_rpc_ping (slurm_msg_t * msg )
30633136{
@@ -6622,6 +6695,9 @@ slurmctld_rpc_t slurmctld_rpcs[] =
66226695 },{
66236696 .msg_type = REQUEST_JOB_SBCAST_CRED ,
66246697 .func = _slurm_rpc_job_sbcast_cred ,
6698+ },{
6699+ .msg_type = REQUEST_SBCAST_CRED_NO_JOB ,
6700+ .func = _slurm_rpc_sbcast_cred_no_job ,
66256701 },{
66266702 .msg_type = REQUEST_PING ,
66276703 .func = _slurm_rpc_ping ,
0 commit comments