mls.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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@paul-moore.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_range_set(struct context *context, struct mls_range *range);
  37. int mls_convert_context(struct policydb *oldp,
  38. struct policydb *newp,
  39. struct context *context);
  40. int mls_compute_sid(struct context *scontext,
  41. struct context *tcontext,
  42. u16 tclass,
  43. u32 specified,
  44. struct context *newcontext,
  45. bool sock);
  46. int mls_setup_user_range(struct context *fromcon, struct user_datum *user,
  47. struct context *usercon);
  48. #ifdef CONFIG_NETLABEL
  49. void mls_export_netlbl_lvl(struct context *context,
  50. struct netlbl_lsm_secattr *secattr);
  51. void mls_import_netlbl_lvl(struct context *context,
  52. struct netlbl_lsm_secattr *secattr);
  53. int mls_export_netlbl_cat(struct context *context,
  54. struct netlbl_lsm_secattr *secattr);
  55. int mls_import_netlbl_cat(struct context *context,
  56. struct netlbl_lsm_secattr *secattr);
  57. #else
  58. static inline void mls_export_netlbl_lvl(struct context *context,
  59. struct netlbl_lsm_secattr *secattr)
  60. {
  61. return;
  62. }
  63. static inline void mls_import_netlbl_lvl(struct context *context,
  64. struct netlbl_lsm_secattr *secattr)
  65. {
  66. return;
  67. }
  68. static inline int mls_export_netlbl_cat(struct context *context,
  69. struct netlbl_lsm_secattr *secattr)
  70. {
  71. return -ENOMEM;
  72. }
  73. static inline int mls_import_netlbl_cat(struct context *context,
  74. struct netlbl_lsm_secattr *secattr)
  75. {
  76. return -ENOMEM;
  77. }
  78. #endif
  79. #endif /* _SS_MLS_H */