Fix build after upstream merge am: 4d132a10b0 am: 26f9657eff

Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2301558

Change-Id: Icbbd957d9459284d43ae10acf184a93f6727fa9e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Thiébaud Weksteen 2022-11-28 02:49:58 +00:00 committed by Automerger Merge Worker
commit 1b76d48225
6 changed files with 19 additions and 15 deletions

View file

@ -25,7 +25,7 @@ license {
"SPDX-license-identifier-LGPL", "SPDX-license-identifier-LGPL",
], ],
license_text: [ license_text: [
"COPYING", "LICENSE",
], ],
} }

View file

@ -94,6 +94,7 @@ cc_defaults {
"src/procattr.c", "src/procattr.c",
"src/regex.c", "src/regex.c",
"src/reject_unknown.c", "src/reject_unknown.c",
"src/selinux_internal.c",
"src/sestatus.c", "src/sestatus.c",
"src/setenforce.c", "src/setenforce.c",
"src/setfilecon.c", "src/setfilecon.c",

View file

@ -56,7 +56,7 @@ int selinux_android_context_with_level(const char * context,
goto out; goto out;
} }
char * newString = context_str(ctx); const char * newString = context_str(ctx);
if (!newString) { if (!newString) {
goto out; goto out;
} }
@ -92,19 +92,19 @@ int selinux_android_setcontext(uid_t uid,
const char *seinfo, const char *seinfo,
const char *pkgname) const char *pkgname)
{ {
char *orig_ctx_str = NULL, *ctx_str; char *orig_ctx_str = NULL;
const char *ctx_str = NULL;
context_t ctx = NULL; context_t ctx = NULL;
int rc = -1; int rc = -1;
if (is_selinux_enabled() <= 0) if (is_selinux_enabled() <= 0)
return 0; return 0;
rc = getcon(&ctx_str); rc = getcon(&orig_ctx_str);
if (rc) if (rc)
goto err; goto err;
ctx = context_new(ctx_str); ctx = context_new(orig_ctx_str);
orig_ctx_str = ctx_str;
if (!ctx) if (!ctx)
goto oom; goto oom;
@ -432,7 +432,8 @@ static int pkgdir_selabel_lookup(const char *pathname,
{ {
char *pkgname = NULL; char *pkgname = NULL;
struct pkg_info *info = NULL; struct pkg_info *info = NULL;
char *secontext = *secontextp; const char *orig_ctx_str = *secontextp;
const char *ctx_str = NULL;
context_t ctx = NULL; context_t ctx = NULL;
int rc = 0; int rc = 0;
unsigned int userid_from_path = 0; unsigned int userid_from_path = 0;
@ -458,7 +459,7 @@ static int pkgdir_selabel_lookup(const char *pathname,
info->uid += userid_from_path * AID_USER_OFFSET; info->uid += userid_from_path * AID_USER_OFFSET;
} }
ctx = context_new(secontext); ctx = context_new(orig_ctx_str);
if (!ctx) if (!ctx)
goto err; goto err;
@ -467,19 +468,19 @@ static int pkgdir_selabel_lookup(const char *pathname,
if (rc < 0) if (rc < 0)
goto err; goto err;
secontext = context_str(ctx); ctx_str = context_str(ctx);
if (!secontext) if (!ctx_str)
goto err; goto err;
if (!strcmp(secontext, *secontextp)) if (!strcmp(ctx_str, orig_ctx_str))
goto out; goto out;
rc = security_check_context(secontext); rc = security_check_context(ctx_str);
if (rc < 0) if (rc < 0)
goto err; goto err;
freecon(*secontextp); freecon(*secontextp);
*secontextp = strdup(secontext); *secontextp = strdup(ctx_str);
if (!(*secontextp)) if (!(*secontextp))
goto err; goto err;

View file

@ -29,7 +29,7 @@ license {
"legacy_unencumbered", "legacy_unencumbered",
], ],
license_text: [ license_text: [
"COPYING", "LICENSE",
], ],
} }

View file

@ -546,6 +546,7 @@ static const char *macro_param_flavor_to_string(enum cil_flavor flavor)
return str; return str;
} }
/* ANDROID: not used.
static void cil_write_src_info_node(FILE *out, struct cil_tree_node *node) static void cil_write_src_info_node(FILE *out, struct cil_tree_node *node)
{ {
struct cil_src_info *info = node->data; struct cil_src_info *info = node->data;
@ -557,6 +558,7 @@ static void cil_write_src_info_node(FILE *out, struct cil_tree_node *node)
fprintf(out, ";;* <?SRC_INFO_KIND> %u %s\n", info->hll_line, info->path); fprintf(out, ";;* <?SRC_INFO_KIND> %u %s\n", info->hll_line, info->path);
} }
} }
*/
void cil_write_ast_node(FILE *out, struct cil_tree_node *node) void cil_write_ast_node(FILE *out, struct cil_tree_node *node)
{ {

View file

@ -11,7 +11,7 @@ license {
"SPDX-license-identifier-BSD", "SPDX-license-identifier-BSD",
], ],
license_text: [ license_text: [
"COPYING", "LICENSE",
], ],
} }