summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pop3d.h6
-rw-r--r--pop3e.c3
-rw-r--r--session.c7
3 files changed, 8 insertions, 8 deletions
diff --git a/pop3d.h b/pop3d.h
index 72f50e5..7e3b47f 100644
--- a/pop3d.h
+++ b/pop3d.h
@@ -114,7 +114,6 @@ struct auth_req {
};
struct listener {
- struct sockaddr_storage ss;
struct event ev;
struct event pause;
int flags;
@@ -129,14 +128,15 @@ enum state {
struct session {
SPLAY_ENTRY(session) entry;
- struct imsgev *iev_maildrop;
struct iobuf iobuf;
struct io io;
+ struct sockaddr_storage ss;
char user[ARGLEN];
char pass[ARGLEN];
size_t m_sz;
size_t nmsgs;
struct listener *l;
+ struct imsgev *iev_maildrop;
uint32_t id;
int flags;
enum state state;
@@ -146,7 +146,7 @@ struct session {
void pop3_main(int [2], struct passwd *);
/* session.c */
-void session_init(struct listener *, int);
+void session_init(struct listener *, int, const struct sockaddr_storage *);
void session_close(struct session *, int);
void session_reply(struct session *, char *, ...);
void session_set_state(struct session *, enum state);
diff --git a/pop3e.c b/pop3e.c
index 728df72..1bd8635 100644
--- a/pop3e.c
+++ b/pop3e.c
@@ -176,8 +176,7 @@ pop3_accept(int fd, short events, void *arg)
}
set_nonblocking(s);
- l->ss = ss;
- session_init(l, s);
+ session_init(l, s, &ss);
}
static void
diff --git a/session.c b/session.c
index 5401e0c..0da444a 100644
--- a/session.c
+++ b/session.c
@@ -97,7 +97,7 @@ struct session_tree sessions;
static int _pop3_debug = 0;
void
-session_init(struct listener *l, int fd)
+session_init(struct listener *l, int fd, const struct sockaddr_storage *ss)
{
struct session *s;
void *ssl;
@@ -105,6 +105,7 @@ session_init(struct listener *l, int fd)
s = xcalloc(1, sizeof(*s), "session_init");
s->l = l;
+ memmove(&s->ss, ss, sizeof(*ss));
if (iobuf_init(&s->iobuf, 0, 0) == -1)
fatal("iobuf_init");
@@ -120,7 +121,7 @@ session_init(struct listener *l, int fd)
return;
}
- log_connect(s->id, &l->ss, l->ss.ss_len);
+ log_connect(s->id, &s->ss, s->ss.ss_len);
SPLAY_INSERT(session_tree, &sessions, s);
session_reply(s, "%s", "+OK pop3d ready");
io_set_write(&s->io);
@@ -188,7 +189,7 @@ session_io(struct io *io, int evt)
case IO_TLSREADY:
/* greet only for pop3s, STLS already greeted */
if (s->flags & POP3S) {
- log_connect(s->id, &s->l->ss, s->l->ss.ss_len);
+ log_connect(s->id, &s->ss, s->ss.ss_len);
session_reply(s, "%s", "+OK pop3 ready");
io_set_write(&s->io);
}