]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ntlm_auth: Add type-safety instead of a simple cast
authorVolker Lendecke <vl@samba.org>
Sun, 5 Jan 2020 13:11:54 +0000 (14:11 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 9 Jan 2020 18:55:36 +0000 (18:55 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/utils/ntlm_auth.c

index d0a2c713fc0766bd35dc177a0c9cf765fdc5ce77..7f8d2688978d7d4a644c636a56f3e98b420761b7 100644 (file)
@@ -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) {