From: Till Kamppeter Date: Fri, 9 Jun 2023 21:38:52 +0000 (+0200) Subject: Regression: Locally saved certificates corrupted X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9ff88c722296c68c3d1edae244dd20c4eacf706;p=thirdparty%2Fcups.git Regression: Locally saved certificates corrupted Base-64-encoding, via the httpEncode64_2() function, used to save printer/server certificates in files, got broken in commit a521b235a1ab, ending up with corrupted files not readable when loading them again and so the certificates of network printers do not get trusted when a previous copy of them gets loaded from the file. So the first job prints (no certificate file yet, certificate loaded from printer) and every subsequent job does not print, as the printer's certificate does not match the one loaded from the file. This commit undoes the changes which got applied to the httpEncode64_2() function to make the certificates correctly encoded again. --- diff --git a/cups/http-support.c b/cups/http-support.c index f92bcba480..d9c5945ed9 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -729,7 +729,7 @@ httpEncode64_2(char *out, /* I - String to write to */ if (inlen > 1) *outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63]; else - *outptr ++ = base64[(in[0] << 4) & 63]; + *outptr ++ = base64[((in[0] & 255) << 4) & 63]; } in ++; @@ -746,9 +746,9 @@ httpEncode64_2(char *out, /* I - String to write to */ if (outptr < outend) { if (inlen > 1) - *outptr ++ = base64[((in[0] << 2) | (in[1] >> 6)) & 63]; + *outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63]; else - *outptr ++ = base64[(in[0] << 2) & 63]; + *outptr ++ = base64[((in[0] & 255) << 2) & 63]; } in ++;