From: Volker Lendecke Date: Sun, 5 Jan 2020 13:11:54 +0000 (+0100) Subject: ntlm_auth: Add type-safety instead of a simple cast X-Git-Tag: ldb-2.1.0~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b95ea37cb3d080f22d5c748364dd3b233b76e50;p=thirdparty%2Fsamba.git ntlm_auth: Add type-safety instead of a simple cast Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index d0a2c713fc0..7f8d2688978 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -1481,7 +1481,14 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, } if (*private1) { - state = (struct gensec_ntlm_state *)*private1; + state = talloc_get_type(*private1, struct gensec_ntlm_state); + if (state == NULL) { + DBG_WARNING("*private1 is of type %s\n", + talloc_get_name(*private1)); + printf("BH *private1 is of type %s\n", + talloc_get_name(*private1)); + exit(1); + } } else { state = talloc_zero(NULL, struct gensec_ntlm_state); if (!state) {