Fix include paths to new location of libutil.
[samba.git] / source4 / dsdb / repl / replicated_objects.c
index 259035fed7b5b445312992025c06860d846b174e..9853a753472c23e1962273b75fe4d31884dd643f 100644 (file)
@@ -6,7 +6,7 @@
     
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
 */
 
 #include "includes.h"
 #include "dsdb/samdb/samdb.h"
 #include "lib/ldb/include/ldb_errors.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "librpc/gen_ndr/ndr_drsuapi.h"
 #include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
 #include "libcli/auth/libcli_auth.h"
+#include "param/param.h"
 
 static WERROR dsdb_decrypt_attribute_value(TALLOC_CTX *mem_ctx,
                                           const DATA_BLOB *gensec_skey,
@@ -196,6 +196,7 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb,
                                  struct dsdb_extended_replicated_object *out)
 {
        NTSTATUS nt_status;
+       enum ndr_err_code ndr_err;
        WERROR status;
        uint32_t i;
        struct ldb_message *msg;
@@ -322,9 +323,12 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb,
        whenChanged_s = ldb_timestring(msg, whenChanged_t);
        W_ERROR_HAVE_NO_MEMORY(whenChanged_s);
 
-       nt_status = ndr_push_struct_blob(&guid_value, msg, &in->object.identifier->guid,
+       ndr_err = ndr_push_struct_blob(&guid_value, msg, 
+                                      lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
+                                      &in->object.identifier->guid,
                                         (ndr_push_flags_fn_t)ndr_push_GUID);
-       if (!NT_STATUS_IS_OK(nt_status)) {
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               nt_status = ndr_map_error2ntstatus(ndr_err);
                return ntstatus_to_werror(nt_status);
        }
 
@@ -396,8 +400,8 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb,
 
        ret = ldb_extended(ldb, DSDB_EXTENDED_REPLICATED_OBJECTS_OID, out, &ext_res);
        if (ret != LDB_SUCCESS) {
-               DEBUG(0,("Failed to apply records: %d: %s\n",
-                       ret, ldb_strerror(ret)));
+               DEBUG(0,("Failed to apply records: %s: %s\n",
+                        ldb_errstring(ldb), ldb_strerror(ret)));
                talloc_free(out);
                return WERR_FOOBAR;
        }