Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
7fcb1be0
Commit
7fcb1be0
authored
Mar 13, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move get_config_user function content into main function (single useage)
parent
b068f75b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
42 deletions
+14
-42
config.lib.inc
src/etc/inc/config.lib.inc
+14
-42
No files found.
src/etc/inc/config.lib.inc
View file @
7fcb1be0
...
...
@@ -337,32 +337,6 @@ function security_checks_disabled()
return
file_exists
(
'/tmp/disable_security_checks'
);
}
function
config_validate
(
$conffile
)
{
global
$g
,
$xmlerr
;
$xml_parser
=
xml_parser_create
();
if
(
!
(
$fp
=
fopen
(
$conffile
,
"r"
)))
{
$xmlerr
=
gettext
(
"XML error: unable to open file"
);
return
false
;
}
while
(
$data
=
fread
(
$fp
,
4096
))
{
if
(
!
xml_parse
(
$xml_parser
,
$data
,
feof
(
$fp
)))
{
$xmlerr
=
sprintf
(
gettext
(
'%1$s at line %2$d'
),
xml_error_string
(
xml_get_error_code
(
$xml_parser
)),
xml_get_current_line_number
(
$xml_parser
));
return
false
;
}
}
xml_parser_free
(
$xml_parser
);
fclose
(
$fp
);
return
true
;
}
/**
* remove old backups
*/
...
...
@@ -401,25 +375,23 @@ function set_device_perms() {
}
}
function
get_config_user
()
{
if
(
empty
(
$_SESSION
[
"Username"
]))
{
$username
=
getenv
(
"USER"
);
if
(
empty
(
$conuser
)
||
$conuser
==
"root"
)
$username
=
"(system)"
;
}
else
$username
=
$_SESSION
[
"Username"
];
if
(
!
empty
(
$_SERVER
[
'REMOTE_ADDR'
]))
$username
.=
'@'
.
$_SERVER
[
'REMOTE_ADDR'
];
return
$username
;
}
function
make_config_revision_entry
(
$desc
=
null
,
$override_user
=
null
)
{
if
(
empty
(
$override_user
))
$username
=
get_config_user
();
else
if
(
empty
(
$override_user
))
{
if
(
empty
(
$_SESSION
[
"Username"
]))
{
$username
=
getenv
(
"USER"
);
if
(
empty
(
$conuser
)
||
$conuser
==
"root"
)
$username
=
"(system)"
;
}
else
{
$username
=
$_SESSION
[
"Username"
];
}
if
(
!
empty
(
$_SERVER
[
'REMOTE_ADDR'
]))
{
$username
.=
'@'
.
$_SERVER
[
'REMOTE_ADDR'
];
}
}
else
{
$username
=
$override_user
;
}
$revision
=
array
();
...
...
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