~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/utils/net_registry_util.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
#include "includes.h"
 
23
#include "registry.h"
23
24
#include "utils/net_registry_util.h"
24
25
#include "utils/net.h"
 
26
#include "../libcli/registry/util_reg.h"
25
27
 
26
28
void print_registry_key(const char *keyname, NTTIME *modtime)
27
29
{
37
39
{
38
40
        if (!raw) {
39
41
                d_printf(_("Type       = %s\n"),
40
 
                         reg_type_lookup(valvalue->type));
 
42
                         str_regtype(valvalue->type));
41
43
        }
42
44
        switch(valvalue->type) {
43
 
        case REG_DWORD:
 
45
        case REG_DWORD: {
 
46
                uint32_t v = 0;
 
47
                if (valvalue->data.length >= 4) {
 
48
                        v = IVAL(valvalue->data.data, 0);
 
49
                }
44
50
                if (!raw) {
45
51
                        d_printf(_("Value      = "));
46
52
                }
47
 
                d_printf("%d\n", valvalue->v.dword);
 
53
                d_printf("%d\n", v);
48
54
                break;
 
55
        }
49
56
        case REG_SZ:
50
 
        case REG_EXPAND_SZ:
 
57
        case REG_EXPAND_SZ: {
 
58
                const char *s;
 
59
 
 
60
                if (!pull_reg_sz(talloc_tos(), &valvalue->data, &s)) {
 
61
                        break;
 
62
                }
51
63
                if (!raw) {
52
64
                        d_printf(_("Value      = \""));
53
65
                }
54
 
                d_printf("%s", valvalue->v.sz.str);
 
66
                d_printf("%s", s);
55
67
                if (!raw) {
56
68
                        d_printf("\"");
57
69
                }
58
70
                d_printf("\n");
59
71
                break;
 
72
        }
60
73
        case REG_MULTI_SZ: {
61
74
                uint32 j;
62
 
                for (j = 0; j < valvalue->v.multi_sz.num_strings; j++) {
 
75
                const char **a;
 
76
 
 
77
                if (!pull_reg_multi_sz(talloc_tos(), &valvalue->data, &a)) {
 
78
                        break;
 
79
                }
 
80
                for (j = 0; a[j] != NULL; j++) {
63
81
                        if (!raw) {
64
82
                                d_printf(_("Value[%3.3d] = \""), j);
65
83
                        }
66
 
                        d_printf("%s", valvalue->v.multi_sz.strings[j]);
 
84
                        d_printf("%s", a[j]);
67
85
                        if (!raw) {
68
86
                                d_printf("\"");
69
87
                        }
75
93
                if (!raw) {
76
94
                        d_printf(_("Value      = "));
77
95
                }
78
 
                d_printf(_("%d bytes\n"), (int)valvalue->v.binary.length);
 
96
                d_printf(_("%d bytes\n"), (int)valvalue->data.length);
79
97
                break;
80
98
        default:
81
99
                if (!raw) {
97
115
/**
98
116
 * Split path into hive name and subkeyname
99
117
 * normalizations performed:
100
 
 *  - convert '/' to '\\'
 
118
 *  - if the path contains no '\\' characters,
 
119
 *    assume that the legacy format of using '/'
 
120
 *    as a separator is used and  convert '/' to '\\'
101
121
 *  - strip trailing '\\' chars
102
122
 */
103
123
WERROR split_hive_key(TALLOC_CTX *ctx, const char *path, char **hivename,
114
134
                return WERR_INVALID_PARAM;
115
135
        }
116
136
 
117
 
        *hivename = talloc_string_sub(ctx, path, "/", "\\");
 
137
        if (strchr(path, '\\') == NULL) {
 
138
                *hivename = talloc_string_sub(ctx, path, "/", "\\");
 
139
        } else {
 
140
                *hivename = talloc_strdup(ctx, path);
 
141
        }
 
142
 
118
143
        if (*hivename == NULL) {
119
144
                return WERR_NOMEM;
120
145
        }