• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Summary: interface for the libxslt security framework
3  * Description: the libxslt security framework allow to restrict
4  *              the access to new resources (file or URL) from
5  *              the stylesheet at runtime.
6  *
7  * Copy: See Copyright for the status of this software.
8  *
9  * Author: Daniel Veillard
10  */
11 
12 #ifndef __XML_XSLT_SECURITY_H__
13 #define __XML_XSLT_SECURITY_H__
14 
15 #include <libxml/tree.h>
16 #include "xsltexports.h"
17 #include "xsltInternals.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /**
24  * xsltSecurityPref:
25  *
26  * structure to indicate the preferences for security in the XSLT
27  * transformation.
28  */
29 typedef struct _xsltSecurityPrefs xsltSecurityPrefs;
30 typedef xsltSecurityPrefs *xsltSecurityPrefsPtr;
31 
32 /**
33  * xsltSecurityOption:
34  *
35  * the set of option that can be configured
36  */
37 typedef enum {
38     XSLT_SECPREF_READ_FILE = 1,
39     XSLT_SECPREF_WRITE_FILE,
40     XSLT_SECPREF_CREATE_DIRECTORY,
41     XSLT_SECPREF_READ_NETWORK,
42     XSLT_SECPREF_WRITE_NETWORK
43 } xsltSecurityOption;
44 
45 /**
46  * xsltSecurityCheck:
47  *
48  * User provided function to check the value of a string like a file
49  * path or an URL ...
50  */
51 typedef int (*xsltSecurityCheck)	(xsltSecurityPrefsPtr sec,
52 					 xsltTransformContextPtr ctxt,
53 					 const char *value);
54 
55 /*
56  * Module interfaces
57  */
58 XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
59 		    xsltNewSecurityPrefs	(void);
60 XSLTPUBFUN void XSLTCALL
61 		    xsltFreeSecurityPrefs	(xsltSecurityPrefsPtr sec);
62 XSLTPUBFUN int XSLTCALL
63 		    xsltSetSecurityPrefs	(xsltSecurityPrefsPtr sec,
64 						 xsltSecurityOption option,
65 						 xsltSecurityCheck func);
66 XSLTPUBFUN xsltSecurityCheck XSLTCALL
67 		    xsltGetSecurityPrefs	(xsltSecurityPrefsPtr sec,
68 						 xsltSecurityOption option);
69 
70 XSLTPUBFUN void XSLTCALL
71 		    xsltSetDefaultSecurityPrefs	(xsltSecurityPrefsPtr sec);
72 XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
73 		    xsltGetDefaultSecurityPrefs	(void);
74 
75 XSLTPUBFUN int XSLTCALL
76 		    xsltSetCtxtSecurityPrefs	(xsltSecurityPrefsPtr sec,
77 						 xsltTransformContextPtr ctxt);
78 
79 XSLTPUBFUN int XSLTCALL
80 		    xsltSecurityAllow		(xsltSecurityPrefsPtr sec,
81 						 xsltTransformContextPtr ctxt,
82 						 const char *value);
83 XSLTPUBFUN int XSLTCALL
84 		    xsltSecurityForbid		(xsltSecurityPrefsPtr sec,
85 						 xsltTransformContextPtr ctxt,
86 						 const char *value);
87 /*
88  * internal interfaces
89  */
90 XSLTPUBFUN int XSLTCALL
91 		    xsltCheckWrite		(xsltSecurityPrefsPtr sec,
92 						 xsltTransformContextPtr ctxt,
93 						 const xmlChar *URL);
94 XSLTPUBFUN int XSLTCALL
95 		    xsltCheckRead		(xsltSecurityPrefsPtr sec,
96 						 xsltTransformContextPtr ctxt,
97 						 const xmlChar *URL);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* __XML_XSLT_SECURITY_H__ */
104 
105