summaryrefslogtreecommitdiff
path: root/source3/utils/net_registry.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-04 13:21:03 +0200
committerMichael Adam <obnox@samba.org>2008-04-04 17:05:00 +0200
commit06466de5e9636dc2934c8f52f20d71ed0f4e6da0 (patch)
tree98ea23ec7cc7303e472e9a4f5f6dbe83d55866bd /source3/utils/net_registry.c
parent24789498214a5af60f5280861eda34337b404468 (diff)
downloadsamba-06466de5e9636dc2934c8f52f20d71ed0f4e6da0.tar.gz
samba-06466de5e9636dc2934c8f52f20d71ed0f4e6da0.tar.bz2
samba-06466de5e9636dc2934c8f52f20d71ed0f4e6da0.zip
net_registry: split utility function of common interest out into util module.
Michael (This used to be commit 3bf890783fadd245c59280173627a6caca2dbefe)
Diffstat (limited to 'source3/utils/net_registry.c')
-rw-r--r--source3/utils/net_registry.c88
1 files changed, 1 insertions, 87 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 3d24500774..f21a1603cf 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "utils/net.h"
+#include "utils/net_registry_util.h"
/*
@@ -29,93 +30,6 @@
*
*/
-static void print_registry_key(const char *keyname, NTTIME *modtime)
-{
- d_printf("Keyname = %s\n", keyname);
- d_printf("Modtime = %s\n",
- modtime
- ? http_timestring(nt_time_to_unix(*modtime))
- : "None");
- d_printf("\n");
-}
-
-static void print_registry_value(const char *valname,
- const struct registry_value *valvalue)
-{
- d_printf("Valuename = %s\n", valname);
- d_printf("Type = %s\n",
- reg_type_lookup(valvalue->type));
- switch(valvalue->type) {
- case REG_DWORD:
- d_printf("Value = %d\n", valvalue->v.dword);
- break;
- case REG_SZ:
- case REG_EXPAND_SZ:
- d_printf("Value = \"%s\"\n", valvalue->v.sz.str);
- break;
- case REG_MULTI_SZ: {
- uint32 j;
- for (j = 0; j < valvalue->v.multi_sz.num_strings; j++) {
- d_printf("Value[%3.3d] = \"%s\"\n", j,
- valvalue->v.multi_sz.strings[j]);
- }
- break;
- }
- case REG_BINARY:
- d_printf("Value = %d bytes\n",
- (int)valvalue->v.binary.length);
- break;
- default:
- d_printf("Value = <unprintable>\n");
- break;
- }
- d_printf("\n");
-}
-
-/**
- * Split path into hive name and subkeyname
- * normalizations performed:
- * - convert '/' to '\\'
- * - strip trailing '\\' chars
- */
-static WERROR split_hive_key(TALLOC_CTX *ctx, const char *path,
- char **hivename, const char **subkeyname)
-{
- char *p;
-
- if ((path == NULL) || (hivename == NULL) || (subkeyname == NULL)) {
- return WERR_INVALID_PARAM;
- }
-
- if (strlen(path) == 0) {
- return WERR_INVALID_PARAM;
- }
-
- *hivename = talloc_string_sub(ctx, path, "/", "\\");
- if (*hivename == NULL) {
- return WERR_NOMEM;
- }
-
- /* strip trailing '\\' chars */
- p = strrchr(*hivename, '\\');
- while ((p != NULL) && (p[1] == '\0')) {
- *p = '\0';
- p = strrchr(*hivename, '\\');
- }
-
- p = strchr(*hivename, '\\');
-
- if ((p == NULL) || (*p == '\0')) {
- /* just the hive - no subkey given */
- *subkeyname = "";
- } else {
- *p = '\0';
- *subkeyname = p+1;
- }
-
- return WERR_OK;
-}
-
/**
* split given path into hive and remaining path and open the hive key
*/