summaryrefslogtreecommitdiff
path: root/server/common.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2009-07-29 14:53:39 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2009-07-29 14:53:39 +0000
commit8ec76c0921175e45602d490cfa696eab781ac87a (patch)
treeaa73ca2871b19990cbe490d438fe886287719016 /server/common.c
parentc57cb726d8889f9bafa558698d98376485900034 (diff)
Factor out code that extacts a sockaddr_in from a notice (and stop using the
deprecated sender_addr macro.) Actually remove the code from realm.c:real_dispatch because nothing was using the result. Ran nuke-trailing-whitespace on all the files I touched, as usual.
Diffstat (limited to 'server/common.c')
-rw-r--r--server/common.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/common.c b/server/common.c
index fd44f38..4af40c7 100644
--- a/server/common.c
+++ b/server/common.c
@@ -79,7 +79,8 @@ hash(const char *string)
}
/* Output a name, replacing newlines with \n and single quotes with \q. */
-void dump_quote(char *p, FILE *fp)
+void
+dump_quote(char *p, FILE *fp)
{
for (; *p; p++) {
if (*p == '\'') {
@@ -94,3 +95,20 @@ void dump_quote(char *p, FILE *fp)
}
}
+/* Pull the address out of the packet for dispatching. Doesn't do anything
+ * special, and will need to change signatures when ipv6 support happens. But
+ * it'll be in one place....
+ */
+void
+notice_extract_address(ZNotice_t *notice, struct sockaddr_in *addr)
+{
+ /*
+ * We get the address out of the uid rather than the
+ * Hopefully by the time a server will actually be speaking ipv6, it won't have
+ * to worry about talking to other <3.0 realms
+ */
+ memset(addr, 0, sizeof(*addr));
+ addr->sin_addr.s_addr = notice->z_uid.zuid_addr.s_addr;
+ addr->sin_port = notice->z_port;
+ addr->sin_family = AF_INET;
+}