Fix the mess with ldb includes.
[metze/samba/wip.git] / source4 / lib / ldb / common / ldb_msg.c
index 528d1d54f1e0f4658fdedd57af767de3139b8c3a..ad53a3d29d27bc0fc1fe376c28d6272cb0c1bf0b 100644 (file)
@@ -31,7 +31,7 @@
  *  Author: Andrew Tridgell
  */
 
-#include "ldb_includes.h"
+#include "ldb_private.h"
 
 /*
   create a new ldb_message in a given memory context (NULL for top level)
@@ -124,11 +124,6 @@ int ldb_msg_add_empty(     struct ldb_message *msg,
 {
        struct ldb_message_element *els;
 
-       /* FIXME: we should probably leave this to the schema module to check */
-       if (! ldb_valid_attr_name(attr_name)) {
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-
        els = talloc_realloc(msg, msg->elements, 
                             struct ldb_message_element, msg->num_elements+1);
        if (!els) {
@@ -394,10 +389,10 @@ int ldb_msg_find_attr_as_bool(const struct ldb_message *msg,
        if (!v || !v->data) {
                return default_value;
        }
-       if (strcasecmp((const char *)v->data, "FALSE") == 0) {
+       if (v->length == 5 && strncasecmp((const char *)v->data, "FALSE", 5) == 0) {
                return 0;
        }
-       if (strcasecmp((const char *)v->data, "TRUE") == 0) {
+       if (v->length == 4 && strncasecmp((const char *)v->data, "TRUE", 4) == 0) {
                return 1;
        }
        return default_value;
@@ -426,7 +421,7 @@ struct ldb_dn *ldb_msg_find_attr_as_dn(struct ldb_context *ldb,
        if (!v || !v->data) {
                return NULL;
        }
-       res_dn = ldb_dn_new(mem_ctx, ldb, (const char *)v->data);
+       res_dn = ldb_dn_from_ldb_val(mem_ctx, ldb, v);
        if ( ! ldb_dn_validate(res_dn)) {
                talloc_free(res_dn);
                return NULL;