Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
0b73a121
Commit
0b73a121
authored
Sep 27, 2001
by
Robert Ricci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to use libdb, and removed some unnecessary boilerplate
parent
88a251cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
24 deletions
+7
-24
db/webcontrol.in
db/webcontrol.in
+7
-24
No files found.
db/webcontrol.in
View file @
0b73a121
...
...
@@ -15,12 +15,8 @@ my $optlist = "m:l:";
#
# Configure variables
#
my
$TB
=
"
@prefix
@
";
my
$DBNAME
=
"
@TBDBNAME
@
";
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/usr/bin:/usr/local/bin:/usr/site/bin
';
delete
@ENV
{'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
use
lib
"
@prefix
@/lib
";
use
libdb
;
#
# Turn off line buffering on output
...
...
@@ -59,36 +55,23 @@ if (defined($options{"l"})) {
}
}
#
# Set up for querying the database.
#
use
Mysql
;
my
$DB
=
Mysql
->
connect
("
localhost
",
$DBNAME
,
"
script
",
"
none
");
#
# Only root or admin types!
#
if
(
$UID
!=
0
)
{
(
$name
)
=
getpwuid
(
$UID
)
or
die
"
$UID
not in passwd file
\n
";
$db_result
=
$DB
->
query
("
select admin from users where uid='
$name
'
");
@row
=
$db_result
->
fetchrow_array
();
if
(
$row
[
0
]
!=
1
)
{
if
((
$UID
!=
0
)
&&
(
!
TBAdmin
(
$UID
)))
{
die
("
Only root or TB administrators can control the web interface.
\n
");
}
}
if
(
$setmesg
)
{
if
(
$message
eq
"")
{
print
"
Clearing Web Message of the Day
\n
";
$db_result
=
$DB
->
query
("
delete from loginmessage
");
DBQueryFatal
("
delete from loginmessage
");
}
else
{
print
"
Setting Web Message of the Day to
$message
\n
";
$db_result
=
$DB
->
query
("
replace into loginmessage (valid, message)
"
.
DBQueryFatal
("
replace into loginmessage (valid, message)
"
.
"
values(1, '
$message
')
");
}
}
...
...
@@ -97,12 +80,12 @@ if ($setlogin) {
if
(
$logins
)
{
print
"
Enabling Web Interface logins
\n
";
$db_result
=
$DB
->
query
("
delete from nologins
");
DBQueryFatal
("
delete from nologins
");
}
else
{
print
"
Disabling Web Interface logins
\n
";
$db_result
=
$DB
->
query
("
replace into nologins (nologins) values(1)
");
DBQueryFatal
("
replace into nologins (nologins) values(1)
");
}
}
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