Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qtkeychain-qt5 for openSUSE:Factory checked in at 2026-11-13 20:12:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qtkeychain-qt5 (Old) and /work/SRC/openSUSE:Factory/.qtkeychain-qt5.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qtkeychain-qt5" Fri Nov 13 20:12:15 2026 rev:20 rq:1396592 version:0.18.0 Changes: -------- --- /work/SRC/openSUSE:Factory/qtkeychain-qt5/qtkeychain-qt5.changes 2026-08-03 17:14:58.257869120 +0200 +++ /work/SRC/openSUSE:Factory/.qtkeychain-qt5.new.1251/qtkeychain-qt5.changes 2026-11-13 20:12:17.633322778 +0100 @@ -1,0 +2,9 @@ +Tue Nov 10 19:58:56 UTC 2026 - Christophe Marin <[email protected]> + +- Update to 0.18.0 + * KWallet: Do not block while waiting for KWalletd to answer/unlock + * libsecret: Fix deletion of entries in a locked collection + * libsecret: Specify libsecret 0.18 as minimum version + * Fix possible crash accessing deleted job + +------------------------------------------------------------------- Old: ---- qtkeychain-qt5-0.17.0.tar.gz New: ---- qtkeychain-qt5-0.18.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qtkeychain-qt5.spec ++++++ --- /var/tmp/diff_new_pack.1SdMB3/_old 2026-11-13 20:12:18.653365956 +0100 +++ /var/tmp/diff_new_pack.1SdMB3/_new 2026-11-13 20:12:18.654365998 +0100 @@ -1,7 +1,7 @@ # # spec file for package qtkeychain-qt5 # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define sover 1 Name: qtkeychain-qt5 -Version: 0.17.0 +Version: 0.18.0 Release: 0 Summary: A password store library License: BSD-2-Clause @@ -31,7 +31,7 @@ BuildRequires: cmake(Qt5DBus) BuildRequires: cmake(Qt5LinguistTools) BuildRequires: cmake(Qt5Test) -BuildRequires: pkgconfig(libsecret-1) +BuildRequires: pkgconfig(libsecret-1) >= 0.18 %description qtkeychain can be used to store passwords. ++++++ qtkeychain-qt6.spec ++++++ --- /var/tmp/diff_new_pack.1SdMB3/_old 2026-11-13 20:12:18.696367776 +0100 +++ /var/tmp/diff_new_pack.1SdMB3/_new 2026-11-13 20:12:18.700367946 +0100 @@ -1,7 +1,7 @@ # # spec file for package qtkeychain-qt6 # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define sover 1 Name: qtkeychain-qt6 -Version: 0.17.0 +Version: 0.18.0 Release: 0 Summary: Platform-independent Qt API for storing passwords securely License: BSD-2-Clause @@ -29,7 +29,7 @@ BuildRequires: cmake(Qt6DBus) BuildRequires: cmake(Qt6LinguistTools) BuildRequires: cmake(Qt6Test) -BuildRequires: pkgconfig(libsecret-1) +BuildRequires: pkgconfig(libsecret-1) >= 0.18 %description QtKeychain is a Qt API to store passwords and other secret data securely. ++++++ qtkeychain-qt5-0.17.0.tar.gz -> qtkeychain-qt5-0.18.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/.github/workflows/build.yml new/qtkeychain-0.18.0/.github/workflows/build.yml --- old/qtkeychain-0.17.0/.github/workflows/build.yml 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/.github/workflows/build.yml 2026-11-10 15:30:45.000000000 +0100 @@ -132,6 +132,32 @@ name: build-artifact ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.qt_version }} path: ${{ github.workspace }}/work/build/${{ github.event.repository.name }} + build-rhel8: + # Minimum: RHEL 8 (comes with libsecret 0.18) + runs-on: ubuntu-latest + container: almalinux:8 + + steps: + - name: Install dependencies + run: | + dnf -y install gcc-c++ make cmake pkgconf-pkg-config git \ + qt5-qtbase-devel qt5-qttools-devel libsecret-devel + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure + run: | + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_WITH_QT5=ON \ + -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" + + - name: Build and Install + run: | + cmake --build build --parallel + cmake --install build + build-android: runs-on: ubuntu-latest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/CMakeLists.txt new/qtkeychain-0.18.0/CMakeLists.txt --- old/qtkeychain-0.17.0/CMakeLists.txt 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/CMakeLists.txt 2026-11-10 15:30:45.000000000 +0100 @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -set(QTKEYCHAIN_VERSION 0.17.0) +set(QTKEYCHAIN_VERSION 0.18.0) set(QTKEYCHAIN_SOVERSION 1) project(qtkeychain VERSION ${QTKEYCHAIN_VERSION} LANGUAGES CXX) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/ChangeLog new/qtkeychain-0.18.0/ChangeLog --- old/qtkeychain-0.17.0/ChangeLog 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/ChangeLog 2026-11-10 15:30:45.000000000 +0100 @@ -1,6 +1,17 @@ ChangeLog ========= +version 0.18.0 (release 2026-11-10) + + - macOS: Add support for modern Data Protection Keychain (same approach as on iOS, no more popups) (Frank Osterfeld) + - macOS: Fix jobs not finishing when using QCoreApplication (Daniel Vrátil) + - KWallet: Do not block while waiting for KWalletd to answer/unlock (Nicolas Fella) + - libsecret: Fix deletion of entries in a locked collection (realstuffie) + - libsecret: Specify libsecret 0.18 as minimum version + - Windows: Fix leak of credentials; improve and error reporting (Eike Ziller) + - Fix possible crash accessing deleted job (Ivan Akulinchev) + - Fix some compiler warnings on Windows + version 0.17.0 (release 2026-07-06) - Windows: Do not ignore "service" when storing data. **Note: This is a breaking change**. qtkeychain will fail to read diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/ReadMe.md new/qtkeychain-0.18.0/ReadMe.md --- old/qtkeychain-0.17.0/ReadMe.md 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/ReadMe.md 2026-11-10 15:30:45.000000000 +0100 @@ -3,7 +3,9 @@ QtKeychain is a Qt API to store passwords and other secret data securely. How the data is stored depends on the platform: - * **macOS:** Passwords are stored in the macOS Keychain. + * **macOS:** Passwords are stored in the macOS Keychain. On macOS 10.15 and newer, the data protection keychain + is used if the application is signed accordingly, otherwise the file-based keychain + (see [Data protection keychain on macOS](#data-protection-keychain-on-macos)). * **Linux/Unix:** If running, GNOME Keyring is used, otherwise QtKeychain tries to use KWallet (via D-Bus), if available. Libsecret (common API for desktop-specific solutions) is also supported. @@ -25,6 +27,57 @@ QtKeychain 0.12 and newer supports Qt 5 and Qt 6 and requires a compiler with C++11 support. Older versions support Qt 4 and Qt 5. +Data protection keychain on macOS +--------------------------------- + +macOS has two keychain implementations: the legacy, file-based keychain and the data protection keychain +(macOS 10.15 and newer, the same implementation as on iOS). Which one QtKeychain uses is controlled per job via +`Job::setMacOSKeychainPreference()`: + + * `DataProtectionKeychainWithLegacyFallback` (default): Use the data protection keychain. Entries not found there + are looked up in the file-based keychain and migrated to the data protection keychain. + * `DataProtectionKeychain`: Use the data protection keychain only. + * `LegacyKeychain`: Use the file-based keychain only (behavior of QtKeychain 0.17 and older). + +The data protection keychain can only be used by applications that are code-signed with an application identifier +entitlement, which in turn must be backed by a provisioning profile. If that is not the case, QtKeychain falls back +to the file-based keychain. + +Thus, depending on how the application is built and distributed: + + * **Mac App Store:** Works out of the box, as App Store builds are signed with a provisioning profile and the + application identifier. + * **Developer ID (notarized, e.g. distributed as DMG):** Requires an App ID and a Developer ID provisioning profile + from the Apple Developer portal. Embed the profile and include in the entitlements: + + ```xml + <key>com.apple.application-identifier</key> + <string>TEAMID.com.example.myapp</string> + <key>com.apple.developer.team-identifier</key> + <string>TEAMID</string> + <key>keychain-access-groups</key> + <array> + <string>TEAMID.com.example.myapp</string> + </array> + ``` + + ``` + codesign --force --options runtime --timestamp --entitlements myapp.entitlements \ + --sign "Developer ID Application: ..." MyApp.app + ``` + + * **Unsigned or ad-hoc signed builds (e.g. local development builds) and command-line tools** + The data protection keychain is not available, the file-based keychain is used. + +Notes: + + * Entries in the data protection keychain belong to the keychain access group (by default the application + identifier, i.e. team ID and bundle identifier). Changing the team or bundle identifier makes existing entries + inaccessible. + * Development builds (file-based keychain) and release builds (data protection keychain) don't see each other's + entries, except that release builds move entries from the file-based keychain to the data protection keychain + on first read (after which development builds no longer find them). + License ------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/appveyor.yml new/qtkeychain-0.18.0/appveyor.yml --- old/qtkeychain-0.17.0/appveyor.yml 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/appveyor.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -version: '{build}' - -build_script: - - ps: | - $ErrorActionPreference="Stop" - Import-Module $env:APPVEYOR_BUILD_FOLDER\appveyorHelp.psm1 - - Init @("ninja") - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build\$env:APPVEYOR_PROJECT_NAME - cd $env:APPVEYOR_BUILD_FOLDER\work\build\$env:APPVEYOR_PROJECT_NAME - LogExec cmake -G"Ninja" $env:APPVEYOR_BUILD_FOLDER -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_ROOT" - - CmakeImageInstall - -test: off - -cache: - - work\install -> appveyor.yml - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml - -environment: - QT_VER: 5.7 - - matrix: - - COMPILER: msvc2015 - - COMPILER: msvc2015_64 - - COMPILER: mingw53_32 - - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/appveyorHelp.psm1 new/qtkeychain-0.18.0/appveyorHelp.psm1 --- old/qtkeychain-0.17.0/appveyorHelp.psm1 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/appveyorHelp.psm1 1970-01-01 01:00:00.000000000 +0100 @@ -1,362 +0,0 @@ -Write-Host "Appveyor Helper scrips https://github.com/TheOneRing/appVeyorHelp" - -$ErrorActionPreference="Stop" - -$script:INSTALL_DIR="$env:APPVEYOR_BUILD_FOLDER\work\install" -$CMAKE_INSTALL_ROOT="`"$INSTALL_DIR`"" -replace "\\", "/" -$env:PATH="$env:PATH;$script:INSTALL_DIR" - -if(!$env:CI -eq "true") -{ - function Push-AppveyorArtifact() - { - Write-Host "Push-AppveyorArtifact $ARGS" - } - function Start-FileDownload([string] $url, [string] $out) - { - if(!$out) - { - $out = $url.SubString($url.LastIndexOf("/")) - } - wget $url -Outfile $out - } -} - -function LogExec() -{ - $OldErrorActionPreference=$ErrorActionPreference - $ErrorActionPreference="Continue" - $LastExitCode = 0 - Write-Host $Args[0], $Args[1..(($Args.Count)-1)] - & $Args[0] $Args[1..(($Args.Count)-1)] - if(!$LastExitCode -eq 0) - { - exit $LastExitCode - } - $ErrorActionPreference=$OldErrorActionPreference -} - -#Set environment variables for Visual Studio Command Prompt -#http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-command-prompt -function BAT-CALL([string] $path, [string] $arg) -{ - Write-Host "Calling `"$path`" `"$arg`"" - cmd /c "$path" "$arg" `&`& set `|`| exit 1| - foreach { - if ($_ -match "=") { - $v = $_.split("=") - #Write-Host "ENV:\$($v[0])=$($v[1])" - set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" - } - } - if($LastExitCode -eq 1) { - Write-Error "$path not found." - } -} - -function Get-QtDir() -{ - $ver = 5.5 - if($env:QT_VER) - { - $ver = $env:QT_VER - } - return "C:\Qt\$ver\$env:COMPILER\" -} - -function SETUP-QT() -{ - [string] $compiler=$env:COMPILER - $qtDir = Get-QtDir - $script:QT_BINARY_DIRS = @($qtDir) - - BAT-CALL "$qtDir\bin\qtenv2.bat" - if ($compiler.StartsWith("mingw49")) - { - #remove sh.exe from path - $env:PATH=$env:PATH -replace "C:\\Program Files \(x86\)\\Git\\bin", "" - $script:MAKE="mingw32-make" - $script:CMAKE_GENERATOR="MinGW Makefiles" - $script:STRIP=@("strip", "-s") - $script:QT_BINARY_DIRS += (Resolve-Path "$qtDir\..\..\Tools\mingw492_32\opt\") - } - elseif ($compiler.StartsWith("msvc")) - { - $arch = "x86" - if($compiler.EndsWith("64")) - { - $arch = "amd64" - } - $compilerDirs = @{ - "msvc2010" = "VS100COMNTOOLS"; - "msvc2012" = "VS110COMNTOOLS"; - "msvc2013" = "VS120COMNTOOLS"; - "msvc2015" = "VS140COMNTOOLS" - } - - $compilerVar = $compilerDirs[$compiler.Split("_")[0]] - $compilerDir = (get-item -path "env:\$($compilerVar)").Value - BAT-CALL "$compilerDir\..\..\VC\vcvarsall.bat" $arch - $script:MAKE="nmake" - $script:CMAKE_GENERATOR="NMake Makefiles" - if($arch -eq "x86") - { - $script:QT_BINARY_DIRS += ("C:\OpenSSL-Win32") - } - else - { - $script:QT_BINARY_DIRS += ("C:\OpenSSL-Win64") - } - } -} - -function Install-ChocolatelyModule([string] $module, [string[]] $myargs) -{ - Write-Host "Install chocolately package $module" - LogExec cinst $module @myargs -y -} - -function Install-CmakeGitModule([string] $url, [hashtable] $arguments) -{ - $module = $url.SubString($url.LastIndexOf("/")+1) - $module = $module.Substring(0,$module.Length - 4) - if(!$arguments.Contains("branch")) - { - $arguments["branch"] = "master" - } - if(!$arguments.Contains("buildType")) - { - $arguments["buildType"] = "Release" - } - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build\$module - pushd $env:APPVEYOR_BUILD_FOLDER\work\git - LogExec git clone -q --depth 1 --branch ([string]$arguments["branch"]) $url $module - popd - pushd $env:APPVEYOR_BUILD_FOLDER\work\build\$module - LogExec cmake -G $script:CMAKE_GENERATOR ("-DCMAKE_BUILD_TYPE=`"{0}`"" -f [string]$arguments["buildType"]) $env:APPVEYOR_BUILD_FOLDER\work\git\$module -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_ROOT" $arguments["options"] - LogExec $script:MAKE install - popd -} - -function Init([string[]] $chocoDeps, [System.Collections.Specialized.OrderedDictionary] $cmakeModules) -{ - $script:MAKE="" - $script:CMAKE_GENERATOR="" - $script:STRIP=$null - - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\image | Out-Null - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build | Out-Null - - SETUP-QT - - if($chocoDeps -contains "ninja") { - $script:CMAKE_GENERATOR="Ninja" - $script:MAKE="ninja" - } - - if ( !(Test-Path "$env:APPVEYOR_BUILD_FOLDER\work\install" ) ) - { - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\install | Out-Null - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\git | Out-Null - - foreach($module in $chocoDeps) { - if($module -eq "nsis") - { - Install-ChocolatelyModule "nsis.portable" @("-pre") - continue - } - Install-ChocolatelyModule $module - } - - foreach($key in $cmakeModules.Keys) { - Install-CmakeGitModule $key $cmakeModules[$key] - } - - [string] $compiler=$env:COMPILER - if($compiler.StartsWith("msvc")) - { - Write-Host "Downloading vcredist.exe" - if ($compiler.StartsWith("msvc2015")) - { - if($compiler.EndsWith("64")) - { - Start-FileDownload https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - else - { - Start-FileDownload https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - } - else - { - if($compiler.EndsWith("64")) - { - Start-FileDownload http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - else - { - Start-FileDownload http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - } - } - } -} - -function relativePath([string] $root, [string] $path) -{ - pushd $root - $out = Resolve-Path -Relative $path - popd - return $out -} - -function StripFile([string] $name) -{ - if($script:STRIP) { - if( $name.EndsWith(".dll") -or $name.EndsWith(".exe")) - { - Write-Host "strip file $name" - LogExec @script:STRIP $name - } - } -} - -function Get-DeployImageName() -{ - $version = Get-Version - if($env:APPVEYOR_REPO_TAG -eq "true") { - return "$env:APPVEYOR_PROJECT_NAME`_$version`_Qt$env:QT_VER`_$env:COMPILER" - }else{ - return "$env:APPVEYOR_PROJECT_NAME`_$env:APPVEYOR_REPO_BRANCH`_$version`_Qt$env:QT_VER`_$env:COMPILER" - } -} - -function Get-Version() -{ - if($env:APPVEYOR_REPO_TAG -eq "true") { - return $env:APPVEYOR_REPO_TAG_NAME - }else{ - $commit = ([string]$env:APPVEYOR_REPO_COMMIT).SubString(0,6) - return $commit - } -} - -function CmakeImageInstall() -{ - $imageName = Get-DeployImageName - $destDir = "$env:APPVEYOR_BUILD_FOLDER\work\cmakeDeployImage\$imageName" - $env:DESTDIR = $destDir - LogExec $script:MAKE install - $env:DESTDIR = $null - if(!$LastExitCode -eq 0) - { - Write-Error "Build Failed" - } - $env:DESTDIR=$null - $prefix=$script:INSTALL_DIR - if( $prefix.substring(1,1) -eq ":") - { - $prefix=$prefix.substring(3) - } - Write-Host "move $destDir\$prefix to $destDir" - mv -Force "$destDir\$prefix\*" "$destDir" - $rootLeftOver = $prefix.substring(0, $prefix.indexOf("\")) - rm -Recurse "$destDir\$rootLeftOver" -} - -function CreateDeployImage([string[]] $whiteList, [string[]] $blackList) -{ - $imageName = Get-DeployImageName - $deployPath = "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName" - - function copyWithWhitelist([string] $root) - { - $files = ls $root -Recurse - foreach($fileName in $files.FullName) - { - $relPath = (relativePath $root $fileName).SubString(2) - if($whiteList | Where {$relPath -match $_}) - { - if($blackList | Where {$relPath -match $_}) - { - continue - } - if(!(Test-Path $deployPath\$relPath)) - { - Write-Host "copy $fileName to $deployPath\$relPath" - mkdir -Force (Split-Path -Parent $deployPath\$relPath) | Out-Null - cp -Force $fileName $deployPath\$relPath - StripFile $deployPath\$relPath - } - } - } - } - Write-Host "CreateDeployImage $imageName" - mkdir $deployPath | Out-Null - - copyWithWhitelist "$env:APPVEYOR_BUILD_FOLDER\work\cmakeDeployImage\$imageName" - copyWithWhitelist "$env:APPVEYOR_BUILD_FOLDER\work\install\" - foreach($folder in $script:QT_BINARY_DIRS) - { - copyWithWhitelist $folder - } - Write-Host "Deploy path $deployPath" - return $deployPath -} - -function 7ZipDeployImage() -{ - $imageName = Get-DeployImageName - LogExec 7za a "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName.7z" "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName" - Push-AppveyorArtifact "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName.7z" -} - -function NsisDeployImage([string] $scriptName) -{ - $imageName = Get-DeployImageName - $installerName = "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName.exe" - $version = Get-Version - if(([string]$env:COMPILER).StartsWith("msvc")) - { - $redist = "$env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe" - }else{ - $redist = "none" - } - if($env:COMPILER.EndsWith("64")) - { - $defaultinstdir = "`$PROGRAMFILES64" - }else{ - $defaultinstdir = "`$PROGRAMFILES" - } - LogExec makensis.exe /DgitDir=$env:APPVEYOR_BUILD_FOLDER /Dsetupname=$installerName /Dcaption=$imageName /Dversion=$version /Dcompiler=$env:COMPILER /Dvcredist=$redist /Ddefaultinstdir=$defaultinstdir /Dsrcdir=$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName $scriptName - Push-AppveyorArtifact $installerName -} - -# based on http://thesurlyadmin.com/2013/01/07/remove-empty-directories-recursively/ -function DeleteEmptyFodlers([string] $root) -{ - $Folders = @() - foreach($Folder in (Get-ChildItem -Path $root -Recurse -Directory)) - { - $Folders += New-Object PSObject -Property @{ - Object = $Folder - Depth = ($Folder.FullName.Split("\")).Count - } - } - $Folders = $Folders | Sort Depth -Descending - - foreach($Folder in $Folders) - { - If ($Folder.Object.GetFileSystemInfos().Count -eq 0) - { - Write-Host "Delete empty dir:" $Folder.Object.FullName - Remove-Item -Path $Folder.Object.FullName -Force - } - } - -} - -Write-Host "CMAKE_INSTALL_ROOT: $CMAKE_INSTALL_ROOT" -Write-Host "Image-Name: ", (Get-DeployImageName) - -Export-ModuleMember -Function @("Init","CmakeImageInstall", "CreateDeployImage", "LogExec", "7ZipDeployImage", "NsisDeployImage", "DeleteEmptyFodlers") -Variable @("CMAKE_INSTALL_ROOT") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/autotest/basic.cpp new/qtkeychain-0.18.0/autotest/basic.cpp --- old/qtkeychain-0.17.0/autotest/basic.cpp 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/autotest/basic.cpp 2026-11-10 15:30:45.000000000 +0100 @@ -19,6 +19,16 @@ Q_OBJECT private Q_SLOTS: + void macOSKeychainPreference() + { + QKeychain::ReadPasswordJob job(QStringLiteral("QtKeychainTest")); + job.setAutoDelete(false); + QCOMPARE(job.macOSKeychainPreference(), + QKeychain::MacOSKeychainPreference::DataProtectionKeychainWithLegacyFallback); + job.setMacOSKeychainPreference(QKeychain::MacOSKeychainPreference::LegacyKeychain); + QCOMPARE(job.macOSKeychainPreference(), QKeychain::MacOSKeychainPreference::LegacyKeychain); + } + void test_data() { QTest::addColumn<QByteArray>("password"); @@ -83,6 +93,9 @@ for (const auto& username : usernames) { QKeychain::DeletePasswordJob deleteJob(serviceKey); + // Stack-allocated: do not let the job schedule its own deletion. + // The read below runs a nested event loop and would deliver it. + deleteJob.setAutoDelete(false); deleteJob.setKey(username); QSignalSpy deleteSpy(&deleteJob, &QKeychain::DeletePasswordJob::finished); deleteJob.start(); @@ -90,6 +103,15 @@ qDebug() << "[delete]" << deleteJob.error() << ": " << deleteJob.errorString(); const auto expected = (serviceKey.isEmpty() && username.isEmpty()) ? QKeychain::EntryNotFound : QKeychain::NoError; QCOMPARE(deleteJob.error(), expected); + if (expected == QKeychain::NoError) { + QKeychain::ReadPasswordJob verifyJob(serviceKey); + verifyJob.setAutoDelete(false); + verifyJob.setKey(username); + QSignalSpy verifySpy(&verifyJob, &QKeychain::ReadPasswordJob::finished); + verifyJob.start(); + verifySpy.wait(); + QCOMPARE(verifyJob.error(), QKeychain::EntryNotFound); + } } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/CMakeLists.txt new/qtkeychain-0.18.0/qtkeychain/CMakeLists.txt --- old/qtkeychain-0.17.0/qtkeychain/CMakeLists.txt 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/CMakeLists.txt 2026-11-10 15:30:45.000000000 +0100 @@ -55,7 +55,7 @@ option(LIBSECRET_SUPPORT "Build with libsecret support" ON) if(LIBSECRET_SUPPORT) - pkg_check_modules(LIBSECRET REQUIRED libsecret-1) + pkg_check_modules(LIBSECRET REQUIRED libsecret-1>=0.18.0) add_definitions(-DHAVE_LIBSECRET=1) INCLUDE_DIRECTORIES(${LIBSECRET_INCLUDE_DIRS}) LINK_DIRECTORIES(${LIBSECRET_LIBRARY_DIRS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/keychain.cpp new/qtkeychain-0.18.0/qtkeychain/keychain.cpp --- old/qtkeychain-0.17.0/qtkeychain/keychain.cpp 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/keychain.cpp 2026-11-10 15:30:45.000000000 +0100 @@ -58,6 +58,16 @@ d->insecureFallback = insecureFallback; } +MacOSKeychainPreference Job::macOSKeychainPreference() const +{ + return d->macOSKeychainPreference; +} + +void Job::setMacOSKeychainPreference(MacOSKeychainPreference preference) +{ + d->macOSKeychainPreference = preference; +} + void Job::doStart() { JobExecutor::instance()->enqueue(this); @@ -190,9 +200,7 @@ void JobExecutor::jobDestroyed(QObject *object) { - Job *job = static_cast<Job *>(object); - Q_UNUSED(object) // for release mode - job->disconnect(this); + object->disconnect(this); m_jobRunning = false; startNextIfNoneRunning(); } @@ -225,7 +233,8 @@ error(NoError), service(service_), autoDelete(true), - insecureFallback(false) + insecureFallback(false), + macOSKeychainPreference(MacOSKeychainPreference::DataProtectionKeychainWithLegacyFallback) { } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/keychain.h new/qtkeychain-0.18.0/qtkeychain/keychain.h --- old/qtkeychain-0.17.0/qtkeychain/keychain.h 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/keychain.h 2026-11-10 15:30:45.000000000 +0100 @@ -38,6 +38,25 @@ OtherError /**< Something else went wrong (errorString() might provide details) */ }; +/** + * Enum to specify keychain preferences on macOS + * + * The data protection keychain requires macOS >= 10.15 and an app signed with an application + * identifier (App Store apps, or Developer ID apps with an embedded provisioning profile granting + * keychain-access-groups). If the process has no entitlement granting a keychain access group + * (e.g. unsigned or ad-hoc signed development builds), the legacy file-based keychain is used + * instead, for reads, writes and deletes alike. + * + * Ignored on all other platforms, including iOS (which only has the data protection keychain). + * + * @since 0.18.0 + */ +enum class MacOSKeychainPreference { + DataProtectionKeychain, ///< Use data protection keychain where available (macOS >= 10.15) + DataProtectionKeychainWithLegacyFallback, ///< Always store credentials in protection keychain (if available), but on read, also check file-based keychain + LegacyKeychain ///< Enforce use of old, file-based keychain +}; + class JobExecutor; class JobPrivate; @@ -157,6 +176,31 @@ void emitFinished(); void emitFinishedWithError(Error, const QString &errorString); + /** + * Set which keychain to use on macOS. Default is + * MacOSKeychainPreference::DataProtectionKeychainWithLegacyFallback. + * + * With DataProtectionKeychainWithLegacyFallback: + * - ReadPasswordJob first checks the data protection keychain. If the entry is not found + * there, the legacy keychain is checked; an entry found there is migrated (written to the + * data protection keychain and removed from the legacy keychain). + * - WritePasswordJob writes to the data protection keychain and removes the entry from the + * legacy keychain, if present. + * - DeletePasswordJob deletes the entry from both keychains. + * + * Has no effect on other platforms. + * @see macOSKeychainPreference() + * @since 0.18.0 + */ + void setMacOSKeychainPreference(MacOSKeychainPreference preference); + + /** + * @return The keychain preference used on macOS. + * @see setMacOSKeychainPreference() + * @since 0.18.0 + */ + MacOSKeychainPreference macOSKeychainPreference() const; + Q_SIGNALS: /** * Emitted when this job is finished. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/keychain_apple.mm new/qtkeychain-0.18.0/qtkeychain/keychain_apple.mm --- old/qtkeychain-0.17.0/qtkeychain/keychain_apple.mm 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/keychain_apple.mm 2026-11-10 15:30:45.000000000 +0100 @@ -9,6 +9,11 @@ #include "keychain_p.h" +#include <QDebug> + +#include <atomic> +#include <memory> + #import <Foundation/Foundation.h> #import <Security/Security.h> @@ -49,6 +54,9 @@ case errSecVerifyFailed: return ErrorDescription(QKeychain::AccessDenied, Job::tr("A cryptographic verification failure has occurred")); + case errSecMissingEntitlement: + return ErrorDescription(QKeychain::AccessDenied, + Job::tr("A required entitlement is not present")); case errSecUnimplemented: return ErrorDescription(QKeychain::NotImplemented, Job::tr("Function or operation not implemented")); @@ -83,7 +91,7 @@ - (instancetype)initWithJob:(Job *)job andPrivateJob:(JobPrivate *)privateJob; - (void)keychainTaskFinished; -- (void)keychainReadTaskFinished:(NSData *)retrievedData; +- (void)keychainReadTaskFinished:(const QByteArray &)retrievedData; - (void)keychainTaskFinishedWithError:(OSStatus)status descriptiveMessage:(NSString *)descriptiveMessage; @@ -120,14 +128,11 @@ } } -- (void)keychainReadTaskFinished:(NSData *)retrievedData +- (void)keychainReadTaskFinished:(const QByteArray &)retrievedData { if (_privateJob) { - _privateJob->data.clear(); + _privateJob->data = retrievedData; _privateJob->mode = JobPrivate::Binary; - if (retrievedData != nil) { - _privateJob->data = QByteArray::fromNSData(retrievedData); - } } if (_job) { @@ -152,114 +157,384 @@ @end +class Completion { +public: + Completion(AppleKeychainInterface *const interface, void (^callback)()) + : interface([interface retain]), callback([callback copy]) + { + } + + ~Completion() + { + [interface release]; + [callback release]; + } + + void operator()() + { + callback(); + } + +private: + AppleKeychainInterface *const interface; + void (^callback)(); +}; + +static void dispatchOnQtMainThread(AppleKeychainInterface *const interface, void (^callback)()) +{ + auto completion = std::make_shared<Completion>(interface, callback); + QMetaObject::invokeMethod(qApp, [completion]() { + (*completion)(); + }, Qt::QueuedConnection); +} + +namespace { + +// On macOS, there are two keychain implementations: the legacy, file-based keychain and the +// data protection keychain (macOS >= 10.15). On iOS and other Apple platforms, there is only the +// data protection keychain, which is what queries use if kSecUseDataProtectionKeychain isn't set; +// so there we always use KeychainKind::Default. +enum class KeychainKind { + Default, // the file-based keychain on macOS, the (only) data protection keychain elsewhere + DataProtection, // the data protection keychain on macOS +}; + +// Set once the data protection keychain returned errSecMissingEntitlement. Second line of +// defense in case the up-front entitlement check (hasKeychainAccessGroupEntitlement()) passes but +// the data protection keychain still rejects the process. (Entitlements never change at runtime) +std::atomic<bool> s_dataProtectionKeychainMissingEntitlement(false); + +#if defined(Q_OS_MACOS) +// Returns true if the process has an entitlement that gives it a keychain access group, which is +// required to use the data protection keychain. Apps without one (unsigned/ad-hoc signed +// development builds, Developer ID builds without provisioning profile) can't use it. We can't +// rely on errSecMissingEntitlement to detect that, as e.g. SecItemCopyMatching returns +// errSecItemNotFound in that case. +bool hasKeychainAccessGroupEntitlement() +{ + SecTaskRef task = SecTaskCreateFromSelf(kCFAllocatorDefault); + if (!task) { + return false; + } + const CFStringRef names[] = { + CFSTR("com.apple.application-identifier"), + CFSTR("keychain-access-groups"), + CFSTR("com.apple.security.application-groups"), // app groups are keychain access groups too + }; + bool found = false; + for (CFStringRef name : names) { + CFTypeRef value = SecTaskCopyValueForEntitlement(task, name, nullptr); + if (value) { + CFRelease(value); + found = true; + break; + } + } + CFRelease(task); + return found; +} +#endif + +bool isDataProtectionKeychainAvailable() +{ +#if defined(Q_OS_MACOS) + if (s_dataProtectionKeychainMissingEntitlement.load()) { + return false; + } + if (@available(macOS 10.15, *)) { + // Thread-safe one-time initialization (jobs run on a global dispatch queue) + static const bool hasEntitlement = [] { + const bool result = hasKeychainAccessGroupEntitlement(); + if (!result) { + qDebug("QtKeychain: The application has no keychain access group entitlement " + "(e.g. no application identifier); using the file-based keychain."); + } + return result; + }(); + return hasEntitlement; + } +#endif + return false; +} + +// Returns true (and remembers it) if @p status indicates that the data protection keychain +// cannot be used by this process. +bool handleMissingEntitlement(OSStatus status) +{ + if (status != errSecMissingEntitlement) { + return false; + } + if (!s_dataProtectionKeychainMissingEntitlement.exchange(true)) { + qDebug("QtKeychain: The data protection keychain is not available (missing entitlement, " + "e.g. the application is not signed with an application identifier). " + "Falling back to the file-based keychain."); + } + return true; +} + +bool isRealError(OSStatus status) +{ + return status != errSecSuccess && status != errSecItemNotFound; +} + +// Returns an autoreleased dictionary. +NSMutableDictionary *createQuery(const QString &service, const QString &key, KeychainKind kind) +{ + NSMutableDictionary *const query = [NSMutableDictionary dictionaryWithDictionary:@{ + (__bridge NSString *)kSecClass : (__bridge NSString *)kSecClassGenericPassword, + (__bridge NSString *)kSecAttrService : service.toNSString(), + (__bridge NSString *)kSecAttrAccount : key.toNSString(), + }]; + +#if defined(Q_OS_MACOS) + if (@available(macOS 10.15, *)) { + // Be explicit for the legacy keychain as well (@NO is the documented default) + query[(__bridge NSString *)kSecUseDataProtectionKeychain] = + kind == KeychainKind::DataProtection ? @YES : @NO; + } +#else + Q_UNUSED(kind) +#endif + + return query; +} + +OSStatus readItem(const QString &service, const QString &key, KeychainKind kind, + QByteArray *data) +{ + NSMutableDictionary *const query = createQuery(service, key, kind); + query[(__bridge NSString *)kSecReturnData] = @YES; + + CFTypeRef dataRef = nullptr; + const OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &dataRef); + + data->clear(); + if (status == errSecSuccess && dataRef) { + *data = QByteArray::fromNSData((__bridge NSData *)dataRef); + } + if (dataRef) { + CFRelease(dataRef); + } + return status; +} + +OSStatus writeItem(const QString &service, const QString &key, KeychainKind kind, + const QByteArray &data) +{ + NSMutableDictionary *const query = createQuery(service, key, kind); + NSDictionary *const update = @{ + (__bridge NSString *)kSecValueData : data.toNSData(), + }; + + OSStatus status = + SecItemUpdate((__bridge CFDictionaryRef)query, (__bridge CFDictionaryRef)update); + + if (status == errSecItemNotFound) { + query[(__bridge NSString *)kSecValueData] = data.toNSData(); + status = SecItemAdd((__bridge CFDictionaryRef)query, nullptr); + } + + return status; +} + +OSStatus deleteItem(const QString &service, const QString &key, KeychainKind kind) +{ + NSMutableDictionary *const query = createQuery(service, key, kind); + return SecItemDelete((__bridge CFDictionaryRef)query); +} + +// Removes a legacy entry after it was successfully written to the data protection keychain. +// Failure is not fatal for the job, as the data protection keychain entry takes precedence. +void deleteLegacyItem(const QString &service, const QString &key) +{ + const OSStatus status = deleteItem(service, key, KeychainKind::Default); + if (isRealError(status)) { + qWarning("QtKeychain: Could not remove entry from the file-based keychain (OSStatus %d)", + static_cast<int>(status)); + } +} + +// Copies an entry found in the legacy keychain into the data protection keychain and +// removes the legacy entry. Failure is not fatal for the read job. +void migrateToDataProtectionKeychain(const QString &service, const QString &key, + const QByteArray &data) +{ + const OSStatus status = writeItem(service, key, KeychainKind::DataProtection, data); + if (status == errSecSuccess) { + deleteLegacyItem(service, key); + } else if (!handleMissingEntitlement(status)) { + qWarning("QtKeychain: Could not migrate entry to the data protection keychain " + "(OSStatus %d)", + static_cast<int>(status)); + } +} + +bool useDataProtectionKeychain(MacOSKeychainPreference preference) +{ + return preference != MacOSKeychainPreference::LegacyKeychain + && isDataProtectionKeychainAvailable(); +} + +bool useLegacyFallback(MacOSKeychainPreference preference) +{ + return preference == MacOSKeychainPreference::DataProtectionKeychainWithLegacyFallback; +} + +OSStatus readPassword(const QString &service, const QString &key, + MacOSKeychainPreference preference, QByteArray *data) +{ + if (!useDataProtectionKeychain(preference)) { + return readItem(service, key, KeychainKind::Default, data); + } + + const OSStatus status = readItem(service, key, KeychainKind::DataProtection, data); + + if (handleMissingEntitlement(status)) { + return readItem(service, key, KeychainKind::Default, data); + } + + if (status == errSecItemNotFound && useLegacyFallback(preference)) { + const OSStatus legacyStatus = readItem(service, key, KeychainKind::Default, data); + if (legacyStatus == errSecSuccess) { + migrateToDataProtectionKeychain(service, key, *data); + } + return legacyStatus; + } + + return status; +} + +OSStatus writePassword(const QString &service, const QString &key, + MacOSKeychainPreference preference, const QByteArray &data) +{ + if (!useDataProtectionKeychain(preference)) { + return writeItem(service, key, KeychainKind::Default, data); + } + + const OSStatus status = writeItem(service, key, KeychainKind::DataProtection, data); + + if (handleMissingEntitlement(status)) { + return writeItem(service, key, KeychainKind::Default, data); + } + + if (status == errSecSuccess && useLegacyFallback(preference)) { + // Otherwise a stale legacy entry would be returned again after deletion + deleteLegacyItem(service, key); + } + + return status; +} + +OSStatus deletePassword(const QString &service, const QString &key, + MacOSKeychainPreference preference) +{ + if (!useDataProtectionKeychain(preference)) { + return deleteItem(service, key, KeychainKind::Default); + } + + const OSStatus status = deleteItem(service, key, KeychainKind::DataProtection); + + if (handleMissingEntitlement(status)) { + return deleteItem(service, key, KeychainKind::Default); + } + + if (!useLegacyFallback(preference)) { + return status; + } + + const OSStatus legacyStatus = deleteItem(service, key, KeychainKind::Default); + + // Report real errors first (an entry left behind would be found again on read), then + // success if the entry existed in either keychain, else errSecItemNotFound. + if (isRealError(status)) { + return status; + } + if (isRealError(legacyStatus)) { + return legacyStatus; + } + if (status == errSecSuccess || legacyStatus == errSecSuccess) { + return errSecSuccess; + } + return errSecItemNotFound; +} + +} // namespace + static void StartReadPassword(const QString &service, const QString &key, + MacOSKeychainPreference preference, AppleKeychainInterface *const interface) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ - NSDictionary *const query = @{ - (__bridge NSString *)kSecClass : (__bridge NSString *)kSecClassGenericPassword, - (__bridge NSString *)kSecAttrService : service.toNSString(), - (__bridge NSString *)kSecAttrAccount : key.toNSString(), - (__bridge NSString *)kSecReturnData : @YES, - }; - - CFTypeRef dataRef = nil; - const OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &dataRef); - - if (status == errSecSuccess) { - const CFDataRef castedDataRef = (CFDataRef)dataRef; - NSData *const data = (__bridge NSData *)castedDataRef; - dispatch_async(dispatch_get_main_queue(), ^{ - [interface keychainReadTaskFinished:data]; - [interface release]; - }); - } else { - NSString *const descriptiveErrorString = - @"Could not retrieve private key from keystore"; - dispatch_async(dispatch_get_main_queue(), ^{ - [interface keychainTaskFinishedWithError:status - descriptiveMessage:descriptiveErrorString]; - [interface release]; - }); - } - - if (dataRef) { - CFRelease(dataRef); + @autoreleasepool { + QByteArray data; + const OSStatus status = readPassword(service, key, preference, &data); + + if (status == errSecSuccess) { + dispatchOnQtMainThread(interface, ^{ + [interface keychainReadTaskFinished:data]; + [interface release]; + }); + } else { + NSString *const descriptiveErrorString = + @"Could not retrieve private key from keystore"; + dispatchOnQtMainThread(interface, ^{ + [interface keychainTaskFinishedWithError:status + descriptiveMessage:descriptiveErrorString]; + [interface release]; + }); + } } }); } static void StartWritePassword(const QString &service, const QString &key, const QByteArray &data, + MacOSKeychainPreference preference, AppleKeychainInterface *const interface) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ - NSDictionary *const query = @{ - (__bridge NSString *)kSecClass : (__bridge NSString *)kSecClassGenericPassword, - (__bridge NSString *)kSecAttrService : service.toNSString(), - (__bridge NSString *)kSecAttrAccount : key.toNSString(), - }; - - OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, nil); - - if (status == errSecSuccess) { - NSDictionary *const update = @{ - (__bridge NSString *)kSecValueData : data.toNSData(), - }; - - status = SecItemUpdate((__bridge CFDictionaryRef)query, - (__bridge CFDictionaryRef)update); - } else { - NSDictionary *const insert = @{ - (__bridge NSString *)kSecClass : (__bridge NSString *)kSecClassGenericPassword, - (__bridge NSString *)kSecAttrService : service.toNSString(), - (__bridge NSString *)kSecAttrAccount : key.toNSString(), - (__bridge NSString *)kSecValueData : data.toNSData(), - }; + @autoreleasepool { + const OSStatus status = writePassword(service, key, preference, data); - status = SecItemAdd((__bridge const CFDictionaryRef)insert, nil); - } - - if (status == errSecSuccess) { - dispatch_async(dispatch_get_main_queue(), ^{ - [interface keychainTaskFinished]; - [interface release]; - }); - } else { - NSString *const descriptiveErrorString = @"Could not store data in settings"; - - dispatch_async(dispatch_get_main_queue(), ^{ - [interface keychainTaskFinishedWithError:status - descriptiveMessage:descriptiveErrorString]; - [interface release]; - }); + if (status == errSecSuccess) { + dispatchOnQtMainThread(interface, ^{ + [interface keychainTaskFinished]; + [interface release]; + }); + } else { + NSString *const descriptiveErrorString = @"Could not store data in settings"; + + dispatchOnQtMainThread(interface, ^{ + [interface keychainTaskFinishedWithError:status + descriptiveMessage:descriptiveErrorString]; + [interface release]; + }); + } } }); } static void StartDeletePassword(const QString &service, const QString &key, + MacOSKeychainPreference preference, AppleKeychainInterface *const interface) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ - NSDictionary *const query = @{ - (__bridge NSString *)kSecClass : (__bridge NSString *)kSecClassGenericPassword, - (__bridge NSString *)kSecAttrService : service.toNSString(), - (__bridge NSString *)kSecAttrAccount : key.toNSString(), - }; - - const OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query); - - if (status == errSecSuccess) { - dispatch_async(dispatch_get_main_queue(), ^{ - [interface keychainTaskFinished]; - [interface release]; - }); - } else { - NSString *const descriptiveErrorString = @"Could not remove private key from keystore"; - dispatch_async(dispatch_get_main_queue(), ^{ - [interface keychainTaskFinishedWithError:status - descriptiveMessage:descriptiveErrorString]; - [interface release]; - }); + @autoreleasepool { + const OSStatus status = deletePassword(service, key, preference); + + if (status == errSecSuccess) { + dispatchOnQtMainThread(interface, ^{ + [interface keychainTaskFinished]; + [interface release]; + }); + } else { + NSString *const descriptiveErrorString = + @"Could not remove private key from keystore"; + dispatchOnQtMainThread(interface, ^{ + [interface keychainTaskFinishedWithError:status + descriptiveMessage:descriptiveErrorString]; + [interface release]; + }); + } } }); } @@ -268,21 +543,21 @@ { AppleKeychainInterface *const interface = [[AppleKeychainInterface alloc] initWithJob:q andPrivateJob:this]; - StartReadPassword(service, key, interface); + StartReadPassword(service, key, macOSKeychainPreference, interface); } void WritePasswordJobPrivate::scheduledStart() { AppleKeychainInterface *const interface = [[AppleKeychainInterface alloc] initWithJob:q andPrivateJob:this]; - StartWritePassword(service, key, data, interface); + StartWritePassword(service, key, data, macOSKeychainPreference, interface); } void DeletePasswordJobPrivate::scheduledStart() { AppleKeychainInterface *const interface = [[AppleKeychainInterface alloc] initWithJob:q andPrivateJob:this]; - StartDeletePassword(service, key, interface); + StartDeletePassword(service, key, macOSKeychainPreference, interface); } bool QKeychain::isAvailable() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/keychain_p.h new/qtkeychain-0.18.0/qtkeychain/keychain_p.h --- old/qtkeychain-0.17.0/qtkeychain/keychain_p.h 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/keychain_p.h 2026-11-10 15:30:45.000000000 +0100 @@ -75,6 +75,7 @@ QString service; bool autoDelete; bool insecureFallback; + MacOSKeychainPreference macOSKeychainPreference; QPointer<QSettings> settings; QString key; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/keychain_unix.cpp new/qtkeychain-0.18.0/qtkeychain/keychain_unix.cpp --- old/qtkeychain-0.17.0/qtkeychain/keychain_unix.cpp 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/keychain_unix.cpp 2026-11-10 15:30:45.000000000 +0100 @@ -96,14 +96,25 @@ if (!QDBusConnection::sessionBus().isConnected()) return false; - org::kde::KWallet iface(QLatin1String(dbusIface), QLatin1String(dbusPath), - QDBusConnection::sessionBus()); - - // At this point iface.isValid() can return false even though the - // interface is activatable by making a call. Hence we check whether - // a wallet can be opened. - - QDBusMessage reply = iface.call(QLatin1String("networkWallet")); + // At this point a QDBusInterface for the service can report isValid() == + // false even though the service is activatable, so we have to make a call + // to find out. org.freedesktop.DBus.Peer.Ping is answered by the QtDBus + // layer inside kwalletd before its application code sees it, and it still + // triggers D-Bus activation, so it tells us the service exists without + // waiting on anything kwalletd is busy with. + // + // Calling an application-level method here instead - networkWallet() - is + // what caused the freeze: while kwalletd has an unlock dialog on screen for + // any client, it stops answering application-level calls, so the reply is + // deferred for the full D-Bus timeout. Since this function runs a blocking + // call, usually on the GUI thread, that froze the whole application for 25 + // seconds. Measured on Kubuntu 26.10, kwalletd 4:26.08.0-0ubuntu1: + // networkWallet took 25301 ms to fail with NoReply on the default timeout, + // while Peer.Ping answered in under a millisecond. + const QDBusMessage ping = QDBusMessage::createMethodCall( + QLatin1String(dbusIface), QLatin1String(dbusPath), + QStringLiteral("org.freedesktop.DBus.Peer"), QStringLiteral("Ping")); + const QDBusMessage reply = QDBusConnection::sessionBus().call(ping); return reply.type() == QDBusMessage::ReplyMessage; } @@ -258,6 +269,11 @@ // This allows to wait for user to unlock wallet, e.g. at Plasma startup iface->setTimeout(0x7FFFFFFF); + if (!reply.isValid()) { + q->emitFinishedWithError(OtherError, reply.error().message()); + return; + } + const QDBusPendingReply<int> pendingReply = iface->open(reply.value(), 0, q->service()); auto pendingWatcher = new QDBusPendingCallWatcher(pendingReply, this); connect(pendingWatcher, &QDBusPendingCallWatcher::finished, this, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/keychain_win.cpp new/qtkeychain-0.18.0/qtkeychain/keychain_win.cpp --- old/qtkeychain-0.17.0/qtkeychain/keychain_win.cpp 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/keychain_win.cpp 2026-11-10 15:30:45.000000000 +0100 @@ -140,19 +140,18 @@ struct CredentialDeleter { - explicit CredentialDeleter(PCREDENTIALW cred) : m_cred(cred) { } + explicit CredentialDeleter(PCREDENTIALW &cred) : m_cred(cred) { } ~CredentialDeleter() { if (m_cred) { CredFree(m_cred); } } - PCREDENTIALW m_cred; + PCREDENTIALW &m_cred; }; static Error credRead(const QString& target, PCREDENTIALW &cred) { if (!CredReadW(reinterpret_cast<const wchar_t *>(target.utf16()), CRED_TYPE_GENERIC, 0, &cred)) { - Error err; switch (GetLastError()) { case ERROR_NOT_FOUND: return EntryNotFound; @@ -184,20 +183,8 @@ err = credRead(key, cred); } if (err != NoError) { - Error err; - QString msg; - switch (GetLastError()) { - case ERROR_NOT_FOUND: - err = EntryNotFound; - msg = tr("Password entry not found"); - break; - default: - err = OtherError; - msg = tr("Could not decrypt data"); - break; - } - - q->emitFinishedWithError(err, msg); + q->emitFinishedWithError(err, err == EntryNotFound ? tr("Password entry not found") + : tr("Could not decrypt data")); return; } @@ -292,7 +279,6 @@ // Found empirically on Win10 1803 build 17134.523. if (err == RPC_S_INVALID_BOUND) { const QString::size_type maxTargetName = CRED_MAX_GENERIC_TARGET_NAME_LENGTH; - const auto& target = targetName(service, key); if (target.size() > maxTargetName) { q->emitFinishedWithError( OtherError, tr("Credential key exceeds maximum size of %1").arg(maxTargetName)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtkeychain-0.17.0/qtkeychain/libsecret.cpp new/qtkeychain-0.18.0/qtkeychain/libsecret.cpp --- old/qtkeychain-0.17.0/qtkeychain/libsecret.cpp 2026-07-06 12:51:54.000000000 +0200 +++ new/qtkeychain-0.18.0/qtkeychain/libsecret.cpp 2026-11-10 15:30:45.000000000 +0100 @@ -38,6 +38,10 @@ GAsyncReadyCallback callback, gpointer user_data, ...) G_GNUC_NULL_TERMINATED; typedef gboolean (*secret_password_clear_finish_t)(GAsyncResult *result, GError **error); +typedef void (*secret_password_search_t)(const SecretSchema *schema, SecretSearchFlags flags, + GCancellable *cancellable, GAsyncReadyCallback callback, + gpointer user_data, ...) G_GNUC_NULL_TERMINATED; +typedef GList *(*secret_password_search_finish_t)(GAsyncResult *result, GError **error); typedef void (*secret_password_free_t)(gchar *password); typedef GQuark (*secret_error_get_quark_t)(void) G_GNUC_CONST; @@ -47,6 +51,8 @@ static secret_password_store_finish_t secret_password_store_finish_fn = nullptr; static secret_password_clear_t secret_password_clear_fn = nullptr; static secret_password_clear_finish_t secret_password_clear_finish_fn = nullptr; +static secret_password_search_t secret_password_search_fn = nullptr; +static secret_password_search_finish_t secret_password_search_finish_fn = nullptr; static secret_password_free_t secret_password_free_fn = nullptr; static secret_error_get_quark_t secret_error_get_quark_fn = nullptr; @@ -149,8 +155,10 @@ if (self) { if (error) { self->q->emitFinishedWithError(gerrorToCode(error), QString::fromUtf8(error->message)); + } else if (!removed) { + self->q->emitFinishedWithError(QKeychain::CouldNotDeleteEntry, + QObject::tr("No matching unlocked entry was deleted")); } else { - Q_UNUSED(removed); self->q->emitFinished(); } } @@ -159,6 +167,29 @@ } } +static void on_password_delete_search(GObject *source, GAsyncResult *result, gpointer inst) +{ + callbackArg *arg = static_cast<callbackArg *>(inst); + GError *error = nullptr; + GList *matches = secret_password_search_finish_fn(result, &error); + + Q_UNUSED(source); + if (error) { + arg->self->q->emitFinishedWithError(gerrorToCode(error), QString::fromUtf8(error->message)); + g_error_free(error); + } else if (!matches) { + arg->self->q->emitFinishedWithError(QKeychain::EntryNotFound, + QObject::tr("Entry not found")); + } else { + secret_password_clear_fn(qtkeychainSchema(), nullptr, on_password_cleared, arg->self, + "user", arg->user.toUtf8().constData(), + "server", arg->server.toUtf8().constData(), nullptr); + } + + g_list_free_full(matches, g_object_unref); + delete arg; +} + static QString modeToString(QKeychain::JobPrivate::Mode mode) { switch (mode) { @@ -270,9 +301,24 @@ return false; } - secret_password_clear_fn(qtkeychainSchema(), nullptr, on_password_cleared, self, "user", - key.toUtf8().constData(), "server", service.toUtf8().constData(), - nullptr); + if (secret_password_search_fn != nullptr && secret_password_search_finish_fn != nullptr) { + callbackArg *arg = new callbackArg; + arg->self = self; + arg->user = key; + arg->server = service; + secret_password_search_fn(qtkeychainSchema(), + static_cast<SecretSearchFlags>(SECRET_SEARCH_ALL + | SECRET_SEARCH_UNLOCK), + nullptr, on_password_delete_search, arg, "user", + key.toUtf8().constData(), "server", + service.toUtf8().constData(), nullptr); + } else { + // libsecret < 0.19 has no secret_password_search(). Clear directly; locked + // entries are then reported as CouldNotDeleteEntry by on_password_cleared(). + secret_password_clear_fn(qtkeychainSchema(), nullptr, on_password_cleared, self, "user", + key.toUtf8().constData(), "server", + service.toUtf8().constData(), nullptr); + } return true; #else Q_UNUSED(key) @@ -295,6 +341,9 @@ secret_password_clear_fn = (secret_password_clear_t)resolve("secret_password_clear"); secret_password_clear_finish_fn = (secret_password_clear_finish_t)resolve("secret_password_clear_finish"); + secret_password_search_fn = (secret_password_search_t)resolve("secret_password_search"); + secret_password_search_finish_fn = + (secret_password_search_finish_t)resolve("secret_password_search_finish"); secret_password_free_fn = (secret_password_free_t)resolve("secret_password_free"); secret_error_get_quark_fn = (secret_error_get_quark_t)resolve("secret_error_get_quark"); }
