From b691fbe18bcdf63aa0c9c177abc7ba94e0c04e1d Mon Sep 17 00:00:00 2001 From: Kenneth G Raeburn Date: Fri, 28 Dec 1990 20:35:08 +0000 Subject: Build hostmanager recipient name from Zephyr realm, rather than assuming Athena, and cache it. --- server/hostm.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/server/hostm.c b/server/hostm.c index 377387e..f692752 100644 --- a/server/hostm.c +++ b/server/hostm.c @@ -605,6 +605,26 @@ host_detach(register ZHostList_t *host, ZServerDesc_t *server) return; } +/* + * Build hostmanager recipient name. + */ +static inline char * +hm_recipient () +{ + static char *recipient; + + if (recipient) + return recipient; + + const char *realm = ZGetRealm (); + if (!realm) + realm = "???"; + recipient = (char *) zalloc (strlen (realm) + 4); + strcpy (recipient, "hm@"); + strcat (recipient, realm); + return recipient; +} + /* * Send a shutdown message to the HostManager at sin, recommending him to * use server @@ -630,7 +650,7 @@ hostm_deathgram(struct sockaddr_in *sin, ZServerDesc_t *server) shutnotice.z_class_inst = HM_CTL_SERVER; shutnotice.z_opcode = SERVER_SHUTDOWN; shutnotice.z_sender = HM_CTL_SERVER; - shutnotice.z_recipient = "hm@ATHENA.MIT.EDU"; + shutnotice.z_recipient = hm_recipient (); shutnotice.z_default_format = ""; shutnotice.z_num_other_fields = 0; @@ -692,7 +712,7 @@ ping(struct sockaddr_in *sin) shutnotice.z_class_inst = HM_CTL_SERVER; shutnotice.z_opcode = SERVER_PING; shutnotice.z_sender = HM_CTL_SERVER; - shutnotice.z_recipient = "hm@ATHENA.MIT.EDU"; + shutnotice.z_recipient = hm_recipient (); shutnotice.z_message = NULL; shutnotice.z_message_len = 0; shutnotice.z_default_format = ""; -- cgit v1.2.3