Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fredix
ncs
Commits
c8b9ec11
Commit
c8b9ec11
authored
Mar 21, 2013
by
fred
Browse files
read the users on startup and add them to the ftp server
parent
f08d1061
Changes
2
Hide whitespace changes
Inline
Side-by-side
CFtpServer/nodeftp.cpp
View file @
c8b9ec11
...
...
@@ -247,6 +247,28 @@ void Nodeftp::ftp_init()
}
else
qErrnoWarning
(
"FTP : Unable to listen"
);
populate
();
}
void
Nodeftp
::
populate
()
{
/* QCryptographicHash cipher( QCryptographicHash::Sha1 );
cipher.addData(password.simplified().toAscii());
QByteArray password_hash = cipher.result();
qDebug() << "password_hash : " << password_hash.toHex();
password_hashed = QString::fromLatin1(password_hash.toHex());
*/
BSONObj
filter
=
BSON
(
"ftp.activated"
<<
true
);
QList
<
BSONObj
>
users_list
=
mongodb_
->
FindAll
(
"users"
,
filter
);
foreach
(
BSONObj
l_user
,
users_list
)
{
add_ftp_user
(
QString
::
fromStdString
(
l_user
.
getField
(
"email"
).
str
()));
}
}
...
...
CFtpServer/nodeftp.h
View file @
c8b9ec11
...
...
@@ -36,6 +36,7 @@ public:
private:
bool
ncs_auth
(
QString
login
,
QString
&
token
,
QString
&
directory
);
void
populate
();
QString
m_directory
;
int
m_port
;
...
...
Write
Preview
Supports
Markdown
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