Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-07-10 13:16:08 +0400
committerOlivier Goffart <ogoffart@woboq.com>2014-07-10 13:19:23 +0400
commit73e35c66afb872fd1278266570419481dd548705 (patch)
tree10909dd8f6727c3326f119ebe9b4f8873b48e5d8 /src/owncloudcmd
parentd3b599b7273e7f797932a85e8007cabeb348c51c (diff)
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.
Diffstat (limited to 'src/owncloudcmd')
-rw-r--r--src/owncloudcmd/owncloudcmd.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index ad7a4aea0..23c660270 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 ) {