Attempt to fix the patchfile_preg backend for big endian machines.
[ira/wip.git] / source4 / lib / registry / patchfile_preg.c
index 0d39e67450f82baba5b003f9ed0fba50287fa891..5216a04c8b63fd0896a47127c1cd598d18a9e606 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,
@@ -21,7 +21,6 @@
 
 #include "includes.h"
 #include "lib/registry/registry.h"
-#include "lib/registry/patchfile.h"
 #include "system/filesys.h"
 #include "param/param.h"
 
@@ -43,30 +42,30 @@ static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
 /* FIXME These functions need to be implemented */
 static WERROR reg_preg_diff_add_key(void *_data, const char *key_name)
 {
-       return WERR_OK;
+       return WERR_NOT_SUPPORTED;
 }
 
 static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
 {
-       return WERR_OK;
+       return WERR_NOT_SUPPORTED;
 }
 
 static WERROR reg_preg_diff_set_value(void *_data, const char *key_name,
                                      const char *value_name,
                                      uint32_t value_type, DATA_BLOB value_data)
 {
-       return WERR_OK;
+       return WERR_NOT_SUPPORTED;
 }
 
 static WERROR reg_preg_diff_del_value(void *_data, const char *key_name,
                                      const char *value_name)
 {
-       return WERR_OK;
+       return WERR_NOT_SUPPORTED;
 }
 
 static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
 {
-       return WERR_OK;
+       return WERR_NOT_SUPPORTED;
 }
 
 static WERROR reg_preg_diff_done(void *_data)
@@ -150,6 +149,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                ret = WERR_GENERAL_FAILURE;
                goto cleanup;
        }
+       preg_header.version = IVAL(&preg_header.version, 0);
+
        if (strncmp(preg_header.hdr, "PReg", 4) != 0) {
                DEBUG(0, ("This file is not a valid preg registry file\n"));
                ret = WERR_GENERAL_FAILURE;
@@ -194,6 +195,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                        ret = WERR_GENERAL_FAILURE;
                        goto cleanup;
                }
+               value_type = IVAL(&value_type, 0);
+
                /* Read past delimiter */
                buf_ptr = buf;
                if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&