summaryrefslogtreecommitdiff
path: root/src/items.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/items.c')
-rw-r--r--src/items.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/items.c b/src/items.c
index 68ae66d..8692b65 100644
--- a/src/items.c
+++ b/src/items.c
@@ -140,6 +140,20 @@ parse_album_xml (const gchar *filename, TPathInfo *path_info)
}
}
+ /* Authentication */
+ index->auth_type = AUTH_TYPE_NONE;
+ s = xml_file_get_node_value (xml, "/gallery/general/auth/type/text()");
+ if (g_strcmp0 (s, "Basic") == 0)
+ index->auth_type = AUTH_TYPE_BASIC;
+ g_free (s);
+ index->auth_realm = xml_file_get_node_value (xml, "/gallery/general/auth/realm/text()");
+ index->auth_username = xml_file_get_node_value (xml, "/gallery/general/auth/username/text()");
+ index->auth_passwd = xml_file_get_node_value (xml, "/gallery/general/auth/password/text()");
+ if (index->auth_type != AUTH_TYPE_NONE && (index->auth_realm == NULL || index->auth_username == NULL || index->auth_passwd == NULL)) {
+ log_error ("Authentication requested but not all information provided. Ignoring.\n");
+ index->auth_type = AUTH_TYPE_NONE;
+ }
+
/* Section Items */
count = xml_file_node_get_children_count (xml, "/gallery/items/*");
index->items = g_ptr_array_new ();
@@ -276,6 +290,9 @@ free_album_data (TAlbum *album)
g_free (album->meta_author);
g_free (album->meta_description);
g_free (album->meta_keywords);
+ g_free (album->auth_realm);
+ g_free (album->auth_username);
+ g_free (album->auth_passwd);
g_strfreev (album->extra_files);
if (album->items) {