dsdb: check type with talloc_get_type_abort in samdb_set_password
authorAndrew Bartlett <abartlet@samba.org>
Mon, 2 Dec 2013 02:44:37 +0000 (15:44 +1300)
committerStefan Metzmacher <metze@samba.org>
Wed, 2 Apr 2014 15:12:47 +0000 (17:12 +0200)
Change-Id: Ie5b534c70dd87ecf58d6a830e38750ecf16eb855
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/common/util.c

index 1bb2fce7e583e25fdaa92663af82074d8c62259f..9dbdbdd7b29cf4cc466a914be1001ad4ff9491fb 100644 (file)
@@ -2153,8 +2153,11 @@ NTSTATUS samdb_set_password(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
        ret = dsdb_autotransaction_request(ldb, req);
 
        if (req->context != NULL) {
-               pwd_stat = talloc_steal(mem_ctx,
-                                       ((struct ldb_control *)req->context)->data);
+               struct ldb_control *control = talloc_get_type_abort(req->context,
+                                                                   struct ldb_control);
+               pwd_stat = talloc_get_type_abort(control->data,
+                                                struct dsdb_control_password_change_status);
+               talloc_steal(mem_ctx, pwd_stat);
        }
 
        talloc_free(req);