pygensec: Don't modify Python bytes objects
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 19 Jul 2021 22:48:41 +0000 (10:48 +1200)
committerJule Anger <janger@samba.org>
Wed, 8 Sep 2021 12:32:10 +0000 (12:32 +0000)
commit25b51c3a287caf5243d2728d4410e40627b25ec5
tree3746bee9ae378881f371b9b5f8e3c352d941eb8f
parenta90933e820c390bfa5dd2d243f27deb7826fa810
pygensec: Don't modify Python bytes objects

gensec_update() and gensec_unwrap() can both modify their input buffers
(for example, during the inplace RRC operation on GSSAPI tokens).
However, buffers obtained from Python bytes objects must not be modified
in any way. Create a copy of the input buffer so the original isn't
modified.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14817
(cherry picked from commit 6818d204897d0b7946dcfbedf79cd53fb9b3f159)
source4/auth/gensec/gensec_gssapi.c
source4/auth/gensec/pygensec.c