r19489: Change ldb_msg_add_value and ldb_msg_add_empty to take a foruth argument.
authorSimo Sorce <idra@samba.org>
Wed, 25 Oct 2006 01:42:59 +0000 (01:42 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:24:38 +0000 (14:24 -0500)
This is a pointer to an element pointer. If it is not null it will be
filled with the pointer of the manipulated element.
Will avoid double searches on the elements list in some cases.
(This used to be commit 0fa5d4bc225b83e9f63ac6d75bffc4c08eb6b620)

21 files changed:
source4/auth/gensec/schannel_state.c
source4/dsdb/samdb/ldb_modules/local_password.c
source4/dsdb/samdb/ldb_modules/objectguid.c
source4/dsdb/samdb/ldb_modules/password_hash.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/ldb_modules/schema.c
source4/dsdb/samdb/samdb.c
source4/lib/ldb/common/ldb_ldif.c
source4/lib/ldb/common/ldb_msg.c
source4/lib/ldb/include/ldb.h
source4/lib/ldb/modules/ldb_map.c
source4/lib/ldb/modules/ldb_map_inbound.c
source4/lib/ldb/modules/ldb_map_outbound.c
source4/lib/ldb/modules/objectclass.c
source4/lib/ldb/modules/rdn_name.c
source4/lib/ldb/standalone.sh
source4/lib/registry/reg_backend_ldb.c
source4/libnet/libnet_samsync_ldb.c
source4/nbt_server/wins/winsdb.c
source4/param/share_ldb.c
source4/rpc_server/lsa/dcesrv_lsa.c

index 855f159981cccc5fdae1ec8b8b26e5fd8abed046..2f33b12a8df7c3c83adae213d314ce9b97b2bf92 100644 (file)
@@ -109,10 +109,10 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx,
        server_state.length = sizeof(creds->server.data);
 
        ldb_msg_add_string(msg, "objectClass", "schannelState");
        server_state.length = sizeof(creds->server.data);
 
        ldb_msg_add_string(msg, "objectClass", "schannelState");
-       ldb_msg_add_value(msg, "sessionKey", &val);
-       ldb_msg_add_value(msg, "seed", &seed);
-       ldb_msg_add_value(msg, "clientState", &client_state);
-       ldb_msg_add_value(msg, "serverState", &server_state);
+       ldb_msg_add_value(msg, "sessionKey", &val, NULL);
+       ldb_msg_add_value(msg, "seed", &seed, NULL);
+       ldb_msg_add_value(msg, "clientState", &client_state, NULL);
+       ldb_msg_add_value(msg, "serverState", &server_state, NULL);
        ldb_msg_add_string(msg, "negotiateFlags", f);
        ldb_msg_add_string(msg, "secureChannelType", sct);
        ldb_msg_add_string(msg, "accountName", creds->account_name);
        ldb_msg_add_string(msg, "negotiateFlags", f);
        ldb_msg_add_string(msg, "secureChannelType", sct);
        ldb_msg_add_string(msg, "accountName", creds->account_name);
index a19b71a44f0ac96cf112d50bb537a2e11d492d5f..b5cff0272d4d30f447f7411edf9d2860df9c5643 100644 (file)
@@ -498,12 +498,10 @@ static int lpdb_local_search_callback(struct ldb_context *ldb, void *context, st
                                                  ares->message->elements[i].name);
                        if (!el) {
                                if (ldb_msg_add_empty(local_context->remote_res->message, 
                                                  ares->message->elements[i].name);
                        if (!el) {
                                if (ldb_msg_add_empty(local_context->remote_res->message, 
-                                                     ares->message->elements[i].name, 0) != LDB_SUCCESS) {
+                                                     ares->message->elements[i].name, 0, &el) != LDB_SUCCESS) {
                                        talloc_free(ares);
                                        return LDB_ERR_OPERATIONS_ERROR;
                                }
                                        talloc_free(ares);
                                        return LDB_ERR_OPERATIONS_ERROR;
                                }
-                               el = ldb_msg_find_element(local_context->remote_res->message, 
-                                                         ares->message->elements[i].name);
                                *el = ares->message->elements[i];
                        }
                }
                                *el = ares->message->elements[i];
                        }
                }
