Lines Matching full:context

30  * security context string representation of `context'.
32 int mls_compute_context_len(struct policydb *p, struct context *context) in mls_compute_context_len() argument
44 u32 index_sens = context->range.level[l].sens; in mls_compute_context_len()
50 e = &context->range.level[l].cat; in mls_compute_context_len()
70 if (mls_level_eq(&context->range.level[0], in mls_compute_context_len()
71 &context->range.level[1])) in mls_compute_context_len()
82 * Write the security context string representation of
83 * the MLS fields of `context' into the string `*scontext'.
86 void mls_sid_to_context(struct policydb *p, struct context *context, in mls_sid_to_context() argument
104 context->range.level[l].sens - 1)); in mls_sid_to_context()
110 e = &context->range.level[l].cat; in mls_sid_to_context()
147 if (mls_level_eq(&context->range.level[0], in mls_sid_to_context()
148 &context->range.level[1])) in mls_sid_to_context()
186 * Return 1 if the MLS fields in the security context
189 int mls_context_isvalid(struct policydb *p, struct context *c) in mls_context_isvalid()
215 * Set the MLS fields in the security context structure
216 * `context' based on the string representation in
223 * copy the MLS field of the associated default context.
231 struct context *context, struct sidtab *s, u32 def_sid) in mls_context_to_sid() argument
251 * No MLS component to the security context, try and map to in mls_context_to_sid()
255 struct context *defcon; in mls_context_to_sid()
264 return mls_context_cpy(context, defcon); in mls_context_to_sid()
292 context->range.level[l].sens = levdatum->level->sens; in mls_context_to_sid()
312 rc = ebitmap_set_bit(&context->range.level[l].cat, in mls_context_to_sid()
330 &context->range.level[l].cat, i, 1); in mls_context_to_sid()
339 context->range.level[1].sens = context->range.level[0].sens; in mls_context_to_sid()
340 rc = ebitmap_cpy(&context->range.level[1].cat, in mls_context_to_sid()
341 &context->range.level[0].cat); in mls_context_to_sid()
350 * Set the MLS fields in the security context structure
351 * `context' based on the string representation in
355 int mls_from_string(struct policydb *p, char *str, struct context *context, in mls_from_string() argument
368 rc = mls_context_to_sid(p, ':', tmpstr, context, NULL, in mls_from_string()
377 * Copies the MLS range `range' into `context'.
379 int mls_range_set(struct context *context, struct mls_range *range) in mls_range_set() argument
383 /* Copy the MLS range into the context */ in mls_range_set()
385 context->range.level[l].sens = range->level[l].sens; in mls_range_set()
386 rc = ebitmap_cpy(&context->range.level[l].cat, in mls_range_set()
395 int mls_setup_user_range(struct policydb *p, struct context *fromcon, in mls_setup_user_range()
396 struct user_datum *user, struct context *usercon) in mls_setup_user_range()
434 * Convert the MLS fields in the security context
437 * storing the resulting context in `newc'.
440 struct context *oldc, struct context *newc) in mls_convert_context()
480 int mls_compute_sid(struct policydb *p, struct context *scontext, in mls_compute_sid()
481 struct context *tcontext, u16 tclass, u32 specified, in mls_compute_sid()
482 struct context *newcontext, bool sock) in mls_compute_sid()
545 * @context: the security context
549 * Given the security context copy the low MLS sensitivity level into the
553 void mls_export_netlbl_lvl(struct policydb *p, struct context *context, in mls_export_netlbl_lvl() argument
559 secattr->attr.mls.lvl = context->range.level[0].sens - 1; in mls_export_netlbl_lvl()
566 * @context: the security context
570 * Given the security context and the NetLabel security attributes, copy the
571 * NetLabel MLS sensitivity level into the context.
574 void mls_import_netlbl_lvl(struct policydb *p, struct context *context, in mls_import_netlbl_lvl() argument
580 context->range.level[0].sens = secattr->attr.mls.lvl + 1; in mls_import_netlbl_lvl()
581 context->range.level[1].sens = context->range.level[0].sens; in mls_import_netlbl_lvl()
587 * @context: the security context
591 * Given the security context copy the low MLS categories into the NetLabel
595 int mls_export_netlbl_cat(struct policydb *p, struct context *context, in mls_export_netlbl_cat() argument
603 rc = ebitmap_netlbl_export(&context->range.level[0].cat, in mls_export_netlbl_cat()
614 * @context: the security context
618 * Copy the NetLabel security attributes into the SELinux context; since the
620 * both the low and high categories of the context. Returns zero on success,
624 int mls_import_netlbl_cat(struct policydb *p, struct context *context, in mls_import_netlbl_cat() argument
632 rc = ebitmap_netlbl_import(&context->range.level[0].cat, in mls_import_netlbl_cat()
636 memcpy(&context->range.level[1].cat, &context->range.level[0].cat, in mls_import_netlbl_cat()
637 sizeof(context->range.level[0].cat)); in mls_import_netlbl_cat()
642 ebitmap_destroy(&context->range.level[0].cat); in mls_import_netlbl_cat()