Compare commits
91 Commits
v1.5.1-rc1
...
v1.5.3-rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f348499bbe | ||
|
|
7a3abac833 | ||
|
|
eb7074e9f0 | ||
|
|
66b152ac69 | ||
|
|
6df00ad08c | ||
|
|
76b24ff00d | ||
|
|
60a1d50ec9 | ||
|
|
9eb3452a71 | ||
|
|
228de7eede | ||
|
|
2164f5d9b7 | ||
|
|
4240010046 | ||
|
|
1eb0875518 | ||
|
|
b8e52304bd | ||
|
|
0658802048 | ||
|
|
eeb68919bf | ||
|
|
9a60732542 | ||
|
|
f8d996258e | ||
|
|
c8714be1d2 | ||
|
|
36cd9d9ced | ||
|
|
9c70ee68d2 | ||
|
|
e809a59049 | ||
|
|
33ae2eb19f | ||
|
|
d4fa955950 | ||
|
|
02bfb4f005 | ||
|
|
d4dd5afbe7 | ||
|
|
8607300195 | ||
|
|
e468ea2d68 | ||
|
|
05a1f7b1bb | ||
|
|
b8a4a2d2f7 | ||
|
|
c7e70533a0 | ||
|
|
d4fa06c4e1 | ||
|
|
065690c2ce | ||
|
|
75cff87316 | ||
|
|
b56843ead2 | ||
|
|
51b5f3c9b2 | ||
|
|
7f508c0718 | ||
|
|
45a7d4ff4c | ||
|
|
995e8938ad | ||
|
|
1e43d1fa49 | ||
|
|
5c1d612761 | ||
|
|
f92cf3dee3 | ||
|
|
a71cb1d3ef | ||
|
|
cd13144415 | ||
|
|
67c07c4daa | ||
|
|
8e7290b450 | ||
|
|
b51a722347 | ||
|
|
30d0e2fee8 | ||
|
|
04647b0d61 | ||
|
|
e991bcd112 | ||
|
|
82afb3b613 | ||
|
|
726b41b0c7 | ||
|
|
e74f0f2854 | ||
|
|
a51f050a08 | ||
|
|
e4965ab06b | ||
|
|
1b03dc759b | ||
|
|
d56c913fe4 | ||
|
|
3234e48cd0 | ||
|
|
e134ae22ac | ||
|
|
86e90451fa | ||
|
|
e66757335b | ||
|
|
393ac82c6a | ||
|
|
372f8b3426 | ||
|
|
8b9cd432b5 | ||
|
|
1eb6e163de | ||
|
|
1875a93a48 | ||
|
|
fd40a25030 | ||
|
|
05ae467cd5 | ||
|
|
4db7b5f2a7 | ||
|
|
958253bb2b | ||
|
|
bcf73cfc40 | ||
|
|
f79ecfe001 | ||
|
|
a677f97b7f | ||
|
|
1a9a14bdec | ||
|
|
153aa31da2 | ||
|
|
0322a44be5 | ||
|
|
5a6a8b504c | ||
|
|
97345447ab | ||
|
|
bb378902ae | ||
|
|
8f1494f8f2 | ||
|
|
4ae66b8b20 | ||
|
|
ccb45bfea6 | ||
|
|
bee5940c42 | ||
|
|
ee3df45fd8 | ||
|
|
49562ca3b6 | ||
|
|
33ab854922 | ||
|
|
fdf73fe539 | ||
|
|
3480cb4432 | ||
|
|
25ee44dd69 | ||
|
|
1471e15674 | ||
|
|
034c3ae017 | ||
|
|
e001e70816 |
@@ -96,6 +96,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)
|
||||
|
||||
57
ChangeLog
@@ -1,6 +1,63 @@
|
||||
ChangeLog
|
||||
=========
|
||||
|
||||
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
|
||||
|
||||
ChangeLog
|
||||
=========
|
||||
|
||||
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)
|
||||
* Added a button to the account dialog that gives information
|
||||
about the encryption layer used for communication, plus a
|
||||
certificate information widget
|
||||
* Preserve the permission settings of local files rather than
|
||||
setting them to a default (Bug #820)
|
||||
* Handle windows lnk files correctly (Bug #1307)
|
||||
* Detect removes and renames in read only shares and
|
||||
restore the gone away files. (Bug #1386)
|
||||
* Fixes sign in/sign out and password dialog. (Bug #1353)
|
||||
* Fixed error messages (Bug #1394)
|
||||
* Lots of fixes for building with Qt5
|
||||
* Changes to network limits are now also applied during a
|
||||
sync run
|
||||
* Fixed mem leak after via valgrind on Mac
|
||||
* Imported the ocsync library into miralls repository.
|
||||
Adopted all build systems and packaging to that.
|
||||
* Introduce a new linux packaging scheme following the
|
||||
debian upstream scheme
|
||||
* Use a refactored Linux file system watcher based on
|
||||
inotify, incl. unit tests
|
||||
* Wizard: Gracefully fall back to HTTP if HTTPS connection
|
||||
fails, issuing a warning
|
||||
* Fixed translation misses in the propagator
|
||||
* Fixes in proxy configuration
|
||||
* Fixes in sync journal handling
|
||||
* Fix the upload progress if the local source is still
|
||||
changing when the upload begins.
|
||||
* Add proxy support to owncloud commandline client
|
||||
* NSIS fixes
|
||||
* A lot of other fixes and minor improvements
|
||||
* Improve Qt5 compatability
|
||||
|
||||
version 1.5.0 (release 2013-12-12 ), csync 0.91.4 required
|
||||
* New owncloud propagator that skips the vio abstraction layer
|
||||
* Add owncloudcmd to replace the ocsync command line tool
|
||||
|
||||
@@ -2,7 +2,7 @@ set( APPLICATION_NAME "ownCloud" )
|
||||
#set( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
|
||||
set( APPLICATION_EXECUTABLE "owncloud" )
|
||||
set( APPLICATION_DOMAIN "owncloud.com" )
|
||||
set( APPLICATION_VENDOR "ownCloud, Inc" )
|
||||
set( APPLICATION_VENDOR "ownCloud" )
|
||||
set( APPLICATION_UPDATE_URL "https://updates.owncloud.com/client/" CACHE string "URL for updater" )
|
||||
|
||||
set( THEME_CLASS "ownCloudTheme" )
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
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 )
|
||||
set( MIRALL_VERSION_SUFFIX "rc1" ) #e.g. beta1, beta2, rc1
|
||||
set( MIRALL_VERSION_SUFFIX rc1) #e.g. beta1, beta2, rc1
|
||||
endif( NOT DEFINED MIRALL_VERSION_SUFFIX )
|
||||
|
||||
if( NOT DEFINED MIRALL_VERSION_BUILD )
|
||||
|
||||
BIN
admin/osx/deny_autoupdate_com.owncloud.desktopclient.plist
Normal file
@@ -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"
|
||||
|
||||
12
admin/osx/sparkle/dsa_pub.pem
Normal file
@@ -0,0 +1,12 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBtzCCASsGByqGSM44BAEwggEeAoGBANC50nTWzroQwwawgaV4jd5TjjqbGKDH
|
||||
6CWbZzyfJ246mJcrwTfM2h5Z80GwLSNFBIjtLGpFd7Wd+CI1dY8oIOYxnYgWDSJC
|
||||
Al1RMoUSSwx0LRr8J3gojcvvsrhk/t57o9bjXynE2tiP1fwzPb+B3NH/02fMnzfH
|
||||
k+B8/8GOnX8dAhUA9PZ1QrH/mN+7ckiGjmoegZdv9tMCgYBPEj2850r8+9tXljU4
|
||||
X0s1NKBfiyhBGw/quJMZ3k0fQ/tpOyYwXYBg+9GBVc4pF1CKMVGoBS6XnLrZ1OkC
|
||||
OP9g+NNH5cLOKrBxjtd1GPG8UF/sZpak2sVfuNKzRtFT/6WFHc3f7C+LiDFZ2aPO
|
||||
A+Kr5MZJ8xxYDYj16WV2nKgoQgOBhQACgYEAuQzycfUZKm7MR9WZSFF9uQ3N3SQr
|
||||
PKYggCl6GTdWYmrsFyXLEBmb3m2qXxx9AcfR2LdkTp/CRCzm+HD6wyHVAAVG2kI2
|
||||
mWafcahlx/lVMd2yytdRE5pjpjLxw7rrt/fvSZsGwUswQJLl4iDWoE+mFfaaZnnM
|
||||
JKoiKLX7LUFOPaU=
|
||||
-----END PUBLIC KEY-----
|
||||
21
admin/osx/sparkle/example_update_rss.rss
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<channel>
|
||||
<title>oC</title>
|
||||
<link>127.0.0.1/test.rss</link>
|
||||
<description>Most recent changes with links to updates.</description>
|
||||
<language>en</language>
|
||||
<item>
|
||||
<title>Version 1.5.1.2180-nightly20140202</title>
|
||||
<pubDate>Wed, 09 Feb 2013 19:20:11 +0000</pubDate>
|
||||
<enclosure url="http://127.0.0.1:8080/signed_ownCloud-1.5.1.2180-nightly20140202.dmg"
|
||||
sparkle:version="1.5.1.2180-nightly20140202"
|
||||
length="21078089"
|
||||
type="application/octet-stream"
|
||||
sparkle:dsaSignature="MCwCFA/RpP/MvNS1SpjD/2/U6RPyju3HAhQteFXvpUjTnNv3sC/lGkxtEkoB4Q=="
|
||||
/>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
||||
@@ -8,11 +8,11 @@ Daily sync job: https://ci.owncloud.org/view/translation-sync/job/translation-sy
|
||||
|
||||
## How to add a new translation string?
|
||||
|
||||
0. Add the variable holding the new translation string to l10n/declarations.nsh
|
||||
|
||||
1. Add the string to the pofiles/messages.pot manually. This step is necessary
|
||||
0. Add the string to the pofiles/messages.pot manually. This step is necessary
|
||||
for the upload of strings to be translated to transifex
|
||||
|
||||
1. Run bin/l10n.sh to properly generate declarations.nsh and English.nsh
|
||||
|
||||
2. If you want to test your installer right away you need to add the new string
|
||||
at least to l10n/English.nsh
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
# Auto-generated - do not modify
|
||||
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "リリースノートを表示"
|
||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "${processName} のプロセスを終了する必要があります。\nインストーラーがそのプロセスを停止してもよろしいですか?"
|
||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "${APPLICATION_EXECUTABLE} のプロセスを終了する必要があります。\nインストーラーがそのプロセスを停止してもよろしいですか?"
|
||||
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "${APPLICATION_EXECUTABLE} プロセスを停止しています。"
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "終了するプロセスがありません"
|
||||
StrCpy $PageReinstall_NEW_Field_1 "システムに ${APPLICATION_NAME} の旧バージョンがインストールされています。\n旧バージョンのアンインストールし、最新バージョンのインストールがおすすめです。\nオペレーションを選択し、次へをクリックする。"
|
||||
StrCpy $PageReinstall_NEW_Field_1 "システムに ${APPLICATION_NAME} の旧バージョンがインストールされています。\n旧バージョンをアンインストールし、最新バージョンをインストールするのをお勧めします。\nオペレーションを選択し、次へをクリックする。"
|
||||
StrCpy $PageReinstall_NEW_Field_2 "インストール前にアンインストールする"
|
||||
StrCpy $PageReinstall_NEW_Field_3 "アンインストールしない"
|
||||
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "インストール済"
|
||||
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "${APPLICATION_NAME} のインストール方法を選択する"
|
||||
StrCpy $PageReinstall_OLD_Field_1 "${APPLICATION_NAME} の最新バージョンが既にインストールされています。\n旧バージョンをインストールしない様にお願いします。旧バージョンのインストールが必要な場合、最初に最新バージョンをアンインストールし、旧バージョンのインストールする。 オペレーションを選択し、次へをクリックする。"
|
||||
StrCpy $PageReinstall_OLD_Field_1 "${APPLICATION_NAME} の最新バージョンが既にインストールされています。\n旧バージョンのインストールはお勧めしません。旧バージョンのインストールが本当に必要な場合は、まず最新バージョンをアンインストールしてから、旧バージョンをインストールしてください。\nオペレーションを選択し、次へをクリックする。"
|
||||
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} は既にインストールされています。\n実行するオペレーションを選択し、次へをクリックする"
|
||||
StrCpy $PageReinstall_SAME_Field_2 "追加/再インストールコンポーネント"
|
||||
StrCpy $PageReinstall_SAME_Field_3 "${APPLICATION_NAME} をアンインストール"
|
||||
StrCpy $UNINSTALLER_APPDATA_TITLE "${APPLICATION_NAME} をアンインストール"
|
||||
StrCpy $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE "実行する為に、メンテナンスオプションを選択してください。"
|
||||
StrCpy $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE "実行するには、メンテナンスオプションを選択してください。"
|
||||
StrCpy $SEC_APPLICATION_DETAILS "${APPLICATION_NAME} の重要なパッケージをインストール中"
|
||||
StrCpy $OPTION_SECTION_SC_START_MENU_SECTION "スタートメニューショートカット"
|
||||
StrCpy $OPTION_SECTION_SC_START_MENU_DetailPrint "スタートメニューに${APPLICATION_NAME} のショートカットの追加"
|
||||
@@ -25,8 +25,8 @@ StrCpy $OPTION_SECTION_SC_APPLICATION_Desc "${APPLICATION_NAME}
|
||||
StrCpy $OPTION_SECTION_SC_START_MENU_Desc "${APPLICATION_NAME} のショートカット"
|
||||
StrCpy $OPTION_SECTION_SC_DESKTOP_Desc "${APPLICATION_NAME} のデスクトップショートカット"
|
||||
StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_Desc "${APPLICATION_NAME} のクイック起動ショートカット"
|
||||
StrCpy $UNINSTALLER_APPDATA_SUBTITLE "${APPLICATION_NAME} のデータフォルダーを削除する"
|
||||
StrCpy $UNINSTALLER_APPDATA_LABEL_1 "${APPLICATION_NAME} のデータフォルダを削除しますか?"
|
||||
StrCpy $UNINSTALLER_APPDATA_SUBTITLE "${APPLICATION_NAME} のデータフォルダーを削除する"
|
||||
StrCpy $UNINSTALLER_APPDATA_LABEL_1 "${APPLICATION_NAME} のデータフォルダーを削除しますか?"
|
||||
StrCpy $UNINSTALLER_APPDATA_LABEL_2 "データフォルダーを削除する場合、チェックボックスをオンにする。\nまたは、データフォルダーを保存する場合、チェックボックスをオフにする。"
|
||||
StrCpy $UNINSTALLER_APPDATA_CHECKBOX "はい。データフォルダーを削除します。"
|
||||
StrCpy $UNINSTALLER_FILE_Detail "アンインストーラーを書き込み"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Auto-generated - do not modify
|
||||
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar notas de lançamento"
|
||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Encontrados ${APPLICATION_EXECUTABLE} processo(s) que precisam ser interrompidos. $ \nVocê quer que o instalador pare esses processos para você?"
|
||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Encontrados ${APPLICATION_EXECUTABLE} processo(s) que precisam ser interrompidos.$\nVocê quer que o instalador pare esses processos para você?"
|
||||
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Desativando ${APPLICATION_EXECUTABLE} processos."
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Processo para eliminar não encontrado!"
|
||||
StrCpy $PageReinstall_NEW_Field_1 "Uma versão mais antiga de ${APPLICATION_NAME} está instalado em seu sistema. É recomendado que você desinstale a versão atual antes de instalar. Selecione a operação que deseja executar e clique em Avançar para continuar."
|
||||
@@ -26,7 +26,7 @@ StrCpy $OPTION_SECTION_SC_START_MENU_Desc "${APPLICATION_NAME} atalho."
|
||||
StrCpy $OPTION_SECTION_SC_DESKTOP_Desc "Atalho Desktop para ${APPLICATION_NAME}."
|
||||
StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_Desc "Atalho Rápido para ${APPLICATION_NAME}."
|
||||
StrCpy $UNINSTALLER_APPDATA_SUBTITLE "Remover ${APPLICATION_NAME} pasta de dados de seu computador."
|
||||
StrCpy $UNINSTALLER_APPDATA_LABEL_1 "Você quer apagar $ {APPLICATION_NAME} 's pasta de dados?"
|
||||
StrCpy $UNINSTALLER_APPDATA_LABEL_1 "Você quer apagar ${APPLICATION_NAME} 's pasta de dados?"
|
||||
StrCpy $UNINSTALLER_APPDATA_LABEL_2 "Deixe desmarcada para manter a pasta de dados para uso posterior ou cheque para excluir a pasta de dados."
|
||||
StrCpy $UNINSTALLER_APPDATA_CHECKBOX "Sim, excluir essa pasta de dados."
|
||||
StrCpy $UNINSTALLER_FILE_Detail "Escrevendo Desinstalador"
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Galician"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
|
||||
@@ -28,5 +28,9 @@
|
||||
<string>@MIRALL_VERSION_STRING@</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(C) 2014 @APPLICATION_VENDOR@</string>
|
||||
<key>SUShowReleaseNotes</key>
|
||||
<false/>
|
||||
<key>SUPublicDSAKeyFile</key>
|
||||
<string>dsa_pub.pem</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
!define VERSION "@CPACK_PACKAGE_VERSION@"
|
||||
|
||||
Var InstallRunIfSilent
|
||||
Var NoAutomaticUpdates
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Installer build timestamp.
|
||||
@@ -67,7 +68,7 @@ Name "@CPACK_NSIS_PACKAGE_NAME@"
|
||||
BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
|
||||
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
|
||||
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
InstallDirRegKey HKCU "Software\${APPLICATION_NAME}" ""
|
||||
InstallDirRegKey HKCU "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
|
||||
InstType Standard
|
||||
InstType Full
|
||||
InstType Minimal
|
||||
@@ -277,21 +278,21 @@ FunctionEnd
|
||||
##############################################################################
|
||||
|
||||
Function PageReinstall
|
||||
ReadRegStr $R0 HKLM "Software\${APPLICATION_NAME}" ""
|
||||
ReadRegStr $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
|
||||
StrCmp $R0 "" 0 +2
|
||||
Abort
|
||||
|
||||
;Detect version
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor"
|
||||
IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
|
||||
minor_check:
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor"
|
||||
IntCmp $R0 ${VER_MINOR} rev_check new_version older_version
|
||||
rev_check:
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision"
|
||||
IntCmp $R0 ${VER_PATCH} build_check new_version older_version
|
||||
build_check:
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
|
||||
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild"
|
||||
IntCmp $R0 ${VER_BUILD} same_version new_version older_version
|
||||
|
||||
new_version:
|
||||
@@ -304,9 +305,9 @@ Function PageReinstall
|
||||
|
||||
older_version:
|
||||
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_OLD_Field_1
|
||||
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_OLD_Field_2
|
||||
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_OLD_Field_3
|
||||
!insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_OLD_MUI_HEADER_TEXT_SUBTITLE
|
||||
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_NEW_Field_2
|
||||
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_NEW_Field_3
|
||||
!insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE
|
||||
StrCpy $R0 "1"
|
||||
Goto reinst_start
|
||||
|
||||
@@ -487,11 +488,11 @@ Section -post
|
||||
SetDetailsPrint listonly
|
||||
|
||||
;Version numbers used to detect existing installation version for comparisson.
|
||||
WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
|
||||
WriteRegStr HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "" $INSTDIR
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
|
||||
|
||||
;Add or Remove Programs entry.
|
||||
WriteRegExpandStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
@@ -501,7 +502,7 @@ Section -post
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMajor" "${VER_MAJOR}"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}.${REVISION}"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}.${VER_PATCH}.${VER_BUILD}"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "URLInfoAbout" "http://${APPLICATION_DOMAIN}/"
|
||||
WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "HelpLink" "http://${APPLICATION_DOMAIN}/"
|
||||
WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "NoModify" "1"
|
||||
@@ -563,12 +564,12 @@ Section Uninstall
|
||||
owncloud_installed:
|
||||
|
||||
;Delete registry keys.
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" ""
|
||||
DeleteRegKey HKLM "Software\${APPLICATION_NAME}"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision"
|
||||
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
|
||||
DeleteRegKey HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}"
|
||||
|
||||
DeleteRegKey HKCR "${APPLICATION_NAME}"
|
||||
|
||||
@@ -607,7 +608,7 @@ Section Uninstall
|
||||
RMDir /r "$LOCALAPPDATA\${APPLICATION_NAME}"
|
||||
${EndIf}
|
||||
|
||||
DeleteRegKey ${MEMENTO_REGISTRY_ROOT} ${MEMENTO_REGISTRY_KEY}
|
||||
DeleteRegKey ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}"
|
||||
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $UNINSTALLER_FINISHED_Detail
|
||||
@@ -628,6 +629,13 @@ Function .onInit
|
||||
StrCpy $InstallRunIfSilent "yes"
|
||||
${EndIf}
|
||||
|
||||
${GetParameters} $R0
|
||||
${GetOptions} $R0 "/noautoupdate" $R0
|
||||
${IfNot} ${Errors}
|
||||
StrCpy $NoAutomaticUpdates "yes"
|
||||
${EndIf}
|
||||
|
||||
|
||||
!insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
|
||||
|
||||
; uncomment this line if you want to see the language selection
|
||||
@@ -695,6 +703,10 @@ FunctionEnd
|
||||
Function .onInstSuccess
|
||||
${MementoSectionSave}
|
||||
|
||||
${If} $NoAutomaticUpdates == "yes"
|
||||
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "skipUpdateCheck" "1"
|
||||
${EndIf}
|
||||
|
||||
${If} ${Silent}
|
||||
${AndIf} $InstallRunIfSilent == "yes"
|
||||
Call LaunchApplication
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#cmakedefine THEME_INCLUDE @THEME_INCLUDE@
|
||||
|
||||
#cmakedefine APPLICATION_NAME "@APPLICATION_NAME@"
|
||||
#cmakedefine APPLICATION_VENDOR "@APPLICATION_VENDOR@"
|
||||
#cmakedefine APPLICATION_REV_DOMAIN "@APPLICATION_REV_DOMAIN@"
|
||||
#cmakedefine APPLICATION_SHORTNAME "@APPLICATION_SHORTNAME@"
|
||||
#cmakedefine APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@"
|
||||
#cmakedefine APPLICATION_UPDATE_URL "@APPLICATION_UPDATE_URL@"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -61,7 +61,6 @@ set(csync_SRCS
|
||||
csync_time.c
|
||||
csync_util.c
|
||||
csync_misc.c
|
||||
csync_lock.c
|
||||
|
||||
csync_update.c
|
||||
csync_reconcile.c
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "c_lib.h"
|
||||
#include "csync_private.h"
|
||||
#include "csync_exclude.h"
|
||||
#include "csync_lock.h"
|
||||
#include "csync_statedb.h"
|
||||
#include "csync_time.h"
|
||||
#include "csync_util.h"
|
||||
@@ -168,7 +167,6 @@ int csync_create(CSYNC **csync, const char *local, const char *remote) {
|
||||
int csync_init(CSYNC *ctx) {
|
||||
int rc;
|
||||
time_t timediff = -1;
|
||||
char *lock = NULL;
|
||||
char *config = NULL;
|
||||
|
||||
if (ctx == NULL) {
|
||||
@@ -183,19 +181,6 @@ int csync_init(CSYNC *ctx) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* create lock file */
|
||||
if (asprintf(&lock, "%s/%s", ctx->local.uri, CSYNC_LOCK_FILE) < 0) {
|
||||
rc = -1;
|
||||
ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (csync_lock(lock) < 0) {
|
||||
rc = -1;
|
||||
ctx->status_code = CSYNC_STATUS_NO_LOCK;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ctx->local.type = LOCAL_REPLICA;
|
||||
|
||||
/* check for uri */
|
||||
@@ -286,8 +271,6 @@ retry_vio_init:
|
||||
|
||||
ctx->status = CSYNC_STATUS_INIT;
|
||||
|
||||
csync_lock_remove(lock);
|
||||
|
||||
csync_set_module_property(ctx, "csync_context", ctx);
|
||||
|
||||
/* initialize random generator */
|
||||
@@ -296,7 +279,6 @@ retry_vio_init:
|
||||
rc = 0;
|
||||
|
||||
out:
|
||||
SAFE_FREE(lock);
|
||||
SAFE_FREE(config);
|
||||
return rc;
|
||||
}
|
||||
@@ -304,7 +286,6 @@ out:
|
||||
int csync_update(CSYNC *ctx) {
|
||||
int rc = -1;
|
||||
struct timespec start, finish;
|
||||
char *lock = NULL;
|
||||
|
||||
if (ctx == NULL) {
|
||||
errno = EBADF;
|
||||
@@ -312,21 +293,6 @@ int csync_update(CSYNC *ctx) {
|
||||
}
|
||||
ctx->status_code = CSYNC_STATUS_OK;
|
||||
|
||||
/* try to create lock file */
|
||||
if (asprintf(&lock, "%s/%s", ctx->local.uri, CSYNC_LOCK_FILE) < 0) {
|
||||
ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
|
||||
rc = -1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (csync_lock(lock) < 0) {
|
||||
ctx->status_code = CSYNC_STATUS_NO_LOCK;
|
||||
rc = -1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
SAFE_FREE(lock);
|
||||
|
||||
/* create/load statedb */
|
||||
if (! csync_is_statedb_disabled(ctx)) {
|
||||
rc = asprintf(&ctx->statedb.file, "%s/.csync_journal.db",
|
||||
@@ -698,8 +664,7 @@ out:
|
||||
}
|
||||
|
||||
int csync_destroy(CSYNC *ctx) {
|
||||
char *lock = NULL;
|
||||
int rc;
|
||||
int rc = 0;
|
||||
|
||||
if (ctx == NULL) {
|
||||
errno = EBADF;
|
||||
@@ -719,12 +684,6 @@ int csync_destroy(CSYNC *ctx) {
|
||||
/* destroy exclude list */
|
||||
csync_exclude_destroy(ctx);
|
||||
|
||||
/* remove the lock file */
|
||||
rc = asprintf(&lock, "%s/%s", ctx->options.config_dir, CSYNC_LOCK_FILE);
|
||||
if (rc > 0) {
|
||||
csync_lock_remove(lock);
|
||||
}
|
||||
|
||||
_csync_clean_ctx(ctx);
|
||||
|
||||
SAFE_FREE(ctx->local.uri);
|
||||
@@ -738,9 +697,7 @@ int csync_destroy(CSYNC *ctx) {
|
||||
|
||||
SAFE_FREE(ctx);
|
||||
|
||||
SAFE_FREE(lock);
|
||||
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Check if csync is the required version or get the version string. */
|
||||
|
||||
@@ -50,7 +50,6 @@ extern "C" {
|
||||
#define CSYNC_CONF_DIR ".ocsync"
|
||||
#define CSYNC_CONF_FILE "ocsync.conf"
|
||||
#define CSYNC_EXCLUDE_FILE "ocsync_exclude.conf"
|
||||
#define CSYNC_LOCK_FILE ".csync.lock"
|
||||
|
||||
/**
|
||||
* Instruction enum. In the file traversal structure, it describes
|
||||
@@ -62,7 +61,7 @@ enum csync_status_codes_e {
|
||||
CSYNC_STATUS_ERROR = 1024, /* don't use this code,
|
||||
just use in csync_status_ok */
|
||||
CSYNC_STATUS_UNSUCCESSFUL,
|
||||
CSYNC_STATUS_NO_LOCK,
|
||||
CSYNC_STATUS_NO_LOCK, /* OBSOLETE does not happen anymore */
|
||||
CSYNC_STATUS_STATEDB_LOAD_ERROR,
|
||||
CSYNC_STATUS_STATEDB_WRITE_ERROR,
|
||||
CSYNC_STATUS_NO_MODULE,
|
||||
@@ -242,7 +241,7 @@ int csync_create(CSYNC **csync, const char *local, const char *remote);
|
||||
/**
|
||||
* @brief Initialize the file synchronizer.
|
||||
*
|
||||
* This function loads the configuration, the statedb and locks the client.
|
||||
* This function loads the configuration
|
||||
*
|
||||
* @param ctx The context to initialize.
|
||||
*
|
||||
@@ -289,7 +288,7 @@ int csync_commit(CSYNC *ctx);
|
||||
/**
|
||||
* @brief Destroy the csync context
|
||||
*
|
||||
* Writes the statedb, unlocks csync and frees the memory.
|
||||
* frees the memory.
|
||||
*
|
||||
* @param ctx The context to destroy.
|
||||
*
|
||||
|
||||
@@ -148,11 +148,6 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) {
|
||||
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
|
||||
CSYNC_EXCLUDE_TYPE type = CSYNC_NOT_EXCLUDED;
|
||||
|
||||
/* exclude the lock file */
|
||||
if (c_streq( path, CSYNC_LOCK_FILE )) {
|
||||
return CSYNC_FILE_SILENTLY_EXCLUDED;
|
||||
}
|
||||
|
||||
if (! ctx->options.unix_extensions) {
|
||||
for (p = path; *p; p++) {
|
||||
switch (*p) {
|
||||
|
||||
@@ -1,236 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "c_lib.h"
|
||||
#include "csync_lock.h"
|
||||
#include "csync.h"
|
||||
|
||||
#define CSYNC_LOG_CATEGORY_NAME "csync.lock"
|
||||
#include "csync_log.h"
|
||||
|
||||
#ifdef _DO_CREATE_A_LOCK_FILE
|
||||
static int _csync_lock_create(const char *lockfile) {
|
||||
int fd = -1;
|
||||
pid_t pid = 0;
|
||||
int rc = -1;
|
||||
char errbuf[256] = {0};
|
||||
char *ctmpfile = NULL;
|
||||
char *dir = NULL;
|
||||
char *buf = NULL;
|
||||
mode_t mask;
|
||||
|
||||
pid = getpid();
|
||||
|
||||
dir = c_dirname(lockfile);
|
||||
if (dir == NULL) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (asprintf(&ctmpfile, "%s/tmp_lock_XXXXXX", dir) < 0) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Create temporary lock file: %s", ctmpfile);
|
||||
mask = umask(0077);
|
||||
fd = mkstemp(ctmpfile);
|
||||
umask(mask);
|
||||
if (fd < 0) {
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"Unable to create temporary lock file: %s - %s",
|
||||
ctmpfile,
|
||||
errbuf);
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Write pid (%d) to temporary lock file: %s", pid, ctmpfile);
|
||||
pid = asprintf(&buf, "%d\n", pid);
|
||||
if (write(fd, buf, pid) == pid) {
|
||||
/* Create lock file */
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Create a hardlink from %s to %s.", ctmpfile, lockfile);
|
||||
if (link(ctmpfile, lockfile) < 0 ) {
|
||||
/* Oops, alredy locked */
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_INFO,
|
||||
"Already locked: %s - %s",
|
||||
lockfile,
|
||||
errbuf);
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"Can't create %s - %s",
|
||||
ctmpfile,
|
||||
errbuf);
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
|
||||
out:
|
||||
if (fd > 0) {
|
||||
close(fd);
|
||||
}
|
||||
if (ctmpfile) {
|
||||
unlink(ctmpfile);
|
||||
}
|
||||
|
||||
SAFE_FREE(buf);
|
||||
SAFE_FREE(dir);
|
||||
SAFE_FREE(ctmpfile);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static pid_t _csync_lock_read(const char *lockfile) {
|
||||
char errbuf[256] = {0};
|
||||
char buf[8] = {0};
|
||||
long int tmp;
|
||||
ssize_t rc;
|
||||
int fd;
|
||||
pid_t pid;
|
||||
mbchar_t *wlockfile;
|
||||
|
||||
/* Read PID from existing lock */
|
||||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
|
||||
wlockfile = c_utf8_to_locale(lockfile);
|
||||
if (wlockfile == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = _topen(wlockfile, O_RDONLY);
|
||||
c_free_locale_string(wlockfile);
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = read(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
|
||||
if (rc <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
tmp = strtol(buf, NULL, 10);
|
||||
if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) {
|
||||
/* Broken lock file */
|
||||
strerror_r(ERANGE, errbuf, sizeof(errbuf));
|
||||
if (unlink(lockfile) < 0) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"Unable to remove broken lock %s - %s",
|
||||
lockfile,
|
||||
errbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
pid = (pid_t)(tmp & 0xFFFF);
|
||||
|
||||
/* Check if process is still alive */
|
||||
if (kill(pid, 0) < 0 && errno == ESRCH) {
|
||||
/* Process is dead. Remove stale lock. */
|
||||
wlockfile = c_utf8_to_locale(lockfile);
|
||||
|
||||
if (_tunlink(wlockfile) < 0) {
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"Unable to remove stale lock %s - %s",
|
||||
lockfile,
|
||||
errbuf);
|
||||
}
|
||||
c_free_locale_string(wlockfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
#endif
|
||||
|
||||
int csync_lock(const char *lockfile) {
|
||||
#ifdef _DO_CREATE_A_LOCK_FILE /* disable lock file for ownCloud client, not only _WIN32 */
|
||||
/* Check if lock already exists. */
|
||||
if (_csync_lock_read(lockfile) > 0) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Aborting, another synchronization process is running.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_INFO, "Creating lock file: %s", lockfile);
|
||||
|
||||
return _csync_lock_create(lockfile);
|
||||
#else
|
||||
(void) lockfile;
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void csync_lock_remove(const char *lockfile) {
|
||||
#ifdef _DO_CREATE_A_LOCK_FILE
|
||||
#ifndef _WIN32
|
||||
char errbuf[256] = {0};
|
||||
mbchar_t *wlockfile;
|
||||
|
||||
/* You can't remove the lock if it is from another process */
|
||||
if (_csync_lock_read(lockfile) == getpid()) {
|
||||
wlockfile = c_utf8_to_locale(lockfile);
|
||||
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Removing lock file: %s", lockfile);
|
||||
if (_tunlink(wlockfile) < 0) {
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"Unable to remove lock %s - %s",
|
||||
lockfile,
|
||||
errbuf);
|
||||
}
|
||||
c_free_locale_string(wlockfile);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
(void) lockfile;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* 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 _CSYNC_LOCK_H
|
||||
#define _CSYNC_LOCK_H
|
||||
|
||||
#include "csync.h"
|
||||
|
||||
/**
|
||||
* @file csync_lock.h
|
||||
*
|
||||
* @brief File locking
|
||||
*
|
||||
* This prevents csync to start the same synchronization task twice which could
|
||||
* lead to several problems.
|
||||
*
|
||||
* @defgroup csyncLockingInternals csync file lockling internals
|
||||
* @ingroup csyncInternalAPI
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Lock the client if possible.
|
||||
*
|
||||
* This functiion tries to lock the client with a lock file.
|
||||
*
|
||||
* @param lockfile The lock file to create.
|
||||
*
|
||||
* @return 0 if the lock was successfull, less than 0 if the lock file
|
||||
* couldn't be created or if it is already locked.
|
||||
*/
|
||||
int csync_lock(const char *lockfile);
|
||||
|
||||
/**
|
||||
* @brief Remove the lockfile
|
||||
*
|
||||
* Only our own lock can be removed. This function can't remove a lock from
|
||||
* another client.
|
||||
*
|
||||
* @param lockfile The lock file to remove.
|
||||
*/
|
||||
void csync_lock_remove(const char *lockfile);
|
||||
|
||||
/**
|
||||
* }@
|
||||
*/
|
||||
#endif /* _CSYNC_LOCK_H */
|
||||
/* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
|
||||
@@ -1081,11 +1081,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,25 +114,28 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
|
||||
|
||||
if( tmp ) {
|
||||
if( tmp->path ) {
|
||||
/* Find the temporar file in the other tree. */
|
||||
len = strlen( tmp->path );
|
||||
h = c_jhash64((uint8_t *) tmp->path, len, 0);
|
||||
node = c_rbtree_find(tree, &h);
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "PHash of temporary opposite (%s): %" PRIu64 " %s",
|
||||
tmp->path , h, node ? "found": "not found" );
|
||||
if (!node) {
|
||||
/* the renamed file could not be found in the opposite tree. That is because it
|
||||
* is not longer existing there, maybe because it was renamed or deleted.
|
||||
* The journal is cleaned up later after propagation.
|
||||
*/
|
||||
|
||||
/* First, check that the file is NOT in our tree (another file with the same name was added) */
|
||||
node = c_rbtree_find(ctx->current == REMOTE_REPLICA ? ctx->remote.tree : ctx->local.tree, &h);
|
||||
if (node) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Origin found in our tree : %s", tmp->path);
|
||||
} else {
|
||||
/* Find the temporar file in the other tree. */
|
||||
node = c_rbtree_find(tree, &h);
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "PHash of temporary opposite (%s): %" PRIu64 " %s",
|
||||
tmp->path , h, node ? "found": "not found" );
|
||||
if (node) {
|
||||
other = (csync_file_stat_t*)node->data;
|
||||
} else {
|
||||
/* the renamed file could not be found in the opposite tree. That is because it
|
||||
* is not longer existing there, maybe because it was renamed or deleted.
|
||||
* The journal is cleaned up later after propagation.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(node) {
|
||||
other = (csync_file_stat_t*)node->data;
|
||||
}
|
||||
|
||||
if(!other) {
|
||||
cur->instruction = CSYNC_INSTRUCTION_NEW;
|
||||
} else if (other->instruction == CSYNC_INSTRUCTION_NONE
|
||||
@@ -159,9 +162,7 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
|
||||
cur->instruction = CSYNC_INSTRUCTION_NONE;
|
||||
other->instruction = CSYNC_INSTRUCTION_SYNC;
|
||||
}
|
||||
|
||||
SAFE_FREE(tmp->etag);
|
||||
SAFE_FREE(tmp);
|
||||
csync_file_stat_free(tmp);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -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
|
||||
@@ -620,7 +618,8 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
|
||||
}
|
||||
|
||||
if (ctx->current_fs && (ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL ||
|
||||
ctx->current_fs->instruction == CSYNC_INSTRUCTION_NEW)) {
|
||||
ctx->current_fs->instruction == CSYNC_INSTRUCTION_NEW ||
|
||||
ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL_RENAME)) {
|
||||
ctx->current_fs->should_update_etag = true;
|
||||
}
|
||||
|
||||
@@ -635,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;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,6 @@ add_cmocka_test(check_std_c_time std_tests/check_std_c_time.c ${TEST_TARGET_LIBR
|
||||
#add_cmocka_test(check_logger log_tests/check_log.c ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
add_cmocka_test(check_csync_create csync_tests/check_csync_create.c ${TEST_TARGET_LIBRARIES})
|
||||
# Disable lock testing for us.
|
||||
# if(NOT WIN32)
|
||||
# add_cmocka_test(check_csync_lock csync_tests/check_csync_lock.c ${TEST_TARGET_LIBRARIES})
|
||||
# endif()
|
||||
add_cmocka_test(check_csync_log csync_tests/check_csync_log.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_exclude csync_tests/check_csync_exclude.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_statedb_load csync_tests/check_csync_statedb_load.c ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "torture.h"
|
||||
|
||||
#define CSYNC_TEST 1
|
||||
#include "std/c_file.h"
|
||||
#include "csync_lock.h"
|
||||
|
||||
#define TEST_LOCK "/tmp/check_csync/test"
|
||||
|
||||
static void setup(void **state) {
|
||||
int rc;
|
||||
|
||||
(void) state; /* unused */
|
||||
|
||||
rc = system("mkdir -p /tmp/check_csync");
|
||||
assert_int_equal(rc, 0);
|
||||
}
|
||||
|
||||
static void teardown(void **state) {
|
||||
int rc;
|
||||
|
||||
(void) state; /* unused */
|
||||
|
||||
rc = system("rm -rf /tmp/check_csync");
|
||||
assert_int_equal(rc, 0);
|
||||
}
|
||||
|
||||
static void check_csync_lock(void **state)
|
||||
{
|
||||
int rc;
|
||||
|
||||
(void) state; /* unused */
|
||||
|
||||
rc = csync_lock(TEST_LOCK);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
assert_true(c_isfile(TEST_LOCK));
|
||||
|
||||
rc = csync_lock(TEST_LOCK);
|
||||
assert_int_equal(rc, -1);
|
||||
|
||||
csync_lock_remove(TEST_LOCK);
|
||||
assert_false(c_isfile(TEST_LOCK));
|
||||
}
|
||||
|
||||
static void check_csync_lock_content(void **state)
|
||||
{
|
||||
char buf[8] = {0};
|
||||
int fd, pid, rc;
|
||||
|
||||
(void) state; /* unused */
|
||||
|
||||
rc = csync_lock(TEST_LOCK);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
assert_true(c_isfile(TEST_LOCK));
|
||||
|
||||
/* open lock file */
|
||||
fd = open(TEST_LOCK, O_RDONLY);
|
||||
assert_true(fd > 0);
|
||||
|
||||
/* read content */
|
||||
pid = read(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
|
||||
assert_true(pid > 0);
|
||||
|
||||
/* get pid */
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
pid = strtol(buf, NULL, 10);
|
||||
|
||||
assert_int_equal(pid, getpid());
|
||||
|
||||
csync_lock_remove(TEST_LOCK);
|
||||
assert_false(c_isfile(TEST_LOCK));
|
||||
}
|
||||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test_setup_teardown(check_csync_lock, setup, teardown),
|
||||
unit_test_setup_teardown(check_csync_lock_content, setup, teardown),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 ".";
|
||||
|
||||
|
||||
@@ -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 ".";
|
||||
|
||||
|
||||
@@ -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 ".";
|
||||
|
||||
@@ -79,6 +93,7 @@ system( "echo \"super new\" >> " . localDir() . 'newdir/myfile.txt' );
|
||||
#Add some files for the next test.
|
||||
system( "echo \"un\" > " . localDir() . '1.txt' );
|
||||
system( "echo \"deux\" > " . localDir() . '2.txt' );
|
||||
system( "echo \"trois\" > " . localDir() . '3.txt' );
|
||||
mkdir( localDir() . 'newdir2' );
|
||||
|
||||
csync();
|
||||
@@ -105,6 +120,17 @@ my $newdir4Id = remoteFileId( localDir(), 'newdir4' );
|
||||
assert( $newdirId eq $newdir3Id, "newdir was not MOVE'd to newdir3?" );
|
||||
assert( $newdir2Id eq $newdir4Id, "newdir2 was not MOVE'd to newdir4?" );
|
||||
|
||||
printInfo("Move a file and replace it by a new one");
|
||||
|
||||
|
||||
move( localDir() . '1.txt', localDir() . '1_bis.txt' );
|
||||
move( localDir() . '3.txt', localDir() . '3_bis.txt' );
|
||||
system( "echo \"new file un\" > " . localDir() . '1.txt' );
|
||||
system( "echo \"new file trois\" > " . localDir() . '3.txt' );
|
||||
|
||||
csync();
|
||||
assertLocalAndRemoteDir( '', 0);
|
||||
|
||||
|
||||
cleanup();
|
||||
|
||||
|
||||
@@ -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 ".";
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 "config_csync.h"
|
||||
|
||||
#include "torture.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
|
||||
*/
|
||||
#ifndef _TORTURE_H
|
||||
#define _TORTURE_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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.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"
|
||||
|
||||
#include "vio/csync_vio_file_stat.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 <stdlib.h>
|
||||
|
||||
#include "torture.h"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Setting up an Account
|
||||
=====================
|
||||
|
||||
If no account has been configured, ownCloud Client will automatically assist
|
||||
you in connecting to your ownCloud Server after the application has been
|
||||
If no account has been configured, the ownCloud Client will automatically
|
||||
assist in connecting to your ownCloud server after the application has been
|
||||
started.
|
||||
|
||||
As a first step, specify the URL to your Server, just
|
||||
like you would when you open your ownCloud instance inside a browser.
|
||||
As a first step, specify the URL to your Server. This is the same address
|
||||
that is used in the browser.
|
||||
|
||||
.. image:: images/wizard_url.png
|
||||
:scale: 50 %
|
||||
@@ -16,22 +16,30 @@ like you would when you open your ownCloud instance inside a browser.
|
||||
This makes it easy for third parties to intercept your communication, and
|
||||
getting hold of your password!
|
||||
|
||||
Next, you are prompted for your username and password. Again, use the same
|
||||
credentials that you would use to log on via the web interface.
|
||||
Next, enter the username and password. These are the same credentials used
|
||||
to log into the web interface.
|
||||
|
||||
.. image:: images/wizard_user.png
|
||||
:scale: 50 %
|
||||
|
||||
Finally, choose the folder that ownCloud Client is supposed to sync the
|
||||
contents of your ownCloud account with. By default, this is a folder
|
||||
called `ownCloud`, which will reside in your home directory.
|
||||
called `ownCloud`, which will be created in the home directory.
|
||||
|
||||
.. image:: images/wizard_targetfolder.png
|
||||
:scale: 50 %
|
||||
|
||||
After pressing `Connect`, ownCloud Client will commence with the syncing
|
||||
process. The next screen will give you the opportunity to review your
|
||||
settings:
|
||||
At this time, the synchronization between the root directories of the
|
||||
ownCloud server will begin.
|
||||
|
||||
.. image:: images/wizard_overview.png
|
||||
:scale: 50 %
|
||||
|
||||
If selecting a local folder that already contains data, there are
|
||||
two options that exist.
|
||||
|
||||
* Keep local data: If selected, the files in the local folder on the
|
||||
client will be synced up to the ownCloud server.
|
||||
* Start a clean sync: If selected, all files in the local folder on
|
||||
the client will be deleted and therefore not synced to the ownCloud
|
||||
server.
|
||||
|
||||
@@ -123,7 +123,7 @@ database. If the ETag is still the same, the file has not changed.
|
||||
|
||||
In case a file has changed on both, the local and the remote repository since
|
||||
the last sync run, it can not easily be decided which version of the file is
|
||||
the one that should be used. However, changes to any side must not be lost.
|
||||
the one that should be used. However, changes to any side must not be lost.
|
||||
|
||||
That is called a **conflict case**. The client solves it by creating a conflict
|
||||
file of the older of the two files and save the newer one under the original
|
||||
|
||||
81
doc/autoupdate.rst
Normal file
@@ -0,0 +1,81 @@
|
||||
The Automatic Updater
|
||||
=====================
|
||||
|
||||
To ensure you're always using the latest version of ownCloud Client, an
|
||||
auto-update mechanism has been added in Version 1.5.1. It will ensure
|
||||
that will automatically profit from the latest features and bugfixes.
|
||||
|
||||
The updater works differently depending on the operating system.
|
||||
|
||||
Basic Workflow
|
||||
--------------
|
||||
|
||||
Windows
|
||||
^^^^^^^
|
||||
|
||||
ownCloud client will check for updates and download the update if one
|
||||
is available. You can view the status under ``Settings -> General -> Updates``.
|
||||
If an update is available and has been successfully downloaded, ownCloud
|
||||
Client will start a silent update prior to its next launch and then start itself.
|
||||
If the silent update fails, the client offers a manual download.
|
||||
|
||||
.. note:: The user needs to be able to attain administrative privileges
|
||||
to successfully perform the update.
|
||||
|
||||
Mac OS X
|
||||
^^^^^^^^
|
||||
|
||||
If a new update is available, ownCloud client will ask the user to update
|
||||
to the latest version using a pop-up dialog. This is the default for Mac
|
||||
OS X applications which use the Sparkle framework.
|
||||
|
||||
Linux
|
||||
^^^^^
|
||||
|
||||
Since distributions provide their own update tool, ownCloud Client on Linux
|
||||
will not perform any updates on its own. It will, however, check for the
|
||||
latest version and passively notify the user (``Settings -> General -> Updates``)
|
||||
if an update is available.
|
||||
|
||||
|
||||
Preventing Auto Updates
|
||||
-----------------------
|
||||
|
||||
In controlled environment such as companies or universities, the auto-update
|
||||
mechanism might not be desired as it interferes with controlled deployment
|
||||
tools and policies. In this case, it is possible to disable the auto-updater
|
||||
entirely:
|
||||
|
||||
Windows
|
||||
^^^^^^^
|
||||
|
||||
There are two alternative approaches:
|
||||
|
||||
1. In ``HKEY_LOCAL_MACHINE\Software\ownCloud\ownCloud``, add a key ``skipUpdateCheck`` (of type DWORD) with the value 1 to the machine. This key
|
||||
can be manually overrideen by the same value in ``HKEY_CURRENT_USER``.
|
||||
|
||||
2. In ``HKEY_LOCAL_MACHINE\Software\Policies\ownCloud\ownCloud``, add a key
|
||||
``skipUpdateCheck`` (of type DWORD) with the value 1 to the machine.
|
||||
Setting the value here cannot be overridden by the user and is the preferred
|
||||
way to control the updater behavior via Group Policies.
|
||||
|
||||
Mac OS X
|
||||
^^^^^^^^
|
||||
|
||||
You can disable the update check via a system-wide ``.plist`` file located
|
||||
at ``/Library/Preferences/com.owncloud.desktopclient.plist``. Add a new root
|
||||
level item of type bool and the name ``skipUpdateCheck`` and set it to ``true``.
|
||||
You can also just copy the file
|
||||
``owncloud.app/Contents/Resources/deny_autoupdate_com.owncloud.desktopclient.plist```
|
||||
to ``/Library/Preferences/com.owncloud.desktopclient.plist``.
|
||||
|
||||
Linux
|
||||
^^^^^
|
||||
|
||||
Since there is no updating functionality, there is no need to remove the check.
|
||||
If you want to disable the check nontheless, open a file called
|
||||
``/etc/ownCloud/ownCloud.conf`` and add the following content::
|
||||
|
||||
[General]
|
||||
skipUpdateCheck=true
|
||||
|
||||
BIN
doc/images/folderwizard_local.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
doc/images/folderwizard_remote.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 40 KiB |
BIN
doc/images/settings_activity.png
Normal file
|
After Width: | Height: | Size: 329 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 168 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 74 KiB |
@@ -10,6 +10,7 @@ Contents
|
||||
accountsetup
|
||||
visualtour
|
||||
advancedusage
|
||||
autoupdate
|
||||
|
||||
building
|
||||
architecture
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
This is the documentation for the ownCloud Sync Client, also referred to as
|
||||
the ownCloud Client.
|
||||
The ownCloud Sync Client is a desktop program installed on a user’s computer.
|
||||
It allows a user to specify one or more directories on the local machine to
|
||||
sync to the ownCloud server. It allows the user to always have the latest
|
||||
files wherever they may be. When a change is made to the file on the
|
||||
computer, it will sync to the ownCloud server via the sync client.
|
||||
|
||||
The ownCloud Sync Client is a desktop program you install on your computer.
|
||||
Specify one ore more directories on the local machine to sync your ownCloud
|
||||
server, and always have your latest files wherever you are. Make a change to the
|
||||
files on one computer, it will flow across the others using these desktop sync
|
||||
clients.
|
||||
|
||||
ownCloud Client is available for Windows, Mac OS X and various Linux
|
||||
distributions. See below for details on how to obtain the Client.
|
||||
The ownCloud Sync Client is available for Windows, MAC OS X, and various
|
||||
Linux distributions.
|
||||
|
||||
Obtaining the Client
|
||||
--------------------
|
||||
|
||||
The latest version of the ownCloud Client can be obtained at
|
||||
http://owncloud.org/sync-clients/.
|
||||
The latest version of the Client can be obtained on the ownCloud web site.
|
||||
|
||||
ownCloud client for **Windows** is provided as a NSIS-based setup file for
|
||||
machine-wide install. Installing the ownCloud client on **Mac OS** follows
|
||||
@@ -29,9 +25,8 @@ the normal app bundle installation pattern:
|
||||
folder.
|
||||
3. On the right hand side From ``Applications``, choose ``ownCloud``.
|
||||
|
||||
The ownCloud Client is also provided as in a convenient repository for a wide
|
||||
range of popular **Linux distributions**. If you want to build the sources
|
||||
instead.
|
||||
The ownCloud client is also provided as in a convenient repository for a wide
|
||||
range of popular **Linux distributions**.
|
||||
|
||||
Supported distributions are Fedora, openSUSE, Ubuntu and Debian.
|
||||
To support other distributions, a is required, see :ref:`building-label`
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
ownCloud Client supports the following command line switches:
|
||||
When invoking the client from the command line, the following options are supported:
|
||||
|
||||
``-h``, ``--help``
|
||||
shows all the below options (opens a window on Windows)
|
||||
|
||||
``--logwindow``
|
||||
open a window to show log output.
|
||||
|
||||
``--logfile`` `<filename>`
|
||||
write log output to file <filename>.
|
||||
write log output to file <filename>. To write to stdout, specify `-`
|
||||
as filename
|
||||
|
||||
``--logdir`` `<name>`
|
||||
write each sync log output in a new file in directory <name>
|
||||
|
||||
@@ -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}
|
||||
|
||||
|
||||
@@ -3,25 +3,27 @@ Visual Tour
|
||||
|
||||
.. index:: visual tour, usage
|
||||
|
||||
ownCloud Client stays in the background, and is visible as an
|
||||
icon in your system tray (Windows, KDE), status bar (Mac OS X)
|
||||
or notification area (Ubuntu), like so:
|
||||
Icon
|
||||
----
|
||||
|
||||
The ownCloud Client remains in the background and is visible
|
||||
as an icon in the system tray (Windows, KDE), status bar
|
||||
(MAC OS X), or notification area (Ubuntu).
|
||||
|
||||
.. image:: images/icon.png
|
||||
|
||||
If a setup is still required, it will open the setup. Otherwise, the
|
||||
main menu is opened, which provides several options and displays
|
||||
progress information:
|
||||
Menu
|
||||
----
|
||||
|
||||
.. image:: images/menu.png
|
||||
|
||||
Here is an explanation of the individual items in the menu:
|
||||
A right click on the icon (left click on Ubuntu and Mac OS X)
|
||||
provides the following menu:
|
||||
|
||||
* ``Open ownCloud in browser``: Opens the ownCloud web interface
|
||||
* ``Open folder 'ownCloud'``: Opens the local folder. If you have
|
||||
defined multiple sync targets, you should see multiple entries
|
||||
here.
|
||||
* **Disk space indicator**: Shows how much space is used up on the server.
|
||||
* ``Open folder 'ownCloud'``: Opens the local folder. If multiple
|
||||
sync targets have been defined, an entry will exist for each local folder.
|
||||
* **Disk space indicator**: Shows how much space is used on the server.
|
||||
* Operation indicator: Shows the status of the current sync process, or
|
||||
``Up to date`` if server and client are in sync.
|
||||
* **Recent Changes**: shows the last six files modified by sync operations,
|
||||
@@ -29,28 +31,90 @@ Here is an explanation of the individual items in the menu:
|
||||
since the last restart of ownCloud Client.
|
||||
* ``Settings...``: provides access to the settings menu.
|
||||
* ``Help``: Opens a browser to display this help.
|
||||
* ``Quit ownCloud``: Quits ownCloud, ending a currently running sync run.
|
||||
* ``Sign out``: Signs the client of of the server.
|
||||
* ``Quit ownCloud``: Quits ownCloud Client, ending a currently running
|
||||
sync run.
|
||||
|
||||
The settings dialog is split up in three categories: ``Account Settings``,
|
||||
``General Settings`` and ``Network Settings``:
|
||||
Settings
|
||||
--------
|
||||
|
||||
Account Settings
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
.. index:: account settings, user, password, Server URL
|
||||
|
||||
The ``Account Settings`` tab provides an executive summary about the synced
|
||||
folders in your account and allows to modify them. It also provides a more
|
||||
detailed report about the storage usage. Finally, it allows to change
|
||||
the files that ownCloud Client should ignore (for details, see the
|
||||
``Ignored Files Editor`` section below), and to modify various aspects
|
||||
of the current account settings, such as user name, password and server URL.
|
||||
The ``Account Settings tab`` provides an executive summary about the synced
|
||||
folders in the account and gives the ability to modify them.
|
||||
|
||||
Where:
|
||||
|
||||
* ``Connected to <ownCloud instance> as <user>``: Indicates the ownCloud server
|
||||
which the client is syncing with and the user account on that server.
|
||||
|
||||
* ``Add Folder...``: Provides the ability to add another folder to the sync
|
||||
(see ``Adding a folder``).
|
||||
* ``Pause/Resume``: Will pause the current sync or prevent the client from
|
||||
starting a new sync. Resume will resume the sync process.
|
||||
* ``Remove``: Will remove the selected folder from being synced. This is used,
|
||||
for instance, when there is a desire to sync only a few folders and not the
|
||||
root. First, remove the root from sync, then add the folders to sync as
|
||||
desired.
|
||||
* ``Storage Usage``: Provides further details on the storage utilization on the
|
||||
ownCloud server.
|
||||
* ``Edit Ignored Files``: Provides a list of files which will be ignored, i.e.
|
||||
will not sync between the client and server. The ignored files editor allows
|
||||
adding patterns for files or directories that should be excluded from the
|
||||
sync process. Besides normal characters, wild cards may be used, an asterisk
|
||||
‘*’ indicating multiple characters, or a question mark ‘?’ indicating a single
|
||||
character.
|
||||
|
||||
* ``Modify Account``: Allows the user to change the ownCloud server being synced
|
||||
to. It brings up the Setting up an Account (see above) windows.
|
||||
|
||||
.. image:: images/settings_account.png
|
||||
:scale: 50 %
|
||||
|
||||
General Settings
|
||||
~~~~~~~~~~~~~~~~
|
||||
Adding a Folder
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Adding a new sync is initiated by clicking ``Add Folder...`` in the ``Account``
|
||||
settings.
|
||||
|
||||
..note: To add a folder, you must not already sync a folder that contains this
|
||||
folder. By default, the wizard sets up the root folder of the ownCloud
|
||||
server to sync all of your ownCloud account. In consequence, you will
|
||||
first need to remove this folder prior to specifying new syncs.
|
||||
|
||||
.. image:: images/folderwizard_local.png
|
||||
:scale: 50 %
|
||||
|
||||
The Directory and alias name must be unique.
|
||||
|
||||
.. image:: images/folderwizard_remote.png
|
||||
:scale: 50 %
|
||||
|
||||
Select the folder on the server to sync with. It is important to note that, a
|
||||
server folder can only sync to the client one time. So, in the above example,
|
||||
the sync is to the server root directory and thus it is not possible to select
|
||||
another folder under the root to sync.
|
||||
|
||||
Activity
|
||||
~~~~~~~~
|
||||
|
||||
.. index:: activity, recent changes, sync activity
|
||||
|
||||
The Activity window, which can be invoked either from the main menu (``Recent
|
||||
Changes -> Details…``) or the Activity tab on the left side of the settings
|
||||
window, provides an in-depth account of the recent sync activity. It will show
|
||||
files that have not been synced because they are on the ignored files list, or
|
||||
because they cannot be synced in a cross-platform manner due to containing
|
||||
special characters that cannot be stored on certain file systems.
|
||||
|
||||
.. image:: images/settings_activity.png
|
||||
:scale: 50 %
|
||||
|
||||
General
|
||||
~~~~~~~
|
||||
|
||||
.. index:: general settings, auto start, startup, desktop notifications
|
||||
|
||||
@@ -59,20 +123,18 @@ The tab provides several useful options:
|
||||
.. image:: images/settings_general.png
|
||||
:scale: 50 %
|
||||
|
||||
* **Launch on System Startup**: This option is automatically activated
|
||||
* ``Launch on System Startup``: This option is automatically activated
|
||||
once a user has conimaged his account. Unchecking the box will cause
|
||||
ownCloud client to not launch on startup for a particular user.
|
||||
* **Show Desktop Nofications**: Do not show bubble notifications whenever
|
||||
a set of sync operations has been performed.
|
||||
* **Use Monochrome Icons**: Use less obstrusive icons. Especially useful
|
||||
on Mac OS.
|
||||
* ``Show Desktop Nofications``: When checked, bubble notifications when
|
||||
a set of sync operations has been performed are provided.
|
||||
* ``Use Monochrome Icons``: Use less obtrusive icons. Especially useful
|
||||
on Mac OS X.
|
||||
* ``About``: provides information about authors as well as build conditions.
|
||||
This information is valuable when submitting a support request.
|
||||
|
||||
The acout menu provides information about authors as well as detailed
|
||||
information about the build conditions. Those are particularly valuable
|
||||
when filing a bug report.
|
||||
|
||||
Network Settings
|
||||
~~~~~~~~~~~~~~~~
|
||||
Network
|
||||
~~~~~~~
|
||||
|
||||
.. index:: proxy settings, SOCKS, bandwith, throttling, limiting
|
||||
|
||||
@@ -97,45 +159,22 @@ Proxy Settings
|
||||
by the port number. HTTP proxies usually listen on Ports 8080 (default) or
|
||||
3128. SOCKS server usually listen on port 1080.
|
||||
* ``Proxy Server requires authentication``: Should be checked if the proxy
|
||||
server does not allow anonymous usage. If you check this option, you must
|
||||
provide username and password in the fields below, or ownless Cloud will no
|
||||
longer be able to connect successfully.
|
||||
server does not allow anonymous usage. If checked, a username and password
|
||||
must be provided.
|
||||
|
||||
Bandwidth Limiting
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ``Download Bandwidth`` (i.e. the bandwidth available for data flowing
|
||||
from the ownCloud Server to the client) can be either ``Unlimited``
|
||||
(the default), or limited to a custom value, specified in bytes
|
||||
The Download Bandwidth can be either unlimited (default) or limited to a
|
||||
custom value. This is the bandwidth available for data flowing from the
|
||||
ownCloud Server to the client.
|
||||
|
||||
The ``Upload Bandwith`` (i.e. the bandwith available for data flowing
|
||||
from the ownCloud Client to the server) additionally has the option
|
||||
to ``Limit automatically``: When this option is checked, the ownCloud
|
||||
Client will surrender available upstream bandwith to other applications.
|
||||
Use this option if you expirience problems with real time communication,
|
||||
such as Skype or other VoIP software, in conjunction with ownCloud Client.
|
||||
This is commonly the case with asymmetric internet connection, such as
|
||||
certain DSL lines with very limited upstream capacity.
|
||||
The Upload Bandwidth, the bandwidth available or data flowing from the
|
||||
ownCloud client to the server, has an additional option to limit automatically.
|
||||
|
||||
ownCloud Client will pick up changes immediately, but ongoing operations
|
||||
will finish using the old settings.
|
||||
|
||||
The Sync Status Display
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. index:: sync status
|
||||
|
||||
The ``Sync Status`` window, which can be invoked from either from the main
|
||||
menu (``Recent Changes`` -> ``Details...``) or the ``Account Settings``
|
||||
(``Info`` button), will provide you with an in-depth summary of the recent
|
||||
sync activity. It will also show files that have not been synched (ignored
|
||||
files). Those are ignored either because they are listed in the ignored
|
||||
files list (see ``Ignored Files Editor`` section below), or because they
|
||||
cannot be synced in a cross-platform manner because they contain special
|
||||
characters that cannot be stored on certain file systems.
|
||||
|
||||
.. image:: images/sync_protocol.png
|
||||
:scale: 50 %
|
||||
When this option is checked, the ownCloud client will surrender available
|
||||
bandwidth to other applications. Use this option if there are issues with
|
||||
real time communication in conjunction with the ownCloud Client.
|
||||
|
||||
.. _ignoredFilesEditor-label:
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ set(libsync_SRCS
|
||||
mirall/quotainfo.cpp
|
||||
mirall/clientproxy.cpp
|
||||
creds/dummycredentials.cpp
|
||||
creds/abstractcredentials.cpp
|
||||
creds/httpcredentials.cpp
|
||||
creds/credentialsfactory.cpp
|
||||
creds/http/httpconfigfile.cpp
|
||||
@@ -93,6 +94,7 @@ set(libsync_SRCS
|
||||
creds/shibboleth/shibbolethwebview.cpp
|
||||
creds/shibboleth/shibbolethrefresher.cpp
|
||||
creds/shibboleth/shibbolethconfigfile.cpp
|
||||
creds/shibboleth/authenticationdialog.cpp
|
||||
creds/credentialscommon.cpp
|
||||
3rdparty/qjson/json.cpp
|
||||
)
|
||||
@@ -126,6 +128,7 @@ set(libsync_HEADERS
|
||||
creds/shibboleth/shibbolethwebview.h
|
||||
creds/shibboleth/shibbolethrefresher.h
|
||||
creds/shibboleth/shibbolethconfigfile.h
|
||||
creds/shibboleth/authenticationdialog.h
|
||||
creds/credentialscommon.h
|
||||
3rdparty/qjson/json.h
|
||||
)
|
||||
@@ -255,6 +258,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
|
||||
@@ -280,6 +284,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
|
||||
@@ -446,6 +451,12 @@ target_link_libraries(${owncloudcmd_NAME} ${synclib_NAME})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mirall)
|
||||
if(BUILD_OWNCLOUD_OSX_BUNDLE)
|
||||
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
|
||||
DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/admin/osx/sparkle/dsa_pub.pem
|
||||
DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources)
|
||||
endif()
|
||||
else()
|
||||
install(TARGETS ${owncloudcmd_NAME}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
|
||||
42
src/creds/abstractcredentials.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 <QString>
|
||||
#include <QDebug>
|
||||
|
||||
#include "creds/abstractcredentials.h"
|
||||
|
||||
namespace Mirall
|
||||
{
|
||||
|
||||
QString AbstractCredentials::keychainKey(const QString &url, const QString &user)
|
||||
{
|
||||
QString u(url);
|
||||
if( u.isEmpty() ) {
|
||||
qDebug() << "Empty url in keyChain, error!";
|
||||
return QString::null;
|
||||
}
|
||||
if( user.isEmpty() ) {
|
||||
qDebug() << "Error: User is emty!";
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
if( !u.endsWith(QChar('/')) ) {
|
||||
u.append(QChar('/'));
|
||||
}
|
||||
|
||||
QString key = user+QLatin1Char(':')+u;
|
||||
return key;
|
||||
}
|
||||
} // ns Mirall
|
||||
@@ -39,12 +39,17 @@ public:
|
||||
virtual bool ready() const = 0;
|
||||
virtual void fetch(Account *account) = 0;
|
||||
virtual bool stillValid(QNetworkReply *reply) = 0;
|
||||
virtual bool fetchFromUser(Account *account) = 0;
|
||||
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);
|
||||
|
||||
Q_SIGNALS:
|
||||
void fetched();
|
||||
};
|
||||
|
||||
@@ -56,12 +56,6 @@ bool DummyCredentials::stillValid(QNetworkReply *reply)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DummyCredentials::fetchFromUser(Account *account)
|
||||
{
|
||||
Q_UNUSED(account)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DummyCredentials::fetch(Account*)
|
||||
{
|
||||
Q_EMIT(fetched());
|
||||
|
||||
@@ -32,7 +32,6 @@ public:
|
||||
QNetworkAccessManager* getQNAM() const;
|
||||
bool ready() const;
|
||||
bool stillValid(QNetworkReply *reply);
|
||||
bool fetchFromUser(Account *account);
|
||||
void fetch(Account*);
|
||||
void persist(Account*);
|
||||
void invalidateToken(Account *) {}
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
using namespace QKeychain;
|
||||
|
||||
Q_DECLARE_METATYPE(Mirall::Account*)
|
||||
|
||||
namespace Mirall
|
||||
{
|
||||
|
||||
@@ -96,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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -181,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)
|
||||
@@ -203,51 +228,39 @@ bool HttpCredentials::stillValid(QNetworkReply *reply)
|
||||
&& (reply->error() != QNetworkReply::OperationCanceledError));
|
||||
}
|
||||
|
||||
bool HttpCredentials::fetchFromUser(Account *account)
|
||||
{
|
||||
bool ok = false;
|
||||
QString password = queryPassword(&ok);
|
||||
if (ok) {
|
||||
_password = password;
|
||||
_ready = true;
|
||||
persist(account);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,21 +282,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);
|
||||
@@ -311,24 +344,4 @@ void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* a
|
||||
reply->close();
|
||||
}
|
||||
|
||||
QString HttpCredentials::keychainKey(const QString &url, const QString &user)
|
||||
{
|
||||
QString u(url);
|
||||
if( u.isEmpty() ) {
|
||||
qDebug() << "Empty url in keyChain, error!";
|
||||
return QString::null;
|
||||
}
|
||||
if( user.isEmpty() ) {
|
||||
qDebug() << "Error: User is emty!";
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
if( !u.endsWith(QChar('/')) ) {
|
||||
u.append(QChar('/'));
|
||||
}
|
||||
|
||||
QString key = user+QLatin1Char(':')+u;
|
||||
return key;
|
||||
}
|
||||
|
||||
} // ns Mirall
|
||||
|
||||
@@ -46,7 +46,6 @@ public:
|
||||
bool ready() const;
|
||||
void fetch(Account *account);
|
||||
bool stillValid(QNetworkReply *reply);
|
||||
bool fetchFromUser(Account *account);
|
||||
void persist(Account *account);
|
||||
QString user() const;
|
||||
QString password() const;
|
||||
@@ -60,10 +59,10 @@ private Q_SLOTS:
|
||||
void slotWriteJobDone(QKeychain::Job*);
|
||||
|
||||
private:
|
||||
static QString keychainKey(const QString &url, const QString &user);
|
||||
QString _user;
|
||||
QString _password;
|
||||
bool _ready;
|
||||
bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible
|
||||
};
|
||||
|
||||
} // ns Mirall
|
||||
|
||||
56
src/creds/shibboleth/authenticationdialog.cpp
Normal file
@@ -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
src/creds/shibboleth/authenticationdialog.h
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -29,11 +32,14 @@ namespace Mirall
|
||||
|
||||
void ShibbolethWebView::setup(Account *account, ShibbolethCookieJar* jar)
|
||||
{
|
||||
_account = account;
|
||||
MirallAccessManager* nm = new MirallAccessManager(this);
|
||||
// we need our own QNAM, but the we offload the SSL error handling to
|
||||
// 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);
|
||||
|
||||
@@ -90,7 +96,7 @@ void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieL
|
||||
Q_EMIT otherCookiesReceived(otherCookies, url);
|
||||
}
|
||||
if (!shibCookie.name().isEmpty()) {
|
||||
Q_EMIT shibbolethCookieReceived(shibCookie);
|
||||
Q_EMIT shibbolethCookieReceived(shibCookie, _account);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,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
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define MIRALL_WIZARD_SHIBBOLETH_WEB_VIEW_H
|
||||
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <QWebView>
|
||||
|
||||
class QNetworkCookie;
|
||||
@@ -39,7 +40,7 @@ protected:
|
||||
void hideEvent(QHideEvent* event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void shibbolethCookieReceived(const QNetworkCookie& cookie);
|
||||
void shibbolethCookieReceived(const QNetworkCookie& cookie, Account* account);
|
||||
void viewHidden();
|
||||
void otherCookiesReceived(const QList<QNetworkCookie>& cookieList, const QUrl& url);
|
||||
|
||||
@@ -47,9 +48,11 @@ 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);
|
||||
QPointer<Account> _account;
|
||||
};
|
||||
|
||||
} // ns Mirall
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMutex>
|
||||
#include <QSettings>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "creds/shibbolethcredentials.h"
|
||||
#include "creds/shibboleth/shibbolethaccessmanager.h"
|
||||
@@ -21,7 +22,13 @@
|
||||
#include "creds/shibboleth/shibbolethrefresher.h"
|
||||
#include "creds/shibboleth/shibbolethconfigfile.h"
|
||||
#include "creds/credentialscommon.h"
|
||||
|
||||
#include "mirall/account.h"
|
||||
#include "mirall/theme.h"
|
||||
|
||||
#include <qtkeychain/keychain.h>
|
||||
|
||||
using namespace QKeychain;
|
||||
|
||||
namespace Mirall
|
||||
{
|
||||
@@ -70,6 +77,7 @@ ShibbolethCredentials::ShibbolethCredentials()
|
||||
_url(),
|
||||
_shibCookie(),
|
||||
_ready(false),
|
||||
_stillValid(false),
|
||||
_browser(0),
|
||||
_otherCookies()
|
||||
{}
|
||||
@@ -166,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;
|
||||
@@ -179,62 +200,64 @@ void ShibbolethCredentials::fetch(Account *account)
|
||||
if (_ready) {
|
||||
Q_EMIT fetched();
|
||||
} else {
|
||||
ShibbolethConfigFile cfg;
|
||||
if (account) {
|
||||
_url = account->url();
|
||||
}
|
||||
_browser = new ShibbolethWebView(account, cfg.createCookieJar());
|
||||
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
|
||||
this, SLOT(onShibbolethCookieReceived(QNetworkCookie)));
|
||||
connect(_browser, SIGNAL(viewHidden()),
|
||||
this, SLOT(slotBrowserHidden()));
|
||||
_browser->show ();
|
||||
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
|
||||
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
|
||||
job->setInsecureFallback(false);
|
||||
job->setKey(keychainKey(account->url().toString(), "shibAssertion"));
|
||||
job->setProperty("account", QVariant::fromValue(account));
|
||||
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
|
||||
job->start();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShibbolethCredentials::stillValid(QNetworkReply *reply)
|
||||
{
|
||||
Q_UNUSED(reply)
|
||||
return true;
|
||||
return _stillValid;
|
||||
}
|
||||
|
||||
bool ShibbolethCredentials::fetchFromUser(Account *account)
|
||||
{
|
||||
Q_UNUSED(account)
|
||||
return false;
|
||||
}
|
||||
|
||||
void ShibbolethCredentials::persist(Account* /*account*/)
|
||||
void ShibbolethCredentials::persist(Account* account)
|
||||
{
|
||||
ShibbolethConfigFile cfg;
|
||||
|
||||
cfg.storeCookies(_otherCookies);
|
||||
|
||||
storeShibCookie(_shibCookie, account);
|
||||
}
|
||||
|
||||
// only used by Application::slotLogout(). Use invalidateAndFetch for normal usage
|
||||
void ShibbolethCredentials::invalidateToken(Account *account)
|
||||
{
|
||||
Q_UNUSED(account)
|
||||
_shibCookie.setValue("");
|
||||
_shibCookie = QNetworkCookie();
|
||||
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)),
|
||||
this, SLOT(onShibbolethCookieReceived(QNetworkCookie)));
|
||||
disconnect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
|
||||
this, SLOT(onShibbolethCookieReceived(QNetworkCookie, Account*)));
|
||||
_browser->hide();
|
||||
_browser->deleteLater();
|
||||
_browser = 0;
|
||||
}
|
||||
|
||||
void ShibbolethCredentials::onShibbolethCookieReceived(const QNetworkCookie& cookie)
|
||||
void ShibbolethCredentials::onShibbolethCookieReceived(const QNetworkCookie& cookie, Account* account)
|
||||
{
|
||||
disposeBrowser();
|
||||
_ready = true;
|
||||
_stillValid = true;
|
||||
_shibCookie = cookie;
|
||||
storeShibCookie(_shibCookie, account);
|
||||
Q_EMIT newCookie(_shibCookie);
|
||||
Q_EMIT fetched();
|
||||
}
|
||||
@@ -250,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
|
||||
@@ -266,4 +303,57 @@ void ShibbolethCredentials::onFetched()
|
||||
Q_EMIT invalidatedAndFetched(prepareCookieData());
|
||||
}
|
||||
|
||||
void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
|
||||
{
|
||||
Account *account = qvariant_cast<Account*>(job->property("account"));
|
||||
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();
|
||||
}
|
||||
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
|
||||
|
||||
_ready = true;
|
||||
_stillValid = true;
|
||||
Q_EMIT newCookie(_shibCookie);
|
||||
Q_EMIT fetched();
|
||||
} else {
|
||||
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());
|
||||
job->setSettings(account->settingsWithGroup(Theme::instance()->appName()));
|
||||
// we don't really care if it works...
|
||||
//connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
|
||||
job->setKey(keychainKey(account->url().toString(), "shibAssertion"));
|
||||
job->setTextData(QString::fromUtf8(cookie.toRawForm()));
|
||||
job->start();
|
||||
}
|
||||
|
||||
} // ns Mirall
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include "creds/abstractcredentials.h"
|
||||
|
||||
namespace QKeychain {
|
||||
class Job;
|
||||
}
|
||||
|
||||
namespace Mirall
|
||||
{
|
||||
|
||||
@@ -43,31 +47,37 @@ public:
|
||||
bool ready() const;
|
||||
void fetch(Account *account);
|
||||
bool stillValid(QNetworkReply *reply);
|
||||
virtual bool fetchFromUser(Account *account);
|
||||
void persist(Account *account);
|
||||
void invalidateToken(Account *account);
|
||||
|
||||
QNetworkCookie cookie() const;
|
||||
|
||||
void showLoginWindow(Account*);
|
||||
|
||||
public Q_SLOTS:
|
||||
void invalidateAndFetch(Account *account);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onShibbolethCookieReceived(const QNetworkCookie& cookie);
|
||||
void onShibbolethCookieReceived(const QNetworkCookie& cookie, Account*);
|
||||
void slotBrowserHidden();
|
||||
void onFetched();
|
||||
void slotReadJobDone(QKeychain::Job*);
|
||||
void slotInvalidateAndFetchInvalidateDone(QKeychain::Job*);
|
||||
void slotReplyFinished(QNetworkReply*);
|
||||
|
||||
Q_SIGNALS:
|
||||
void newCookie(const QNetworkCookie& cookie);
|
||||
void invalidatedAndFetched(const QByteArray& cookieData);
|
||||
|
||||
private:
|
||||
void storeShibCookie(const QNetworkCookie &cookie, Account *account);
|
||||
QUrl _url;
|
||||
QByteArray prepareCookieData() const;
|
||||
void disposeBrowser();
|
||||
|
||||
QNetworkCookie _shibCookie;
|
||||
bool _ready;
|
||||
bool _stillValid;
|
||||
ShibbolethWebView* _browser;
|
||||
QMap<QUrl, QList<QNetworkCookie> > _otherCookies;
|
||||
};
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
#include "mirall/account.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/networkjobs.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/quotainfo.h"
|
||||
#include "creds/abstractcredentials.h"
|
||||
#include "creds/credentialsfactory.h"
|
||||
|
||||
@@ -61,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()
|
||||
@@ -155,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>)));
|
||||
@@ -175,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));
|
||||
@@ -297,9 +310,19 @@ void Account::setState(int state)
|
||||
}
|
||||
}
|
||||
|
||||
QuotaInfo *Account::quotaInfo()
|
||||
{
|
||||
return _quotaInfo;
|
||||
}
|
||||
|
||||
void Account::slotHandleErrors(QNetworkReply *reply , QList<QSslError> errors)
|
||||
{
|
||||
qDebug() << "SSL-Warnings happened for url " << reply->url().toString();
|
||||
NetworkJobTimeoutPauser pauser(reply);
|
||||
qDebug() << "SSL-Errors happened for url " << reply->url().toString();
|
||||
foreach(const QSslError &error, errors) {
|
||||
qDebug() << "\tError in " << error.certificate() << ":"
|
||||
<< error.errorString() << "("<< error.error()<< ")";
|
||||
}
|
||||
|
||||
if( _treatSslErrorsAsFailure ) {
|
||||
// User decided once not to trust. Honor this decision.
|
||||
@@ -315,7 +338,7 @@ void Account::slotHandleErrors(QNetworkReply *reply , QList<QSslError> errors)
|
||||
QSslSocket::addDefaultCaCertificates(approvedCerts);
|
||||
addApprovedCerts(approvedCerts);
|
||||
// all ssl certs are known and accepted. We can ignore the problems right away.
|
||||
qDebug() << "Certs are already known and trusted, Warnings are not valid.";
|
||||
qDebug() << "Certs are already known and trusted, Errors are not valid.";
|
||||
reply->ignoreSslErrors();
|
||||
} else {
|
||||
_treatSslErrorsAsFailure = true;
|
||||
|
||||
@@ -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;
|
||||
@@ -163,4 +169,6 @@ private:
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Mirall::Account*)
|
||||
|
||||
#endif //SERVERCONNECTION_H
|
||||
|
||||
@@ -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()) );
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
#include "mirall/clientproxy.h"
|
||||
|
||||
#include "updater/updater.h"
|
||||
|
||||
#include "creds/abstractcredentials.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -88,6 +89,9 @@ Application::Application(int &argc, char **argv) :
|
||||
_logFlush(false),
|
||||
_userTriggeredConnect(false)
|
||||
{
|
||||
// TODO: Can't set this without breaking current config pathes
|
||||
// setOrganizationName(QLatin1String(APPLICATION_VENDOR));
|
||||
setOrganizationDomain(QLatin1String(APPLICATION_REV_DOMAIN));
|
||||
setApplicationName( _theme->appNameGUI() );
|
||||
setWindowIcon( _theme->applicationIcon() );
|
||||
|
||||
@@ -131,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*)));
|
||||
@@ -139,7 +143,9 @@ Application::Application(int &argc, char **argv) :
|
||||
// startup procedure.
|
||||
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
|
||||
|
||||
if( !cfg.skipUpdateCheck() ) {
|
||||
if( cfg.skipUpdateCheck() ) {
|
||||
qDebug() << Q_FUNC_INFO << "Skipping update check";
|
||||
} else {
|
||||
QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() ));
|
||||
}
|
||||
|
||||
@@ -183,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)));
|
||||
}
|
||||
|
||||
|
||||
@@ -218,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 );
|
||||
@@ -247,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)
|
||||
@@ -267,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);
|
||||
@@ -278,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()));
|
||||
}
|
||||
|
||||