index 0c4a493adb93ab7544043281336ddeedb2303aed..76413ca56be0aa08abdbd10e3f672ad6a53e3b0c 100644 (file)
@@ -151,7 +151,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       ret = ldb_msg_add_value(msg, "objectGUID", &v);
+       ret = ldb_msg_add_value(msg, "objectGUID", &v, NULL);
        if (ret) {
                talloc_free(down_req);
                return ret;
        if (ret) {
                talloc_free(down_req);
                return ret;
index 9ba7bc44c4be4e4289e4b5a87f8d04575f80dcf6..1b35ec3e8c449e85d78fa3e2844cf799e889eb3a 100644 (file)
@@ -106,10 +106,10 @@ static int add_password_hashes(struct ldb_module *module, struct ldb_message *ms
        }
 
        if (is_mod) {
        }
 
        if (is_mod) {
-               if (ldb_msg_add_empty(msg, "ntPwdHash", LDB_FLAG_MOD_REPLACE) != 0) {
+               if (ldb_msg_add_empty(msg, "ntPwdHash", LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                        return LDB_ERR_OPERATIONS_ERROR;
                }
-               if (ldb_msg_add_empty(msg, "lmPwdHash", LDB_FLAG_MOD_REPLACE) != 0) {
+               if (ldb_msg_add_empty(msg, "lmPwdHash", LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
        }       
                        return LDB_ERR_OPERATIONS_ERROR;
                }
        }       
@@ -250,7 +250,7 @@ static int add_krb5_keys_from_password(struct ldb_module *module, struct ldb_mes
                        hdb_free_keys (smb_krb5_context->krb5_context, num_keys, keys);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                        hdb_free_keys (smb_krb5_context->krb5_context, num_keys, keys);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
-               ret = ldb_msg_add_value(msg, "krb5Key", &val);
+               ret = ldb_msg_add_value(msg, "krb5Key", &val, NULL);
                if (ret != LDB_SUCCESS) {
                        hdb_free_keys (smb_krb5_context->krb5_context, num_keys, keys);
                        return ret;
                if (ret != LDB_SUCCESS) {
                        hdb_free_keys (smb_krb5_context->krb5_context, num_keys, keys);
                        return ret;
@@ -301,7 +301,7 @@ static int add_krb5_keys_from_NThash(struct ldb_module *module, struct ldb_messa
        if (!val.data) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
        if (!val.data) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       if (ldb_msg_add_value(msg, "krb5Key", &val) != 0) {
+       if (ldb_msg_add_value(msg, "krb5Key", &val, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -319,12 +319,12 @@ static int set_pwdLastSet(struct ldb_module *module, struct ldb_message *msg, in
                /* be sure there isn't a 0 value set (eg. coming from the template) */
                ldb_msg_remove_attr(msg, "pwdLastSet");
                /* add */
                /* be sure there isn't a 0 value set (eg. coming from the template) */
                ldb_msg_remove_attr(msg, "pwdLastSet");
                /* add */
-               if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_ADD) != 0) {
+               if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_ADD, NULL) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
        } else {
                /* replace */
                        return LDB_ERR_OPERATIONS_ERROR;
                }
        } else {
                /* replace */
-               if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_REPLACE) != 0) {
+               if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
        }
                        return LDB_ERR_OPERATIONS_ERROR;
                }
        }
@@ -339,7 +339,7 @@ static int set_pwdLastSet(struct ldb_module *module, struct ldb_message *msg, in
 static int add_keyVersionNumber(struct ldb_module *module, struct ldb_message *msg, int previous)
 {
        /* replace or add */
 static int add_keyVersionNumber(struct ldb_module *module, struct ldb_message *msg, int previous)
 {
        /* replace or add */
-       if (ldb_msg_add_empty(msg, "msDS-KeyVersionNumber", LDB_FLAG_MOD_REPLACE) != 0) {
+       if (ldb_msg_add_empty(msg, "msDS-KeyVersionNumber", LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -385,7 +385,7 @@ static int setPwdHistory(struct ldb_module *module, struct ldb_message *msg, str
        } else {
                ZERO_STRUCT(new_nt_history[0]);
        }
        } else {
                ZERO_STRUCT(new_nt_history[0]);
        }
-       if (ldb_msg_add_empty(msg, "sambaNTPwdHistory", LDB_FLAG_MOD_REPLACE) != LDB_SUCCESS) {
+       if (ldb_msg_add_empty(msg, "sambaNTPwdHistory", LDB_FLAG_MOD_REPLACE, NULL) != LDB_SUCCESS) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
        if (samdb_msg_add_hashes(msg, msg, "sambaNTPwdHistory", new_nt_history, nt_hist_len) != LDB_SUCCESS) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
        if (samdb_msg_add_hashes(msg, msg, "sambaNTPwdHistory", new_nt_history, nt_hist_len) != LDB_SUCCESS) {
@@ -408,7 +408,7 @@ static int setPwdHistory(struct ldb_module *module, struct ldb_message *msg, str
        } else {
                ZERO_STRUCT(new_lm_history[0]);
        }
        } else {
                ZERO_STRUCT(new_lm_history[0]);
        }
-       if (ldb_msg_add_empty(msg, "sambaLMPwdHistory", LDB_FLAG_MOD_REPLACE) != LDB_SUCCESS) {
+       if (ldb_msg_add_empty(msg, "sambaLMPwdHistory", LDB_FLAG_MOD_REPLACE, NULL) != LDB_SUCCESS) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
        if (samdb_msg_add_hashes(msg, msg, "sambaLMPwdHistory", new_lm_history, lm_hist_len) != LDB_SUCCESS) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
        if (samdb_msg_add_hashes(msg, msg, "sambaLMPwdHistory", new_lm_history, lm_hist_len) != LDB_SUCCESS) {
@@ -1005,7 +1005,7 @@ static int password_hash_mod_do_mod(struct ldb_handle *h) {
        }
 
        /* we are going to replace the existing krb5key or delete it */
        }
 
        /* we are going to replace the existing krb5key or delete it */
-       if (ldb_msg_add_empty(msg, "krb5key", LDB_FLAG_MOD_REPLACE) != 0) {
+       if (ldb_msg_add_empty(msg, "krb5key", LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
index f589ba859dfec37b3d6d43e3791bed1ec27aea11..fbb5ead537d04246a7076451a66a5ceac3d8c2bc 100644 (file)
@@ -54,7 +54,7 @@ static BOOL samldb_msg_add_sid(struct ldb_module *module, struct ldb_message *ms
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
        }
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
        }
-       return (ldb_msg_add_value(msg, name, &v) == 0);
+       return (ldb_msg_add_value(msg, name, &v, NULL) == 0);
 }
 
 /*
 }
 
 /*
index 87b1d30269c08dc60c576007ce0688c0e15c6c76..fe275ce841622f4901c6e8a863c07ee56e19f810 100644 (file)
@@ -902,7 +902,7 @@ static int schema_add_build_down_req(struct schema_context *sctx)
 
        /* rebuild the objectclass list */
        ldb_msg_remove_attr(msg, "objectClass");
 
        /* rebuild the objectclass list */
        ldb_msg_remove_attr(msg, "objectClass");
-       ret = ldb_msg_add_empty(msg, "objectClass", 0);
+       ret = ldb_msg_add_empty(msg, "objectClass", 0, NULL);
        if (ret != LDB_SUCCESS) {
                return ret;
        }
        if (ret != LDB_SUCCESS) {
                return ret;
        }
index 506c17a5fd26646ee16a166e144849691df62685..5578cdd7d63a6c2c1e49d5c8d6da9b93bf64b8d8 100644 (file)
@@ -773,7 +773,7 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
        }
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
        }
-       return ldb_msg_add_value(msg, attr_name, &v);
+       return ldb_msg_add_value(msg, attr_name, &v, NULL);
 }
 
 
 }
 
 
@@ -785,7 +785,7 @@ int samdb_msg_add_delete(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc
 {
        /* we use an empty replace rather than a delete, as it allows for 
           samdb_replace() to be used everywhere */
 {
        /* we use an empty replace rather than a delete, as it allows for 
           samdb_replace() to be used everywhere */
-       return ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_REPLACE);
+       return ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_REPLACE, NULL);
 }
 
 /*
 }
 
 /*
@@ -890,7 +890,7 @@ int samdb_msg_add_hash(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct
                return -1;
        }
        val.length = 16;
                return -1;
        }
        val.length = 16;
-       return ldb_msg_add_value(msg, attr_name, &val);
+       return ldb_msg_add_value(msg, attr_name, &val, NULL);
 }
 
 /*
 }
 
 /*
@@ -909,7 +909,7 @@ int samdb_msg_add_hashes(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
        for (i=0;i<count;i++) {
                memcpy(i*16 + (char *)val.data, hashes[i].hash, 16);
        }
        for (i=0;i<count;i++) {
                memcpy(i*16 + (char *)val.data, hashes[i].hash, 16);
        }
-       return ldb_msg_add_value(msg, attr_name, &val);
+       return ldb_msg_add_value(msg, attr_name, &val, NULL);
 }
 
 /*
 }
 
 /*
@@ -930,7 +930,7 @@ int samdb_msg_add_logon_hours(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx,
        struct ldb_val val;
        val.length = hours->units_per_week / 8;
        val.data = hours->bits;
        struct ldb_val val;
        val.length = hours->units_per_week / 8;
        val.data = hours->bits;
-       return ldb_msg_add_value(msg, attr_name, &val);
+       return ldb_msg_add_value(msg, attr_name, &val, NULL);
 }
 
 /*
 }
 
 /*
@@ -939,7 +939,7 @@ int samdb_msg_add_logon_hours(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx,
 int samdb_msg_add_value(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
                              const char *attr_name, const struct ldb_val *val)
 {
 int samdb_msg_add_value(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
                              const char *attr_name, const struct ldb_val *val)
 {
-       return ldb_msg_add_value(msg, attr_name, val);
+       return ldb_msg_add_value(msg, attr_name, val, NULL);
 }
 
 /*
 }
 
 /*
@@ -954,7 +954,7 @@ int samdb_msg_set_value(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct
        if (el) {
                el->num_values = 0;
        }
        if (el) {
                el->num_values = 0;
        }
-       return ldb_msg_add_value(msg, attr_name, val);
+       return ldb_msg_add_value(msg, attr_name, val, NULL);
 }
 
 /*
 }
 
 /*
index 4992eb01ad66d9b22b5fcea87ac2713ee1199e6a..135ce9eecd908c3fc13dcc866541c9b8fd26a329 100644 (file)
@@ -613,7 +613,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
                }
 
                if (empty) {
                }
 
                if (empty) {
-                       if (ldb_msg_add_empty(msg, (char *)value.data, flags) != 0) {
+                       if (ldb_msg_add_empty(msg, (char *)value.data, flags, NULL) != 0) {
                                goto failed;
                        }
                        continue;
                                goto failed;
                        }
                        continue;
index 7e001f91807513dfcc74582ce47d28c6ace8bb01..da8ab4994fb50c9c88e2b16688979d50b658a804 100644 (file)
@@ -119,7 +119,10 @@ struct ldb_val ldb_val_dup(void *mem_ctx, const struct ldb_val *v)
 /*
   add an empty element to a message
 */
 /*
   add an empty element to a message
 */
-int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags)
+int ldb_msg_add_empty( struct ldb_message *msg,
+                       const char *attr_name,
+                       int flags,
+                       struct ldb_message_element **return_el)
 {
        struct ldb_message_element *els;
 
 {
        struct ldb_message_element *els;
 
@@ -146,6 +149,10 @@ int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags)
        msg->elements = els;
        msg->num_elements++;
 
        msg->elements = els;
        msg->num_elements++;
 
+       if (return_el) {
+               *return_el = &els[msg->num_elements-1];
+       }
+
        return LDB_SUCCESS;
 }
 
        return LDB_SUCCESS;
 }
 
@@ -156,7 +163,7 @@ int ldb_msg_add(struct ldb_message *msg,
                const struct ldb_message_element *el, 
                int flags)
 {
                const struct ldb_message_element *el, 
                int flags)
 {
-       if (ldb_msg_add_empty(msg, el->name, flags) != 0) {
+       if (ldb_msg_add_empty(msg, el->name, flags, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -171,15 +178,15 @@ int ldb_msg_add(struct ldb_message *msg,
 */
 int ldb_msg_add_value(struct ldb_message *msg, 
                      const char *attr_name,
 */
 int ldb_msg_add_value(struct ldb_message *msg, 
                      const char *attr_name,
-                     const struct ldb_val *val)
+                     const struct ldb_val *val,
+                     struct ldb_message_element **return_el)
 {
        struct ldb_message_element *el;
        struct ldb_val *vals;
 
        el = ldb_msg_find_element(msg, attr_name);
        if (!el) {
 {
        struct ldb_message_element *el;
        struct ldb_val *vals;
 
        el = ldb_msg_find_element(msg, attr_name);
        if (!el) {
-               ldb_msg_add_empty(msg, attr_name, 0);
-               el = ldb_msg_find_element(msg, attr_name);
+               ldb_msg_add_empty(msg, attr_name, 0, &el);
        }
        if (!el) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
        if (!el) {
                return LDB_ERR_OPERATIONS_ERROR;
@@ -194,6 +201,10 @@ int ldb_msg_add_value(struct ldb_message *msg,
        el->values[el->num_values] = *val;
        el->num_values++;
 
        el->values[el->num_values] = *val;
        el->num_values++;
 
+       if (return_el) {
+               *return_el = el;
+       }
+
        return LDB_SUCCESS;
 }
 
        return LDB_SUCCESS;
 }
 
@@ -206,10 +217,10 @@ int ldb_msg_add_steal_value(struct ldb_message *msg,
                            struct ldb_val *val)
 {
        int ret;
                            struct ldb_val *val)
 {
        int ret;
-       ret = ldb_msg_add_value(msg, attr_name, val);
+       struct ldb_message_element *el;
+
+       ret = ldb_msg_add_value(msg, attr_name, val, &el);
        if (ret == LDB_SUCCESS) {
        if (ret == LDB_SUCCESS) {
-               struct ldb_message_element *el;
-               el = ldb_msg_find_element(msg, attr_name);
                talloc_steal(el->values, val->data);
        }
        return ret;
                talloc_steal(el->values, val->data);
        }
        return ret;
@@ -232,7 +243,7 @@ int ldb_msg_add_string(struct ldb_message *msg,
                return LDB_SUCCESS;
        }
 
                return LDB_SUCCESS;
        }
 
-       return ldb_msg_add_value(msg, attr_name, &val);
+       return ldb_msg_add_value(msg, attr_name, &val, NULL);
 }
 
 /*
 }
 
 /*
@@ -576,7 +587,7 @@ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb,
                if (!el) {
                        if (ldb_msg_add_empty(mod, 
                                              msg1->elements[i].name,
                if (!el) {
                        if (ldb_msg_add_empty(mod, 
                                              msg1->elements[i].name,
-                                             LDB_FLAG_MOD_DELETE) != 0) {
+                                             LDB_FLAG_MOD_DELETE, NULL) != 0) {
                                return NULL;
                        }
                }
                                return NULL;
                        }
                }
index 62e8039a2c6b5c08fdc51ce12c7b382012d23e79..aa8b9447b29875b6abc03924a3790fb8a4f0a437 100644 (file)
@@ -1366,7 +1366,10 @@ struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el,
 /**
    add a new empty element to a ldb_message
 */
 /**
    add a new empty element to a ldb_message
 */
-int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags);
+int ldb_msg_add_empty(struct ldb_message *msg,
+               const char *attr_name,
+               int flags,
+               struct ldb_message_element **return_el);
 
 /**
    add a element to a ldb_message
 
 /**
    add a element to a ldb_message
@@ -1375,8 +1378,9 @@ int ldb_msg_add(struct ldb_message *msg,
                const struct ldb_message_element *el, 
                int flags);
 int ldb_msg_add_value(struct ldb_message *msg, 
                const struct ldb_message_element *el, 
                int flags);
 int ldb_msg_add_value(struct ldb_message *msg, 
-                     const char *attr_name,
-                     const struct ldb_val *val);
+               const char *attr_name,
+               const struct ldb_val *val,
+               struct ldb_message_element **return_el);
 int ldb_msg_add_steal_value(struct ldb_message *msg, 
                      const char *attr_name,
                      struct ldb_val *val);
 int ldb_msg_add_steal_value(struct ldb_message *msg, 
                      const char *attr_name,
                      struct ldb_val *val);
index f9ae66a2aa5b0d1ada01ea8f041156bcdea5919c..1cdeeeb2934729ea41c34a1066f2ff0195ad11d6 100644 (file)
@@ -964,7 +964,7 @@ struct ldb_request *map_build_fixup_req(struct map_context *ac, const struct ldb
        if (dn == NULL) {
                goto failed;
        }
        if (dn == NULL) {
                goto failed;
        }
-       if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE) != 0) {
+       if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                goto failed;
        }
        if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) {
                goto failed;
        }
        if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) {
index 404b2ce528baf1f8f27308da4f2063c54bd7e257..b83a17e502c41a641247ad9d76ae9d285c0882f7 100644 (file)
@@ -345,7 +345,7 @@ int map_modify_do_local(struct ldb_handle *handle)
                /* Add local 'IS_MAPPED' */
                /* TODO: use GUIDs here instead */
                dn = ldb_dn_linearize(msg, ac->remote_req->op.mod.message->dn);
                /* Add local 'IS_MAPPED' */
                /* TODO: use GUIDs here instead */
                dn = ldb_dn_linearize(msg, ac->remote_req->op.mod.message->dn);
-               if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_ADD) != 0) {
+               if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_ADD, NULL) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) {
index cd33f2904363714277c32666f2f567a61c6f8b8e..ff3b5c3aa2b26c2aa778a3f805d6e0851e88f50c 100644 (file)
@@ -192,12 +192,7 @@ static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_ele
 
        /* no local result, add as new element */
        if (old == NULL) {
 
        /* no local result, add as new element */
        if (old == NULL) {
-               if (ldb_msg_add_empty(msg, el->name, 0) != 0) {
-                       return -1;
-               }
-
-               old = ldb_msg_find_element(msg, el->name);
-               if (old == NULL) {
+               if (ldb_msg_add_empty(msg, el->name, 0, &old) != 0) {
                        return -1;
                }
        }
                        return -1;
                }
        }
index e4040a8e3d18d765dbef173c2fea020e5ea60979..191238f9c95ca61388a5d6e1cdcb930d9cc3438c 100644 (file)
@@ -250,7 +250,7 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req)
        }
 
        ldb_msg_remove_attr(msg, "objectClass");
        }
 
        ldb_msg_remove_attr(msg, "objectClass");
-       ret = ldb_msg_add_empty(msg, "objectClass", 0);
+       ret = ldb_msg_add_empty(msg, "objectClass", 0, NULL);
        
        if (ret != LDB_SUCCESS) {
                talloc_free(mem_ctx);
        
        if (ret != LDB_SUCCESS) {
                talloc_free(mem_ctx);
@@ -351,7 +351,7 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req
                 * because we need it sorted */
                
                ldb_msg_remove_attr(msg, "objectClass");
                 * because we need it sorted */
                
                ldb_msg_remove_attr(msg, "objectClass");
-               ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE);
+               ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL);
                
                if (ret != LDB_SUCCESS) {
                        talloc_free(mem_ctx);
                
                if (ret != LDB_SUCCESS) {
                        talloc_free(mem_ctx);
@@ -537,7 +537,7 @@ static int objectclass_do_mod(struct ldb_handle *h) {
         * We could do a constrained add/del, but we are meant to be
         * in a transaction... */
 
         * We could do a constrained add/del, but we are meant to be
         * in a transaction... */
 
-       ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE);
+       ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL);
        if (ret != LDB_SUCCESS) {
                ldb_set_errstring(ac->module->ldb, "objectclass: could not clear objectclass in modify msg");
                talloc_free(mem_ctx);
        if (ret != LDB_SUCCESS) {
                ldb_set_errstring(ac->module->ldb, "objectclass: could not clear objectclass in modify msg");
                talloc_free(mem_ctx);
index fce1d34ac0d139f13b32a6858d89ef10824c235c..510a43dbc941cc6635da081b0687ed4090157de8 100644 (file)
@@ -91,7 +91,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
                attribute->num_values = 0;
        }
 
                attribute->num_values = 0;
        }
 
-       if (ldb_msg_add_value(msg, "name", &rdn->value) != 0) {
+       if (ldb_msg_add_value(msg, "name", &rdn->value, NULL) != 0) {
                talloc_free(down_req);
                return LDB_ERR_OPERATIONS_ERROR;
        }
                talloc_free(down_req);
                return LDB_ERR_OPERATIONS_ERROR;
        }
@@ -99,7 +99,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
        attribute = rdn_name_find_attribute(msg, rdn->name);
 
        if (!attribute) {
        attribute = rdn_name_find_attribute(msg, rdn->name);
 
        if (!attribute) {
-               if (ldb_msg_add_value(msg, rdn->name, &rdn->value) != 0) {
+               if (ldb_msg_add_value(msg, rdn->name, &rdn->value, NULL) != 0) {
                        talloc_free(down_req);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                        talloc_free(down_req);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
@@ -213,16 +213,16 @@ static int rdn_name_rename_do_mod(struct ldb_handle *h) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       if (ldb_msg_add_empty(msg, rdn->name, LDB_FLAG_MOD_REPLACE) != 0) {
+       if (ldb_msg_add_empty(msg, rdn->name, LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       if (ldb_msg_add_value(msg, rdn->name, &rdn->value) != 0) {
+       if (ldb_msg_add_value(msg, rdn->name, &rdn->value, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       if (ldb_msg_add_empty(msg, "name", LDB_FLAG_MOD_REPLACE) != 0) {
+       if (ldb_msg_add_empty(msg, "name", LDB_FLAG_MOD_REPLACE, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       if (ldb_msg_add_value(msg, "name", &rdn->value) != 0) {
+       if (ldb_msg_add_value(msg, "name", &rdn->value, NULL) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
index 598738088089402bb6a091388a6a83b231f44f10..fa1b9bafe3b809d5a6cc71444865d1299b1337a5 100755 (executable)
@@ -18,7 +18,7 @@ rm -fr build
 mkdir build
 cd build
 
 mkdir build
 cd build
 
-../configure
+../configure $*
 make dirs
 make all
 
 make dirs
 make all
 
index 8edbc5a08568d294e39c2007e6d35fc93ef602d5..b9bfe8a230641b569d38a2b53b5af208295189be 100644 (file)
@@ -77,14 +77,14 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, TALLOC_CT
        case REG_SZ:
        case REG_EXPAND_SZ:
                val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, (void **)&val.data);
        case REG_SZ:
        case REG_EXPAND_SZ:
                val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, (void **)&val.data);
-               ldb_msg_add_value(msg, "data", &val);
+               ldb_msg_add_value(msg, "data", &val, NULL);
                break;
 
        case REG_DWORD:
                ldb_msg_add_string(msg, "data", talloc_asprintf(mem_ctx, "0x%x", IVAL(data.data, 0)));
                break;
        default:
                break;
 
        case REG_DWORD:
                ldb_msg_add_string(msg, "data", talloc_asprintf(mem_ctx, "0x%x", IVAL(data.data, 0)));
                break;
        default:
-               ldb_msg_add_value(msg, "data", &data);
+               ldb_msg_add_value(msg, "data", &data, NULL);
        }
 
 
        }
 
 
index 31591e624635fa5f7cf27a5103eb49897f0e39c6..a57e2735e7118e0fd2fb8599f84f785627461b3e 100644 (file)
@@ -174,7 +174,7 @@ static NTSTATUS samsync_ldb_handle_domain(TALLOC_CTX *mem_ctx,
                                return nt_status;
                        }
                        
                                return nt_status;
                        }
                        
-                       ldb_msg_add_value(msg, "objectGUID", &v);
+                       ldb_msg_add_value(msg, "objectGUID", &v, NULL);
                }
        } else if (database == SAM_DATABASE_BUILTIN) {
                /* work out the builtin_dn - useful for so many calls its worth
                }
        } else if (database == SAM_DATABASE_BUILTIN) {
                /* work out the builtin_dn - useful for so many calls its worth
index 0ac7a4bb7f1cdbc3ccd15a6fe1ef7bb08f248749..798663eb8b12288f121a6ebef018511ee09883df 100644 (file)
@@ -105,11 +105,11 @@ uint64_t winsdb_set_maxVersion(struct winsdb_handle *h, uint64_t newMaxVersion)
        msg->dn = dn;
 
 
        msg->dn = dn;
 
 
-       ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE);
+       ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL);
        if (ret != 0) goto failed;
        ret = ldb_msg_add_string(msg, "objectClass", "winsMaxVersion");
        if (ret != 0) goto failed;
        if (ret != 0) goto failed;
        ret = ldb_msg_add_string(msg, "objectClass", "winsMaxVersion");
        if (ret != 0) goto failed;
-       ret = ldb_msg_add_empty(msg, "maxVersion", LDB_FLAG_MOD_REPLACE);
+       ret = ldb_msg_add_empty(msg, "maxVersion", LDB_FLAG_MOD_REPLACE, NULL);
        if (ret != 0) goto failed;
        ret = ldb_msg_add_fmt(msg, "maxVersion", "%llu", (long long)newMaxVersion);
        if (ret != 0) goto failed;
        if (ret != 0) goto failed;
        ret = ldb_msg_add_fmt(msg, "maxVersion", "%llu", (long long)newMaxVersion);
        if (ret != 0) goto failed;
@@ -343,7 +343,7 @@ static int ldb_msg_add_winsdb_addr(struct ldb_message *msg, struct winsdb_record
        val.data = discard_const_p(uint8_t, str);
        val.length = strlen(str);
 
        val.data = discard_const_p(uint8_t, str);
        val.length = strlen(str);
 
-       return ldb_msg_add_value(msg, attr_name, &val);
+       return ldb_msg_add_value(msg, attr_name, &val, NULL);
 }
 
 struct winsdb_addr **winsdb_addr_list_make(TALLOC_CTX *mem_ctx)
 }
 
 struct winsdb_addr **winsdb_addr_list_make(TALLOC_CTX *mem_ctx)
@@ -794,17 +794,17 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb,
        ret |= ldb_msg_add_fmt(msg, "recordState", "%u", rec->state);
        ret |= ldb_msg_add_fmt(msg, "nodeType", "%u", rec->node);
        ret |= ldb_msg_add_fmt(msg, "isStatic", "%u", rec->is_static);
        ret |= ldb_msg_add_fmt(msg, "recordState", "%u", rec->state);
        ret |= ldb_msg_add_fmt(msg, "nodeType", "%u", rec->node);
        ret |= ldb_msg_add_fmt(msg, "isStatic", "%u", rec->is_static);
-       ret |= ldb_msg_add_empty(msg, "expireTime", 0);
+       ret |= ldb_msg_add_empty(msg, "expireTime", 0, NULL);
        if (!(rec->is_static && rec->state == WREPL_STATE_ACTIVE)) {
                ret |= ldb_msg_add_string(msg, "expireTime", expire_time);
        }
        ret |= ldb_msg_add_fmt(msg, "versionID", "%llu", (long long)rec->version);
        ret |= ldb_msg_add_string(msg, "winsOwner", rec->wins_owner);
        if (!(rec->is_static && rec->state == WREPL_STATE_ACTIVE)) {
                ret |= ldb_msg_add_string(msg, "expireTime", expire_time);
        }
        ret |= ldb_msg_add_fmt(msg, "versionID", "%llu", (long long)rec->version);
        ret |= ldb_msg_add_string(msg, "winsOwner", rec->wins_owner);
-       ret |= ldb_msg_add_empty(msg, "address", 0);
+       ret |= ldb_msg_add_empty(msg, "address", 0, NULL);
        for (i=0;rec->addresses[i];i++) {
                ret |= ldb_msg_add_winsdb_addr(msg, rec, "address", rec->addresses[i]);
        }
        for (i=0;rec->addresses[i];i++) {
                ret |= ldb_msg_add_winsdb_addr(msg, rec, "address", rec->addresses[i]);
        }
-       ret |= ldb_msg_add_empty(msg, "registeredBy", 0);
+       ret |= ldb_msg_add_empty(msg, "registeredBy", 0, NULL);
        if (rec->registered_by) {
                ret |= ldb_msg_add_string(msg, "registeredBy", rec->registered_by);
                if (ret != 0) goto failed;
        if (rec->registered_by) {
                ret |= ldb_msg_add_string(msg, "registeredBy", rec->registered_by);
                if (ret != 0) goto failed;
index ac56b950c8db846d8b76153cf5e7322cbf056380..62b529e6cf36b9664fa00694d15976c411f4cbcf 100644 (file)
@@ -280,7 +280,7 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx,
        } } while(0)
 
 #define SHARE_ADD_BLOB(name, value) do { \
        } } while(0)
 
 #define SHARE_ADD_BLOB(name, value) do { \
-       err = ldb_msg_add_value(msg, name, value); \
+       err = ldb_msg_add_value(msg, name, value, NULL); \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add blob share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add blob share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
@@ -383,7 +383,7 @@ done:
 }
 
 #define SHARE_MOD_STRING(name, value) do { \
 }
 
 #define SHARE_MOD_STRING(name, value) do { \
-       err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE); \
+       err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE, NULL); \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
@@ -397,7 +397,7 @@ done:
        } } while(0)
 
 #define SHARE_MOD_INT(name, value) do { \
        } } while(0)
 
 #define SHARE_MOD_INT(name, value) do { \
-       err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE); \
+       err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE, NULL); \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
@@ -411,13 +411,13 @@ done:
        } } while(0)
 
 #define SHARE_MOD_BLOB(name, value) do { \
        } } while(0)
 
 #define SHARE_MOD_BLOB(name, value) do { \
-       err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE); \
+       err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE, NULL); \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
                goto done; \
        } \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
                goto done; \
        } \
-       err = ldb_msg_add_value(msg, name, value); \
+       err = ldb_msg_add_value(msg, name, value, NULL); \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add blob share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
        if (err != LDB_SUCCESS) { \
                DEBUG(2,("ERROR: unable to add blob share option %s to ldb msg\n", name)); \
                ret = NT_STATUS_UNSUCCESSFUL; \
index 7fb62e2e0def040adb0f3778144d08004135b0b7..c5c85a35feb9ba2af424941c4e557d9a55ce3fd1 100644 (file)
@@ -1955,7 +1955,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call,
                return NT_STATUS_NO_SUCH_USER;
        }
 
                return NT_STATUS_NO_SUCH_USER;
        }
 
-       if (ldb_msg_add_empty(msg, "privilege", ldb_flag)) {
+       if (ldb_msg_add_empty(msg, "privilege", ldb_flag, NULL)) {
                return NT_STATUS_NO_MEMORY;
        }
 
                return NT_STATUS_NO_MEMORY;
        }