Skip to content

Commit

Permalink
Release 4.3.2
Browse files Browse the repository at this point in the history
Bug fixes:

- Fixed crash on attempt to generate code for touch credential in
  YubiKey Slots mode
- Fixed crash in QR scan
  • Loading branch information
emlun committed Dec 19, 2017
2 parents 3c34b73 + 67a079e commit 8f3939a
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 50 deletions.
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
* Version 4.3.2
** Bugfix: Fixed crash on attempt to generate code for touch credential in YubiKey Slots mode
** Bugfix: Fixed crash in QR scan

* Version 4.3.1
** Bugfix: Removed references to QML Array prototype methods added in Qt 5.9 (unavailable in Ubuntu Zesty and earlier)

* Version 4.3.0
** Now requires ykman version >= 0.5.0
** Feature: New icon
** Feature: Remembered passwords are now shared with ykman.
** Feature: Added option to hide window on launch
*** Thanks to Steven Stallion for contributing!
Expand Down
60 changes: 35 additions & 25 deletions compute-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@
import sys


def promote_commit_distance_to_patch_version(version):
'''If version starts with `X.Y-Z-g*`, and X, Y and Z are numeric, reformat
it to `X.Y.Z-g*`'''
return re.sub(
r'^([0-9]+\.[0-9]+)-([0-9]+)(-g.*)$', r'\1.\2\3',
version
)


def replace_zero_patch_version_with_commit_distance(version):
'''If version starts with `X.Y.0-Z-g*`, and X, Y and Z are numeric,
reformat it to `X.Y.Z-g*`'''
return re.sub(
r'^([0-9]+\.[0-9]+)\.0-([0-9]+)(-g.*)$', r'\1.\2\3',
version
)


def append_missing_patch_version(version):
'''If version is plain `X.Y`, append `.0`'''
return re.sub(
r'^([0-9]+\.[0-9]+)(-dirty)?$', r'\1.0\2',
version
)


def prepend_zero_version_to_raw_commit_id(version):
'''If version is raw abbreviated commit ID, prepend `0.0.0-`'''
return re.sub(
r'^([0-9a-f]{7}(-dirty)?)$', r'0.0.0-\1',
version
)


