Always return /vendor/bin/sh as shell for OEM ids in getpwnam() etc.
During the review of the script that generates /vendor/etc/passwd, it
was suggested that the shell be /vendor/bin/sh instead of the typical
/system/bin/sh. This has subsequently caused bionic unit tests to
fail, since they always check that the shell is set to /system/bin/sh.
In the spirit of that review, libc is modified to return
/vendor/bin/sh for the OEM AID ranges and the test is updated to
expect this.
Test: bionic unit tests
Change-Id: Ie7c1c48fde8a71b3df1aa0ef112d42ab7bd3baec
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index 68897ed..24a8648 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -42,8 +42,9 @@
using android::base::StartsWith;
enum uid_type_t {
+ TYPE_APP,
TYPE_SYSTEM,
- TYPE_APP
+ TYPE_VENDOR,
};
#if defined(__BIONIC__)
@@ -61,12 +62,17 @@
EXPECT_EQ(nullptr, pwd->pw_gecos);
#endif
- if (uid_type == TYPE_SYSTEM) {
- EXPECT_STREQ("/", pwd->pw_dir);
- } else {
+ if (uid_type == TYPE_APP) {
EXPECT_STREQ("/data", pwd->pw_dir);
+ } else {
+ EXPECT_STREQ("/", pwd->pw_dir);
}
- EXPECT_STREQ("/system/bin/sh", pwd->pw_shell);
+
+ if (uid_type == TYPE_VENDOR) {
+ EXPECT_STREQ("/vendor/bin/sh", pwd->pw_shell);
+ } else {
+ EXPECT_STREQ("/system/bin/sh", pwd->pw_shell);
+ }
}
static void check_getpwuid(const char* username, uid_t uid, uid_type_t uid_type,
@@ -155,19 +161,19 @@
}
TEST(pwd, getpwnam_oem_id_5000) {
- check_get_passwd("oem_5000", 5000, TYPE_SYSTEM, false);
+ check_get_passwd("oem_5000", 5000, TYPE_VENDOR, false);
}
TEST(pwd, getpwnam_oem_id_5999) {
- check_get_passwd("oem_5999", 5999, TYPE_SYSTEM, false);
+ check_get_passwd("oem_5999", 5999, TYPE_VENDOR, false);
}
TEST(pwd, getpwnam_oem_id_2900) {
- check_get_passwd("oem_2900", 2900, TYPE_SYSTEM, false);
+ check_get_passwd("oem_2900", 2900, TYPE_VENDOR, false);
}
TEST(pwd, getpwnam_oem_id_2999) {
- check_get_passwd("oem_2999", 2999, TYPE_SYSTEM, false);
+ check_get_passwd("oem_2999", 2999, TYPE_VENDOR, false);
}
TEST(pwd, getpwnam_app_id_nobody) {