Skip to content

Commit

Permalink
feat: Implement Shares management page.
Browse files Browse the repository at this point in the history
fix: Fix a possible scurity issue when checking cookies.

This security issue is caused by PH7 issue 25.

Feature tracking issue #12
  • Loading branch information
Maxwell175 committed Aug 24, 2018
1 parent ee2b457 commit b6d6aa0
Show file tree
Hide file tree
Showing 12 changed files with 975 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <fastpbkdf2.h>

#define ToChr(x) x.toUtf8().data()
#define ToChr(x) (x).toUtf8().data()

namespace Common {
const quint8 MAX_RESULTCODE = 5;
Expand Down
2 changes: 1 addition & 1 deletion SSNFSd/config.sql
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS "Users" (
`Email` TEXT NOT NULL UNIQUE,
`Password_Hash` TEXT NOT NULL,
`Updt_TmStmp` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
`Crtd_TmStmp` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
`Updt_User` TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS "User_Roles" (
`User_Key` INTEGER NOT NULL,
Expand Down
454 changes: 454 additions & 0 deletions SSNFSd/ssnfswebworker.cpp

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions SSNFSd/ssnfsworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#define STR(tok) STR_EXPAND(tok)
#define HELLO_STR "SSNFS server version " STR(_SERVER_VERSION)

#define ToChr(x) x.toUtf8().data()

SSNFSWorker::SSNFSWorker(int socketDescriptor, QObject *parent)
: QThread(parent), socketDescriptor(socketDescriptor)
{
Expand Down
3 changes: 3 additions & 0 deletions SSNFSd/ssnfsworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class SSNFSWorker : public QThread
QHash<quint16, QString> knownResultCodes;
QVector<QString> userPerms;

// SaveShares


void handleRegistration();

private:
Expand Down
2 changes: 1 addition & 1 deletion SSNFSd/webpanel/approve.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright 2018 Maxwell Dreytser
*
-->
<?php include_once("check-cookie.php"); ?>
<?php include_once("check-cookie.php"); if (http_response_code() == 303) exit; ?>

<!DOCTYPE html>
<html lang="en">
Expand Down
30 changes: 22 additions & 8 deletions SSNFSd/webpanel/computers.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,35 @@
padding-top: 20px;
padding-bottom: 20px;
}

.panel-default>.panel-heading {
color: #fff;
background-color: #1d233a;
cursor: move;
}

.panel-title {
font-size: 1em;
font-weight: bold;
}

.panel-body {
min-height: 215px;
padding: 0 15px;
}

.no-data {
color: darkgray;
text-align: center;
}
</style>
</head>
<body>
<div class="container">

<?php include_once("navbar.php"); ?>

<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
<h1>Navbar example</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="../../components/#navbar" role="button">View navbar docs &raquo;</a>
</p>
</div>


</div> <!-- /container -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion SSNFSd/webpanel/connected.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright 2018 Maxwell Dreytser
*
-->
<?php include_once("check-cookie.php"); ?>
<?php include_once("check-cookie.php"); if (http_response_code() == 303) exit; ?>
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down
18 changes: 5 additions & 13 deletions SSNFSd/webpanel/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright 2018 Maxwell Dreytser
*
-->
<?php include_once("check-cookie.php"); ?>
<?php include_once("check-cookie.php"); if (http_response_code() == 303) exit; ?>
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -162,12 +162,7 @@
<tr>
<td><?php echo $pendClient["userName"]; ?></td>
<td><?php echo $pendClient["clientName"]; ?></td>
<td class="moreinfo-icon"><a href="javascript:void(0)" onclick='window.showCompApprove(this,
<?php echo json_encode($pendClient["pendingClientKey"], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); ?>,
<?php echo json_encode($pendClient["userName"], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); ?>,
<?php echo json_encode($pendClient["clientName"], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); ?>,
<?php echo json_encode($pendClient["submitTmStmp"], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); ?>,
<?php echo json_encode($pendClient["submitHost"], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); ?>)'>
<td class="moreinfo-icon"><a href="javascript:void(0)" onclick='window.showCompApprove(this, <?php echo json_encode($pendClient, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_FORCE_OBJECT); ?>)'>
<i class="fas fa-info-circle"></i></a>
</td>
</tr>
Expand Down Expand Up @@ -201,18 +196,15 @@
});

window.currApprovalInfo = {};
window.showCompApprove = function(caller, pendingClientKey, userName, clientName, submitTmStmp, submitHost) {
window.showCompApprove = function(caller, data) {
OpenSpeechBubbles.forEach(function(bubble) { bubble.removeBubble(); });
var approveFrame = document.createElement("iframe");
approveFrame.src = "approve.php";
approveFrame.style.border = '0';
approveFrame.width = '350';
approveFrame.height = '168';
window.currApprovalInfo.pendingClientKey = pendingClientKey;
window.currApprovalInfo.userName = userName;
window.currApprovalInfo.clientName = clientName;
window.currApprovalInfo.submitTmStmp = new Date(submitTmStmp*1000);
window.currApprovalInfo.submitHost = submitHost;
window.currApprovalInfo = data;
window.currApprovalInfo.submitTmStmp = new Date(window.currApprovalInfo.submitTmStmp*1000);
window.currApprovalInfo.iframe = approveFrame;
window.currApprovalInfo.approveWindow = SpeechBubble(caller, approveFrame);
var closeBtn = document.createElement('i');
Expand Down
2 changes: 1 addition & 1 deletion SSNFSd/webpanel/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright 2018 Maxwell Dreytser
*
-->
<?php include_once("check-cookie.php"); ?>
<?php include_once("check-cookie.php"); if (http_response_code() == 303) exit; ?>
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down
Loading

0 comments on commit b6d6aa0

Please sign in to comment.