You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.6 KiB

4 years ago
  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. #ifndef __XML_XSLT_SECURITY_H__
  12. #define __XML_XSLT_SECURITY_H__
  13. #include <libxml/tree.h>
  14. #include "xsltexports.h"
  15. #include "xsltInternals.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * xsltSecurityPref:
  21. *
  22. * structure to indicate the preferences for security in the XSLT
  23. * transformation.
  24. */
  25. typedef struct _xsltSecurityPrefs xsltSecurityPrefs;
  26. typedef xsltSecurityPrefs *xsltSecurityPrefsPtr;
  27. /**
  28. * xsltSecurityOption:
  29. *
  30. * the set of option that can be configured
  31. */
  32. typedef enum {
  33. XSLT_SECPREF_READ_FILE = 1,
  34. XSLT_SECPREF_WRITE_FILE,
  35. XSLT_SECPREF_CREATE_DIRECTORY,
  36. XSLT_SECPREF_READ_NETWORK,
  37. XSLT_SECPREF_WRITE_NETWORK
  38. } xsltSecurityOption;
  39. /**
  40. * xsltSecurityCheck:
  41. *
  42. * User provided function to check the value of a string like a file
  43. * path or an URL ...
  44. */
  45. typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec,
  46. xsltTransformContextPtr ctxt,
  47. const char *value);
  48. /*
  49. * Module interfaces
  50. */
  51. XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
  52. xsltNewSecurityPrefs (void);
  53. XSLTPUBFUN void XSLTCALL
  54. xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec);
  55. XSLTPUBFUN int XSLTCALL
  56. xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec,
  57. xsltSecurityOption option,
  58. xsltSecurityCheck func);
  59. XSLTPUBFUN xsltSecurityCheck XSLTCALL
  60. xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec,
  61. xsltSecurityOption option);
  62. XSLTPUBFUN void XSLTCALL
  63. xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec);
  64. XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
  65. xsltGetDefaultSecurityPrefs (void);
  66. XSLTPUBFUN int XSLTCALL
  67. xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec,
  68. xsltTransformContextPtr ctxt);
  69. XSLTPUBFUN int XSLTCALL
  70. xsltSecurityAllow (xsltSecurityPrefsPtr sec,
  71. xsltTransformContextPtr ctxt,
  72. const char *value);
  73. XSLTPUBFUN int XSLTCALL
  74. xsltSecurityForbid (xsltSecurityPrefsPtr sec,
  75. xsltTransformContextPtr ctxt,
  76. const char *value);
  77. /*
  78. * internal interfaces
  79. */
  80. XSLTPUBFUN int XSLTCALL
  81. xsltCheckWrite (xsltSecurityPrefsPtr sec,
  82. xsltTransformContextPtr ctxt,
  83. const xmlChar *URL);
  84. XSLTPUBFUN int XSLTCALL
  85. xsltCheckRead (xsltSecurityPrefsPtr sec,
  86. xsltTransformContextPtr ctxt,
  87. const xmlChar *URL);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* __XML_XSLT_SECURITY_H__ */