diff --git a/csync/src/csync_owncloud.c b/csync/src/csync_owncloud.c index cc009c9bf..8207f76a5 100644 --- a/csync/src/csync_owncloud.c +++ b/csync/src/csync_owncloud.c @@ -110,7 +110,7 @@ static int ssl_callback_by_neon(void *userdata, int failures, } } DEBUG_WEBDAV("## VERIFY_SSL CERT: %d", ret ); - return ret; + return ret; } /* diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp index eefbc4229..ebf36bf5d 100644 --- a/src/owncloudcmd/owncloudcmd.cpp +++ b/src/owncloudcmd/owncloudcmd.cpp @@ -214,6 +214,30 @@ void parseOptions( const QStringList& app_args, CmdOptions *options ) } } +int getauth_cmd(const char *prompt, + char *buf, + size_t len, + int echo, + int verify, + void *userdata) +{ + int re = 0; + + const QString qPrompt = QString::fromLatin1( prompt ).trimmed(); + + if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) { + // its an SSL problem. + if( opts->trustSSL ) { + qstrcpy(buf, "yes"); + } else { + qstrcpy(buf, "no"); + } + } else { + re = -1; + } + return re; +} + int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -315,6 +339,8 @@ restart_sync: opts = &options; cred->syncContextPreInit(_csync_ctx); + csync_set_auth_callback( _csync_ctx, getauth_cmd ); + if( csync_init( _csync_ctx ) < 0 ) { qFatal("Could not initialize csync!"); return EXIT_FAILURE;