s3: use shared registry functions.
authorGünther Deschner <gd@samba.org>
Tue, 27 Apr 2010 14:38:40 +0000 (16:38 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 27 Apr 2010 14:42:15 +0000 (16:42 +0200)
Guenther

source3/Makefile.in
source3/include/proto.h
source3/lib/util_reg.c [deleted file]
source3/libgpo/gpo_reg.c
source3/utils/net_registry.c
source3/utils/net_registry_util.c
source3/utils/net_rpc_registry.c

index 5551ee4510176ae605c8fea3e025c3b7d856c2ae..4721463ed4c89abd4d95527f617c657a0c960bc1 100644 (file)
@@ -561,7 +561,7 @@ LIBMSRPC_GEN_OBJ = ../librpc/gen_ndr/cli_lsa.o \
 #
 # registry-related objects
 #
-UTIL_REG_OBJ = lib/util_reg.o
+UTIL_REG_OBJ = ../libcli/registry/util_reg.o
 UTIL_REG_API_OBJ = lib/util_reg_api.o
 
 REG_INIT_BASIC_OBJ = registry/reg_init_basic.o
index ff4a04b4fa9a6c1294b77d29b05015f4df0aaef9..09c2c02fec8a42eb8ee1ff367c7aa6a9416e8869 100644 (file)
@@ -1290,9 +1290,9 @@ void flush_pwnam_cache(void);
 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
 
-/* The following definitions come from lib/util_reg.c  */
+/* The following definitions come from ..libcli/registry/util_reg.c  */
 
-const char *reg_type_lookup(enum winreg_Type type);
+const char *str_regtype(int type);
 bool push_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
                 DATA_BLOB *blob, const char *s);
 bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
diff --git a/source3/lib/util_reg.c b/source3/lib/util_reg.c
deleted file mode 100644 (file)
index c5528e4..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * Registry helper routines
- * Copyright (C) Volker Lendecke 2006
- * 
- * 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 3 of the License, or (at your option)
- * any later version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "../librpc/gen_ndr/ndr_winreg.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_REGISTRY
-
-extern struct registry_ops smbconf_reg_ops;
-
-const char *reg_type_lookup(enum winreg_Type type)
-{
-       const char *result;
-
-       switch(type) {
-       case REG_NONE:
-               result = "REG_NONE";
-               break;
-       case REG_SZ:
-               result = "REG_SZ";
-               break;
-       case REG_EXPAND_SZ:
-               result = "REG_EXPAND_SZ";
-               break;
-       case REG_BINARY:
-               result = "REG_BINARY";
-               break;
-       case REG_DWORD:
-               result = "REG_DWORD";
-               break;
-       case REG_DWORD_BIG_ENDIAN:
-               result = "REG_DWORD_BIG_ENDIAN";
-               break;
-       case REG_LINK:
-               result = "REG_LINK";
-               break;
-       case REG_MULTI_SZ:
-               result = "REG_MULTI_SZ";
-               break;
-       case REG_RESOURCE_LIST:
-               result = "REG_RESOURCE_LIST";
-               break;
-       case REG_FULL_RESOURCE_DESCRIPTOR:
-               result = "REG_FULL_RESOURCE_DESCRIPTOR";
-               break;
-       case REG_RESOURCE_REQUIREMENTS_LIST:
-               result = "REG_RESOURCE_REQUIREMENTS_LIST";
-               break;
-       case REG_QWORD:
-               result = "REG_QWORD";
-               break;
-       default:
-               result = "REG TYPE IS UNKNOWN";
-               break;
-       }
-       return result;
-}
-
-/*******************************************************************
- push a string in unix charset into a REG_SZ UCS2 null terminated blob
- ********************************************************************/
-
-bool push_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
-                DATA_BLOB *blob, const char *s)
-{
-       union winreg_Data data;
-       enum ndr_err_code ndr_err;
-       data.string = s;
-       ndr_err = ndr_push_union_blob(blob, mem_ctx, ic, &data, REG_SZ,
-                       (ndr_push_flags_fn_t)ndr_push_winreg_Data);
-       return NDR_ERR_CODE_IS_SUCCESS(ndr_err);
-}
-
-/*******************************************************************
- push a string_array in unix charset into a REG_MULTI_SZ UCS2 double-null
- terminated blob
- ********************************************************************/
-
-bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
-                      DATA_BLOB *blob, const char **a)
-{
-       union winreg_Data data;
-       enum ndr_err_code ndr_err;
-       data.string_array = a;
-       ndr_err = ndr_push_union_blob(blob, mem_ctx, ic, &data, REG_MULTI_SZ,
-                       (ndr_push_flags_fn_t)ndr_push_winreg_Data);
-       return NDR_ERR_CODE_IS_SUCCESS(ndr_err);
-}
-
-/*******************************************************************
- pull a string in unix charset out of a REG_SZ UCS2 null terminated blob
- ********************************************************************/
-
-bool pull_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
-                const DATA_BLOB *blob, const char **s)
-{
-       union winreg_Data data;
-       enum ndr_err_code ndr_err;
-       ndr_err = ndr_pull_union_blob(blob, mem_ctx, ic, &data, REG_SZ,
-                       (ndr_pull_flags_fn_t)ndr_pull_winreg_Data);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               return false;
-       }
-       *s = data.string;
-       return true;
-}
-
-/*******************************************************************
- pull a string_array in unix charset out of a REG_MULTI_SZ UCS2 double-null
- terminated blob
- ********************************************************************/
-
-bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
-                      const DATA_BLOB *blob, const char ***a)
-{
-       union winreg_Data data;
-       enum ndr_err_code ndr_err;
-       ndr_err = ndr_pull_union_blob(blob, mem_ctx, ic, &data, REG_MULTI_SZ,
-                       (ndr_pull_flags_fn_t)ndr_pull_winreg_Data);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               return false;
-       }
-       *a = data.string_array;
-       return true;
-}
index 9367bcae9c24b644d737dd169c32b25476fe5830..0c26dbedc6208d1f4c54248630d3a2940fc002ef 100644 (file)
@@ -787,7 +787,7 @@ void dump_reg_val(int lvl, const char *direction,
                return;
        }
 
