Skip to content

Commit 8cfcf90

Browse files
committed
pseudo-user for Linux superuser Perl scripts
1 parent f408405 commit 8cfcf90

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ If PEB is going to be compiled for end users and interaction with the Perl debug
160160
close_command: "_close_",
161161
close_confirmation: "_closed_"
162162
}
163-
request.open('GET', 'http://interactive@local-pseudodomain/perl/interactive-script.pl' + formatParameters(parameters), true);
163+
request.open('GET', 'http://interactive@local-pseudodomain/perl/interactive-script.pl' +
164+
formatParameters(parameters), true);
164165
request.send();
165166
});
166167

@@ -223,7 +224,7 @@ If PEB is going to be compiled for end users and interaction with the Perl debug
223224
```
224225

225226
## Calling Linux Superuser Perl Scripts
226-
Linux superuser Perl scripts can be started using the special query string item ```user=root```. So if PEB finds an URL like: ```http://local-pseudodomain/perl/root-open-directory.pl?user=root```, it will ask the user for the root password and then call ```sudo```, which will start the script. Root password is saved for 5 minutes inside the memory of the running PEB and is deleted afterwards. Output from superuser scripts is displayed inside PEB like the output from any other noninteractive Perl script. User data from HTML forms is supplied to superuser Perl scripts as the first command line argument without ```STDIN``` input or ```QUERY_STRING``` environment variable like in the user-level Perl scripts.
227+
Linux superuser Perl scripts can be started using the special pseudo-user ```root```. So if PEB finds an URL like: ```http://root@local-pseudodomain/perl/root-open-directory.pl```, it will ask the user for the root password and then call ```sudo```, which will start the script. Root password is saved for 5 minutes inside the memory of the running PEB and is deleted afterwards. Output from superuser scripts is displayed inside PEB like the output from any other noninteractive Perl script. User data from HTML forms is supplied to superuser Perl scripts as the first command line argument without ```STDIN``` input or ```QUERY_STRING``` environment variable like in the user-level Perl scripts.
227228

228229
## Settings
229230
**Settings based on the existence of certain files and folders:**

resources/app/interactive-script.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
close_command: "_close_",
5353
close_confirmation: "_closed_"
5454
}
55-
request.open('GET', 'http://interactive@local-pseudodomain/perl/interactive-script.pl' + formatParameters(parameters), true);
55+
request.open('GET', 'http://interactive@local-pseudodomain/perl/interactive-script.pl' +
56+
formatParameters(parameters), true);
5657
request.send();
5758
});
5859

resources/app/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
</p>
9090

9191
<p>
92-
<a href="http://local-pseudodomain/perl/root-open-directory.pl?user=root"
93-
data-toggle="tooltip" title="http://local-pseudodomain/perl/root-open-directory.pl?user=root"
92+
<a href="http://root@local-pseudodomain/perl/root-open-directory.pl"
93+
data-toggle="tooltip" title="http://root@local-pseudodomain/perl/root-open-directory.pl"
9494
data-placement="right" id="root-directory-lister">
9595
Linux /root Directory Lister</a>
9696
</p>

resources/app/root-get.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</head>
2020

2121
<body>
22-
<form action="perl/get-post-test.pl" method="get" onsubmit="submitFunction()">
22+
<form action="http://root@local-pseudodomain/perl/get-post-test.pl" method="get" onsubmit="submitFunction()">
2323
<div class="col-lg-10 col-lg-offset-1">
2424
<fieldset>
2525
<legend>Send GET request to local Perl script</legend>
@@ -45,7 +45,6 @@
4545
</div>
4646
</fieldset>
4747
</div>
48-
<input type="hidden" name="user" value="root">
4948
</form>
5049
</body>
5150

resources/app/root-post.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</head>
2020

2121
<body>
22-
<form action="perl/get-post-test.pl?user=root" method="post" onsubmit="submitFunction()">
22+
<form action="http://root@local-pseudodomain/perl/get-post-test.pl" method="post" onsubmit="submitFunction()">
2323
<div class="col-lg-10 col-lg-offset-1">
2424
<fieldset>
2525
<legend>Send POST request to local Perl script</legend>

src/peb.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ QNonInteractiveScriptHandler::QNonInteractiveScriptHandler(
628628
// qDebug() << "Script output target:" << scriptOutputTarget;
629629

630630
#if ADMIN_PRIVILEGES_CHECK == 0
631-
scriptUser = scriptQuery.queryItemValue("user");
632-
scriptQuery.removeQueryItem("user");
633-
// qDebug() << "Script user:" << scriptUser;
631+
scriptUser = url.userName();
634632
#endif
635633

636634
scriptFullFilePath = QDir::toNativeSeparators

0 commit comments

Comments
 (0)