aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Weiser <michael.weiser@gmx.de>2019-02-01 11:03:53 +0000
committerMichael Weiser <michael.weiser@gmx.de>2019-02-28 15:10:58 +0000
commit916cfa191e1e5fac30766c9404a56d2f0d31a708 (patch)
treeb15e0dcd987f2ff84a824bf7df8be444c30d2318 /src
parentMerge branch 'master' into 'master' (diff)
downloadlaps-916cfa191e1e5fac30766c9404a56d2f0d31a708.tar.gz
laps-916cfa191e1e5fac30766c9404a56d2f0d31a708.tar.bz2
laps-916cfa191e1e5fac30766c9404a56d2f0d31a708.zip
Handle empty password change timestamp LDAP attribute
If the password change timestamp LDAP attribute is unset, e.g. because the host has been freshly added, the search will return an empty value which will cause an error message from datetime.py: Traceback (most recent call last): File "src/usr/share/laps/dependencies/datetime.py", line 47, in <module> print action(float(timestamp)) ValueError: could not convert string to float: With this change we initialise ts_epoch to zero and leave it at that if the attribute is not set to avoid the error and cause an immediate password change.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/usr/share/laps/laps.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/usr/share/laps/laps.sh b/src/usr/share/laps/laps.sh
index 15280d3..efdf76d 100755
--- a/src/usr/share/laps/laps.sh
+++ b/src/usr/share/laps/laps.sh
@@ -215,8 +215,11 @@ wrapper_get_timestamp_from_ldap() {
___wgtfl_krb5cc_tmpfile="${7}"
ts_filetime="$( get_attrib_from_ldap "${___wgtfl_ldapsearch_bin}" "${___wgtfl_ldapsearch_flags}" "${___wgtfl_ldapsearch_filter}" "${___wgtfl_attrib}" "${___wgtfl_ldapconf}" "${___wgtfl_krb5cc_tmpfile}" )"
- debuglev 3 && ferror "timestamp(FILETIME): ${ts_filetime}"
- ts_epoch="$( "${___wgtfl_datetime_py}" -e "${ts_filetime}" )"
+ ts_epoch=0
+ if test -n "$ts_filetime" ; then
+ debuglev 3 && ferror "timestamp(FILETIME): ${ts_filetime}"
+ ts_epoch="$( "${___wgtfl_datetime_py}" -e "${ts_filetime}" )"
+ fi
debuglev 2 && ferror "timestamp(epoch): ${ts_epoch}"
debuglev 1 && ferror "timestamp(UTC): $( date -u -d "@${ts_epoch}" "+%FT%TZ" )"
bgstack15