Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add check to make sure the target paths are within the allowed mount directory #18

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ inline QByteArray getSystemInfo() {
if (SystemStr.endsWith('|'))
SystemStr.truncate(SystemStr.length() - 1);

qCritical() << SystemStr;
return SystemStr;
}

Expand Down
11 changes: 7 additions & 4 deletions SSNFS-client/fuseclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ int FuseClient::fs_opt_proc(void *data, const char *arg, int key, fuse_args *out

case FUSE_OPT_KEY_NONOPT:
{
//qInfo() << arg;
QString strArg(arg);
if (host.isNull() && shareName.isNull() && strArg.count(QLatin1Char('/')) == 1) {

QStringList parts = strArg.split('/');
QStringList hostParts = parts[0].split(':');
host = hostParts[0];
Expand All @@ -184,6 +186,7 @@ int FuseClient::fs_opt_proc(void *data, const char *arg, int key, fuse_args *out
system(ToChr(fuseUnmount));
}
QFileInfo mountPathInfo(strArg);
qCritical() << strArg ;
if (mountPathInfo.exists() == false || !mountPathInfo.isDir() || mountPathInfo.isSymLink()) {
qCritical() << "The specified mount path does not exist or is not a valid directory.";
return -1;
Expand All @@ -205,9 +208,8 @@ int FuseClient::fs_opt_proc(void *data, const char *arg, int key, fuse_args *out

void FuseClient::started() {
connect(&passwdWatcher, SIGNAL(fileChanged(QString)), this, SLOT(syncLocalUsers()), Qt::QueuedConnection);

struct fuse_operations fs_oper = {};

qInfo() << qApp->arguments();
fs_oper.init = fs_call_init;
fs_oper.getattr = fs_call_getattr;
fs_oper.readdir = fs_call_readdir;
Expand Down Expand Up @@ -313,8 +315,9 @@ int FuseClient::initSocket()

socket->setCaCertificates(QSslSocket::systemCaCertificates());
socket->setPeerVerifyMode(QSslSocket::VerifyNone);
socket->setPrivateKey("/home/maxwell/Coding/SSNFS/SSNFS-client/key.pem");
socket->setLocalCertificate("/home/maxwell/Coding/SSNFS/SSNFS-client/cert.pem");
// Does not given an error if these files are not found but does not mount as well
socket->setPrivateKey("/home/deepakchethan/Git/build-SSNFS-Desktop-Debug/SSNFS-client/key.pem");
socket->setLocalCertificate("/home/deepakchethan/Git/build-SSNFS-Desktop-Debug/SSNFS-client/cert.pem");

socket->connectToHostEncrypted(host, port);

Expand Down
Loading