summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-29 18:27:01 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-29 18:27:01 +0000
commita74ce132aa15b199bfa727ca445db7ba9642d770 (patch)
treee02ad1047334046232af8a1276ca01adcbdfa057 /network
parentfe648edb4d67bb603509f392d3c82ebfe8334921 (diff)
network: reject incomming connections if there is a pending authorization
Diffstat (limited to 'network')
-rw-r--r--network/server.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/network/server.c b/network/server.c
index edd89c60..60293cf7 100644
--- a/network/server.c
+++ b/network/server.c
@@ -326,8 +326,6 @@ static gboolean connect_setup_event(GIOChannel *chan,
return FALSE;
}
- /* FIXME: Missing address setup connection request retries */
-
gerr = g_io_channel_read(chan, (gchar *)pkt, sizeof(pkt) - 1, &n);
if (gerr != G_IO_ERROR_NONE)
return FALSE;
@@ -428,9 +426,19 @@ static gboolean connect_event(GIOChannel *chan,
/* FIXME: Maybe keep a list of connected devices */
ba2str(&dst, peer);
- info("Incoming connection from:%s on PSM %d", peer, psm);
+ if (ns->pauth) {
+ GIOChannel *io;
+ error("Rejecting connection from %s\
+ due pending authorization", peer);
+ io = g_io_channel_unix_new(nsk);
+ send_bnep_ctrl_rsp(io, BNEP_CONN_NOT_ALLOWED);
+ g_io_channel_unref(io);
+ g_io_channel_close(io);
+ close(nsk);
+ return TRUE;
+ }
- /* FIXME: HOW handle multiple incomming connections? */
+ info("Incoming connection from:%s on PSM %d", peer, psm);
/* Setting the pending incomming connection setup */
ns->pauth = g_new0(struct pending_auth, 1);