diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 2 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/lib/util_reg.c | 142 | ||||
-rw-r--r-- | source3/libgpo/gpo_reg.c | 4 | ||||
-rw-r--r-- | source3/utils/net_registry.c | 2 | ||||
-rw-r--r-- | source3/utils/net_registry_util.c | 2 | ||||
-rw-r--r-- | source3/utils/net_rpc_registry.c | 2 |
7 files changed, 8 insertions, 150 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 5551ee4510..4721463ed4 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -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 diff --git a/source3/include/proto.h b/source3/include/proto.h index ff4a04b4fa..09c2c02fec 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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 index c5528e41b5..0000000000 --- a/source3/lib/util_reg.c +++ /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; -} diff --git a/source3/libgpo/gpo_reg.c b/source3/libgpo/gpo_reg.c index 9367bcae9c..0c26dbedc6 100644 --- a/source3/libgpo/gpo_reg.c +++ b/source3/libgpo/gpo_reg.c @@ -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)); } diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 3b55c1406b..ae9cdde2fb 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -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; } diff --git a/source3/utils/net_registry_util.c b/source3/utils/net_registry_util.c index 3d1919cbf1..0b0f617222 100644 --- a/source3/utils/net_registry_util.c +++ b/source3/utils/net_registry_util.c @@ -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: diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 28a1c8d82f..2400af4601 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -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 ) { |