Bug#516543: lt-sample-client: Decoding data from base64: bad protocol / cancel
Peter Eisentraut
petere at debian.org
Sun Feb 22 08:39:44 UTC 2009
Package: sasl2-bin
Version: 2.1.22.dfsg1-23
Severity: normal
Tags: patch
Playing around with the sasl-sample-client/sasl-sample-server, I always get
this:
$ ./sample-client -s test
service=test
Waiting for mechanism list from server...
S: Q1JBTS1NRDUgTE9HSU4gRElHRVNULU1ENSBOVExNIFBMQUlOIEFOT05ZTU9VUw==
lt-sample-client: Decoding data from base64: bad protocol / cancel
A similar report can be found here:
https://answers.launchpad.net/ubuntu/+source/cyrus-sasl2/+question/60325
The problem turns out to be that the newline at the end of the base64-encoded
string needs to be stripped off before the string is passed to the decoding
routine. According to Debian bug #400955, this was at some point made more
strict, so it probably worked in an earlier version, but it doesn't anymore.
A simple fix is to change the following lines, identical in sample-server.c
and sample-client.c, from
result = sasl_decode64(buf + 3, (unsigned) strlen(buf + 3), buf,
SAMPLE_SEC_BUF_SIZE, &len);
to
result = sasl_decode64(buf + 3, (unsigned) strlen(buf + 3) - 1, buf,
SAMPLE_SEC_BUF_SIZE, &len);
This assumes that the string always contains a trailing newline, which is
technically not guaranteed, but should be unlikely. (The input buf comes from
fgets().)
With this fix, I could get sasl-sample-client/sasl-sample-server working.
More information about the Pkg-cyrus-sasl2-debian-devel
mailing list