summaryrefslogtreecommitdiff
path: root/rsvg-defs.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2012-01-26 21:17:31 +0100
committerChristian Persch <chpe@gnome.org>2012-01-26 21:17:31 +0100
commita2e869cb700c13804056820fd4afa215e551b9c5 (patch)
tree86506a485f85272d251bac8bb1f9ae7008dac2d0 /rsvg-defs.c
parentcd6700bb4852466bd1d700774c0fce4dde25c6e6 (diff)
downloadlibrsvg-a2e869cb700c13804056820fd4afa215e551b9c5.tar.gz
Add permission check before loading other files
Wrap _rsvg_io_acquire_* in _rsvg_handle_acquire_* that first checks whether the load should be allowed. For the moment, always allow the load; more restricted policies will be introduced in a follow-up commit.
Diffstat (limited to 'rsvg-defs.c')
-rw-r--r--rsvg-defs.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/rsvg-defs.c b/rsvg-defs.c
index 0c3df9f9..71678d7e 100644
--- a/rsvg-defs.c
+++ b/rsvg-defs.c
@@ -36,8 +36,8 @@ struct _RsvgDefs {
GHashTable *hash;
GPtrArray *unnamed;
GHashTable *externs;
- gchar *base_uri;
GSList *toresolve;
+ RsvgHandle *ctx;
};
typedef struct _RsvgResolutionPending RsvgResolutionPending;
@@ -48,7 +48,7 @@ struct _RsvgResolutionPending {
};
RsvgDefs *
-rsvg_defs_new (void)
+rsvg_defs_new (RsvgHandle *handle)
{
RsvgDefs *result = g_new (RsvgDefs, 1);
@@ -56,18 +56,12 @@ rsvg_defs_new (void)
result->externs =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_object_unref);
result->unnamed = g_ptr_array_new ();
- result->base_uri = NULL;
result->toresolve = NULL;
+ result->ctx = handle; /* no need to take a ref here */
return result;
}
-void
-rsvg_defs_set_base_uri (RsvgDefs * self, gchar * base_uri)
-{
- self->base_uri = base_uri;
-}
-
static int
rsvg_defs_load_extern (const RsvgDefs * defs, const char *name)
{
@@ -76,9 +70,9 @@ rsvg_defs_load_extern (const RsvgDefs * defs, const char *name)
guint8 *data;
gsize data_len;
- filename = rsvg_get_file_path (name, defs->base_uri);
+ filename = rsvg_get_file_path (name, rsvg_handle_get_base_uri (defs->ctx));
- data = _rsvg_io_acquire_data (name, defs->base_uri, &data_len, NULL);
+ data = _rsvg_handle_acquire_data (defs->ctx, name, &data_len, NULL);
if (data) {
handle = rsvg_handle_new ();