sal/osl/unx/security.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
New commits: commit fd268507704ba82af2abe4f5f777daf4c43d74fe Author: Michael Meeks <michael.me...@suse.com> Date: Wed Jan 25 15:09:55 2012 +0000 android: cleanup osl security code for empty home / username fields diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index d73111c..96605fc 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -276,7 +276,7 @@ static sal_Bool SAL_CALL osl_psz_getUserName(oslSecurity Security, sal_Char* psz { oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; - if (pSecImpl == NULL) + if (pSecImpl == NULL || pSecImpl->m_pPasswd.pw_name == NULL) return sal_False; strncpy(pszName, pSecImpl->m_pPasswd.pw_name, nMax); @@ -364,14 +364,17 @@ static sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszD pStr = getenv("HOME"); #endif - if ((pStr != NULL) && (strlen(pStr) > 0) && - (access(pStr, 0) == 0)) + if (pStr != NULL && strlen(pStr) > 0 && access(pStr, 0) == 0) strncpy(pszDirectory, pStr, nMax); - else + else if (pSecImpl->m_pPasswd.pw_dir != NULL) strncpy(pszDirectory, pSecImpl->m_pPasswd.pw_dir, nMax); + else + return sal_False; } - else + else if (pSecImpl->m_pPasswd.pw_dir != NULL) strncpy(pszDirectory, pSecImpl->m_pPasswd.pw_dir, nMax); + else + return sal_False; return sal_True; } @@ -403,8 +406,7 @@ static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* ps { sal_Char *pStr = getenv("XDG_CONFIG_HOME"); - if ((pStr == NULL) || (strlen(pStr) == 0) || - (access(pStr, 0) != 0)) + if (pStr == NULL || strlen(pStr) == 0 || access(pStr, 0) != 0) { size_t n = 0; // a default equal to $HOME/.config should be used. @@ -460,9 +462,9 @@ sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security) return sal_False; if (pSecImpl->m_pPasswd.pw_uid != 0) - return (sal_False); + return sal_False; - return (sal_True); + return sal_True; } void SAL_CALL osl_freeSecurityHandle(oslSecurity Security) _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits