Re: initial_sid context via libsepol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/07/2016 10:41 AM, Richard Haines wrote:





On Saturday, 5 March 2016, 14:48, Richard Haines <richard_c_haines@xxxxxxxxxxxxxx> wrote:




On Friday, 4 March 2016, 21:18, "Roberts, William C"
<william.c.roberts@xxxxxxxxx> wrote:






How can one obtain the same value as /sys/fs/selinux/initial_contexts/file
via libsepol?

I’ve been digging around libsepol and its not quite clear to me.

It looks as though the record is here:
                 context_struct_t *a = &((policydb_t
*)pol.db)->ocontexts[OCON_ISID]->context[0];
                 context_struct_t *b = &((policydb_t
*)pol.db)->ocontexts[OCON_ISID]->context[1];

                 printf("%u\n", a->type);
                 printf("%u\n",b->type);

Prints:
185
0

Not sure if this is right, and how to format the context struct to a string.
I didn’t see any helpers.




I've attached an example, hope it's useful

I've updated the example with more detail and display SID name using SID value not counter.


Any particular reason you didn't use sepol_sid_to_context()?


_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux