mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
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 <abartlet@samba.org> Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
This commit is contained in:
parent
195c0e0d49
commit
416b6c5a03
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user