mls.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Multi-level security (MLS) policy operations.
  3. *
  4. * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
  5. */
  6. /*
  7. * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
  8. *
  9. * Support for enhanced MLS infrastructure.
  10. *
  11. * Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
  12. */
  13. /*
  14. * Updated: Hewlett-Packard <paul.moore@hp.com>
  15. *
  16. * Added support to import/export the MLS label from NetLabel
  17. *
  18. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  19. */
  20. #ifndef _SS_MLS_H_
  21. #define _SS_MLS_H_
  22. #include "context.h"
  23. #include "policydb.h"
  24. int mls_compute_context_len(struct context *context);
  25. void mls_sid_to_context(struct context *context, char **scontext);
  26. int mls_context_isvalid(struct policydb *p, struct context *c);
  27. int mls_range_isvalid(struct policydb *p, struct mls_range *r);
  28. int mls_level_isvalid(struct policydb *p, struct mls_level *l);
  29. int mls_context_to_sid(struct policydb *p,
  30. char oldc,
  31. char **scontext,
  32. struct context *context,
  33. struct sidtab *s,
  34. u32 def_sid);
  35. int mls_from_string(char *str, struct context *context, gfp_t gfp_mask);
  36. int mls_convert_context(struct policydb *oldp,
  37. struct policydb *newp,
  38. struct context *context);
  39. int mls_compute_sid(struct context *scontext,
  40. struct context *tcontext,
  41. u16 tclass,
  42. u32 specified,
  43. struct context *newcontext);
  44. int mls_setup_user_range(struct context *fromcon, struct user_datum *user,
  45. struct context *usercon);
  46. #ifdef CONFIG_NETLABEL
  47. void mls_export_netlbl_lvl(struct context *context,
  48. struct netlbl_lsm_secattr *secattr);
  49. void mls_import_netlbl_lvl(struct context *context,
  50. struct netlbl_lsm_secattr *secattr);
  51. int mls_export_netlbl_cat(struct context *context,
  52. struct netlbl_lsm_secattr *secattr);
  53. int mls_import_netlbl_cat(struct context *context,
  54. struct netlbl_lsm_secattr *secattr);
  55. #else
  56. static inline void mls_export_netlbl_lvl(struct context *context,
  57. struct netlbl_lsm_secattr *secattr)
  58. {
  59. return;
  60. }
  61. static inline void mls_import_netlbl_lvl(struct context *context,
  62. struct netlbl_lsm_secattr *secattr)
  63. {
  64. return;
  65. }
  66. static inline int mls_export_netlbl_cat(struct context *context,
  67. struct netlbl_lsm_secattr *secattr)
  68. {
  69. return -ENOMEM;
  70. }
  71. static inline int mls_import_netlbl_cat(struct context *context,
  72. struct netlbl_lsm_secattr *secattr)
  73. {
  74. return -ENOMEM;
  75. }
  76. #endif
  77. #endif /* _SS_MLS_H */