[Pkg-owncloud-commits] [owncloud-client] 186/332: owncloudcmd: fix the --trust option
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 73e35c66afb872fd1278266570419481dd548705
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Thu Jul 10 11:16:08 2014 +0200
owncloudcmd: fix the --trust option
We can't call csync_set_userdata in owncloudcmd because it is
going to be overwritten later in the SyncEngine.
So we had an object of type SyncEngine* that we cast to CmdOptions*
and the trust flag was in the padding, so was some random data.
Therefore we must use global variables in that case in order to
know if we should ignore the certificate.
---
src/owncloudcmd/owncloudcmd.cpp | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index ad7a4ae..23c6602 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -42,12 +42,13 @@ struct CmdOptions {
bool trustSSL;
};
+// we can't use csync_set_userdata because the SyncEngine sets it already.
+// So we have to use a global variable
+CmdOptions *opts = 0;
+
int getauth(const char* prompt, char* buf, size_t len, int a, int b, void *userdata)
{
- (void) a;
- (void) b;
-
- struct CmdOptions *opts = (struct CmdOptions*) userdata;
+ Q_UNUSED(a) Q_UNUSED(b) Q_UNUSED(userdata)
std::cout << "** Authentication required: \n" << prompt << std::endl;
std::string s;
@@ -169,7 +170,7 @@ int main(int argc, char **argv) {
csync_set_log_level(options.silent ? 1 : 11);
- csync_set_userdata(_csync_ctx, &options);
+ opts = &options;
csync_set_auth_callback( _csync_ctx, getauth );
if( csync_init( _csync_ctx ) < 0 ) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list