Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
2f32282e
Commit
2f32282e
authored
10 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Fix namespaces.
parent
a38bf33d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Utils/System.php
+9
-9
9 additions, 9 deletions
lib/SimpleSAML/Utils/System.php
with
9 additions
and
9 deletions
lib/SimpleSAML/Utils/System.php
+
9
−
9
View file @
2f32282e
...
...
@@ -58,7 +58,7 @@ class System
* This function retrieves the path to a directory where temporary files can be saved.
*
* @return string Path to a temporary directory, without a trailing directory separator.
* @throws SimpleSAML_Error_Exception If the temporary directory cannot be created or it exists and does not belong
* @throws
\
SimpleSAML_Error_Exception If the temporary directory cannot be created or it exists and does not belong
* to the current user.
*
* @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
...
...
@@ -67,7 +67,7 @@ class System
*/
public
static
function
getTempDir
()
{
$globalConfig
=
SimpleSAML_Configuration
::
getInstance
();
$globalConfig
=
\
SimpleSAML_Configuration
::
getInstance
();
$tempDir
=
rtrim
(
$globalConfig
->
getString
(
'tempdir'
,
sys_get_temp_dir
()
.
DIRECTORY_SEPARATOR
.
'simplesaml'
),
DIRECTORY_SEPARATOR
);
...
...
@@ -75,14 +75,14 @@ class System
if
(
!
is_dir
(
$tempDir
))
{
if
(
!
mkdir
(
$tempDir
,
0700
,
true
))
{
$error
=
error_get_last
();
throw
new
SimpleSAML_Error_Exception
(
'Error creating temporary directory "'
.
$tempDir
.
throw
new
\
SimpleSAML_Error_Exception
(
'Error creating temporary directory "'
.
$tempDir
.
'": '
.
$error
[
'message'
]);
}
}
elseif
(
function_exists
(
'posix_getuid'
))
{
// check that the owner of the temp directory is the current user
$stat
=
lstat
(
$tempDir
);
if
(
$stat
[
'uid'
]
!==
posix_getuid
())
{
throw
new
SimpleSAML_Error_Exception
(
'Temporary directory "'
.
$tempDir
.
throw
new
\
SimpleSAML_Error_Exception
(
'Temporary directory "'
.
$tempDir
.
'" does not belong to the current user.'
);
}
}
...
...
@@ -100,7 +100,7 @@ class System
* @param string $data The data we should write to the file.
* @param int $mode The permissions to apply to the file. Defaults to 0600.
*
* @throws SimpleSAML_Error_Exception If any of the input parameters doesn't have the proper types, or the file
* @throws
\
SimpleSAML_Error_Exception If any of the input parameters doesn't have the proper types, or the file
* cannot be saved, permissions cannot be changed or it is not possible to write to the target file.
*
* @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
...
...
@@ -111,7 +111,7 @@ class System
public
static
function
writeFile
(
$filename
,
$data
,
$mode
=
0600
)
{
if
(
!
is_string
(
$filename
)
||
!
is_string
(
$data
)
||
!
is_numeric
(
$mode
))
{
throw
new
SimpleSAML_Error_Exception
(
'Invalid input parameters'
);
throw
new
\
SimpleSAML_Error_Exception
(
'Invalid input parameters'
);
}
$tmpFile
=
self
::
getTempDir
()
.
DIRECTORY_SEPARATOR
.
rand
();
...
...
@@ -119,7 +119,7 @@ class System
$res
=
@
file_put_contents
(
$tmpFile
,
$data
);
if
(
$res
===
false
)
{
$error
=
error_get_last
();
throw
new
SimpleSAML_Error_Exception
(
'Error saving file "'
.
$tmpFile
.
throw
new
\
SimpleSAML_Error_Exception
(
'Error saving file "'
.
$tmpFile
.
'": '
.
$error
[
'message'
]);
}
...
...
@@ -127,7 +127,7 @@ class System
if
(
!
chmod
(
$tmpFile
,
$mode
))
{
unlink
(
$tmpFile
);
$error
=
error_get_last
();
throw
new
SimpleSAML_Error_Exception
(
'Error changing file mode of "'
.
$tmpFile
.
throw
new
\
SimpleSAML_Error_Exception
(
'Error changing file mode of "'
.
$tmpFile
.
'": '
.
$error
[
'message'
]);
}
}
...
...
@@ -135,7 +135,7 @@ class System
if
(
!
rename
(
$tmpFile
,
$filename
))
{
unlink
(
$tmpFile
);
$error
=
error_get_last
();
throw
new
SimpleSAML_Error_Exception
(
'Error moving "'
.
$tmpFile
.
'" to "'
.
throw
new
\
SimpleSAML_Error_Exception
(
'Error moving "'
.
$tmpFile
.
'" to "'
.
$filename
.
'": '
.
$error
[
'message'
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment