Diff between 0e2afe102e555b8309c4655552f2f32a26f4d989 and d713e186e596e8d2f725e06239dd31967f06300f

Changed Files

File Additions Deletions Status
gobex/gobex.c +9 -0 modified
gobex/gobex.h +3 -1 modified
tools/obex-server-tool.c +2 -0 modified

Full Patch

diff --git a/gobex/gobex.c b/gobex/gobex.c
index 8cd7f17..e72dc41 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -482,6 +482,15 @@ immediate_completion:
 	return TRUE;
 }
 
+gboolean g_obex_send_rsp(GObex *obex, guint8 rspcode, GError **err)
+{
+	GObexPacket *rsp;
+
+	rsp = g_obex_packet_new(rspcode, TRUE, G_OBEX_HDR_INVALID);
+
+	return g_obex_send(obex, rsp, err);
+}
+
 void g_obex_set_disconnect_function(GObex *obex, GObexFunc func,
 							gpointer user_data)
 {
diff --git a/gobex/gobex.h b/gobex/gobex.h
index cfe9235..cec57c2 100644
--- a/gobex/gobex.h
+++ b/gobex/gobex.h
@@ -48,6 +48,8 @@ guint g_obex_send_req(GObex *obex, GObexPacket *req, gint timeout,
 gboolean g_obex_cancel_req(GObex *obex, guint req_id,
 						gboolean remove_callback);
 
+gboolean g_obex_send_rsp(GObex *obex, guint8 rspcode, GError **err);
+
 void g_obex_set_disconnect_function(GObex *obex, GObexFunc func,
 							gpointer user_data);
 gint g_obex_add_request_function(GObex *obex, guint8 opcode,
@@ -64,7 +66,7 @@ GObex *g_obex_new(GIOChannel *io, GObexTransportType transport_type,
 GObex *g_obex_ref(GObex *obex);
 void g_obex_unref(GObex *obex);
 
-/* Higher level functions */
+/* High level client functions */
 
 guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
 				GError **err, guint8 first_hdr_id, ...);
diff --git a/tools/obex-server-tool.c b/tools/obex-server-tool.c
index 314df93..2e80a1b 100644
--- a/tools/obex-server-tool.c
+++ b/tools/obex-server-tool.c
@@ -128,6 +128,7 @@ static void handle_put(GObex *obex, GObexPacket *req, gpointer user_data)
 	if (data->fd < 0) {
 		g_printerr("open(%s): %s\n", name, strerror(errno));
 		g_free(data);
+		g_obex_send_rsp(obex, G_OBEX_RSP_FORBIDDEN, NULL);
 		return;
 	}
 
@@ -181,6 +182,7 @@ static void handle_get(GObex *obex, GObexPacket *req, gpointer user_data)
 	if (data->fd < 0) {
 		g_printerr("open(%s): %s", name, strerror(errno));
 		g_free(data);
+		g_obex_send_rsp(obex, G_OBEX_RSP_FORBIDDEN, NULL);
 		return;
 	}