Added Non Shibboleth WebDAV authentication and Dav Path customization to owncloudcmd

This commit is contained in:
Niels van Adrichem 2015-11-02 22:57:17 +01:00
parent 4737c16996
commit 8f5658bc01
5 changed files with 34 additions and 0 deletions

View file

@ -56,8 +56,10 @@ struct CmdOptions {
bool useNetrc;
bool interactive;
bool ignoreHiddenFiles;
bool nonShib;
QString exclude;
QString unsyncedfolders;
QString davPath;
};
// we can't use csync_set_userdata because the SyncEngine sets it already.
@ -155,6 +157,8 @@ void help()
std::cout << " --password, -p [pass] Use [pass] as password" << 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 << " --nonshib, -ns Use Non Shibboleth WebDAV authentication" << std::endl;
std::cout << " --davpath, -dp [path] Custom themed dav path, overrides --nonshib" << 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 << "" << std::endl;
@ -222,6 +226,10 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
options->exclude = it.next();
} else if( option == "--unsyncedfolders" && !it.peekNext().startsWith("-") ) {
options->unsyncedfolders = it.next();
} else if( option == "--nonshib" || option == "-ns") {
options->nonShib = true;
} else if( (option == "--davpath" || option == "-dp") && !it.peekNext().startsWith("-") ) {
options->davPath = it.next();
} else {
help();
}
@ -268,6 +276,7 @@ int main(int argc, char **argv) {
options.useNetrc = false;
options.interactive = true;
options.ignoreHiddenFiles = true;
options.nonShib = false;
ClientProxy clientProxy;
parseOptions( app.arguments(), &options );
@ -282,6 +291,15 @@ int main(int argc, char **argv) {
if(!options.target_url.endsWith("/")) {
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() )) {
options.target_url.append(account->davPath());
}

View file

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

View file

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

View file

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

View file

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