diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-02-12 10:32:07 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-02-12 10:32:07 +0000 |
commit | b23ec2812dc55dc3eb955ab7582362dd402bf0ba (patch) | |
tree | 33759e4c5b6db3eaaafb29072e73328655e9a386 | |
parent | feb3cc08f6061c2c3c0097f5bb0f0c6fe59fa958 (diff) | |
parent | 43df9a6412c0ca87904e9291bd21afbc10aecc5f (diff) | |
download | selinux-b23ec2812dc55dc3eb955ab7582362dd402bf0ba.tar.gz |
Merge "Delete unused selinux_android_setfilecon()." am: 87f91ab161 am: d5725073a9 am: 43df9a6412
Change-Id: I29c40047df33436a2d3abc9f8cdfbc281726eb4b
-rw-r--r-- | libselinux/include/selinux/android.h | 5 | ||||
-rw-r--r-- | libselinux/src/android/android_platform.c | 58 |
2 files changed, 0 insertions, 63 deletions
diff --git a/libselinux/include/selinux/android.h b/libselinux/include/selinux/android.h index 640ba2eb..3d1816d9 100644 --- a/libselinux/include/selinux/android.h +++ b/libselinux/include/selinux/android.h @@ -32,11 +32,6 @@ extern int selinux_android_setcontext(uid_t uid, const char *seinfo, const char *name); -extern int selinux_android_setfilecon(const char *pkgdir, - const char *pkgname, - const char *seinfo, - uid_t uid); - extern int selinux_log_callback(int type, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); diff --git a/libselinux/src/android/android_platform.c b/libselinux/src/android/android_platform.c index a51d1657..20bb4a98 100644 --- a/libselinux/src/android/android_platform.c +++ b/libselinux/src/android/android_platform.c @@ -955,64 +955,6 @@ oom: return -2; } -int selinux_android_setfilecon(const char *pkgdir, - const char *pkgname, - const char *seinfo, - uid_t uid) -{ - char *orig_ctx_str = NULL; - char *ctx_str = NULL; - context_t ctx = NULL; - int rc = -1; - - if (is_selinux_enabled() <= 0) - return 0; - - rc = getfilecon(pkgdir, &ctx_str); - if (rc < 0) - goto err; - - ctx = context_new(ctx_str); - orig_ctx_str = ctx_str; - if (!ctx) - goto oom; - - rc = seapp_context_lookup(SEAPP_TYPE, uid, 0, seinfo, pkgname, NULL, ctx); - if (rc == -1) - goto err; - else if (rc == -2) - goto oom; - - ctx_str = context_str(ctx); - if (!ctx_str) - goto oom; - - rc = security_check_context(ctx_str); - if (rc < 0) - goto err; - - if (strcmp(ctx_str, orig_ctx_str)) { - rc = setfilecon(pkgdir, ctx_str); - if (rc < 0) - goto err; - } - - rc = 0; -out: - freecon(orig_ctx_str); - context_free(ctx); - return rc; -err: - selinux_log(SELINUX_ERROR, "%s: Error setting context for pkgdir %s, uid %d: %s\n", - __FUNCTION__, pkgdir, uid, strerror(errno)); - rc = -1; - goto out; -oom: - selinux_log(SELINUX_ERROR, "%s: Out of memory\n", __FUNCTION__); - rc = -1; - goto out; -} - int selinux_android_setcon(const char *con) { int ret = setcon(con); |