From b9ff88c722296c68c3d1edae244dd20c4eacf706 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Fri, 9 Jun 2023 23:38:52 +0200 Subject: [PATCH] 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. --- cups/http-support.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 ++; -- 2.47.2