[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sal/osl
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 16 02:27:14 UTC 2019
sal/osl/unx/security.cxx | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
New commits:
commit 93cdc8bbceafc37a796e68611a22ddc2395635ed
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu May 16 05:01:46 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Thu May 16 05:21:31 2019 +0300
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
diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index 9370fe608cf9..8fc3e3f855a1 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -120,6 +120,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;
@@ -132,6 +161,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
deleteSecurityImpl(p);
return nullptr;
}
+#endif
}
}
More information about the Libreoffice-commits
mailing list