def compute_version(tag_prefix=None):
git_result = subprocess.run(
['git', 'describe',
Expand All @@ -53,31 +87,7 @@ def compute_version(tag_prefix=None):
# Remove tag prefix
git_version = re.sub(r'^' + tag_prefix, '', git_version)

# If version starts with 'X.Y-Z-g*', and X, Y and Z are numeric, reformat
# it to 'X.Y.Z-g*'
git_version = re.sub(
r'^([0-9]+\.[0-9]+)-([0-9]+)(-g.*)$', r'\1.\2\3',
git_version
)

# If version starts with 'X.Y.0-Z-g*', and X, Y and Z are numeric, reformat
# it to 'X.Y.Z-g*'
git_version = re.sub(
r'^([0-9]+\.[0-9]+)\.0-([0-9]+)(-g.*)$', r'\1.\2\3',
git_version
)

# If version is plain 'X.Y', append '.0'
git_version = re.sub(
r'^([0-9]+\.[0-9]+)(-dirty)?$', r'\1.0\2',
git_version
)

# If version is raw abbreviated commit ID, prepend '0.0.0-'
git_version = re.sub(
r'^([0-9a-f]{7}(-dirty)?)$', r'0.0.0-\1',
git_version
)
git_version = prepend_zero_version_to_raw_commit_id(git_version)

return git_version

Expand Down
18 changes: 16 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
yubioath-desktop (4.3.1-1) xenial; urgency=low
yubioath-desktop (4.3.2-1) xenial; urgency=low

* Build for ppa

-- Emil Lundberg <[email protected]> Sun, 17 Dec 2017 00:42:45 +0100
-- Emil Lundberg <[email protected]> Tue, 19 Dec 2017 16:25:34 +0100


yubioath-desktop (4.3.1-3) xenial; urgency=low

* Tidy up yubikey-manager dependency version constraints

-- Emil Lundberg <[email protected]> Mon, 18 Dec 2017 16:17:26 +0100


yubioath-desktop (4.3.1-2) xenial; urgency=low

* Build for ppa

-- Emil Lundberg <[email protected]> Sun, 17 Dec 2017 15:18:03 +0100
8 changes: 4 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Build-Depends: debhelper (>= 9),
qml-module-io-thp-pyotherside,
qml-module-qt-labs-settings,
libqt5svg5-dev,
yubikey-manager (>= 0.5.0~),
yubikey-manager (< 0.6.0)
yubikey-manager (>= 0.5.0),
yubikey-manager (< 0.6)
Homepage: https://developers.yubico.com/yubioath-desktop/

Package: yubioath-desktop
Architecture: any
Depends: ${misc:Depends},
${shlibs:Depends},
python3-yubikey-manager (>= 0.5.0~),
python3-yubikey-manager (< 0.6.0),
python3-yubikey-manager (>= 0.5.0),
python3-yubikey-manager (< 0.6),
qml-module-io-thp-pyotherside,
qml-module-qtquick-controls,
qml-module-qtquick-dialogs,
Expand Down
28 changes: 14 additions & 14 deletions git-archive-recursive → dev-util/package-sources.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/bin/bash
# Similar to git-archive(1), but recurses into currently checked out submodules.
#
# Usage: git-archive-recursive [ARCHIVE_NAME]
#
# If ARCHIVE_NAME is not given, it defaults to
# "$(basename $(pwd))-$(git rev-parse --short HEAD).tar.gz".
# Similar to git-archive(1), but recurses into currently checked out
# submodules. Also generates a VERSION file, and has some special handling of
# submodules named `qt-solutions`.
#
# NOTE: Submodules' state is not checked. You should ensure that all submodules
# are checked out to the commits specified in .gitmodules .
# are checked out to the commits specified in `.gitmodules`.

PROJECT_NAME="$(basename $(pwd))"
PROJECT_NAME="yubioath-desktop"
TMP_DIR=$(mktemp -d "git-archive-recursive-${PROJECT_NAME}-XXXXXX")
SUBMODULES_DIR="${TMP_DIR}/submodules/"
OUTPUT_DIR="${TMP_DIR}/dist"
Expand All @@ -22,21 +19,28 @@ cleanup() {
die() {
echo "Error occurred - exiting!" >&2
cleanup
exit 1
}

# Exit on error
trap die ERR


version=$(python3 compute-version.py "${PROJECT_NAME}"-)
commit=$(git rev-parse --short HEAD)
archive_name="archive-${commit}.tar.gz"
output_archive_base_name="${1:-${PROJECT_NAME}-${commit}}"
output_archive_base_name="${1:-${PROJECT_NAME}}"
output_archive_dir="${OUTPUT_DIR}/${output_archive_base_name}"
output_archive_name="${output_archive_base_name}.tar.gz"
output_archive_name="${output_archive_base_name}-${version}.tar.gz"

mkdir -p "${SUBMODULES_DIR}"
mkdir -p "${output_archive_dir}"

python3 compute-version.py "${PROJECT_NAME}"- > "${output_archive_dir}/${VERSION_FILE}"
echo "Embedded ${VERSION_FILE} file:"
cat "${output_archive_dir}/${VERSION_FILE}"
echo

# Create sources archive for root repo
git archive "$commit" > "${TMP_DIR}/${archive_name}"
# Unpack sources into output directory
Expand Down Expand Up @@ -64,10 +68,6 @@ for submodule_line in $(git submodule status --recursive); do
fi
done

if [[ -f "${VERSION_FILE}" ]]; then
cp "${VERSION_FILE}" "${output_archive_dir}"
fi

# Bundle all sources together
tar cf "${output_archive_name}" -C "${OUTPUT_DIR}" .

Expand Down
17 changes: 17 additions & 0 deletions dev-util/ppa-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Generate `VERSION` file and run `../scripts/make-ppa`
#
# Command line arguments are passed through to `make-ppa`.

die() {
echo "Error occurred - exiting!" >&2
cleanup
exit 1
}

python3 compute-version.py yubioath-desktop- > VERSION

echo "Version:"
cat VERSION

../scripts/make-ppa "$@"
12 changes: 10 additions & 2 deletions py/yubikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import json
import types
from base64 import b64decode
from base64 import b32encode, b64decode
from binascii import a2b_hex, b2a_hex

from ykman.descriptor import get_descriptors
Expand Down Expand Up @@ -57,6 +57,13 @@ def pair_to_dict(cred, code):
}


def credential_data_to_dict(credentialData):
return {
k: b32encode(v).decode('utf8') if type(v) == bytes else v
for k, v in credentialData.__dict__.items()
}


class Controller(object):
_descriptor = None
_dev_info = {}
Expand Down Expand Up @@ -278,7 +285,8 @@ def parse_qr(self, screenshot):
data = b64decode(screenshot['data'])
image = PixelImage(data, screenshot['width'], screenshot['height'])
for qr in qrparse.parse_qr_codes(image, 2):
return CredentialData.from_uri(qrdecode.decode_qr_data(qr))
return credential_data_to_dict(
CredentialData.from_uri(qrdecode.decode_qr_data(qr)))

def reset(self):
dev = self._descriptor.open_device(TRANSPORT.CCID)
Expand Down
4 changes: 2 additions & 2 deletions qml/YubiKey.qml
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ Python {
})
}

function calculateSlotMode(slot, digits, copyAfterUpdate) {
function calculateSlotMode(slot, digits, copyAfterUpdate, touch) {
var now = Math.floor(Date.now() / 1000)
var margin = entry.credential.touch ? 10 : 0;
var margin = touch ? 10 : 0;
do_call('yubikey.controller.calculate_slot_mode', [slot, digits, now + margin],
function (entry) {
updateSingleCredential(entry.credential, entry.code, copyAfterUpdate)
Expand Down
2 changes: 1 addition & 1 deletion qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ ApplicationWindow {
if (settings.slotMode) {
var slot = getSlot(entry.credential.name)
var digits = getDigits(slot)
device.calculateSlotMode(slot, digits, copyAfterUpdate)
device.calculateSlotMode(slot, digits, copyAfterUpdate, entry.credential.touch)
} else {
device.calculate(entry, copyAfterUpdate)
}
Expand Down

0 comments on commit 8f3939a

Please sign in to comment.