summaryrefslogtreecommitdiffstats
path: root/sal
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2019-05-16 05:01:46 +0300
committerTor Lillqvist <tml@collabora.com>2019-05-16 05:08:19 +0300
commitf665456cd0da35649bef179755be66c2aab290a7 (patch)
tree76c083cd02959d287460d93834a15c51fa87e0d2 /sal
parentdo not add non-text to PRIMARY selection in VclQt5Clipboard (diff)
downloadcore-f665456cd0da35649bef179755be66c2aab290a7.tar.gz
core-f665456cd0da35649bef179755be66c2aab290a7.zip
Use hand-crafted passwd entry for iOS Simulator as getpwuid_r() does not work
getpwuid_r() returns nullptr. Oddly enough, it does work on actual iOS, though. So use hand-crafted values that match behaviour on actual iOS. Change-Id: Idcc95d330a93495938520229e039f340876c3653
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/security.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index 982b7c940c2f..413c67e943d3 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -126,6 +126,35 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
if (p == nullptr) {
return nullptr;
}
+#if defined(IOS) && defined(X86_64)
+ // getpwuid_r() does not work in the iOS simulator
+ (void) found;
+ char * buffer = p->m_buffer;
+ assert(n >= 100);
+ strcpy(buffer, "mobile");
+ p->m_pPasswd.pw_name = buffer;
+ buffer += strlen(buffer) + 1;
+ strcpy(buffer, "*");
+ p->m_pPasswd.pw_passwd = buffer;
+ buffer += strlen(buffer) + 1;
+ p->m_pPasswd.pw_uid = geteuid();
+ p->m_pPasswd.pw_gid = getegid();
+ p->m_pPasswd.pw_change = 0;
+ strcpy(buffer, "");
+ p->m_pPasswd.pw_class = buffer;
+ buffer += strlen(buffer) + 1;
+ strcpy(buffer, "Mobile User");
+ p->m_pPasswd.pw_gecos = buffer;
+ buffer += strlen(buffer) + 1;
+ strcpy(buffer, "/var/mobile"); // ???
+ p->m_pPasswd.pw_dir = buffer;
+ buffer += strlen(buffer) + 1;
+ strcpy(buffer, "");
+ p->m_pPasswd.pw_shell = buffer;
+ buffer += strlen(buffer) + 1;
+ p->m_pPasswd.pw_expire = 0;
+ return p;
+#else
switch (getpwuid_r(getuid(), &p->m_pPasswd, p->m_buffer, n, &found)) {
case ERANGE:
break;
@@ -138,6 +167,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
deleteSecurityImpl(p);
return nullptr;
}
+#endif
}
}