-       type_str = reg_type_lookup(val->type);
+       type_str = str_regtype(val->type);
 
        DEBUG(lvl,("\tdump_reg_val:\t%s '%s'\n\t\t\t'%s' %s: ",
                direction, key, subkey, type_str));
@@ -933,7 +933,7 @@ WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
        if (flags & GPO_INFO_FLAG_VERBOSE) {
                printf("about to store key:    [%s]\n", entry->key);
                printf("               value:  [%s]\n", entry->value);
-               printf("               data:   [%s]\n", reg_type_lookup(entry->data->type));
+               printf("               data:   [%s]\n", str_regtype(entry->data->type));
                printf("               action: [%s]\n", gp_reg_action_str(entry->action));
        }
 
index 3b55c1406b14c23614a8ecde098677393542dfd3..ae9cdde2fbd968a0f67571c8a27dff0ca5c88125 100644 (file)
@@ -418,7 +418,7 @@ static void net_registry_increment_fn(void *private_data)
 
        if (value->type != REG_DWORD) {
                d_fprintf(stderr, _("value not a DWORD: %s\n"),
-                         reg_type_lookup(value->type));
+                         str_regtype(value->type));
                goto done;
        }
 
index 3d1919cbf10634ecf4a8d730cd11b96384108e36..0b0f6172229c19c37b3da3d8b2847d1fbfdaf454 100644 (file)
@@ -37,7 +37,7 @@ void print_registry_value(const struct registry_value *valvalue, bool raw)
 {
        if (!raw) {
                d_printf(_("Type       = %s\n"),
-                        reg_type_lookup(valvalue->type));
+                        str_regtype(valvalue->type));
        }
        switch(valvalue->type) {
        case REG_DWORD:
index 28a1c8d82f2737156d5bb8737d1e8b4297f94e8d..2400af4601ea47bfa650f868ad0dc87d25773567 100644 (file)
@@ -955,7 +955,7 @@ static void dump_values( REGF_NK_REC *nk )
 
        for ( i=0; i<nk->num_values; i++ ) {
                d_printf( "\"%s\" = ", nk->values[i].valuename ? nk->values[i].valuename : "(default)" );
-               d_printf( "(%s) ", reg_type_lookup( nk->values[i].type ) );
+               d_printf( "(%s) ", str_regtype( nk->values[i].type ) );
 
                data_size = nk->values[i].data_size & ~VK_DATA_IN_OFFSET;
                switch ( nk->values[i].type ) {