Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
533237fe
Kaydet (Commit)
533237fe
authored
May 13, 2014
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Related fdo#60338: Restrictive open mode flags for tempfile w/o calling umask
Change-Id: Ia83cbe4c9352eb2a2cf317dd1fc5771ddc12c993
üst
82fa84e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
14 deletions
+27
-14
file.cxx
sal/osl/unx/file.cxx
+16
-5
file_impl.hxx
sal/osl/unx/file_impl.hxx
+6
-1
file_misc.cxx
sal/osl/unx/file_misc.cxx
+1
-1
tempfile.cxx
sal/osl/unx/tempfile.cxx
+4
-7
No files found.
sal/osl/unx/file.cxx
Dosyayı görüntüle @
533237fe
...
...
@@ -821,7 +821,8 @@ openMemoryAsFile( void *address, size_t size, oslFileHandle *pHandle, const char
#endif
oslFileError
openFilePath
(
const
char
*
cpFilePath
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
)
openFilePath
(
const
char
*
cpFilePath
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
,
mode_t
mode
)
{
oslFileError
eRet
;
...
...
@@ -852,18 +853,22 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags
#endif
/* set mode and flags */
int
mode
=
S_IRUSR
|
S_IRGRP
|
S_IROTH
;
int
def
mode
=
S_IRUSR
|
S_IRGRP
|
S_IROTH
;
int
flags
=
O_RDONLY
;
if
(
uFlags
&
osl_File_OpenFlag_Write
)
{
mode
|=
S_IWUSR
|
S_IWGRP
|
S_IWOTH
;
def
mode
|=
S_IWUSR
|
S_IWGRP
|
S_IWOTH
;
flags
=
OPEN_WRITE_FLAGS
;
}
if
(
uFlags
&
osl_File_OpenFlag_Create
)
{
mode
|=
S_IWUSR
|
S_IWGRP
|
S_IWOTH
;
def
mode
|=
S_IWUSR
|
S_IWGRP
|
S_IWOTH
;
flags
=
OPEN_CREATE_FLAGS
;
}
if
(
mode
==
mode_t
(
-
1
))
{
mode
=
defmode
;
}
/* Check for flags passed in from SvFileStream::Open() */
if
(
uFlags
&
osl_File_OpenFlag_Trunc
)
...
...
@@ -999,6 +1004,12 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags
oslFileError
SAL_CALL
osl_openFile
(
rtl_uString
*
ustrFileURL
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
)
{
return
openFile
(
ustrFileURL
,
pHandle
,
uFlags
,
mode_t
(
-
1
));
}
oslFileError
SAL_CALL
openFile
(
rtl_uString
*
ustrFileURL
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
,
mode_t
mode
)
{
oslFileError
eRet
;
...
...
@@ -1016,7 +1027,7 @@ SAL_CALL osl_openFile( rtl_uString* ustrFileURL, oslFileHandle* pHandle, sal_uIn
return
oslTranslateFileError
(
OSL_FET_ERROR
,
errno
);
#endif
/* MACOSX */
return
openFilePath
(
buffer
,
pHandle
,
uFlags
);
return
openFilePath
(
buffer
,
pHandle
,
uFlags
,
mode
);
}
oslFileError
...
...
sal/osl/unx/file_impl.hxx
Dosyayı görüntüle @
533237fe
...
...
@@ -22,6 +22,7 @@
#include "osl/file.h"
#include <stddef.h>
#include <sys/types.h>
struct
DirectoryItem_Impl
{
...
...
@@ -43,10 +44,14 @@ struct DirectoryItem_Impl
oslFileType
getFileType
()
const
;
};
oslFileError
openFile
(
rtl_uString
*
pustrFileURL
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
,
mode_t
mode
);
oslFileError
openFilePath
(
const
char
*
cpFilePath
,
oslFileHandle
*
pHandle
,
sal_uInt32
uFlags
);
sal_uInt32
uFlags
,
mode_t
mode
);
#endif
/* INCLUDED_FILE_IMPL_HXX */
...
...
sal/osl/unx/file_misc.cxx
Dosyayı görüntüle @
533237fe
...
...
@@ -917,7 +917,7 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
if
(
openFilePath
(
pszSourceFileName
,
&
SourceFileFH
,
osl_File_OpenFlag_Read
|
osl_File_OpenFlag_NoLock
|
osl_File_OpenFlag_NoExcl
)
!=
osl_File_E_None
)
osl_File_OpenFlag_Read
|
osl_File_OpenFlag_NoLock
|
osl_File_OpenFlag_NoExcl
,
mode_t
(
-
1
)
)
!=
osl_File_E_None
)
{
// Let's hope errno is still set relevantly after openFilePath...
nRet
=
errno
;
...
...
sal/osl/unx/tempfile.cxx
Dosyayı görüntüle @
533237fe
...
...
@@ -30,6 +30,7 @@
#include <sal/macros.h>
#include "file_url.h"
#include "file_impl.hxx"
oslFileError
SAL_CALL
osl_getTempDirURL
(
rtl_uString
**
pustrTempDir
)
{
...
...
@@ -233,17 +234,13 @@ static oslFileError osl_create_temp_file_impl_(
if
(
osl_File_E_None
==
osl_error
)
{
/* RW permission for the user only! */
mode_t
old_mode
=
umask
(
077
);
osl_error
=
osl_openFile
(
osl_error
=
openFile
(
tmp_file_url
,
file_handle
,
osl_File_OpenFlag_Read
|
osl_File_OpenFlag_Write
|
osl_File_OpenFlag_Create
);
umask
(
old_mode
);
osl_File_OpenFlag_Create
,
S_IRUSR
|
S_IWUSR
);
}
/* in case of error osl_File_E_EXIST we simply try again else we give up */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment