Fix the OTP plugin on 32 bit machines and add SHA2 support

Submitted upstream as https://bugzilla.cyrusimap.org/show_bug.cgi?id=3914
This commit is contained in:
manu 2015-11-10 08:46:06 +00:00
parent 7622cab930
commit f4aa70fb11
3 changed files with 35 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.18 2014/02/12 23:18:31 tron Exp $
# $NetBSD: Makefile,v 1.19 2015/11/10 08:46:06 manu Exp $
PKGNAME= ${DISTNAME:S/cyrus-sasl/cy2-otp/}
PKGREVISION= 2
PKGREVISION= 3
COMMENT= Cyrus SASL OTP authentication plugin
SASL_PLUGIN= yes

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.31 2015/11/04 01:17:43 agc Exp $
$NetBSD: distinfo,v 1.32 2015/11/10 08:46:06 manu Exp $
SHA1 (cyrus-sasl-2.1.26.tar.gz) = d6669fb91434192529bd13ee95737a8a5040241c
RMD160 (cyrus-sasl-2.1.26.tar.gz) = 861a06d663cf3da37a198d0f971d99b249b5f4b8
@ -12,6 +12,7 @@ SHA1 (patch-configure) = 473e4bb41d6e5c6ac136288b673880bd123853cf
SHA1 (patch-configure.in) = c1bc731ea44e13943dc3952c46a0e588364c1dc7
SHA1 (patch-include_sasl.h) = 315e9e8236108b49955dbf304a56b17cd028a8d6
SHA1 (patch-libsasl2.pc.in) = ef5679feef7afb12429071020892d88ecd7c43e6
SHA1 (patch-plugins_otp.c) = ac06dcf61f822630c371b7791d9c3014e1bd1e38
SHA1 (patch-saslauthd_Makefile.in) = b7962486aef16ec1e5b27a05a3405d79540f8e20
SHA1 (patch-saslauthd_auth__rimap.c) = cc3e04ae0cf049eeb507df3226a2098528afaaab
SHA1 (patch-saslauthd_md5global.h) = fc200c6aee12bf58877c7a755c121441ebaa1bde

View file

@ -0,0 +1,31 @@
$NetBSD: patch-plugins_otp.c,v 1.1 2015/11/10 08:46:06 manu Exp $
Fix the OTP plugin on 32 bit machines and add SHA2 support
Submitted upstream as https://bugzilla.cyrusimap.org/show_bug.cgi?id=3914
--- plugins/otp.c.orig 2012-10-12 16:05:48.000000000 +0200
+++ plugins/otp.c 2015-11-07 15:19:43.000000000 +0100
@@ -92,8 +92,12 @@
static algorithm_option_t algorithm_options[] = {
{"md4", 0, "md4"},
{"md5", 0, "md5"},
{"sha1", 4, "sha1"},
+ {"sha224", 4, "sha224"},
+ {"sha256", 4, "sha256"},
+ {"sha384", 4, "sha384"},
+ {"sha512", 4, "sha512"},
{NULL, 0, NULL}
};
/* Convert the binary data into ASCII hex */
@@ -675,9 +679,9 @@
SETERROR(utils, "OTP secret too short");
return SASL_FAIL;
}
- sscanf(secret, "%s\t%04d\t%s\t%s\t%020ld",
+ sscanf(secret, "%s\t%04d\t%s\t%s\t%020lu",
alg, seq, seed, buf, timeout);
hex2bin(buf, otp, OTP_HASH_SIZE);