Comparar commits

..

81 Commits

Autor SHA1 Mensagem Data
Klaas Freitag 08dd9796d1 HACK to avoid continuation: See task #1448
We do not know the _modtime from the server, at this point, so just set
the current one.  (rather than the one locally)
2014-04-04 10:50:40 +02:00
Sandro Knauß 47274f1075 Merge remote-tracking branch 'respect-XDG_CONFIG_HOME' into 1.5 2014-03-21 17:20:15 +01:00
Markus Goetz f72e1cc837 Log: Don't override level for csync
The level shall be set from Folder or owncloudCmd only.
2014-03-21 13:52:35 +01:00
Olivier Goffart 8aace3284f owncloudcmd: Fix an error during update phase would not terminate
the QApplication::quit()  would be run before the exec() and would
be a noop,   and then exec would just wait forever.
2014-03-21 10:03:11 +01:00
Olivier Goffart 922e004fc6 Make it an error instead of a crash when dav_connect fails.
Fixes #1591
2014-03-21 09:54:26 +01:00
Klaas Freitag 9d1208baa4 Also allow http and https protocols. 2014-03-18 17:10:03 +01:00
Klaas Freitag 8e914deb99 Revert "Do not rely on the url scheme owncloud(s) any more."
This reverts commit 34dd3b207e.
It can be implemented simpler.
2014-03-18 16:57:01 +01:00
Klaas Freitag 34dd3b207e Do not rely on the url scheme owncloud(s) any more.
If it is not owncloud or ownclouds, rely on the scheme
that was given by the user.
2014-03-18 14:16:50 +01:00
Klaas Freitag 68e8d659fb Remove unused code. 2014-03-18 14:16:06 +01:00
Olivier Goffart 5c45ede4a5 Read the quota as double
The server is sending floating point number when the amount of storage
is set to a custom number (say 1.2GB)

This should fix #1374
2014-03-17 10:37:06 +01:00
Olivier Goffart cabcdd890e Only run the CheckQuota job if the account is connected
We use another job to check the connection.
And this may cause wrong password failure as we are still in the wizzard

Fixes #1567
2014-03-17 10:35:43 +01:00
Olivier Goffart 0a5e691ba3 Remove debug output that might cause a crash
The account may not be finilized when this is called while the
wizzard is still running on first connection
2014-03-17 10:22:14 +01:00
Olivier Goffart ba300c2fc1 Fix memory leak: Don't use raw pointers 2014-03-17 10:04:42 +01:00
Markus Goetz 07904e078a CSyncThread: Emit a signal for each file before propagate
This can be used to display info before the sync is happening
2014-03-14 14:08:32 +01:00
Markus Goetz d5fd6309ed CMake: Fix target_link_libraries parameters 2014-03-12 15:03:11 +01:00
Markus Goetz a2467b5dea CMake: Do options one directory above
This fixes linking when keychain was not desired.
2014-03-12 14:20:38 +01:00
Markus Goetz 0bbcee7354 CMake: Fix else 2014-03-11 17:56:29 +01:00
Markus Goetz 8a18cf811e CMake: Fix warning 2014-03-11 17:33:45 +01:00
Markus Goetz 4e7e25c569 Improve libowncloudsync
* Introduce TokenCredentials
* Introduce static compiling
* Have compile flags for smaller compile
2014-03-11 17:05:44 +01:00
Markus Goetz c24c97703a CMake: Ignore failure when working as submodule 2014-03-11 17:05:44 +01:00
Klaas Freitag aa4e90acfc Put ocsync to a private library - WIP 2014-03-11 10:18:07 +01:00
Klaas Freitag c8a8eb35fa Disable the folder if it is going to be removed. 2014-03-10 12:22:06 +01:00
Daniel Molkentin 2656cc70d1 1.5.3 final 2014-03-10 10:15:50 +01:00
Klaas Freitag 8bf2c54b56 Install include dirs app name aware. 2014-03-07 13:05:17 +01:00
Markus Goetz 630f61142a Proxy: Try to fix issue
See https://github.com/owncloud/mirall/commit/eb7074e9f088214648183a45c2ce806f65a8bf3c for discussion
2014-03-06 17:48:18 +01:00
Klaas Freitag f348499bbe For Windows, add the __USE_MINGW_ANSI_STDIO=1 switch 2014-03-05 15:39:49 +01:00
Klaas Freitag 7a3abac833 Bump version to 1.5.3rc1 2014-03-05 10:49:58 +01:00
Markus Goetz eb7074e9f0 csync: Don't free proxy settings on commit
Should fix #1502 and #1524
and #1459 and #1521
2014-03-04 18:44:52 +01:00
Klaas Freitag 66b152ac69 Remove left over member variables. 2014-03-03 18:12:12 +01:00
Olivier Goffart 6df00ad08c Only removes the password from the credidentials if it has been fetched before
Also only run the propfind job if the credidentials are readon, and fetch them
otherwise
2014-03-03 17:55:15 +01:00
Olivier Goffart 76b24ff00d Revert "Do not wipe the credentials from config for reconnect."
This reverts commit 9eb3452a71.

We need that or wrong password can never be changed
2014-03-03 17:21:20 +01:00
Olivier Goffart 60a1d50ec9 Keep the rentrency flag when asking the user for the password 2014-03-03 17:16:57 +01:00
Klaas Freitag 9eb3452a71 Do not wipe the credentials from config for reconnect.
This should fix bug #1491
2014-03-03 16:39:38 +01:00
Klaas Freitag 228de7eede Make the CheckServerJob ignoring credential fails. 2014-03-03 16:37:29 +01:00
Klaas Freitag 2164f5d9b7 Remove a superflous MessageBox. User is asked for Password instead. 2014-03-03 16:36:59 +01:00
Klaas Freitag 4240010046 Add method clearCookieJar which wipes QNAMs cookies. 2014-03-03 16:36:30 +01:00
Klaas Freitag 1eb0875518 Use the mirall config file for all Keychain jobs.
Also set the job as parent to get proper deletion of the
settings object.
2014-03-03 16:35:57 +01:00
Klaas Freitag b8e52304bd Do proper initialization of _fetchJobInProgress.
That confused win32, since this flag was true very often.
2014-03-03 16:33:59 +01:00
Olivier Goffart 0658802048 Fix layout of the network tab
Fixes #1491
2014-02-28 13:17:04 +01:00
Olivier Goffart eeb68919bf Do not erase the username and password from the config if we never connected
If we never fetched the credidentials, the _user and _password will be empty,
we should therefore not try to save them because it would just erase them.

Version 1.5.2 always try to fetch the creds at startup.  But now we only
do it if we detect an internet connection
2014-02-28 12:51:06 +01:00
Olivier Goffart 9a60732542 Do not erase the full account config if an old version of the client stored the password 2014-02-28 12:51:06 +01:00
Daniel Molkentin f8d996258e OS X: Make script more even robust 2014-02-28 11:16:25 +01:00
Daniel Molkentin c8714be1d2 mac os sign script: quote all params 2014-02-28 10:23:02 +01:00
Daniel Molkentin 36cd9d9ced Shibboleth: Move browser window to the offset of the setup wizard 2014-02-27 17:07:59 +01:00
Daniel Molkentin 9c70ee68d2 Mask password lineedit 2014-02-27 17:07:59 +01:00
Olivier Goffart e809a59049 Remove spurious error message.
Sometimes 'success' is false without apparent reason.
Just remove the message
2014-02-27 17:03:42 +01:00
Daniel Molkentin 33ae2eb19f Try to handle auth requests by a Shibboleth IdP 2014-02-27 13:18:53 +01:00
Olivier Goffart d4fa955950 Don't fetch credidentials from application.cpp
They will be fetched by the connection validator after doing
the status.php check
2014-02-27 13:06:29 +01:00
Daniel Molkentin 02bfb4f005 Amend ChangeLog 2014-02-26 15:08:12 +01:00
Daniel Molkentin d4dd5afbe7 Revert "Make "Sign Out" forget the cookies"
This reverts commit 8607300195.

This approach is too dangerous for 1.5.2.
2014-02-26 15:05:15 +01:00
Olivier Goffart 8607300195 Make "Sign Out" forget the cookies
If we keep the cookies, next time we sign in, the entered password
does not matter as the server still think our session is logged in.
2014-02-26 13:23:52 +01:00
Olivier Goffart e468ea2d68 Avoid re-entrency in HTTPCredidential::fetch
It is likely to re-enter if there is two jobs that asks for a password.

Example:
 1. log out
 2. restart the application
 3. enter a wrong password
 4. enter a wrong password again a few times
 5. enter the correct password
 6. it should must not prompt for the password again.

Because of the re-entrency, it was still prompting for the password several
times after the right password had been entered
2014-02-26 13:10:11 +01:00
Daniel Molkentin 05a1f7b1bb Another fix for the reconnect-logic 2014-02-26 11:26:50 +01:00
Daniel Molkentin b8a4a2d2f7 Add ChangeLog 2014-02-25 18:11:04 +01:00
Markus Goetz c7e70533a0 Shibboleth: Detect also QNAM redirects
If a QNAM job (e.g. Quota or ETag job) gets redirected,
we'll invalidate and then prompt to re-fetch the credentials
from the user.
(The keychain credentials will be wrong so they get deleted)
2014-02-25 14:22:55 +01:00
Daniel Molkentin d4fa06c4e1 Fix potential crash in c_iconv on Mac OS X 2014-02-25 12:48:40 +01:00
Markus Goetz 065690c2ce Shibboleth: Have proper invalidation if timeout during sync 2014-02-25 09:33:28 +01:00
Olivier Goffart 75cff87316 add missing copyright header 2014-02-24 19:32:41 +01:00
Markus Goetz b56843ead2 Account: Fix Metatype registratition 2014-02-24 15:31:11 +01:00
Markus Goetz 51b5f3c9b2 Propfind Job: Print redirect URL in log 2014-02-24 15:20:49 +01:00
Daniel Molkentin 7f508c0718 Account needs qRegisterMetaType 2014-02-24 14:56:57 +01:00
Daniel Molkentin 45a7d4ff4c Fix Wizard when returning from later steps
We need to reset the credential type when
returning to the first page from later steps.
Otherwise, unfinished credential instances
and their NAM will try to fetch data, which
will fail with weird symptoms.
2014-02-24 14:56:57 +01:00
Daniel Molkentin 995e8938ad SSLButton: Fix certificate display 2014-02-24 14:56:56 +01:00
Olivier Goffart 1e43d1fa49 Add missing license headers in tests
LGPL for csync tests,  GPL for mirall tests
2014-02-24 11:08:58 +01:00
Daniel Molkentin 5c1d612761 Account settings: Set correct state icon right away 2014-02-21 21:02:35 +01:00
Olivier Goffart f92cf3dee3 ammand last commit
We should not close the directory twice in the normal case
2014-02-21 19:09:38 +01:00
Olivier Goffart a71cb1d3ef Fix potential crash in case of abort while update:
We need to reset ctx->remote.read_from_db  BEFORE caling vio_closedir
Otherwise, it may interpret the handle as a 'bdtree' handle instead of
a owncloud handle.

Should fix #1442
2014-02-21 16:57:24 +01:00
Olivier Goffart cd13144415 Fix adding a file in a Shared readonly directory
It should not create a conflict in that case.

Also when editing a file, create a conflict using the normal way,
after downloading the file and checking it is not the same
2014-02-21 10:53:09 +01:00
Daniel Molkentin 67c07c4daa bump to 1.5.2 2014-02-21 09:56:04 +01:00
Daniel Molkentin 8e7290b450 Fix online state handling
Before this commit, parts of mirall were aware of the state, but not all.
Also, the state was not set back to Connected again in all cases. This
commit introduces the following changes:

- Make QuotaInfo a member of Account
- QuotaInfo and Folder (EtagJob) can put the client in disconnected mode
- FolderMan now disables etag-polling when offline

Fixes #1459
Fixes #1441
2014-02-20 23:24:03 +01:00
Daniel Molkentin b51a722347 Fix German translation for branch 2014-02-20 23:23:46 +01:00
Daniel Molkentin 30d0e2fee8 Remove stray debug 2014-02-20 23:23:46 +01:00
Klaas Freitag 04647b0d61 Handle empty passwords returning from the keychain read procedure.
This is needed if the keychain does not have the an QSettings based
fallback any more.
2014-02-20 16:53:38 +01:00
Klaas Freitag e991bcd112 Do not store the password in the config file. Erase it if it is there.
This fixes bug #1458
2014-02-20 14:35:02 +01:00
Klaas Freitag 82afb3b613 If a file in a read only share was edited, restore and create conflict.
This fixes bug #1448
2014-02-19 17:21:43 +01:00
Daniel Molkentin 726b41b0c7 Shib: Close browser window after login 2014-02-19 15:34:43 +01:00
Olivier Goffart e74f0f2854 Better support when user remove or rename the Shared directory 2014-02-19 15:23:36 +01:00
Olivier Goffart a51f050a08 More fix for moving shared directories
Abort a directory job if the first job fails

