[rygel] core: Verify upnp:class against createClass



commit 5f84d8e3d3e29831cc0bdcc0fe30e1cc82df3631
Author: Jens Georg <mail jensge org>
Date:   Tue Jun 14 15:25:40 2011 +0200

    core: Verify upnp:class against createClass
    
    Prevent that a CP tried to create an item that doesn't match the
    advertised createClass of a container.

 src/rygel/rygel-item-creator.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index 6047be6..fdaa11e 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -98,6 +98,16 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
 
             var container = yield this.fetch_container ();
 
+            /* Verify the create class. Note that we always assume
+             * createClass includeDerived to be false */
+            if (!container.create_classes.contains (didl_item.upnp_class)) {
+                throw new ContentDirectoryError.BAD_METADATA
+                                        ("Creating of objects with class %s " +
+                                         "is not supported in %s",
+                                         didl_item.upnp_class,
+                                         container.id);
+            }
+
             this.item = this.create_item (didl_item.id,
                                           container,
                                           didl_item.title,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]