From cf8bf8391cffc4cd35e634a8b9a3adf954260b88 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Mon, 23 Mar 2009 13:50:35 +0000 Subject: Brain dumps used to stash the address of the client for which metadata was being sent in an extra header field. This worked about as well as you might expect. Fortunately we happened to be putting an address in header field 18 anyway, so backwards compatibility should be relatively painless. I don't know which approach is a more egregious hack, but this change at least nets us four less lines of code, which is obviously good, right? Oh, and while we're at it, if the sa_family isn't set on the sender address, just cringe and set it to AF_INET. --- server/bdump.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'server/bdump.c') diff --git a/server/bdump.c b/server/bdump.c index da67d62..5b04866 100644 --- a/server/bdump.c +++ b/server/bdump.c @@ -865,11 +865,6 @@ bdump_send_list_tcp(ZNotice_Kind_t kind, memset (¬ice, 0, sizeof(notice)); - retval = ZMakeAscii(addrbuf, sizeof(addrbuf), - (unsigned char *) &addr->sin_addr, - sizeof(struct in_addr)); - if (retval != ZERR_NONE) - return retval; notice.z_kind = kind; notice.z_port = addr->sin_port; @@ -879,8 +874,9 @@ bdump_send_list_tcp(ZNotice_Kind_t kind, notice.z_sender = sender; notice.z_recipient = recip; notice.z_default_format = ""; - notice.z_num_other_fields = 1; - notice.z_other_fields[0] = addrbuf; + notice.z_num_other_fields = 0; + if (addr) + notice.z_sender_sockaddr.ip4 = *addr; /*XXX*/ retval = ZFormatNoticeList(¬ice, lyst, num, &pack, &packlen, ZNOAUTH); if (retval != ZERR_NONE) @@ -1230,20 +1226,8 @@ bdump_recv_loop(Server *server) notice.z_recipient); } #endif /* DEBUG */ - if (notice.z_num_other_fields >= 1) { - retval = ZReadAscii(notice.z_other_fields[0], - strlen(notice.z_other_fields[0]), - (unsigned char *) &who.sin_addr, - sizeof(struct in_addr)); - if (retval != ZERR_NONE) { - syslog(LOG_ERR, "brl zreadascii failed: %s", - error_message(retval)); - return retval; - } - } else { - who.sin_addr.s_addr = notice.z_sender_addr.s_addr; - } - who.sin_family = AF_INET; + who.sin_family = AF_INET; /*XXX*/ + who.sin_addr.s_addr = notice.z_sender_sockaddr.ip4.sin_addr.s_addr; who.sin_port = notice.z_port; if (strcmp(notice.z_opcode, ADMIN_DONE) == 0) { -- cgit v1.2.3