Also make sure the jobs are in the directory job of their destination paths
2014-02-19 13:08:35 +01:00
Klaas Freitag e4965ab06b Mac FS watcher: ignore events from the same process 2014-02-18 16:28:25 +01:00
hefee 1b03dc759b fixing typo
GNU Public License->  GNU General Public License
2014-02-17 22:42:51 +01:00
hefee 4e0496f74d respect XDG_CONFIG_HOME for getting user config dir.
Under linux the XDG Base Directory Specification define different
enviroment variables where to store what.
2013-12-31 02:10:44 +01:00
96 arquivos alterados com 1923 adições e 419 exclusões
+24 -2
Ver Arquivo
@@ -41,6 +41,7 @@ get_git_head_revision(GIT_REFSPEC GIT_SHA1)
# if we cannot get it from git, directly try .tag (packages)
# this will work if the tar balls have been properly created
# via git-archive.
if (GIT_SHA1)
if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
@@ -49,6 +50,7 @@ if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
set (GIT_SHA1 "${sha1_candidate}")
endif()
endif()
endif()
set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
set(DATADIR ${DATA_INSTALL_DIR})
@@ -72,13 +74,30 @@ else()
endif()
#####
# this option removes Http authentication, keychain, shibboleth etc and is intended for
# external authentication mechanisms
option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
if(TOKEN_AUTH_ONLY)
message("Compiling with token authentication")
add_definitions(-DTOKEN_AUTH_ONLY=1)
endif()
# this option creates only libocsync and libowncloudsync
option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
#### find libs
#find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
#if( UNIX AND NOT APPLE ) # Fdo notifications
# find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
#endif()
find_package(Neon REQUIRED)
find_package(QtKeychain REQUIRED)
if(NOT TOKEN_AUTH_ONLY)
find_package(QtKeychain REQUIRED)
set(WITH_QTKEYCHAIN ${QTKEYCHAIN_FOUND})
else()
endif()
Find_package(Sparkle)
if(UNIX)
find_package(INotify REQUIRED)
@@ -88,7 +107,7 @@ endif()
find_package(Sphinx)
find_package(PdfLatex)
set(WITH_QTKEYCHAIN ${QTKEYCHAIN_FOUND})
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -96,6 +115,9 @@ include(OwnCloudCPack.cmake)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
if( WIN32 )
add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
endif( WIN32 )
# Handle Translations, pick all mirall_* files from trans directory.
file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/mirall_*.ts)
+31 -1
Ver Arquivo
@@ -1,6 +1,37 @@
ChangeLog
=========
version 1.5.3 (release 2014-03-10 )
* Fix usage of proxies after first sync run (#1502, #1524, #1459, #1521)
* Do not wipe the credentials from config for reconnect (#1499, #1503)
* Do not erase the full account config if an old version of the client stored
the password (related to above)
* Fix layout of the network tab (fixes #1491)
* Handle authentication requests by a Shibboleth IdP
* Shibboleth: If no connection is available, don't open the login window
* [Packaging] Debian/Ubuntu: ship sync-exclude.lst
* [Packaging] Fix issues with access to gnome keychain in Fedora and RHEL6
* [Packaging] Ensure all sub packages get updated
* [Packaging] Fix incorrect path in desktop file (RHEL6/CentOS6)
version 1.5.2 (release 2014-02-26 )
* Fix behavior when attempting to rename Shared folder
* Fix potential endless sync loops on Mac OS (#1463)
* Fix potential crash when pausing during update phase (#1442)
* Fix handing of shared directories
* Fix online state handling (#1441, #1459)
* Fix potential crash in c_iconv on Mac OS
* Fix certificate chain display in SSLButton
* Fix sporadicly appearing multiple auth prompts on sign-in
* Show correct state icon in Account Settings right away
* Re-fetch content that gets deleted from read only shared directories
* Do not store the password in the config file, erase existing ones (#1469)
* Shibboleth: Close browser window after login
* Shibboleth: Proper invalidation if timeout during sync
* Shibboleth: Do not pop up IdP login immediately when modifying account
* Shibboleth: Avoid auth on restart by storing cookies in the wallet
* Fix license headers
version 1.5.1 (release 2014-02-13 )
* Added an auto updater that updates the client if a
more recent version was found automatically (Windows, Mac OS X)
@@ -68,7 +99,6 @@ version 1.5.0 (release 2013-12-12 ), csync 0.91.4 required
* Windows: Fix move file operation
version 1.4.2 (release 2013-10-18 ), csync 0.90.4 required
* Do not show the warning icon in the tray (#944)
* Fix manual proxy support when switching (#1016)
* Add folder column to detailed sync protocol (#1037)
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
set( MIRALL_VERSION_MAJOR 1 )
set( MIRALL_VERSION_MINOR 5 )
set( MIRALL_VERSION_PATCH 1 )
set( MIRALL_VERSION_PATCH 3 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )
+13 -14
Ver Arquivo
@@ -2,18 +2,17 @@
[ "$#" -lt 2 ] && echo "Usage: sign_dmg.sh <dmg> <identity>" && exit
src_dmg=$1
tmp_dmg=writable_$1
signed_dmg=signed_$1
identity=$2
mount="/Volumes/$(basename $src_dmg|cut -d"-" -f1)"
test -e $tmp_dmg && rm -rf $tmp_dmg
hdiutil convert $src_dmg -format UDRW -o $tmp_dmg
hdiutil attach $tmp_dmg
pushd $mount
codesign -s "$identity" $mount/*.app
src_dmg="$1"
tmp_dmg="writable_$1"
signed_dmg="signed_$1"
identity="$2"
mount="/Volumes/$(basename "$src_dmg"|sed 's,-\([0-9]\)\(.*\),,')"
test -e "$tmp_dmg" && rm -rf "$tmp_dmg"
hdiutil convert "$src_dmg" -format UDRW -o "$tmp_dmg"
hdiutil attach "$tmp_dmg"
pushd "$mount"
codesign -s "$identity" "$mount"/*.app
popd
diskutil eject $mount
test -e $signed_dmg && rm -rf $signed_dmg
hdiutil convert $tmp_dmg -format UDBZ -o $signed_dmg
diskutil eject "$mount"
test -e "$signed_dmg" && rm -rf "$signed_dmg"
hdiutil convert "$tmp_dmg" -format UDBZ -o "$signed_dmg"
@@ -33,6 +33,10 @@ if (UNIX)
"${EXEC_INSTALL_PREFIX}/libexec"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/libexec)"
)
SET(LIB_PRIVATE_INSTALL_DIR
"${LIB_INSTALL_DIR}/${APPLICATION_SHORT_NAME}"
CACHE PATH "The subdirectory relative to the install prefix where private libs are installed"
)
SET(PLUGIN_INSTALL_DIR
"${LIB_INSTALL_DIR}/${APPLICATION_SHORT_NAME}"
CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is prefix/lib/${APPLICATION_SHORT_NAME})"
-5
Ver Arquivo
@@ -37,11 +37,6 @@ if (HAVE_LIBDL)
endif (HAVE_LIBDL)
check_function_exists(asprintf HAVE_ASPRINTF)
if(NOT HAVE_ASPRINTF)
if(MINGW)
add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
endif()
endif()
check_function_exists(fnmatch HAVE_FNMATCH)
if(NOT HAVE_FNMATCH AND WIN32)
+6 -4
Ver Arquivo
@@ -32,7 +32,6 @@ set(CSYNC_LIBRARY
)
set(CSYNC_LINK_LIBRARIES
${CSYNC_LIBRARY}
${CSTDLIB_LIBRARY}
${CSYNC_REQUIRED_LIBRARIES}
${SQLITE3_LIBRARIES}
@@ -100,8 +99,11 @@ include_directories(
)
add_library(${CSYNC_LIBRARY} SHARED ${csync_SRCS})
add_library(${CSYNC_LIBRARY}_static STATIC ${csync_SRCS})
target_link_libraries(${CSYNC_LIBRARY} ${CSYNC_LINK_LIBRARIES})
target_link_libraries(${CSYNC_LIBRARY}_static ${CSYNC_LINK_LIBRARIES})
target_link_libraries(${CSYNC_LINK_LIBRARIES})
set_target_properties(
${CSYNC_LIBRARY}
@@ -116,9 +118,9 @@ INSTALL(
TARGETS
${CSYNC_LIBRARY}
LIBRARY DESTINATION
${LIB_INSTALL_DIR}
${PLUGIN_INSTALL_DIR}
ARCHIVE DESTINATION
${LIB_INSTALL_DIR}
${PLUGIN_INSTALL_DIR}
RUNTIME DESTINATION
${BIN_INSTALL_DIR}
)
+7 -18
Ver Arquivo
@@ -480,13 +480,13 @@ static int dav_connect(const char *base_url) {
DEBUG_WEBDAV("* port %u", port );
DEBUG_WEBDAV("* path %s", path );
if( strcmp( scheme, "owncloud" ) == 0 ) {
if( strcmp( scheme, "owncloud" ) == 0 || strcmp( scheme, "http" ) == 0 ) {
strcpy( protocol, "http");
} else if( strcmp( scheme, "ownclouds" ) == 0 ) {
} else if( strcmp( scheme, "ownclouds" ) == 0 || strcmp( scheme, "https") == 0 ) {
strcpy( protocol, "https");
useSSL = 1;
} else {
DEBUG_WEBDAV("Invalid scheme %s, go outa here!", scheme );
DEBUG_WEBDAV("Invalid scheme %s, go out here!", scheme );
rc = -1;
goto out;
}
@@ -497,15 +497,6 @@ static int dav_connect(const char *base_url) {
port = ne_uri_defaultport(protocol);
}
#if 0
rc = ne_sock_init();
DEBUG_WEBDAV("ne_sock_init: %d", rc );
if (rc < 0) {
rc = -1;
goto out;
}
#endif
dav_session.ctx = ne_session_create( protocol, host, port);
if (dav_session.ctx == NULL) {
@@ -979,7 +970,10 @@ static csync_vio_method_handle_t *owncloud_opendir(const char *uri) {
DEBUG_WEBDAV("opendir method called on %s", uri );
dav_connect( uri );
if (dav_connect( uri ) < 0) {
DEBUG_WEBDAV("connection failed");
return NULL;
}
curi = _cleanPath( uri );
if (is_first_propfind && !dav_session.no_recursive_propfind) {
@@ -1081,11 +1075,6 @@ static int owncloud_commit() {
SAFE_FREE( dav_session.session_key);
SAFE_FREE( dav_session.error_string );
SAFE_FREE( dav_session.proxy_type );
SAFE_FREE( dav_session.proxy_host );
SAFE_FREE( dav_session.proxy_user );
SAFE_FREE( dav_session.proxy_pwd );
return 0;
}
+3 -6
Ver Arquivo
@@ -598,9 +598,8 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
ctx->status_code = CSYNC_STATUS_UPDATE_ERROR;
}
csync_vio_closedir(ctx, dh);
ctx->current_fs = previous_fs;
goto done;
goto error;
}
if (flag == CSYNC_FTW_FLAG_DIR && depth
@@ -608,8 +607,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
rc = csync_ftw(ctx, filename, fn, depth - 1);
if (rc < 0) {
ctx->current_fs = previous_fs;
csync_vio_closedir(ctx, dh);
goto done;
goto error;
}
if (ctx->current_fs && !ctx->current_fs->child_modified
@@ -636,15 +634,14 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, " <= Closing walk for %s with read_from_db %d", uri, read_from_db);
done:
ctx->remote.read_from_db = read_from_db;
csync_vio_file_stat_destroy(dirent);
SAFE_FREE(filename);
return rc;
error:
ctx->remote.read_from_db = read_from_db;
if (dh != NULL) {
csync_vio_closedir(ctx, dh);
}
ctx->remote.read_from_db = read_from_db;
SAFE_FREE(filename);
return -1;
}
+20
Ver Arquivo
@@ -1,3 +1,23 @@
/*
* httpbf - send big files via http
*
* Copyright (c) 2012 Klaas Freitag <freitag@owncloud.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
+1 -1
Ver Arquivo
@@ -126,7 +126,7 @@ static char *c_iconv(const char* str, enum iconv_direction dir)
}
if (ret == (size_t)-1) {
SAFE_FREE(out);
SAFE_FREE(out_in);
return NULL;
}
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config_csync.h"
#include "torture.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "torture.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
#include <stdio.h>
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config_csync.h"
#include <string.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "torture.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "csync_misc.h"
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <unistd.h>
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#define CSYNC_TEST 1
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "csync_time.h"
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "torture.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "csync_update.c"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "csync_util.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2013 by Klaas Freitag <freitag@owncloud.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "c_string.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2013 by Klaas Freitag <freitag@owncloud.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <sys/types.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "support.h"
+14
Ver Arquivo
@@ -6,6 +6,20 @@
#
# Copyright (C) by Klaas Freitag <freitag@owncloud.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
use lib ".";
+14
Ver Arquivo
@@ -6,6 +6,20 @@
#
# Copyright (C) by Klaas Freitag <freitag@owncloud.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
use lib ".";
+14
Ver Arquivo
@@ -6,6 +6,20 @@
#
# Copyright (C) by Olivier Goffart <ogoffart@woboq.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
use lib ".";
+14
Ver Arquivo
@@ -6,6 +6,20 @@
#
# Copyright (C) by Olivier Goffart <ogoffart@woboq.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
use lib ".";
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "std/c_alloc.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
#include <time.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <time.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <unistd.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config_csync.h"
#include "torture.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _TORTURE_H
#define _TORTURE_H
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "torture.h"
#include "vio/csync_vio_file_stat.h"
+19
Ver Arquivo
@@ -1,3 +1,22 @@
/*
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
#include "torture.h"
+13
Ver Arquivo
@@ -1,4 +1,17 @@
#!/bin/sh
#
# Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
WINEPREFIX=${WINEPREFIX:=$HOME/.wine}
+81 -40
Ver Arquivo
@@ -85,18 +85,30 @@ set(libsync_SRCS
mirall/clientproxy.cpp
creds/dummycredentials.cpp
creds/abstractcredentials.cpp
creds/httpcredentials.cpp
creds/credentialsfactory.cpp
creds/http/httpconfigfile.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethaccessmanager.cpp
creds/shibboleth/shibbolethcookiejar.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethrefresher.cpp
creds/shibboleth/shibbolethconfigfile.cpp
creds/credentialscommon.cpp
3rdparty/qjson/json.cpp
)
if(TOKEN_AUTH_ONLY)
set (libsync_SRCS
${libsync_SRCS}
creds/tokencredentials.cpp
)
else()
set (libsync_SRCS
${libsync_SRCS}
creds/httpcredentials.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethaccessmanager.cpp
creds/shibboleth/shibbolethcookiejar.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethrefresher.cpp
creds/shibboleth/shibbolethconfigfile.cpp
creds/shibboleth/authenticationdialog.cpp
)
endif()
set(libsync_HEADERS
mirall/folderman.h
@@ -118,18 +130,30 @@ set(libsync_HEADERS
mirall/clientproxy.h
creds/abstractcredentials.h
creds/dummycredentials.h
creds/httpcredentials.h
creds/credentialsfactory.h
creds/http/httpconfigfile.h
creds/shibbolethcredentials.h
creds/shibboleth/shibbolethaccessmanager.h
creds/shibboleth/shibbolethcookiejar.h
creds/shibboleth/shibbolethwebview.h
creds/shibboleth/shibbolethrefresher.h
creds/shibboleth/shibbolethconfigfile.h
creds/credentialscommon.h
3rdparty/qjson/json.h
)
if(TOKEN_AUTH_ONLY)
set (libsync_HEADERS
${libsync_HEADERS}
creds/tokencredentials.h
)
else()
set (libsync_HEADERS
${libsync_HEADERS}
creds/httpcredentials.h
creds/shibbolethcredentials.h
creds/shibboleth/shibbolethaccessmanager.h
creds/shibboleth/shibbolethcookiejar.h
creds/shibboleth/shibbolethwebview.h
creds/shibboleth/shibbolethrefresher.h
creds/shibboleth/shibbolethconfigfile.h
creds/shibboleth/authenticationdialog.h
)
endif()
IF( NOT WIN32 AND NOT APPLE )
set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_linux.cpp)
@@ -168,11 +192,11 @@ set(creds_HEADERS
IF (NOT APPLE)
INSTALL(
FILES ${owncloudsync_HEADERS}
DESTINATION ${INCLUDE_INSTALL_DIR}/owncloudsync/mirall
DESTINATION ${INCLUDE_INSTALL_DIR}/${synclib_NAME}/mirall
)
INSTALL(
FILES ${creds_HEADERS}
DESTINATION ${INCLUDE_INSTALL_DIR}/owncloudsync/creds
DESTINATION ${INCLUDE_INSTALL_DIR}/${synclib_NAME}/creds
)
ENDIF(NOT APPLE)
@@ -199,15 +223,22 @@ if(NEON_FOUND)
endif()
add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})
add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc})
qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql)
qt5_use_modules(${synclib_NAME}_static Widgets Network Xml WebKitWidgets Sql)
set_target_properties( ${synclib_NAME} PROPERTIES
VERSION ${MIRALL_VERSION}
SOVERSION ${MIRALL_SOVERSION}
)
set_target_properties( ${synclib_NAME}_static PROPERTIES
VERSION ${MIRALL_VERSION}
SOVERSION ${MIRALL_SOVERSION}
)
target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} )
target_link_libraries(${synclib_NAME}_static ${libsync_LINK_TARGETS} )
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(TARGETS ${synclib_NAME}
@@ -256,6 +287,7 @@ set(mirall_SRCS
wizard/owncloudwizard.cpp
wizard/owncloudsetuppage.cpp
wizard/owncloudhttpcredspage.cpp
wizard/abstractcredswizardpage.cpp
wizard/owncloudwizardresultpage.cpp
wizard/owncloudwizardcommon.cpp
wizard/owncloudshibbolethcredspage.cpp
@@ -273,6 +305,8 @@ set(mirall_SRCS
mirall/sslbutton.cpp
)
set(mirall_HEADERS
mirall/application.h
mirall/systray.h
@@ -281,6 +315,7 @@ set(mirall_HEADERS
wizard/owncloudwizard.h
wizard/owncloudsetuppage.h
wizard/owncloudhttpcredspage.h
wizard/abstractcredswizardpage.h
wizard/owncloudwizardresultpage.h
wizard/owncloudwizardcommon.h
wizard/owncloudshibbolethcredspage.h
@@ -366,14 +401,14 @@ endif(WITH_DBUS)
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
if(NOT WIN32)
if(NOT WIN32 AND NOT BUILD_LIBRARIES_ONLY)
file( GLOB _icons "${theme_dir}/colored/${ICON_APP_NAME}-icon-*.png" )
foreach( _file ${_icons} )
string( REPLACE "${theme_dir}/colored/${ICON_APP_NAME}-icon-" "" _res ${_file} )
string( REPLACE ".png" "" _res ${_res} )
install( FILES ${_file} RENAME ${ICON_APP_NAME}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
endforeach( _file )
endif(NOT WIN32)
endif(NOT WIN32 AND NOT BUILD_LIBRARIES_ONLY)
install(FILES ${mirall_I18N} DESTINATION share/${APPLICATION_EXECUTABLE}/i18n)
@@ -382,7 +417,7 @@ endif(NOT WIN32)
# add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml WebKitWidgets Sql ${ADDITIONAL_APP_MODULES})
else()
elseif(NOT BUILD_LIBRARIES_ONLY)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
include(DeployQt4)
@@ -405,25 +440,28 @@ add_library(updater STATIC ${updater_SRCS} ${updaterMoc})
target_link_libraries(updater ${synclib_NAME})
qt5_use_modules(updater Widgets Network Xml)
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
)
target_link_libraries( ${APPLICATION_EXECUTABLE} ${QT_LIBRARIES} )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
if(NOT BUILD_LIBRARIES_ONLY)
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
)
target_link_libraries( ${APPLICATION_EXECUTABLE} ${QT_LIBRARIES} )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
install(TARGETS ${APPLICATION_EXECUTABLE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
BUNDLE DESTINATION "."
)
endif()
install(TARGETS ${APPLICATION_EXECUTABLE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
BUNDLE DESTINATION "."
)
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
# currently it needs to be done because the code right above needs to be executed no matter
# if building a bundle or not and the install_qt4_executable needs to be called afterwards
if(BUILD_OWNCLOUD_OSX_BUNDLE)
if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
install_qt4_executable(${OWNCLOUD_OSX_BUNDLE} "qtaccessiblewidgets;qsqlite")
endif()
@@ -439,13 +477,16 @@ endif()
set(owncloudcmd_NAME ${APPLICATION_EXECUTABLE}cmd)
set(OWNCLOUDCMD_SRC owncloudcmd/owncloudcmd.cpp)
add_executable(${owncloudcmd_NAME} ${OWNCLOUDCMD_SRC})
qt5_use_modules(${owncloudcmd_NAME} Network Sql)
set_target_properties(${owncloudcmd_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
target_link_libraries(${owncloudcmd_NAME} ${synclib_NAME})
if(NOT BUILD_LIBRARIES_ONLY)
add_executable(${owncloudcmd_NAME} ${OWNCLOUDCMD_SRC})
qt5_use_modules(${owncloudcmd_NAME} Network Sql)
set_target_properties(${owncloudcmd_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
target_link_libraries(${owncloudcmd_NAME} ${synclib_NAME})
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mirall)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
install(TARGETS ${owncloudcmd_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
if (SPARKLE_FOUND)
install(FILES ${CMAKE_SOURCE_DIR}/admin/osx/deny_autoupdate_com.owncloud.desktopclient.plist
@@ -453,7 +494,7 @@ if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES ${CMAKE_SOURCE_DIR}/admin/osx/sparkle/dsa_pub.pem
DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources)
endif()
else()
elseif(NOT BUILD_LIBRARIES_ONLY)
install(TARGETS ${owncloudcmd_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+4
Ver Arquivo
@@ -42,6 +42,10 @@ public:
virtual void persist(Account *account) = 0;
/** Invalidates auth token, or password for basic auth */
virtual void invalidateToken(Account *account) = 0;
virtual void invalidateAndFetch(Account *account) {
invalidateToken(account);
fetch(account);
}
static QString keychainKey(const QString &url, const QString &user);
+9
Ver Arquivo
@@ -13,9 +13,13 @@
#include <QString>
#ifdef TOKEN_AUTH_ONLY
#include "creds/tokencredentials.h"
#else
#include "creds/httpcredentials.h"
#include "creds/dummycredentials.h"
#include "creds/shibbolethcredentials.h"
#endif
namespace Mirall
{
@@ -25,6 +29,10 @@ namespace CredentialsFactory
AbstractCredentials* create(const QString& type)
{
#ifdef TOKEN_AUTH_ONLY
return new TokenCredentials;
#else
// empty string might happen for old version of configuration
if (type == "http" || type == "") {
return new HttpCredentials;
@@ -36,6 +44,7 @@ AbstractCredentials* create(const QString& type)
qWarning("Unknown credentials type: %s", qPrintable(type));
return new DummyCredentials;
}
#endif
}
} // ns CredentialsFactory
+88 -43
Ver Arquivo
@@ -94,13 +94,16 @@ private:
HttpCredentials::HttpCredentials()
: _user(),
_password(),
_ready(false)
{}
_ready(false),
_fetchJobInProgress(false)
{
}
HttpCredentials::HttpCredentials(const QString& user, const QString& password)
: _user(user),
_password(password),
_ready(true)
_ready(true),
_fetchJobInProgress(false)
{
}
@@ -179,19 +182,43 @@ QString HttpCredentials::fetchUser(Account* account)
void HttpCredentials::fetch(Account *account)
{
if( !account ) {
return;
}
if (_fetchJobInProgress) {
return;
}
// User must be fetched from config file
fetchUser(account);
QSettings *settings = account->settingsWithGroup(Theme::instance()->appName());
const QString kck = keychainKey(account->url().toString(), _user );
QString key = QString::fromLatin1( "%1/data" ).arg( kck );
if( settings && settings->contains(key) ) {
// Clean the password from the config file if it is in there.
// we do not want a security problem.
settings->remove(key);
key = QString::fromLatin1( "%1/type" ).arg( kck );
settings->remove(key);
settings->sync();
}
if (_ready) {
Q_EMIT fetched();
} else {
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
if( ! account->property("fetch_from_old_place").isValid() ) {
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
}
job->setInsecureFallback(true);
job->setKey(keychainKey(account->url().toString(), _user));
settings->setParent(job); // make the job parent to make setting deleted properly
job->setSettings(settings);
job->setInsecureFallback(false);
job->setKey(kck);
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
job->setProperty("account", QVariant::fromValue(account));
job->start();
_fetchJobInProgress = true;
}
}
bool HttpCredentials::stillValid(QNetworkReply *reply)
@@ -204,48 +231,46 @@ bool HttpCredentials::stillValid(QNetworkReply *reply)
void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
{
ReadPasswordJob *readJob = static_cast<ReadPasswordJob*>(job);
delete readJob->settings();
_password = readJob->textData();
Account *account = qvariant_cast<Account*>(readJob->property("account"));
QKeychain::Error error = job->error();
switch (error) {
case NoError:
_ready = true;
account->setProperty("fetch_from_old_place", QVariant());
Q_EMIT fetched();
break;
default:
if (!_user.isEmpty()) {
bool ok;
// In case we haven't tried at the old place yet, do!
if( !account->property("fetch_from_old_place").isValid() ) {
account->setProperty("fetch_from_old_place", QVariant(true) );
if( _user.isEmpty()) {
qDebug() << "Strange: User is empty!";
}
fetch(account);
return;
}
QString pwd = queryPassword(&ok);
if (ok) {
_password = pwd;
_ready = true;
persist(account);
}
emit fetched();
QKeychain::Error error = job->error();
if( !_password.isEmpty() && error == NoError ) {
_fetchJobInProgress = false;
// All cool, the keychain did not come back with error.
// Still, the password can be empty which indicates a problem and
// the password dialog has to be opened.
_ready = true;
emit fetched();
} else {
if( error != NoError ) {
qDebug() << "Error while reading password" << job->errorString();
}
qDebug() << "Error while reading password" << job->errorString();
bool ok;
QString pwd = queryPassword(&ok);
_fetchJobInProgress = false;
if (ok) {
_password = pwd;
_ready = true;
persist(account);
}
emit fetched();
}
}
QString HttpCredentials::queryPassword(bool *ok)
{
qDebug() << AccountManager::instance()->account()->state();
if (ok) {
QString str = QInputDialog::getText(0, tr("Enter Password"),
tr("Please enter %1 password for user '%2':")
.arg(Theme::instance()->appNameGUI(), _user),
QLineEdit::Password, QString(), ok);
qDebug() << AccountManager::instance()->account()->state();
return str;
} else {
return QString();
@@ -255,21 +280,41 @@ QString HttpCredentials::queryPassword(bool *ok)
void HttpCredentials::invalidateToken(Account *account)
{
_password = QString();
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
job->setInsecureFallback(true);
connect(job, SIGNAL(destroyed(QObject*)), job->settings(), SLOT(deleteLater()));
job->setKey(keychainKey(account->url().toString(), _user));
job->start();
_ready = false;
// User must be fetched from config file to generate a valid key
fetchUser(account);
const QString kck = keychainKey(account->url().toString(), _user);
if( kck.isEmpty() ) {
qDebug() << "InvalidateToken: User is empty, bailing out!";
return;
}
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
QSettings *settings = account->settingsWithGroup(Theme::instance()->appName());
settings->setParent(job); // make the job parent to make setting deleted properly
job->setSettings(settings);
job->setInsecureFallback(true);
job->setKey(kck);
job->start();
account->clearCookieJar();
}
void HttpCredentials::persist(Account *account)
{
if (_user.isEmpty()) {
// We never connected or fetched the user, there is nothing to save.
return;
}
account->setCredentialSetting(QLatin1String(userC), _user);
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
job->setInsecureFallback(true);
QSettings *settings = account->settingsWithGroup(Theme::instance()->appName());
settings->setParent(job); // make the job parent to make setting deleted properly
job->setSettings(settings);
job->setInsecureFallback(false);
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
job->setKey(keychainKey(account->url().toString(), _user));
job->setTextData(_password);
+1
Ver Arquivo
@@ -62,6 +62,7 @@ private:
QString _user;
QString _password;
bool _ready;
bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible
};
} // ns Mirall
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2014 by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "authenticationdialog.h"
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QFormLayout>
#include <QDialogButtonBox>
namespace Mirall {
AuthenticationDialog::AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent)
: QDialog(parent)
, _user(new QLineEdit)
, _password(new QLineEdit)
{
setWindowTitle(tr("Authentication Required"));
QVBoxLayout *lay = new QVBoxLayout(this);
QLabel *label = new QLabel(tr("Enter username and password for '%1' at %2.").arg(realm, domain));
lay->addWidget(label);
QFormLayout *form = new QFormLayout;
form->addRow(tr("&User:"), _user);
form->addRow(tr("&Password:"), _password);
lay->addLayout(form);
_password->setEchoMode(QLineEdit::Password);
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal);
connect(box, SIGNAL(accepted()), this, SLOT(accept()));
connect(box, SIGNAL(rejected()), this, SLOT(reject()));
lay->addWidget(box);
}
QString AuthenticationDialog::user() const
{
return _user->text();
}
QString AuthenticationDialog::password() const
{
return _password->text();
}
} // namespace Mirall
+41
Ver Arquivo
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2014 by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_AUTHENTICATIONDIALOG_H
#define MIRALL_AUTHENTICATIONDIALOG_H
#include <QDialog>
class QLineEdit;
namespace Mirall {
/** @brief Authenticate a user for a specific credential given his credentials */
class AuthenticationDialog : public QDialog {
Q_OBJECT
public:
AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent = 0);
QString user() const;
QString password() const;
private:
QLineEdit *_user;
QLineEdit *_password;
};
} // namespace Mirall
#endif // MIRALL_AUTHENTICATIONDIALOG_H
@@ -31,14 +31,13 @@ QNetworkReply* ShibbolethAccessManager::createRequest(QNetworkAccessManager::Ope
QNetworkCookieJar* jar(cookieJar());
QUrl url(request.url());
QList<QNetworkCookie> cookies;
Q_FOREACH(const QNetworkCookie& cookie, jar->cookiesForUrl(url)) {
if (!cookie.name().startsWith("_shibsession_")) {
cookies << cookie;
}
}
cookies << _cookie;
cookies << _cookie; // this line and the line above replace all cookies with self and then add the shibboleth cookie (filtering the current shib cookie)
jar->setCookiesFromUrl(cookies, url);
}
+23 -3
Ver Arquivo
@@ -17,9 +17,12 @@
#include <QWebFrame>
#include <QWebPage>
#include <QMessageBox>
#include <QAuthenticator>
#include <QNetworkReply>
#include "creds/shibboleth/shibbolethcookiejar.h"
#include "creds/shibboleth/shibbolethwebview.h"
#include "creds/shibboleth/authenticationdialog.h"
#include "mirall/account.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/theme.h"
@@ -35,6 +38,8 @@ void ShibbolethWebView::setup(Account *account, ShibbolethCookieJar* jar)
// the account object, which already can do this
connect(nm, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
account, SLOT(slotHandleErrors(QNetworkReply*,QList<QSslError>)));
connect(nm, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
SLOT(slotHandleAuthentication(QNetworkReply*,QAuthenticator*)));
QWebPage* page = new QWebPage(this);
@@ -115,11 +120,26 @@ void ShibbolethWebView::slotLoadFinished(bool success)
}
if (!success) {
QMessageBox::critical(this, tr("Error loading IdP login page"),
tr("Could not load Shibboleth login page to log you in.\n"
"Please ensure that your network connection is working."));
qDebug() << Q_FUNC_INFO << "Could not load Shibboleth login page to log you in.";
}
}
void ShibbolethWebView::slotHandleAuthentication(QNetworkReply *reply, QAuthenticator *authenticator)
{
Q_UNUSED(reply)
QUrl url = reply->url();
// show only scheme, host and port
QUrl reducedUrl;
reducedUrl.setScheme(url.scheme());
reducedUrl.setHost(url.host());
reducedUrl.setPort(url.port());
AuthenticationDialog dialog(authenticator->realm(), reducedUrl.toString(), this);
if (dialog.exec() == QDialog::Accepted) {
authenticator->setUser(dialog.user());
authenticator->setPassword(dialog.password());
}
}
} // ns Mirall
+1
Ver Arquivo
@@ -48,6 +48,7 @@ private Q_SLOTS:
void onNewCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);
void slotLoadStarted();
void slotLoadFinished(bool success = true);
void slotHandleAuthentication(QNetworkReply*,QAuthenticator*);
private:
void setup(Account *account, ShibbolethCookieJar* jar);
+58 -10
Ver Arquivo
@@ -14,6 +14,7 @@
#include <QMutex>
#include <QSettings>
#include <QNetworkReply>
#include "creds/shibbolethcredentials.h"
#include "creds/shibboleth/shibbolethaccessmanager.h"
@@ -76,6 +77,7 @@ ShibbolethCredentials::ShibbolethCredentials()
_url(),
_shibCookie(),
_ready(false),
_stillValid(false),
_browser(0),
_otherCookies()
{}
@@ -172,9 +174,22 @@ QNetworkAccessManager* ShibbolethCredentials::getQNAM() const
connect(this, SIGNAL(newCookie(QNetworkCookie)),
qnam, SLOT(setCookie(QNetworkCookie)));
connect(qnam, SIGNAL(finished(QNetworkReply*)),
this, SLOT(slotReplyFinished(QNetworkReply*)));
return qnam;
}
void ShibbolethCredentials::slotReplyFinished(QNetworkReply* r)
{
QVariant target = r->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (target.isValid()) {
_stillValid = false;
qWarning() << Q_FUNC_INFO << "detected redirect, will open Login Window"; // will be done in NetworkJob's finished signal
} else {
//_stillValid = true; // gets set when reading from keychain or getting it from browser
}
}
bool ShibbolethCredentials::ready() const
{
return _ready;
@@ -201,7 +216,7 @@ void ShibbolethCredentials::fetch(Account *account)
bool ShibbolethCredentials::stillValid(QNetworkReply *reply)
{
Q_UNUSED(reply)
return true;
return _stillValid;
}
void ShibbolethCredentials::persist(Account* account)
@@ -213,17 +228,20 @@ void ShibbolethCredentials::persist(Account* account)
storeShibCookie(_shibCookie, account);
}
// only used by Application::slotLogout(). Use invalidateAndFetch for normal usage
void ShibbolethCredentials::invalidateToken(Account *account)
{
Q_UNUSED(account)
_shibCookie = QNetworkCookie();
storeShibCookie(_shibCookie, account);
storeShibCookie(_shibCookie, account); // store/erase cookie
// ### access to ctx missing, but might not be required at all
//csync_set_module_property(ctx, "session_key", "");
}
void ShibbolethCredentials::disposeBrowser()
{
qDebug() << Q_FUNC_INFO;
disconnect(_browser, SIGNAL(viewHidden()),
this, SLOT(slotBrowserHidden()));
disconnect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
@@ -237,6 +255,7 @@ void ShibbolethCredentials::onShibbolethCookieReceived(const QNetworkCookie& coo
{
disposeBrowser();
_ready = true;
_stillValid = true;
_shibCookie = cookie;
storeShibCookie(_shibCookie, account);
Q_EMIT newCookie(_shibCookie);
@@ -254,6 +273,20 @@ void ShibbolethCredentials::slotBrowserHidden()
void ShibbolethCredentials::invalidateAndFetch(Account* account)
{
_ready = false;
// delete the credentials, then in the slot fetch them again (which will trigger browser)
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
job->setProperty("account", QVariant::fromValue(account));
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotInvalidateAndFetchInvalidateDone(QKeychain::Job*)));
job->setKey(keychainKey(account->url().toString(), "shibAssertion"));
job->start();
}
void ShibbolethCredentials::slotInvalidateAndFetchInvalidateDone(QKeychain::Job* job)
{
Account *account = qvariant_cast<Account*>(job->property("account"));
connect (this, SIGNAL(fetched()),
this, SLOT(onFetched()));
// small hack to support the ShibbolethRefresher hack
@@ -276,6 +309,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
if (job->error() == QKeychain::NoError) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob*>(job);
delete readJob->settings();
qDebug() << Q_FUNC_INFO;
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8());
if (cookies.count() > 0) {
_shibCookie = cookies.first();
@@ -283,20 +317,34 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
_ready = true;
_stillValid = true;
Q_EMIT newCookie(_shibCookie);
Q_EMIT fetched();
} else {
ShibbolethConfigFile cfg;
_browser = new ShibbolethWebView(account, cfg.createCookieJar());
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
this, SLOT(onShibbolethCookieReceived(QNetworkCookie, Account*)));
connect(_browser, SIGNAL(viewHidden()),
this, SLOT(slotBrowserHidden()));
_browser->show();
showLoginWindow(account);
}
}
void ShibbolethCredentials::showLoginWindow(Account* account)
{
if (_browser) {
_browser->activateWindow();
_browser->raise();
// FIXME On OS X this does not raise properly
return;
}
ShibbolethConfigFile cfg;
_browser = new ShibbolethWebView(account, cfg.createCookieJar());
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
this, SLOT(onShibbolethCookieReceived(QNetworkCookie, Account*)));
connect(_browser, SIGNAL(viewHidden()),
this, SLOT(slotBrowserHidden()));
// FIXME If the browser was hidden (e.g. user closed it) without us logging in, the logic gets stuck
// and can only be unstuck by restarting the app or pressing "Sign in" (we should switch to offline but we don't)
_browser->show();
}
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie, Account *account)
{
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
+5
Ver Arquivo
@@ -52,6 +52,8 @@ public:
QNetworkCookie cookie() const;
void showLoginWindow(Account*);
public Q_SLOTS:
void invalidateAndFetch(Account *account);
@@ -60,6 +62,8 @@ private Q_SLOTS:
void slotBrowserHidden();
void onFetched();
void slotReadJobDone(QKeychain::Job*);
void slotInvalidateAndFetchInvalidateDone(QKeychain::Job*);
void slotReplyFinished(QNetworkReply*);
Q_SIGNALS:
void newCookie(const QNetworkCookie& cookie);
@@ -73,6 +77,7 @@ private:
QNetworkCookie _shibCookie;
bool _ready;
bool _stillValid;
ShibbolethWebView* _browser;
QMap<QUrl, QList<QNetworkCookie> > _otherCookies;
};
+240
Ver Arquivo
@@ -0,0 +1,240 @@
/*
* Copyright (C) by Klaas Freitag <freitag@kde.org>
* Copyright (c) by Markus Goetz <guruz@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QMutex>
#include <QDebug>
#include <QNetworkReply>
#include <QSettings>
#include <QInputDialog>
#include "mirall/account.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/utility.h"
#include "mirall/theme.h"
#include "creds/credentialscommon.h"
#include "creds/tokencredentials.h"
namespace Mirall
{
namespace
{
int getauth(const char *prompt,
char *buf,
size_t len,
int echo,
int verify,
void *userdata)
{
int re = 0;
QMutex mutex;
// ### safe?
TokenCredentials* http_credentials = qobject_cast<TokenCredentials*>(AccountManager::instance()->account()->credentials());
if (!http_credentials) {
qDebug() << "Not a HTTP creds instance!";
return -1;
}
QString qPrompt = QString::fromLatin1( prompt ).trimmed();
QString user = http_credentials->user();
QString pwd = http_credentials->password();
if( qPrompt == QLatin1String("Enter your username:") ) {
// qDebug() << "OOO Username requested!";
QMutexLocker locker( &mutex );
qstrncpy( buf, user.toUtf8().constData(), len );
} else if( qPrompt == QLatin1String("Enter your password:") ) {
QMutexLocker locker( &mutex );
// qDebug() << "OOO Password requested!";
qstrncpy( buf, pwd.toUtf8().constData(), len );
} else {
re = handleNeonSSLProblems(prompt, buf, len, echo, verify, userdata);
}
return re;
}
const char userC[] = "user";
} // ns
class TokenCredentialsAccessManager : public MirallAccessManager {
public:
TokenCredentialsAccessManager(const TokenCredentials *cred, QObject* parent = 0)
: MirallAccessManager(parent), _cred(cred) {}
protected:
QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) {
QByteArray credHash = QByteArray(_cred->user().toUtf8()+":"+_cred->password().toUtf8()).toBase64();
QNetworkRequest req(request);
req.setRawHeader(QByteArray("Authorization"), QByteArray("Basic ") + credHash);
//qDebug() << "Request for " << req.url() << "with authorization" << QByteArray::fromBase64(credHash);
return MirallAccessManager::createRequest(op, req, outgoingData);
}
private:
const TokenCredentials *_cred;
};
TokenCredentials::TokenCredentials()
: _user(),
_password(),
_ready(false)
{
}
TokenCredentials::TokenCredentials(const QString& user, const QString& password)
: _user(user),
_password(password),
_ready(true)
{
}
void TokenCredentials::syncContextPreInit (CSYNC* ctx)
{
csync_set_auth_callback (ctx, getauth);
}
void TokenCredentials::syncContextPreStart (CSYNC* ctx)
{
// TODO: This should not be a part of this method, but we don't have
// any way to get "session_key" module property from csync. Had we
// have it, then we could remove this code and keep it in
// csyncthread code (or folder code, git remembers).
QList<QNetworkCookie> cookies(AccountManager::instance()->account()->lastAuthCookies());
QString cookiesAsString;
// Stuff cookies inside csync, then we can avoid the intermediate HTTP 401 reply
// when https://github.com/owncloud/core/pull/4042 is merged.
foreach(QNetworkCookie c, cookies) {
cookiesAsString += c.name();
cookiesAsString += '=';
cookiesAsString += c.value();
cookiesAsString += "; ";
}
csync_set_module_property(ctx, "session_key", cookiesAsString.toLatin1().data());
}
bool TokenCredentials::changed(AbstractCredentials* credentials) const
{
TokenCredentials* other(dynamic_cast< TokenCredentials* >(credentials));
if (!other || (other->user() != this->user())) {
return true;
}
return false;
}
QString TokenCredentials::authType() const
{
return QString::fromLatin1("http");
}
QString TokenCredentials::user() const
{
return _user;
}
QString TokenCredentials::password() const
{
return _password;
}
QNetworkAccessManager* TokenCredentials::getQNAM() const
{
MirallAccessManager* qnam = new TokenCredentialsAccessManager(this);
connect( qnam, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
this, SLOT(slotAuthentication(QNetworkReply*,QAuthenticator*)));
return qnam;
}
bool TokenCredentials::ready() const
{
return _ready;
}
QString TokenCredentials::fetchUser(Account* account)
{
_user = account->credentialSetting(QLatin1String(userC)).toString();
return _user;
}
void TokenCredentials::fetch(Account *account)
{
if( !account ) {
return;
}
Q_EMIT fetched();
}
bool TokenCredentials::stillValid(QNetworkReply *reply)
{
return ((reply->error() != QNetworkReply::AuthenticationRequiredError)
// returned if user or password is incorrect
&& (reply->error() != QNetworkReply::OperationCanceledError));
}
QString TokenCredentials::queryPassword(bool *ok)
{
qDebug() << AccountManager::instance()->account()->state();
if (ok) {
QString str = QInputDialog::getText(0, tr("Enter Password"),
tr("Please enter %1 password for user '%2':")
.arg(Theme::instance()->appNameGUI(), _user),
QLineEdit::Password, QString(), ok);
qDebug() << AccountManager::instance()->account()->state();
return str;
} else {
return QString();
}
}
void TokenCredentials::invalidateToken(Account *account)
{
_password = QString();
_ready = false;
// User must be fetched from config file to generate a valid key
fetchUser(account);
const QString kck = keychainKey(account->url().toString(), _user);
if( kck.isEmpty() ) {
qDebug() << "InvalidateToken: User is empty, bailing out!";
return;
}
account->clearCookieJar();
}
void TokenCredentials::persist(Account *account)
{
}
void TokenCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* authenticator)
{
Q_UNUSED(authenticator)
// we cannot use QAuthenticator, because it sends username and passwords with latin1
// instead of utf8 encoding. Instead, we send it manually. Thus, if we reach this signal,
// those credentials were invalid and we terminate.
qDebug() << "Stop request: Authentication failed for " << reply->url().toString();
reply->close();
}
} // ns Mirall
+67
Ver Arquivo
@@ -0,0 +1,67 @@
/*
* Copyright (C) by Klaas Freitag <freitag@kde.org>
* Copyright (c) by Markus Goetz <guruz@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_CREDS_HTTP_CREDENTIALS_H
#define MIRALL_CREDS_HTTP_CREDENTIALS_H
#include <QMap>
#include "creds/abstractcredentials.h"
class QNetworkReply;
class QAuthenticator;
namespace QKeychain {
class Job;
}
namespace Mirall
{
class TokenCredentials : public AbstractCredentials
{
Q_OBJECT
public:
TokenCredentials();
TokenCredentials(const QString& user, const QString& password);
void syncContextPreInit(CSYNC* ctx);
void syncContextPreStart(CSYNC* ctx);
bool changed(AbstractCredentials* credentials) const;
QString authType() const;
QNetworkAccessManager* getQNAM() const;
bool ready() const;
void fetch(Account *account);
bool stillValid(QNetworkReply *reply);
void persist(Account *account);
QString user() const;
QString password() const;
QString queryPassword(bool *ok);
void invalidateToken(Account *account);
QString fetchUser(Account *account);
private Q_SLOTS:
void slotAuthentication(QNetworkReply*, QAuthenticator*);
private:
QString _user;
QString _password;
bool _ready;
};
} // ns Mirall
#endif
+18 -1
Ver Arquivo
@@ -15,6 +15,7 @@
#include "mirall/theme.h"
#include "mirall/networkjobs.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/quotainfo.h"
#include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h"
@@ -62,11 +63,13 @@ Account::Account(AbstractSslErrorHandler *sslErrorHandler, QObject *parent)
: QObject(parent)
, _url(Theme::instance()->overrideServerUrl())
, _sslErrorHandler(sslErrorHandler)
, _quotaInfo(new QuotaInfo(this))
, _am(0)
, _credentials(0)
, _treatSslErrorsAsFailure(false)
, _state(Account::Disconnected)
{
qRegisterMetaType<Account*>("Account*");
}
Account::~Account()
@@ -156,11 +159,15 @@ AbstractCredentials *Account::credentials() const
void Account::setCredentials(AbstractCredentials *cred)
{
_credentials = cred;
// set active credential manager
if (_am) {
_am->deleteLater();
}
if (_credentials) {
credentials()->deleteLater();
}
_credentials = cred;
_am = _credentials->getQNAM();
connect(_am, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
SLOT(slotHandleErrors(QNetworkReply*,QList<QSslError>)));
@@ -176,6 +183,11 @@ QList<QNetworkCookie> Account::lastAuthCookies() const
return _am->cookieJar()->cookiesForUrl(_url);
}
void Account::clearCookieJar()
{
_am->setCookieJar(new QNetworkCookieJar);
}
QNetworkReply *Account::headRequest(const QString &relPath)
{
return headRequest(concatUrlPath(url(), relPath));
@@ -298,6 +310,11 @@ void Account::setState(int state)
}
}
QuotaInfo *Account::quotaInfo()
{
return _quotaInfo;
}
void Account::slotHandleErrors(QNetworkReply *reply , QList<QSslError> errors)
{
NetworkJobTimeoutPauser pauser(reply);
+6
Ver Arquivo
@@ -32,6 +32,7 @@ namespace Mirall {
class AbstractCredentials;
class Account;
class QuotaInfo;
class AccountManager : public QObject {
Q_OBJECT
@@ -142,6 +143,10 @@ public:
int state() const;
void setState(int state);
void clearCookieJar();
QuotaInfo *quotaInfo();
signals:
void stateChanged(int state);
@@ -154,6 +159,7 @@ private:
QList<QSslCertificate> _approvedCerts;
QSslConfiguration _sslConfiguration;
QScopedPointer<AbstractSslErrorHandler> _sslErrorHandler;
QuotaInfo *_quotaInfo;
QNetworkAccessManager *_am;
AbstractCredentials* _credentials;
bool _treatSslErrorsAsFailure;
+8 -1
Ver Arquivo
@@ -25,6 +25,7 @@
#include "mirall/mirallconfigfile.h"
#include "mirall/ignorelisteditor.h"
#include "mirall/account.h"
#include "mirall/quotainfo.h"
#include "creds/abstractcredentials.h"
#include <math.h>
@@ -106,6 +107,11 @@ AccountSettings::AccountSettings(QWidget *parent) :
slotAccountStateChanged(_account->state());
}
QuotaInfo *quotaInfo = _account->quotaInfo();
connect( quotaInfo, SIGNAL(quotaUpdated(qint64,qint64)),
this, SLOT(slotUpdateQuota(qint64,qint64)));
slotUpdateQuota(quotaInfo->lastQuotaTotalBytes(), quotaInfo->lastQuotaUsedBytes());
setFolderList(FolderMan::instance()->map());
}
@@ -133,6 +139,7 @@ void AccountSettings::slotFolderActivated( const QModelIndex& indx )
} else {
ui->_buttonEnable->setText( tr( "Resume" ) );
}
ui->_buttonEnable->setEnabled(_account && _account->state() == Account::Connected);
}
}
@@ -752,7 +759,7 @@ void AccountSettings::slotAccountStateChanged(int state)
/*, tr("Version: %1 (%2)").arg(versionStr).arg(version) */ );
}
} else {
showConnectionLabel( tr("No connection to %1 at <a href=\"%1\">%2</a>.")
showConnectionLabel( tr("No connection to %1 at <a href=\"%2\">%3</a>.")
.arg(Theme::instance()->appNameGUI(),
_account->url().toString(),
safeUrl.toString()) );
+35 -27
Ver Arquivo
@@ -135,7 +135,7 @@ Application::Application(int &argc, char **argv) :
}
if (account) {
connect(account, SIGNAL(stateChanged(int)), _gui, SLOT(slotAccountStateChanged()));
slotAccountChanged(account);
}
connect(AccountManager::instance(), SIGNAL(accountChanged(Account*,Account*)),
this, SLOT(slotAccountChanged(Account*,Account*)));
@@ -189,8 +189,16 @@ void Application::slotLogout()
void Application::slotAccountChanged(Account *newAccount, Account *oldAccount)
{
disconnect(oldAccount, SIGNAL(stateChanged(int)), _gui, SLOT(slotAccountStateChanged()));
if (oldAccount) {
disconnect(oldAccount, SIGNAL(stateChanged(int)), _gui, SLOT(slotAccountStateChanged()));
disconnect(oldAccount, SIGNAL(stateChanged(int)), this, SLOT(slotToggleFolderman(int)));
connect(oldAccount->quotaInfo(), SIGNAL(quotaUpdated(qint64,qint64)),
_gui, SLOT(slotRefreshQuotaDisplay(qint64,qint64)));
}
connect(newAccount, SIGNAL(stateChanged(int)), _gui, SLOT(slotAccountStateChanged()));
connect(newAccount, SIGNAL(stateChanged(int)), this, SLOT(slotToggleFolderman(int)));
connect(newAccount->quotaInfo(), SIGNAL(quotaUpdated(qint64,qint64)),
_gui, SLOT(slotRefreshQuotaDisplay(qint64,qint64)));
}
@@ -224,15 +232,13 @@ void Application::slotCheckConnection()
return;
}
AbstractCredentials* credentials(account->credentials());
if (_conValidator)
_conValidator->deleteLater();
_conValidator = new ConnectionValidator(account);
connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
_conValidator->checkConnection();
if (! credentials->ready()) {
connect( credentials, SIGNAL(fetched()),
this, SLOT(slotCredentialsFetched()), Qt::UniqueConnection);
credentials->fetch(account);
} else {
slotCredentialsFetched();
}
} else {
// let gui open the setup wizard
_gui->slotOpenSettingsDialog( true );
@@ -253,13 +259,25 @@ void Application::slotCredentialsFetched()
// Then we ask again for the credidentials if they are wrong again
account->setState(Account::Disconnected);
}
slotCheckConnection();
}
void Application::slotToggleFolderman(int state)
{
FolderMan* folderMan = FolderMan::instance();
switch (state) {
case Account::Connected:
folderMan->setSyncEnabled(true);
folderMan->slotScheduleAllFolders();
break;
case Account::Disconnected:
case Account::SignedOut:
case Account::InvalidCredidential:
folderMan->setSyncEnabled(false);
folderMan->terminateSyncProcess();
break;
}
if (_conValidator)
_conValidator->deleteLater();
_conValidator = new ConnectionValidator(account);
connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
_conValidator->checkConnection();
}
void Application::slotConnectionValidatorResult(ConnectionValidator::Status status)
@@ -273,10 +291,6 @@ void Application::slotConnectionValidatorResult(ConnectionValidator::Status stat
folderMan->setSyncEnabled(true);
// queue up the sync for all folders.
folderMan->slotScheduleAllFolders();
if(!_connectionMsgBox.isNull()) {
_connectionMsgBox->close();
}
} else {
// if we have problems here, it's unlikely that syncing will work.
FolderMan::instance()->setSyncEnabled(false);
@@ -284,13 +298,7 @@ void Application::slotConnectionValidatorResult(ConnectionValidator::Status stat
startupFails = _conValidator->errors();
_startupNetworkError = _conValidator->networkError();
if (_userTriggeredConnect) {
if(_connectionMsgBox.isNull()) {
_connectionMsgBox = new QMessageBox(QMessageBox::Warning, tr("Connection failed"),
_conValidator->errors().join(". ").append('.'), QMessageBox::Ok, 0);
_connectionMsgBox->setAttribute(Qt::WA_DeleteOnClose);
_connectionMsgBox->open();
_userTriggeredConnect = false;
}
_userTriggeredConnect = false;
}
QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection()));
}
+2 -2
Ver Arquivo
@@ -76,8 +76,9 @@ protected slots:
void slotLogin();
void slotLogout();
void slotCleanup();
void slotAccountChanged(Account *newAccount, Account *oldAccount);
void slotAccountChanged(Account *newAccount, Account *oldAccount = 0);
void slotCredentialsFetched();
void slotToggleFolderman(int state);
private:
void setHelp();
@@ -99,7 +100,6 @@ private:
int _logExpire;
bool _logFlush;
bool _userTriggeredConnect;
QPointer<QMessageBox> _connectionMsgBox;
ClientProxy _proxy;
+12 -1
Ver Arquivo
@@ -19,6 +19,7 @@
#include "mirall/theme.h"
#include "mirall/account.h"
#include "mirall/networkjobs.h"
#include <creds/abstractcredentials.h>
namespace Mirall {
@@ -108,7 +109,14 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QVariantMap &inf
return;
}
QTimer::singleShot( 0, this, SLOT( slotCheckAuthentication() ));
AbstractCredentials *creds = _account->credentials();
if (creds->ready()) {
QTimer::singleShot( 0, this, SLOT( slotCheckAuthentication() ));
} else {
connect( creds, SIGNAL(fetched()),
this, SLOT(slotCheckAuthentication()), Qt::UniqueConnection);
creds->fetch(_account);
}
}
// status.php could not be loaded.
@@ -126,6 +134,9 @@ void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
void ConnectionValidator::slotCheckAuthentication()
{
AbstractCredentials *creds = _account->credentials();
disconnect( creds, SIGNAL(fetched()),
this, SLOT(slotCheckAuthentication()));
// simply GET the webdav root, will fail if credentials are wrong.
// continue in slotAuthCheck here :-)
PropfindJob *job = new PropfindJob(_account, "/", this);
+2 -2
Ver Arquivo
@@ -335,6 +335,7 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
// No need to do anything.
_hasFiles = true;
emit syncItemDisconvered(item);
return re;
}
break;
@@ -375,6 +376,7 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
}
_syncedItems.append(item);
emit syncItemDisconvered(item);
return re;
}
@@ -488,8 +490,6 @@ void CSyncThread::startSync()
// }
// csync_set_auth_callback( _csync_ctx, getauth );
csync_set_log_callback( csyncLogCatcher );
csync_set_log_level( 11 );
_syncTime.start();
+5
Ver Arquivo
@@ -62,6 +62,11 @@ signals:
void csyncError( const QString& );
void csyncWarning( const QString& );
void csyncUnavailable();
// before actual syncing (after update+reconcile)
void syncItemDisconvered(const SyncFileItem&);
// after sync is done
void treeWalkResult(const SyncFileItemVector&);
void transmissionProgress( const Progress::Info& progress );
+4 -1
Ver Arquivo
@@ -291,7 +291,10 @@ void Folder::etagRetreived(const QString& etag)
void Folder::slotNetworkUnavailable()
{
AccountManager::instance()->account()->setState(Account::Disconnected);
Account *account = AccountManager::instance()->account();
if (account && account->state() == Account::Connected) {
account->setState(Account::Disconnected);
}
_syncResult.setStatus(SyncResult::Unavailable);
emit syncStateChange();
}
+6 -3
Ver Arquivo
@@ -537,14 +537,17 @@ void FolderMan::removeFolder( const QString& alias )
if( _folderMap.contains( alias )) {
qDebug() << "Removing " << alias;
f = _folderMap.take( alias );
if(f) {
f->wipe();
}
} else {
qDebug() << "!! Can not remove " << alias << ", not in folderMap.";
}
if( f ) {
f->wipe();
// can be removed if we are able to delete the folder object.
f->setSyncEnabled(false);
// remove the folder configuration
QFile file( _folderConfigPath + QLatin1Char('/') + f->configFile() );
if( file.exists() ) {
qDebug() << "Remove folder config file " << file.fileName();
+4 -7
Ver Arquivo
@@ -22,6 +22,7 @@
#include <QDebug>
#include <QStringList>
#include <QObject>
#include <QVarLengthArray>
namespace Mirall {
@@ -129,13 +130,10 @@ void FolderWatcherPrivate::slotReceivedNotification(int fd)
struct inotify_event* event;
int i;
int error;
char *buffer = NULL;
int buf_size = 2048;
buffer = (char*) malloc(buf_size);
QVarLengthArray<char, 2048> buffer(2048);
do {
len = read(fd, buffer, buf_size);
len = read(fd, buffer.data(), buffer.size());
error = errno;
/**
* From inotify documentation:
@@ -149,8 +147,7 @@ void FolderWatcherPrivate::slotReceivedNotification(int fd)
if (len < 0 && error == EINVAL)
{
// double the buffer size
buf_size *= 2;
buffer = (char *) realloc(buffer, buf_size);
buffer.resize(buffer.size() * 2);
/* and try again ... */
continue;
}
+1 -1
Ver Arquivo
@@ -69,7 +69,7 @@ void FolderWatcherPrivate::startWatching()
pathsToWatch,
kFSEventStreamEventIdSinceNow,
0, // latency
kFSEventStreamCreateFlagNone
kFSEventStreamCreateFlagNone+kFSEventStreamCreateFlagIgnoreSelf
);
FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+14
Ver Arquivo
@@ -13,6 +13,7 @@
#include <QNetworkRequest>
#include <QNetworkProxy>
#include <QAuthenticator>
#include "mirall/mirallaccessmanager.h"
#include "mirall/utility.h"
@@ -29,6 +30,8 @@ MirallAccessManager::MirallAccessManager(QObject* parent)
proxy.setHostName(" ");
setProxy(proxy);
#endif
QObject::connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
this, SLOT(slotProxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
}
QNetworkReply* MirallAccessManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest& request, QIODevice* outgoingData)
@@ -44,4 +47,15 @@ QNetworkReply* MirallAccessManager::createRequest(QNetworkAccessManager::Operati
return QNetworkAccessManager::createRequest(op, newRequest, outgoingData);
}
void MirallAccessManager::slotProxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
{
Q_UNUSED(authenticator);
qDebug() << Q_FUNC_INFO << proxy.type();
// We put in the password here and in ClientProxy in the proxy itself.
if (!proxy.user().isEmpty() || !proxy.password().isEmpty()) {
authenticator->setUser(proxy.user());
authenticator->setPassword(proxy.password());
}
}
} // ns Mirall
+2
Ver Arquivo
@@ -28,6 +28,8 @@ public:
protected:
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest& request, QIODevice* outgoingData = 0);
protected slots:
void slotProxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
};
} // ns Mirall
-1
Ver Arquivo
@@ -402,7 +402,6 @@ QVariant MirallConfigFile::getValue(const QString& param, const QString& group,
const QVariant& defaultValue) const
{
QVariant systemSetting;
qDebug() << Q_FUNC_INFO;
if (Utility::isMac()) {
QSettings systemSettings(QLatin1String("/Library/Preferences/" APPLICATION_REV_DOMAIN ".plist"), QSettings::NativeFormat);
if (!group.isEmpty()) {
+17 -7
Ver Arquivo
@@ -34,6 +34,7 @@
#include "creds/credentialsfactory.h"
#include "creds/abstractcredentials.h"
#include "creds/shibbolethcredentials.h"
Q_DECLARE_METATYPE(QTimer*)
@@ -138,21 +139,26 @@ void AbstractNetworkJob::slotFinished()
{
if( _reply->error() != QNetworkReply::NoError ) {
qDebug() << Q_FUNC_INFO << _reply->error() << _reply->errorString();
if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) {
qDebug() << Q_FUNC_INFO << _reply->rawHeader("Proxy-Authenticate");
}
emit networkError(_reply);
}
finished();
AbstractCredentials *creds = _account->credentials();
if (!creds->stillValid(_reply) &&! _ignoreCredentialFailure
&& _account->state() != Account::InvalidCredidential) {
// invalidate & forget token/password
_account->credentials()->invalidateToken(_account);
_account->setState(Account::InvalidCredidential);
// invalidate & forget token/password
// but try to re-sign in.
connect( creds, SIGNAL(fetched()),
qApp, SLOT(slotCredentialsFetched()), Qt::UniqueConnection);
creds->fetch(_account); // this triggers Application::runValidator when the credidentials are fetched
if (creds->ready()) {
creds->invalidateAndFetch(_account);
} else {
creds->fetch(_account);
}
}
deleteLater();
}
@@ -308,6 +314,7 @@ CheckServerJob::CheckServerJob(Account *account, bool followRedirect, QObject *p
, _followRedirects(followRedirect)
, _redirectCount(0)
{
setIgnoreCredentialFailure(true);
}
void CheckServerJob::start()
@@ -458,7 +465,8 @@ void PropfindJob::finished()
}
emit result(items);
} else {
qDebug() << "Quota request *not* successful, http result code is " << http_result_code;
qDebug() << "Quota request *not* successful, http result code is" << http_result_code
<< (http_result_code == 302 ? reply()->header(QNetworkRequest::LocationHeader).toString() : QLatin1String(""));
}
}
@@ -523,9 +531,11 @@ void CheckQuotaJob::finished()
reader.namespaceUri() == QLatin1String("DAV:")) {
QString name = reader.name().toString();
if (name == QLatin1String("quota-available-bytes")) {
quotaAvailableBytes = reader.readElementText().toLongLong();
// I have seen the server returning frational bytes:
// <d:quota-available-bytes>1374532061.2</d:quota-available-bytes>
quotaAvailableBytes = reader.readElementText().toDouble();
} else if (name == QLatin1String("quota-used-bytes")) {
quotaUsedBytes = reader.readElementText().toLongLong();
quotaUsedBytes = reader.readElementText().toDouble();
}
}
}
+153 -129
Ver Arquivo
@@ -14,7 +14,7 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<item row="0" column="0">
<widget class="QGroupBox" name="proxyGroupBox">
<property name="enabled">
<bool>true</bool>
@@ -177,151 +177,175 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Download Bandwidth</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QRadioButton" name="downloadLimitRadioButton">
<property name="text">
<string>Limit to</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSpinBox" name="downloadSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>80</number>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Download Bandwidth</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QRadioButton" name="downloadLimitRadioButton">
<property name="text">
<string>Limit to</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSpinBox" name="downloadSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>80</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>KBytes/s</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="noDownloadLimitRadioButton">
<property name="text">
<string>KBytes/s</string>
<string>No limit</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>147</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>147</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="noDownloadLimitRadioButton">
<property name="text">
<string>No limit</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Upload Bandwidth</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="noUploadLimitRadioButton">
<property name="text">
<string>No limit</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="autoUploadLimitRadioButton">
<property name="text">
<string>Limit automatically</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="uploadLimitRadioButton">
<property name="text">
<string>Limit to</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="uploadSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>10</number>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Upload Bandwidth</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<widget class="QRadioButton" name="uploadLimitRadioButton">
<property name="text">
<string>Limit to</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="autoUploadLimitRadioButton">
<property name="text">
<string>KBytes/s</string>
<string>Limit automatically</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="noUploadLimitRadioButton">
<property name="text">
<string>No limit</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="uploadSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>KBytes/s</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
<zorder>autoUploadLimitRadioButton</zorder>
<zorder>uploadLimitRadioButton</zorder>
<zorder>noUploadLimitRadioButton</zorder>
</widget>
<zorder>autoUploadLimitRadioButton</zorder>
<zorder>uploadLimitRadioButton</zorder>
<zorder>noUploadLimitRadioButton</zorder>
<zorder>horizontalSpacer_2</zorder>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
-8
Ver Arquivo
@@ -38,7 +38,6 @@ ownCloudGui::ownCloudGui(Application *parent) :
_logBrowser(0),
_contextMenu(0),
_recentActionsMenu(0),
_quotaInfo(0),
_folderOpenActionMapper(new QSignalMapper(this)),
_recentItemsMapper(new QSignalMapper(this)),
_app(parent)
@@ -98,11 +97,6 @@ void ownCloudGui::slotOpenSettingsDialog( bool openSettings )
}
}
QuotaInfo *ownCloudGui::quotaInfo() const
{
return _quotaInfo;
}
void ownCloudGui::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
{
// A click on the tray icon should only open the status window on Win and
@@ -363,8 +357,6 @@ void ownCloudGui::setupActions()
_actionLogout = new QAction(tr("Sign out"), this);
connect(_actionLogout, SIGNAL(triggered()), _app, SLOT(slotLogout()));
_quotaInfo = new QuotaInfo(this);
connect(_quotaInfo, SIGNAL(quotaUpdated(qint64,qint64)), SLOT(slotRefreshQuotaDisplay(qint64,qint64)));
}
void ownCloudGui::slotRefreshQuotaDisplay( qint64 total, qint64 used )
-4
Ver Arquivo
@@ -42,8 +42,6 @@ public:
bool checkAccountExists(bool openSettings);
QuotaInfo *quotaInfo() const;
signals:
void setupProxy();
@@ -94,8 +92,6 @@ private:
QAction *_actionHelp;
QAction *_actionQuit;
QuotaInfo *_quotaInfo;
QSignalMapper *_folderOpenActionMapper;
QSignalMapper *_recentItemsMapper;
+56 -20
Ver Arquivo
@@ -106,33 +106,50 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
*
* Return true if the problem is handled.
*/
bool PropagateItemJob::checkForProblemsWithShared()
bool PropagateItemJob::checkForProblemsWithShared(const QString& msg)
{
QString errorString = QString::fromUtf8(ne_get_error(_propagator->_session));
int httpStatusCode = errorString.mid(0, errorString.indexOf(QChar(' '))).toInt();
PropagateItemJob *newJob = NULL;
if( httpStatusCode == 403 && _propagator->isInSharedDirectory(_item._file )) {
if( _item._type != SyncFileItem::Directory ) {
// the file was removed locally from a read only Shared sync
// the file is gone locally and it should be recovered.
SyncFileItem downloadItem(_item);
downloadItem._instruction = CSYNC_INSTRUCTION_SYNC;
if (downloadItem._instruction == CSYNC_INSTRUCTION_NEW) {
// don't try to recover pushing new files
return false;
} else if (downloadItem._instruction == CSYNC_INSTRUCTION_SYNC) {
// we modified the file locally, jsut create a conflict then
downloadItem._instruction = CSYNC_INSTRUCTION_CONFLICT;
// HACK to avoid continuation: See task #1448: We do not know the _modtime from the
// server, at this point, so just set the current one. (rather than the one locally)
downloadItem._modtime = Utility::qDateTimeToTime_t(QDateTime::currentDateTime());
} else {
// the file was removed or renamed, just recover the old one
downloadItem._instruction = CSYNC_INSTRUCTION_SYNC;
}
downloadItem._dir = SyncFileItem::Down;
_restoreJob.reset(new PropagateDownloadFile(_propagator, downloadItem));
newJob = new PropagateDownloadFile(_propagator, downloadItem);
} else {
// Directories are harder to recover.
// But just re-create the directory, next sync will be able to recover the files
SyncFileItem mkdirItem(_item);
mkdirItem._instruction = CSYNC_INSTRUCTION_SYNC;
mkdirItem._dir = SyncFileItem::Down;
_restoreJob.reset(new PropagateLocalMkdir(_propagator, mkdirItem));
newJob = new PropagateLocalMkdir(_propagator, mkdirItem);
// Also remove the inodes and fileid from the db so no further renames are tried for
// this item.
_propagator->_journal->avoidRenamesOnNextSync(_item._file);
}
connect(_restoreJob.data(), SIGNAL(completed(SyncFileItem)),
this, SLOT(slotRestoreJobCompleted(SyncFileItem)));
_restoreJob->start();
if( newJob ) {
newJob->setRestoreJobMsg(msg);
_restoreJob.reset(newJob);
connect(_restoreJob.data(), SIGNAL(completed(SyncFileItem)),
this, SLOT(slotRestoreJobCompleted(SyncFileItem)));
_restoreJob->start();
}
return true;
}
return false;
@@ -140,14 +157,30 @@ bool PropagateItemJob::checkForProblemsWithShared()
void PropagateItemJob::slotRestoreJobCompleted(const SyncFileItem& item )
{
if( item._status == SyncFileItem::Success ) {
done( SyncFileItem::SoftError, tr("The file was removed from a read only share. The file has been restored."));
QString msg;
if(_restoreJob) {
msg = _restoreJob->restoreJobMsg();
_restoreJob->setRestoreJobMsg();
}
if( item._status == SyncFileItem::Success || item._status == SyncFileItem::Conflict) {
done( SyncFileItem::SoftError, msg);
} else {
done( item._status, tr("A file was removed from a read only share, but restoring failed: %1").arg(item._errorString) );
done( item._status, tr("A file or directory was removed from a read only share, but restoring failed: %1").arg(item._errorString) );
}
}
QString PropagateItemJob::restoreJobMsg()
{
return _restoreJobMsg;
}
void PropagateItemJob::setRestoreJobMsg( const QString& msg )
{
_restoreJobMsg = msg;
}
// compare two files with given filename and return true if they have the same content
static bool fileEquals(const QString &fn1, const QString &fn2) {
QFile f1(fn1);
@@ -241,7 +274,7 @@ void PropagateRemoteRemove::start()
qDebug() << "** DELETE " << uri.data();
int rc = ne_delete(_propagator->_session, uri.data());
if( checkForProblemsWithShared() ) {
if( checkForProblemsWithShared(tr("The file has been removed from a read only share. It was restored.")) ) {
return;
}
@@ -387,8 +420,9 @@ void PropagateUploadFile::start()
done( SyncFileItem::SoftError, errMsg );
} else {
// Other HBF error conditions.
// FIXME: find out the error class.
_item._httpErrorCode = hbf_fail_http_code(trans.data());
if(checkForProblemsWithShared(tr("The file was edited locally but is part of a read only share. "
"It is restored and your edit is in the conflict file.")))
return;
done(SyncFileItem::NormalError, hbf_error_string(trans.data(), state));
}
return;
@@ -895,6 +929,8 @@ void PropagateLocalRename::start()
void PropagateRemoteRename::start()
{
qDebug() << Q_FUNC_INFO << _item._file << "-->"<< _item._renameTarget;
if (_item._file == _item._renameTarget) {
if (!_item._isDirectory) {
// The parents has been renamed already so there is nothing more to do.
@@ -923,7 +959,7 @@ void PropagateRemoteRename::start()
int rc = ne_move(_propagator->_session, 1, uri1.data(), uri2.data());
if( checkForProblemsWithShared()) {
if( checkForProblemsWithShared(tr("The file was renamed but is part of a read only share. The original file was restored."))) {
return;
}
@@ -1061,7 +1097,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& _syncedItems)
continue;
}
while (!item._file.startsWith(directories.top().first)) {
while (!item.destination().startsWith(directories.top().first)) {
directories.pop();
}
@@ -1075,7 +1111,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& _syncedItems)
} else {
directories.top().second->append(dir);
}
directories.push(qMakePair(item._file + "/" , dir));
directories.push(qMakePair(item.destination() + "/" , dir));
} else if (PropagateItemJob* current = createJob(item)) {
directories.top().second->append(current);
}
@@ -1105,7 +1141,7 @@ bool OwncloudPropagator::isInSharedDirectory(const QString& file)
// The Shared directory is synced as its own sync connection
re = true;
} else {
if( file.startsWith("Shared/") ) {
if( file.startsWith("Shared/") || file == "Shared" ) {
// The whole ownCloud is synced and Shared is always a top dir
re = true;
}
@@ -1126,7 +1162,7 @@ void PropagateDirectory::start()
void PropagateDirectory::proceedNext(SyncFileItem::Status status)
{
if (status == SyncFileItem::FatalError) {
if (status == SyncFileItem::FatalError || (_current == -1 && status != SyncFileItem::Success)) {
emit finished(status);
return;
} else if (status == SyncFileItem::NormalError || status == SyncFileItem::SoftError) {
+9 -1
Ver Arquivo
@@ -119,12 +119,20 @@ protected:
*/
void limitBandwidth(qint64 progress, qint64 limit);
bool checkForProblemsWithShared();
bool checkForProblemsWithShared(const QString& msg);
/*
* set a custom restore job message that is used if the restore job succeeded.
* It is displayed in the activity view.
*/
QString restoreJobMsg();
void setRestoreJobMsg( const QString& msg = QString() );
QElapsedTimer _lastTime;
qint64 _lastProgress;
int _httpStatusCode;
SyncFileItem _item;
QString _restoreJobMsg;
protected slots:
void slotRestoreJobCompleted(const SyncFileItem& );
+30 -20
Ver Arquivo
@@ -27,18 +27,17 @@ static const int failIntervalT = 5*1000;
static const int initialTimeT = 1*1000;
}
QuotaInfo::QuotaInfo(QObject *parent)
: QObject(parent)
, _account(AccountManager::instance()->account())
QuotaInfo::QuotaInfo(Account *account)
: QObject(account)
, _account(account)
, _lastQuotaTotalBytes(0)
, _lastQuotaUsedBytes(0)
, _refreshTimer(new QTimer(this))
, _jobRestartTimer(new QTimer(this))
{
connect(AccountManager::instance(), SIGNAL(accountChanged(Account*,Account*)),
SLOT(slotAccountChanged(Account*,Account*)));
connect(_refreshTimer, SIGNAL(timeout()), SLOT(slotCheckQuota()));
_refreshTimer->setSingleShot(true);
_refreshTimer->start(initialTimeT);
connect(_account, SIGNAL(stateChanged(int)), SLOT(slotAccountStateChanged(int)));
connect(_jobRestartTimer, SIGNAL(timeout()), SLOT(slotCheckQuota()));
_jobRestartTimer->setSingleShot(true);
_jobRestartTimer->start(initialTimeT);
}
void QuotaInfo::slotAccountChanged(Account *newAccount, Account *oldAccount)
@@ -50,39 +49,50 @@ void QuotaInfo::slotAccountChanged(Account *newAccount, Account *oldAccount)
void QuotaInfo::slotAccountStateChanged(int state)
{
if (state == Account::Connected) {
switch (state) {
case Account::SignedOut: // fall through
case Account::InvalidCredidential:
case Account::Disconnected:
_jobRestartTimer->stop();
break;
case Account::Connected: // fall through
slotCheckQuota();
} else {
_refreshTimer->stop();
}
}
void QuotaInfo::slotRequestFailed()
{
_refreshTimer->start(failIntervalT);
if (!_account.isNull() && _account->state() == Account::Connected) {
_account->setState(Account::Disconnected);
}
_lastQuotaTotalBytes = 0;
_lastQuotaUsedBytes = 0;
_jobRestartTimer->start(failIntervalT);
_jobRestartTimer->start(failIntervalT);
}
void QuotaInfo::slotCheckQuota()
{
if (!_account.isNull() && _account->credentials() && _account->credentials()->ready()
&& _account->state() == Account::Connected) {
if (!_account.isNull() && _account->state() == Account::Connected
&& _account->credentials() && _account->credentials()->ready()) {
CheckQuotaJob *job = new CheckQuotaJob(_account, "/", this);
connect(job, SIGNAL(quotaRetrieved(qint64,qint64)), SLOT(slotUpdateLastQuota(qint64,qint64)));
connect(job, SIGNAL(networkError(QNetworkReply*)), SLOT(slotRequestFailed()));
job->start();
} else {
_lastQuotaTotalBytes = 0;
_lastQuotaUsedBytes = 0;
_refreshTimer->start(failIntervalT);
}
}
void QuotaInfo::slotUpdateLastQuota(qint64 total, qint64 used)
{
if(_account->state() == Account::Disconnected) {
_account->setState(Account::Connected);
}
_lastQuotaTotalBytes = total;
_lastQuotaUsedBytes = used;
emit quotaUpdated(total, used);
_refreshTimer->start(defaultIntervalT);
_jobRestartTimer->start(defaultIntervalT);
}
}
+7 -2
Ver Arquivo
@@ -11,6 +11,9 @@
* for more details.
*/
#ifndef QUOTAINFO_H
#define QUOTAINFO_H
#include <QObject>
#include <QPointer>
@@ -23,7 +26,7 @@ class Account;
class QuotaInfo : public QObject {
Q_OBJECT
public:
QuotaInfo(QObject *parent);
QuotaInfo(Account *account);
qint64 lastQuotaTotalBytes() const { return _lastQuotaTotalBytes; }
qint64 lastQuotaUsedBytes() const { return _lastQuotaUsedBytes; }
@@ -44,9 +47,11 @@ private:
QPointer<Account> _account;
qint64 _lastQuotaTotalBytes;
qint64 _lastQuotaUsedBytes;
QTimer *_refreshTimer;
QTimer *_jobRestartTimer;
};
} // namespace Mirall
#endif //QUOTAINFO_H
+7 -8
Ver Arquivo
@@ -78,10 +78,6 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
connect( folderMan, SIGNAL(folderSyncStateChange(QString)),
this, SLOT(slotSyncStateChange(QString)));
QuotaInfo *quotaInfo = gui->quotaInfo();
connect( quotaInfo, SIGNAL(quotaUpdated(qint64,qint64)),
_accountSettings, SLOT(slotUpdateQuota(qint64,qint64)));
_accountSettings->slotUpdateQuota(quotaInfo->lastQuotaTotalBytes(), quotaInfo->lastQuotaUsedBytes());
connect( _accountSettings, SIGNAL(folderChanged()), gui, SLOT(slotFoldersChanged()));
connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)),
gui, SLOT(slotFolderOpenAction(QString)));
@@ -132,10 +128,11 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::addAccount(const QString &title, QWidget *widget)
{
_accountItem = new QListWidgetItem(Theme::instance()->syncStateIcon(SyncResult::Undefined, true), title);
_accountItem = new QListWidgetItem(title);
_accountItem->setSizeHint(QSize(0, 32));
_ui->labelWidget->addItem(_accountItem);
_ui->stack->addWidget(widget);
slotSyncStateChange();
}
@@ -145,9 +142,11 @@ void SettingsDialog::slotSyncStateChange(const QString& alias)
SyncResult state = folderMan->accountStatus(folderMan->map().values());
_accountItem->setIcon(Theme::instance()->syncStateIcon(state.status()));
Folder *folder = folderMan->folder(alias);
if( folder ) {
_accountSettings->slotUpdateFolderState(folder);
if (!alias.isEmpty()) {
Folder *folder = folderMan->folder(alias);
if( folder ) {
_accountSettings->slotUpdateFolderState(folder);
}
}
}
+1 -1
Ver Arquivo
@@ -45,7 +45,7 @@ public:
void setGeneralErrors( const QStringList& errors );
public slots:
void slotSyncStateChange(const QString& alias);
void slotSyncStateChange(const QString& alias = QString());
void slotRefreshResultList();
void showActivityPage();
+15 -10
Ver Arquivo
@@ -69,7 +69,6 @@ static bool isSelfSigned(const QSslCertificate &certificate)
certificate.issuerInfo(QSslCertificate::OrganizationalUnitName) == certificate.subjectInfo(QSslCertificate::OrganizationalUnitName);
}
QMenu* SslButton::buildCertMenu(QMenu *parent, const QSslCertificate& cert,
const QList<QSslCertificate>& userApproved, int pos)
{
@@ -79,6 +78,8 @@ QMenu* SslButton::buildCertMenu(QMenu *parent, const QSslCertificate& cert,
QString country = QStringList(cert.subjectInfo(QSslCertificate::CountryName)).join(QChar(';'));
QString state = QStringList(cert.subjectInfo(QSslCertificate::StateOrProvinceName)).join(QChar(';'));
QString issuer = QStringList(cert.issuerInfo(QSslCertificate::CommonName)).join(QChar(';'));
if (issuer.isEmpty())
issuer = QStringList(cert.issuerInfo(QSslCertificate::OrganizationalUnitName)).join(QChar(';'));
QString md5 = Utility::formatFingerprint(cert.digest(QCryptographicHash::Md5).toHex());
QString sha1 = Utility::formatFingerprint(cert.digest(QCryptographicHash::Sha1).toHex());
QString serial = QString::fromUtf8(cert.serialNumber(), true);
@@ -136,8 +137,8 @@ QMenu* SslButton::buildCertMenu(QMenu *parent, const QSslCertificate& cert,
QString certId = cn.isEmpty() ? ou : cn;
if (QSslSocket::systemCaCertificates().contains(cert) && pos == 0) {
txt += tr("%1 (in Root CA store)").arg(certId);
if (QSslSocket::systemCaCertificates().contains(cert)) {
txt += certId;
} else {
if (isSelfSigned(cert)) {
txt += tr("%1 (self-signed)").arg(certId);
@@ -178,15 +179,19 @@ void SslButton::updateAccountInfo(Account *account)
QList<QSslCertificate> chain = account->sslConfiguration().peerCertificateChain();
menu->addAction(tr("Certificate information:"))->setEnabled(false);
QListIterator<QSslCertificate> caIt(QSslSocket::systemCaCertificates());
caIt.toBack();
QList<QSslCertificate> tmpChain;
foreach(QSslCertificate cert, chain) {
tmpChain << cert;
if (QSslSocket::systemCaCertificates().contains(cert))
break;
}
chain = tmpChain;
// find trust anchor (informational only, verification is done by QSslSocket!)
while (caIt.hasPrevious()) {
QSslCertificate rootCA = caIt.previous();
foreach(QSslCertificate rootCA, QSslSocket::systemCaCertificates()) {
if (rootCA.issuerInfo(QSslCertificate::CommonName) == chain.last().issuerInfo(QSslCertificate::CommonName) &&
rootCA.issuerInfo(QSslCertificate::Organization) == chain.last().issuerInfo(QSslCertificate::Organization)
&& !isSelfSigned(rootCA)) {
chain << rootCA;
rootCA.issuerInfo(QSslCertificate::Organization) == chain.last().issuerInfo(QSslCertificate::Organization)) {
chain.append(rootCA);
break;
}
}
+2 -1
Ver Arquivo
@@ -785,8 +785,9 @@ void SyncJournalDb::avoidRenamesOnNextSync(const QString& path)
}
QSqlQuery query(_db);
query.prepare("UPDATE metadata SET fileid = '', inode = '0' WHERE path LIKE(?||'/%')");
query.prepare("UPDATE metadata SET fileid = '', inode = '0' WHERE path == ? OR path LIKE(?||'/%')");
query.bindValue(0, path);
query.bindValue(1, path);
if( !query.exec() ) {
qDebug() << "SQL error in avoidRenamesOnNextSync: "<< query.lastError().text();
} else {
+1 -1
Ver Arquivo
@@ -204,7 +204,7 @@ QString Theme::about() const
{
return tr("<p>Version %1 For more information please visit <a href='%2'>%3</a>.</p>"
"<p>Copyright ownCloud, Inc.<p>"
"<p>Distributed by %4 and licensed under the GNU Public License (GPL) Version 2.0.<br>"
"<p>Distributed by %4 and licensed under the GNU General Public License (GPL) Version 2.0.<br>"
"%5 and the %5 logo are registered trademarks of %4 in the<br>"
"United States, other countries, or both.</p>")
.arg(MIRALL_VERSION_STRING).arg("http://"MIRALL_STRINGIFY(APPLICATION_DOMAIN))
+16 -3
Ver Arquivo
@@ -26,17 +26,30 @@ static void setupFavLink_private(const QString &folder) {
}
}
// returns the autostart directory the linux way
// and respects the XDG_CONFIG_HOME env variable
// can be replaces for qt5 with QStandardPaths
QString getUserAutostartDir_private()
{
QString config = QLatin1String(qgetenv("XDG_CONFIG_HOME"));
if (config.isEmpty()) {
config = QDir::homePath()+QLatin1String("/.config");
}
config += QLatin1String("/autostart/");
return config;
}
bool hasLaunchOnStartup_private(const QString &appName)
{
QString userAutoStartPath = QDir::homePath()+QLatin1String("/.config/autostart/");
QString desktopFileLocation = userAutoStartPath+appName+QLatin1String(".desktop");
QString desktopFileLocation = getUserAutostartDir_private()+appName+QLatin1String(".desktop");
return QFile::exists(desktopFileLocation);
}
void setLaunchOnStartup_private(const QString &appName, const QString& guiName, bool enable)
{
QString userAutoStartPath = QDir::homePath()+QLatin1String("/.config/autostart/");
QString userAutoStartPath = getUserAutostartDir_private();
QString desktopFileLocation = userAutoStartPath+appName+QLatin1String(".desktop");
if (enable) {
if (!QDir().exists(userAutoStartPath) && !QDir().mkdir(userAutoStartPath)) {
+5 -1
Ver Arquivo
@@ -126,6 +126,7 @@ int main(int argc, char **argv) {
qFatal("ne_sock_init failed!");
}
csync_set_log_callback( csyncLogCatcher );
csync_set_log_level(11);
csync_enable_conflictcopys(_csync_ctx);
Logger::instance()->setLogFile("-");
@@ -177,7 +178,10 @@ int main(int argc, char **argv) {
SyncJournalDb db(options.source_dir);
CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), &db);
QObject::connect(&csyncthread, SIGNAL(finished()), &app, SLOT(quit()));
csyncthread.startSync();
// Have to be done async, else, an error while updating does not terminate the event loop.
QMetaObject::invokeMethod(&csyncthread, "startSync", Qt::QueuedConnection);
app.exec();
+34
Ver Arquivo
@@ -0,0 +1,34 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h"
#include "mirall/account.h"
#include "wizard/owncloudwizard.h"
#include "wizard/abstractcredswizardpage.h"
namespace Mirall {
void AbstractCredentialsWizardPage::cleanupPage()
{
Account *account = static_cast<OwncloudWizard*>(wizard())->account();
AbstractCredentials *creds = account->credentials();
if (creds) {
if (!creds->inherits("DummyCredentials")) {
account->setCredentials(CredentialsFactory::create("dummy"));
}
}
}
}
+2 -1
Ver Arquivo
@@ -24,7 +24,8 @@ class AbstractCredentials;
class AbstractCredentialsWizardPage : public QWizardPage
{
public:
virtual AbstractCredentials* getCredentials() const = 0;
void cleanupPage();
virtual AbstractCredentials* getCredentials() const = 0;
};
} // ns Mirall
+3 -2
Ver Arquivo
@@ -38,13 +38,14 @@ void OwncloudShibbolethCredsPage::setupBrowser()
}
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard*>(wizard());
_browser = new ShibbolethWebView(ocWizard->account());
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
this, SLOT(slotShibbolethCookieReceived(QNetworkCookie)));
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
this, SLOT(slotShibbolethCookieReceived(QNetworkCookie, Account*)));
connect(_browser, SIGNAL(viewHidden()),
this, SLOT(slotViewHidden()));
connect(_browser, SIGNAL(otherCookiesReceived(QList<QNetworkCookie>, QUrl)),
this, SLOT(slotOtherCookiesReceived(QList<QNetworkCookie>, QUrl)));
_browser->move(ocWizard->x(), ocWizard->y());
_browser->show();
_browser->setFocus();
}
+12
Ver Arquivo
@@ -1,3 +1,15 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "../../../src/mirall/utility.h"
#include <QDir>
+13
Ver Arquivo
@@ -1,4 +1,17 @@
#!/usr/bin/env perl
#
# Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
use strict;
use File::Path qw(make_path);
use File::Basename qw(dirname);
+13
Ver Arquivo
@@ -1,4 +1,17 @@
#!/usr/bin/env perl
#
# Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
use strict;
use Data::Random::WordList;
+3 -3
Ver Arquivo
@@ -1661,7 +1661,7 @@ Bitte stellen Sie sicher, dass Ihre Netzwerkverbindung funktioniert.</translatio
<message>
<location filename="../src/mirall/sslbutton.cpp" line="104"/>
<source>Serial:</source>
<translation>Schlüssel:</translation>
<translation>Seriennummer:</translation>
</message>
<message>
<location filename="../src/mirall/sslbutton.cpp" line="107"/>
@@ -1676,7 +1676,7 @@ Bitte stellen Sie sicher, dass Ihre Netzwerkverbindung funktioniert.</translatio
<message>
<location filename="../src/mirall/sslbutton.cpp" line="111"/>
<source>Issued on:</source>
<translation>Ausgestellt auf:</translation>
<translation>Ausgestellt am:</translation>
</message>
<message>
<location filename="../src/mirall/sslbutton.cpp" line="112"/>
@@ -2362,4 +2362,4 @@ Bitte stellen Sie sicher, dass Ihre Netzwerkverbindung funktioniert.</translatio
<translation>Synchronisation wurde angehalten</translation>
</message>
</context>
</TS>
</TS>