[rygel/wip/acl: 44/44] rygel: Add initial ACL support
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/acl: 44/44] rygel: Add initial ACL support
- Date: Sun, 30 Mar 2014 18:53:02 +0000 (UTC)
commit 8951946e727f4e4ed72f6e8b03bdf9b9b1d219cc
Author: Jens Georg <mail jensge org>
Date: Sun Feb 23 17:21:09 2014 +0100
rygel: Add initial ACL support
Signed-off-by: Jens Georg <mail jensge org>
src/librygel-server/rygel-http-server.vala | 2 +-
src/rygel/Makefile.am | 1 +
src/rygel/rygel-acl.vala | 52 ++++++++++++++++++++++++++++
src/rygel/rygel-main.vala | 6 +++
4 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-server/rygel-http-server.vala b/src/librygel-server/rygel-http-server.vala
index 0472d2a..50c8860 100644
--- a/src/librygel-server/rygel-http-server.vala
+++ b/src/librygel-server/rygel-http-server.vala
@@ -49,7 +49,7 @@ public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
}
public async void run () {
- context.server.add_handler (this.path_root, this.server_handler);
+ context.add_server_handler (true, this.path_root, this.server_handler);
context.server.request_aborted.connect (this.on_request_aborted);
context.server.request_started.connect (this.on_request_started);
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index 843dba0..fad95d6 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -3,6 +3,7 @@ include $(top_srcdir)/common.am
bin_PROGRAMS = rygel
rygel_SOURCES = \
+ rygel-acl.vala \
rygel-dbus-service.vala \
rygel-main.vala \
rygel-cmdline-config.vala \
diff --git a/src/rygel/rygel-acl.vala b/src/rygel/rygel-acl.vala
new file mode 100644
index 0000000..28b4a24
--- /dev/null
+++ b/src/rygel/rygel-acl.vala
@@ -0,0 +1,52 @@
+/*
+ *
+ * Copyright (C) 2014 Jens Georg <mail jensge org>
+ *
+ * Author: Jens Georg <mail jensge org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+internal class Rygel.Acl : GLib.Object, GUPnP.Acl
+{
+ public bool can_sync () { return true; }
+
+ public bool is_allowed (GUPnP.Device? device,
+ GUPnP.Service? service,
+ string path,
+ string address,
+ string agent) {
+ message ("%s at %s is trying to access %s/%s (%s)",
+ agent,
+ address,
+ device == null ? "(unknown)" : device.get_friendly_name (),
+ service == null ? "(unknown)" : service.get_id (),
+ path);
+
+ return true;
+ }
+
+ public async bool is_allowed_async (GUPnP.Device? device,
+ GUPnP.Service? service,
+ string path,
+ string address,
+ string agent,
+ GLib.Cancellable? cancellable)
+ throws GLib.Error {
+ assert_not_reached ();
+ }
+}
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index 0c0387e..a9511de 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -3,9 +3,11 @@
* Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak gnome org>.
* Copyright (C) 2012 Openismus GmbH.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2014 Jens Georg <mail jensge org>
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* Jens Georg <jensg openismus com>
+ * Jens Georg <mail jensge org>
*
* This file is part of Rygel.
*
@@ -38,6 +40,7 @@ internal class Rygel.Main : Object {
private Configuration config;
private LogHandler log_handler;
+ private Acl acl;
private MainLoop main_loop;
@@ -54,6 +57,7 @@ internal class Rygel.Main : Object {
this.root_devices = new ArrayList <RootDevice> ();
this.factories = new ArrayList <RootDeviceFactory> ();
this.main_loop = new GLib.MainLoop (null, false);
+ this.acl = new Acl ();
this.exit_code = 0;
@@ -151,6 +155,8 @@ internal class Rygel.Main : Object {
context.interface,
context.host_ip);
+ context.acl = this.acl;
+
try {
ifaces = this.config.get_interfaces ();
} catch (GLib.Error err) {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]