diff --git a/NEWS b/NEWS index 7468a8d0e117c19cf02e1d50bab9345d021e12cf..767b3e18e4584de19512c744fba718ee0fbf4561 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ documents those changes that are of interest to users and admins. -- Purge vestigial job scripts when the slurmd cold starts or slurmstepd terminates abnormally. -- Add support for FreeBSD. + -- Add sanity check for NULL cluster names trying to register. * Changes in Slurm 2.5.4 ======================== diff --git a/src/slurmdbd/proc_req.c b/src/slurmdbd/proc_req.c index 02b11c44ec6f1a8175568e4e5ff5b6c059fb1b47..3a04453ea94a5dcf16758d5f7667a5fbec1dac43 100644 --- a/src/slurmdbd/proc_req.c +++ b/src/slurmdbd/proc_req.c @@ -1733,6 +1733,7 @@ static int _init_conn(slurmdbd_conn_t *slurmdbd_conn, debug("DBD_INIT: CLUSTER:%s VERSION:%u UID:%u IP:%s CONN:%u", init_msg->cluster_name, init_msg->version, init_msg->uid, slurmdbd_conn->ip, slurmdbd_conn->newsockfd); + slurmdbd_conn->cluster_name = xstrdup(init_msg->cluster_name); slurmdbd_conn->db_conn = acct_storage_g_get_connection( false, slurmdbd_conn->newsockfd, init_msg->rollback, @@ -2704,6 +2705,17 @@ static int _register_ctld(slurmdbd_conn_t *slurmdbd_conn, debug2("DBD_REGISTER_CTLD: called for %s(%u)", slurmdbd_conn->cluster_name, register_ctld_msg->port); + /* Just to make sure we don't allow a NULL cluster name to attempt + to connect. This should never happen, but here just for + sanity check. + */ + if (!slurmdbd_conn->cluster_name) { + comment = "Must have a cluster name to register it"; + error("CONN:%u %s", slurmdbd_conn->newsockfd, comment); + rc = ESLURM_BAD_NAME; + goto end_it; + } + debug2("slurmctld at ip:%s, port:%d", slurmdbd_conn->ip, register_ctld_msg->port);