From: Andrew Bartlett Date: Mon, 4 Mar 2024 01:27:19 +0000 (+1300) Subject: lib/ldb-samba: Align py_ldb_set_opaque_integer() with pyldb_set_opaque() and use... X-Git-Tag: tdb-1.4.11~1524 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=416b6c5a03d4fa9d55decc1de6a9ab409fa045f0;p=thirdparty%2Fsamba.git lib/ldb-samba: Align py_ldb_set_opaque_integer() with pyldb_set_opaque() and use "unsigned long long" We need to change the internal types assumed in Samba for the opaque integers to "unsigned long long" as this is what ldb.set_opaque() will create, and we want to move to this interface rather than have a duplicate. Signed-off-by: Andrew Bartlett Reviewed-by: Jo Sutton --- diff --git a/lib/ldb-samba/pyldb.c b/lib/ldb-samba/pyldb.c index 2241abc01df..fe6f44b57ca 100644 --- a/lib/ldb-samba/pyldb.c +++ b/lib/ldb-samba/pyldb.c @@ -95,7 +95,7 @@ static PyObject *py_ldb_set_credentials(PyObject *self, PyObject *args) static PyObject *py_ldb_set_opaque_integer(PyObject *self, PyObject *args) { int value; - int *old_val, *new_val; + unsigned long long *old_val, *new_val; char *py_opaque_name, *opaque_name_talloc; struct ldb_context *ldb; int ret; @@ -107,7 +107,7 @@ static PyObject *py_ldb_set_opaque_integer(PyObject *self, PyObject *args) ldb = pyldb_Ldb_AS_LDBCONTEXT(self); /* see if we have a cached copy */ - old_val = (int *)ldb_get_opaque(ldb, py_opaque_name); + old_val = (unsigned long long *)ldb_get_opaque(ldb, py_opaque_name); /* XXX: We shouldn't just blindly assume that the value that is * already present has the size of an int and is not shared * with other code that may rely on it not changing. @@ -124,7 +124,7 @@ static PyObject *py_ldb_set_opaque_integer(PyObject *self, PyObject *args) return NULL; } - new_val = talloc(tmp_ctx, int); + new_val = talloc(tmp_ctx, unsigned long long); if (new_val == NULL) { talloc_free(tmp_ctx); PyErr_NoMemory(); diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index fff0abaedaa..d31d7d94f2d 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -4122,8 +4122,8 @@ const char *samdb_cn_to_lDAPDisplayName(TALLOC_CTX *mem_ctx, const char *cn) */ int dsdb_functional_level(struct ldb_context *ldb) { - int *domainFunctionality = - talloc_get_type(ldb_get_opaque(ldb, "domainFunctionality"), int); + unsigned long long *domainFunctionality = + talloc_get_type(ldb_get_opaque(ldb, "domainFunctionality"), unsigned long long); if (!domainFunctionality) { /* this is expected during initial provision */ DEBUG(4,(__location__ ": WARNING: domainFunctionality not setup\n")); @@ -4137,8 +4137,8 @@ int dsdb_functional_level(struct ldb_context *ldb) */ int dsdb_forest_functional_level(struct ldb_context *ldb) { - int *forestFunctionality = - talloc_get_type(ldb_get_opaque(ldb, "forestFunctionality"), int); + unsigned long long *forestFunctionality = + talloc_get_type(ldb_get_opaque(ldb, "forestFunctionality"), unsigned long long); if (!forestFunctionality) { DEBUG(0,(__location__ ": WARNING: forestFunctionality not setup\n")); return DS_DOMAIN_FUNCTION_2000; @@ -4151,8 +4151,8 @@ int dsdb_forest_functional_level(struct ldb_context *ldb) */ int dsdb_dc_functional_level(struct ldb_context *ldb) { - int *dcFunctionality = - talloc_get_type(ldb_get_opaque(ldb, "domainControllerFunctionality"), int); + unsigned long long *dcFunctionality = + talloc_get_type(ldb_get_opaque(ldb, "domainControllerFunctionality"), unsigned long long); if (!dcFunctionality) { /* this is expected during initial provision */ DEBUG(4,(__location__ ": WARNING: domainControllerFunctionality not setup\n")); @@ -4296,7 +4296,7 @@ int dsdb_check_and_update_fl(struct ldb_context *ldb_ctx, struct loadparm_contex * will not re-read the DB */ { - int *val = talloc(ldb_ctx, int); + unsigned long long *val = talloc(ldb_ctx, unsigned long long); if (!val) { TALLOC_FREE(frame); return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 7aec0063c96..57098f0a8b7 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -7644,10 +7644,10 @@ static int replmd_allow_missing_target(struct ldb_module *module, * replication is completed, so failing now would just * trigger errors, rather than trigger a GET_TGT */ - int *finished_full_join_ptr = + unsigned long long *finished_full_join_ptr = talloc_get_type(ldb_get_opaque(ldb, DSDB_FULL_JOIN_REPLICATION_COMPLETED_OPAQUE_NAME), - int); + unsigned long long); bool finished_full_join = finished_full_join_ptr && *finished_full_join_ptr; /* diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index d80d2af485c..7541a2cf376 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -234,7 +234,7 @@ static int rootdse_add_dynamic(struct rootdse_context *ac, struct ldb_message *m const char * const *attrs = ac->req->op.search.attrs; const char **server_sasl = NULL; const struct dsdb_schema *schema; - int *val; + unsigned long long *val; struct ldb_control *edn_control; const char *dn_attrs[] = { "configurationNamingContext", @@ -452,7 +452,7 @@ static int rootdse_add_dynamic(struct rootdse_context *ac, struct ldb_message *m } if (do_attribute(attrs, "domainControllerFunctionality") - && (val = talloc_get_type(ldb_get_opaque(ldb, "domainControllerFunctionality"), int))) { + && (val = talloc_get_type(ldb_get_opaque(ldb, "domainControllerFunctionality"), unsigned long long))) { if (samdb_msg_add_int(ldb, msg, msg, "domainControllerFunctionality", *val) != LDB_SUCCESS) { @@ -1039,7 +1039,8 @@ static int rootdse_init(struct ldb_module *module) = ldb_msg_find_attr_as_int(res->msgs[0], "msDS-Behavior-Version", -1); if (domain_behaviour_version != -1) { - int *val = talloc(ldb, int); + unsigned long long *val + = talloc(ldb, unsigned long long); if (!val) { talloc_free(mem_ctx); return ldb_oom(ldb); @@ -1064,7 +1065,8 @@ static int rootdse_init(struct ldb_module *module) = ldb_msg_find_attr_as_int(res->msgs[0], "msDS-Behavior-Version", -1); if (forest_behaviour_version != -1) { - int *val = talloc(ldb, int); + unsigned long long *val + = talloc(ldb, unsigned long long); if (!val) { talloc_free(mem_ctx); return ldb_oom(ldb); @@ -1107,7 +1109,8 @@ static int rootdse_init(struct ldb_module *module) = ldb_msg_find_attr_as_int(res->msgs[0], "msDS-Behavior-Version", -1); if (domain_controller_behaviour_version != -1) { - int *val = talloc(ldb, int); + unsigned long long *val + = talloc(ldb, unsigned long long); if (!val) { talloc_free(mem_ctx); return ldb_oom(ldb);