Fix ACL crash for non-existing user.
[pwmd.git] / src / xml.h
blobe37d12bdca0edb94e93feef44eb13dc74f228e33
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef XML_H
21 #define XML_H
23 #include <libxml/tree.h>
24 #include <libxml/parser.h>
25 #include <libxml/xpath.h>
27 #include "util-misc.h"
28 #include "common.h"
29 #include "util-string.h"
31 struct element_list_s
33 struct slist_s *list;
34 char **elements;
35 char *prefix;
36 int resolving;
37 int recurse;
38 int verbose;
39 int with_target;
40 char **req;
43 gpg_error_t new_root_element (struct client_s *, xmlDocPtr doc, char *name);
44 xmlDocPtr new_document (void);
45 gpg_error_t list_root_elements (struct client_s *, xmlDocPtr doc,
46 struct string_s **, int, int);
47 int valid_xml_element (xmlChar * element);
48 xmlNodePtr find_elements (struct client_s *, xmlDocPtr doc, xmlNodePtr node,
49 char **req, gpg_error_t * error, int *target,
50 xmlNodePtr (*found_fn) (struct client_s *,
51 xmlNodePtr, char **,
52 gpg_error_t *, char **,
53 void *),
54 xmlNodePtr (*not_found_fn) (struct client_s *, int,
55 xmlNodePtr, char **,
56 gpg_error_t *, void *),
57 int is_list_command, int recursion_depth,
58 void *data, int stop);
59 xmlNodePtr find_root_element (struct client_s *, xmlDocPtr doc, char ***req,
60 gpg_error_t * error, int *target,
61 int recursion_depth, int stop);
62 xmlNodePtr create_elements_cb (struct client_s *, int verify, xmlNodePtr node,
63 char **elements, gpg_error_t * error,
64 void *data);
65 xmlNodePtr create_target_elements_cb (struct client_s *, int verify,
66 xmlNodePtr node, char **elements,
67 gpg_error_t * error, void *data);
68 int is_literal_element (char **element);
69 int valid_element_path (char **path, int content);
70 xmlNodePtr find_text_node (xmlNodePtr node);
71 gpg_error_t create_path_list (struct client_s *, xmlDocPtr doc,
72 struct element_list_s *elements, char *path);
73 gpg_error_t recurse_xpath_nodeset (struct client_s *, xmlDocPtr doc,
74 xmlNodeSetPtr nodes, xmlChar * value,
75 xmlBufferPtr * result, int, const xmlChar *);
76 gpg_error_t add_attribute (struct client_s *, xmlNodePtr node,
77 const char *name, const char *value);
78 xmlChar *node_has_attribute (xmlNodePtr n, xmlChar * attr);
79 gpg_error_t delete_attribute (struct client_s *, xmlNodePtr n,
80 const xmlChar * name);
81 gpg_error_t convert_pre_212_elements (xmlDocPtr doc);
82 gpg_error_t validate_import (struct client_s *, xmlNodePtr);
83 xmlNodePtr find_element (struct client_s *, xmlNodePtr node, char *element,
84 xmlNodePtr stop, gpg_error_t *);
85 gpg_error_t update_element_mtime (struct client_s *, xmlNodePtr n);
86 gpg_error_t unlink_node (struct client_s *, xmlNodePtr n);
87 gpg_error_t parse_doc (const char *xml, size_t len, xmlDocPtr *doc);
88 gpg_error_t attr_ctime (struct client_s *, xmlNodePtr n);
89 gpg_error_t build_realpath (struct client_s *, xmlDocPtr doc, char *line,
90 struct string_s **result);
91 gpg_error_t validate_target_attribute (struct client_s *, xmlDocPtr doc,
92 const char *src, xmlNodePtr dst);
93 int valid_xml_attribute (const char *str);
94 gpg_error_t is_element_owner (struct client_s *, xmlNodePtr);
96 #endif