summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-12-28 20:35:08 +0000
committerGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-12-28 20:35:08 +0000
commitb691fbe18bcdf63aa0c9c177abc7ba94e0c04e1d (patch)
treea52a3a54f9d7c301b6d5fe8f0024887d0057bd7d /server
parent1135b8fd3064d7dff9081120511fe6410e87690c (diff)
Build hostmanager recipient name from Zephyr realm, rather than
assuming Athena, and cache it.
Diffstat (limited to 'server')
-rw-r--r--server/hostm.c24
1 files 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
@@ -606,6 +606,26 @@ host_detach(register ZHostList_t *host, ZServerDesc_t *server)
}
/*
+ * 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 = "";