Merge git://github.com/NvanAdrichem/client into 2.1, pull #4060

This commit is contained in:
Klaas Freitag 2015-11-18 17:00:19 +01:00
commit 8abaf92083
7 changed files with 46 additions and 0 deletions

View file

@ -50,6 +50,12 @@ OPTIONS
``--httpproxy http://[user@pass:]<server>:<port>`` ``--httpproxy http://[user@pass:]<server>:<port>``
Uses ``server`` as HTTP proxy. Uses ``server`` as HTTP proxy.
``--nonshib``
Uses Non Shibboleth WebDAV Authentication
``--davpath [path]``
Overrides the WebDAV Path with ``path``
Example Example
======= =======
To synchronize the ownCloud directory ``Music`` to the local directory ``media/music`` To synchronize the ownCloud directory ``Music`` to the local directory ``media/music``

View file

@ -42,6 +42,12 @@ Other command line switches supported by ``owncloudcmd`` include the following:
``--unsyncedfolders [file]`` ``--unsyncedfolders [file]``
File containing list of folders to not sync File containing list of folders to not sync
``--nonshib``
Uses Non Shibboleth WebDAV Authentication
``--davpath [path]``
Overrides the WebDAV Path with ``path``
Credential Handling Credential Handling
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~

View file

@ -56,8 +56,10 @@ struct CmdOptions {
bool useNetrc; bool useNetrc;
bool interactive; bool interactive;
bool ignoreHiddenFiles; bool ignoreHiddenFiles;
bool nonShib;
QString exclude; QString exclude;
QString unsyncedfolders; QString unsyncedfolders;
QString davPath;
int restartTimes; int restartTimes;
}; };
@ -156,6 +158,8 @@ void help()
std::cout << " --password, -p [pass] Use [pass] as password" << std::endl; std::cout << " --password, -p [pass] Use [pass] as password" << std::endl;
std::cout << " -n Use netrc (5) for login" << std::endl; std::cout << " -n Use netrc (5) for login" << std::endl;
std::cout << " --non-interactive Do not block execution with interaction" << std::endl; std::cout << " --non-interactive Do not block execution with interaction" << std::endl;
std::cout << " --nonshib Use Non Shibboleth WebDAV authentication" << std::endl;
std::cout << " --davpath [path] Custom themed dav path, overrides --nonshib" << std::endl;
std::cout << " --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl; std::cout << " --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl;
std::cout << " -h Sync hidden files,do not ignore them" << std::endl; std::cout << " -h Sync hidden files,do not ignore them" << std::endl;
std::cout << " --version, -v Display version and exit" << std::endl; std::cout << " --version, -v Display version and exit" << std::endl;
@ -224,6 +228,10 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
options->exclude = it.next(); options->exclude = it.next();
} else if( option == "--unsyncedfolders" && !it.peekNext().startsWith("-") ) { } else if( option == "--unsyncedfolders" && !it.peekNext().startsWith("-") ) {
options->unsyncedfolders = it.next(); options->unsyncedfolders = it.next();
} else if( option == "--nonshib" ) {
options->nonShib = true;
} else if( option == "--davpath" && !it.peekNext().startsWith("-") ) {
options->davPath = it.next();
} else if( option == "--max-sync-retries" && !it.peekNext().startsWith("-") ) { } else if( option == "--max-sync-retries" && !it.peekNext().startsWith("-") ) {
options->restartTimes = it.next().toInt(); options->restartTimes = it.next().toInt();
} else { } else {
@ -272,6 +280,7 @@ int main(int argc, char **argv) {
options.useNetrc = false; options.useNetrc = false;
options.interactive = true; options.interactive = true;
options.ignoreHiddenFiles = true; options.ignoreHiddenFiles = true;
options.nonShib = false;
options.restartTimes = 3; options.restartTimes = 3;
ClientProxy clientProxy; ClientProxy clientProxy;
@ -287,6 +296,15 @@ int main(int argc, char **argv) {
if(!options.target_url.endsWith("/")) { if(!options.target_url.endsWith("/")) {
options.target_url.append("/"); options.target_url.append("/");
} }
if( options.nonShib ) {
account->setNonShib(true);
}
if(!options.davPath.isEmpty()) {
account->setDavPath( options.davPath );
}
if( !options.target_url.contains( account->davPath() )) { if( !options.target_url.contains( account->davPath() )) {
options.target_url.append(account->davPath()); options.target_url.append(account->davPath());
} }

View file

@ -497,6 +497,15 @@ bool Account::rootEtagChangesNotOnlySubFolderEtags()
return (serverVersionInt() >= 0x080100); return (serverVersionInt() >= 0x080100);
} }
void Account::setNonShib(bool nonShib)
{
if( nonShib ) {
_davPath = Theme::instance()->webDavPathNonShib();
} else {
_davPath = Theme::instance()->webDavPath();
}
}
} // namespace OCC } // namespace OCC

View file

@ -67,6 +67,7 @@ public:
*/ */
QString davPath() const; QString davPath() const;
void setDavPath(const QString&s) { _davPath = s; } void setDavPath(const QString&s) { _davPath = s; }
void setNonShib(bool nonShib);
static AccountPtr create(); static AccountPtr create();
~Account(); ~Account();

View file

@ -412,5 +412,10 @@ QString Theme::webDavPath() const
return QLatin1String("remote.php/webdav/"); return QLatin1String("remote.php/webdav/");
} }
QString Theme::webDavPathNonShib() const
{
return QLatin1String("remote.php/nonshib-webdav/");
}
} // end namespace client } // end namespace client

View file

@ -227,6 +227,7 @@ public:
* it has a trailing slash, for example "remote.php/webdav/". * it has a trailing slash, for example "remote.php/webdav/".
*/ */
virtual QString webDavPath() const; virtual QString webDavPath() const;
virtual QString webDavPathNonShib() const;
protected: protected:
#ifndef TOKEN_AUTH_ONLY #ifndef TOKEN_AUTH_ONLY