{"id":7373,"date":"2022-12-20T19:37:52","date_gmt":"2022-12-20T22:37:52","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/getkeycreatecon-man3\/"},"modified":"2022-12-20T19:37:52","modified_gmt":"2022-12-20T22:37:52","slug":"getkeycreatecon-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/getkeycreatecon-man3\/","title":{"rendered":"getkeycreatecon (man3)"},"content":{"rendered":"<h1 align=\"center\">getkeycreatecon<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">getkeycreatecon, setkeycreatecon \u2212 get or set the SELinux security context used for creating a new kernel keyrings<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <selinux\/selinux.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int getkeycreatecon(char **<\/b><i>con<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int getkeycreatecon_raw(char **<\/b><i>con<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int setkeycreatecon(char *<\/b><i>context<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int setkeycreatecon_raw(char *<\/b><i>context<\/i><b>);<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getkeycreatecon<\/b>() retrieves the context used for creating a new kernel keyring. This returned context should be freed with <b>freecon<\/b>(3) if non-NULL. <b>getkeycreatecon<\/b>() sets *con to NULL if no keycreate context has been explicitly set by the program (i.e. using the default policy behavior).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>setkeycreatecon<\/b>() sets the context used for creating a new kernel keyring. NULL can be passed to <b>setkeycreatecon<\/b>() to reset to the default policy behavior. The keycreate context is automatically reset after the next <b>execve<\/b>(2), so a program doesn\u2019t need to explicitly sanitize it upon startup.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>setkeycreatecon<\/b>() can be applied prior to library functions that internally perform an file creation, in order to set an file context on the objects.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getkeycreatecon_raw<\/b>() and <b>setkeycreatecon_raw<\/b>() behave identically to their non-raw counterparts but do not perform context translation.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Note:<\/b> Signal handlers that perform a <b>setkeycreatecon<\/b>() must take care to save, reset, and restore the keycreate context to avoid unexpected behavior.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Note:<\/b> Contexts are thread specific.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">On error \u22121 is returned. On success 0 is returned.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>selinux<\/b>(8), <b>freecon<\/b>(3), <b>getcon<\/b>(3), <b>getexeccon<\/b>(3)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  getkeycreatecon, setkeycreatecon \u2212 get or set the SELinux security context used for creating a new kernel keyrings <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3687,3007],"class_list":["post-7373","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-getkeycreatecon","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7373"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7373\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}