~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source3/rpc_server/srv_dssetup_nt.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:
1
 
/*
2
 
 *  Unix SMB/CIFS implementation.
3
 
 *  RPC Pipe client / server routines
4
 
 *  Copyright (C) Andrew Tridgell               1992-1997.
5
 
 *  Copyright (C) Luke Kenneth Casson Leighton  1996-1997.
6
 
 *  Copyright (C) Paul Ashton                        1997.
7
 
 *  Copyright (C) Jeremy Allison                     2001.
8
 
 *  Copyright (C) Gerald Carter                      2002.
9
 
 *  Copyright (C) Guenther Deschner                  2008.
10
 
 *
11
 
 *  This program is free software; you can redistribute it and/or modify
12
 
 *  it under the terms of the GNU General Public License as published by
13
 
 *  the Free Software Foundation; either version 3 of the License, or
14
 
 *  (at your option) any later version.
15
 
 *
16
 
 *  This program is distributed in the hope that it will be useful,
17
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
 *  GNU General Public License for more details.
20
 
 *
21
 
 *  You should have received a copy of the GNU General Public License
22
 
 *  along with this program; if not, see <http://www.gnu.org/licenses/>.
23
 
 */
24
 
 
25
 
#include "includes.h"
26
 
#include "../librpc/gen_ndr/srv_dssetup.h"
27
 
 
28
 
#undef DBGC_CLASS
29
 
#define DBGC_CLASS DBGC_RPC_SRV
30
 
 
31
 
/********************************************************************
32
 
 Fill in a dssetup_DsRolePrimaryDomInfoBasic structure
33
 
 ********************************************************************/
34
 
 
35
 
static WERROR fill_dsrole_dominfo_basic(TALLOC_CTX *ctx,
36
 
                                        struct dssetup_DsRolePrimaryDomInfoBasic **info)
37
 
{
38
 
        struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
39
 
        char *dnsdomain = NULL;
40
 
 
41
 
        DEBUG(10,("fill_dsrole_dominfo_basic: enter\n"));
42
 
 
43
 
        basic = TALLOC_ZERO_P(ctx, struct dssetup_DsRolePrimaryDomInfoBasic);
44
 
        if (!basic) {
45
 
                DEBUG(0,("fill_dsrole_dominfo_basic: out of memory\n"));
46
 
                return WERR_NOMEM;
47
 
        }
48
 
 
49
 
        switch (lp_server_role()) {
50
 
                case ROLE_STANDALONE:
51
 
                        basic->role = DS_ROLE_STANDALONE_SERVER;
52
 
                        basic->domain = get_global_sam_name();
53
 
                        break;
54
 
                case ROLE_DOMAIN_MEMBER:
55
 
                        basic->role = DS_ROLE_MEMBER_SERVER;
56
 
                        basic->domain = lp_workgroup();
57
 
                        break;
58
 
                case ROLE_DOMAIN_BDC:
59
 
                        basic->role = DS_ROLE_BACKUP_DC;
60
 
                        basic->domain = get_global_sam_name();
61
 
                        break;
62
 
                case ROLE_DOMAIN_PDC:
63
 
                        basic->role = DS_ROLE_PRIMARY_DC;
64
 
                        basic->domain = get_global_sam_name();
65
 
                        break;
66
 
        }
67
 
 
68
 
        if (secrets_fetch_domain_guid(lp_workgroup(), &basic->domain_guid)) {
69
 
                basic->flags |= DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT;
70
 
        }
71
 
 
72
 
        /* fill in some additional fields if we are a member of an AD domain */
73
 
 
74
 
        if (lp_security() == SEC_ADS) {
75
 
                dnsdomain = talloc_strdup(ctx, lp_realm());
76
 
                if (!dnsdomain) {
77
 
                        return WERR_NOMEM;
78
 
                }
79
 
                strlower_m(dnsdomain);
80
 
                basic->dns_domain = dnsdomain;
81
 
 
82
 
                /* FIXME!! We really should fill in the correct forest
83
 
                   name.  Should get this information from winbindd.  */
84
 
                basic->forest = dnsdomain;
85
 
        } else {
86
 
                /* security = domain should not fill in the dns or
87
 
                   forest name */
88
 
                basic->dns_domain = NULL;
89
 
                basic->forest = NULL;
90
 
        }
91
 
 
92
 
        *info = basic;
93
 
 
94
 
        return WERR_OK;
95
 
}
96
 
 
97
 
/********************************************************************
98
 
 Implement the _dssetup_DsRoleGetPrimaryDomainInformation() call
99
 
 ********************************************************************/
100
 
 
101
 
WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p,
102
 
                                                  struct dssetup_DsRoleGetPrimaryDomainInformation *r)
103
 
{
104
 
        WERROR werr = WERR_OK;
105
 
 
106
 
        switch (r->in.level) {
107
 
 
108
 
                case DS_ROLE_BASIC_INFORMATION: {
109
 
                        struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
110
 
                        werr = fill_dsrole_dominfo_basic(p->mem_ctx, &basic);
111
 
                        if (W_ERROR_IS_OK(werr)) {
112
 
                                r->out.info->basic = *basic;
113
 
                        }
114
 
                        break;
115
 
                }
116
 
                default:
117
 
                        DEBUG(0,("_dssetup_DsRoleGetPrimaryDomainInformation: "
118
 
                                "Unknown info level [%d]!\n", r->in.level));
119
 
                        werr = WERR_UNKNOWN_LEVEL;
120
 
        }
121
 
 
122
 
        return werr;
123
 
}
124
 
 
125
 
/****************************************************************
126
 
****************************************************************/
127
 
 
128
 
WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p,
129
 
                                        struct dssetup_DsRoleDnsNameToFlatName *r)
130
 
{
131
 
        p->rng_fault_state = true;
132
 
        return WERR_NOT_SUPPORTED;
133
 
}
134
 
 
135
 
/****************************************************************
136
 
****************************************************************/
137
 
 
138
 
WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p,
139
 
                             struct dssetup_DsRoleDcAsDc *r)
140
 
{
141
 
        p->rng_fault_state = true;
142
 
        return WERR_NOT_SUPPORTED;
143
 
}
144
 
 
145
 
/****************************************************************
146
 
****************************************************************/
147
 
 
148
 
WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p,
149
 
                                  struct dssetup_DsRoleDcAsReplica *r)
150
 
{
151
 
        p->rng_fault_state = true;
152
 
        return WERR_NOT_SUPPORTED;
153
 
}
154
 
 
155
 
/****************************************************************
156
 
****************************************************************/
157
 
 
158
 
WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p,
159
 
                               struct dssetup_DsRoleDemoteDc *r)
160
 
{
161
 
        p->rng_fault_state = true;
162
 
        return WERR_NOT_SUPPORTED;
163
 
}
164
 
 
165
 
/****************************************************************
166
 
****************************************************************/
167
 
 
168
 
WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p,
169
 
                                             struct dssetup_DsRoleGetDcOperationProgress *r)
170
 
{
171
 
        p->rng_fault_state = true;
172
 
        return WERR_NOT_SUPPORTED;
173
 
}
174
 
 
175
 
/****************************************************************
176
 
****************************************************************/
177
 
 
178
 
WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p,
179
 
                                            struct dssetup_DsRoleGetDcOperationResults *r)
180
 
{
181
 
        p->rng_fault_state = true;
182
 
        return WERR_NOT_SUPPORTED;
183
 
}
184
 
 
185
 
/****************************************************************
186
 
****************************************************************/
187
 
 
188
 
WERROR _dssetup_DsRoleCancel(pipes_struct *p,
189
 
                             struct dssetup_DsRoleCancel *r)
190
 
{
191
 
        p->rng_fault_state = true;
192
 
        return WERR_NOT_SUPPORTED;
193
 
}
194
 
 
195
 
/****************************************************************
196
 
****************************************************************/
197
 
 
198
 
WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p,
199
 
                                                struct dssetup_DsRoleServerSaveStateForUpgrade *r)
200
 
{
201
 
        p->rng_fault_state = true;
202
 
        return WERR_NOT_SUPPORTED;
203
 
}
204
 
 
205
 
/****************************************************************
206
 
****************************************************************/
207
 
 
208
 
WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p,
209
 
                                             struct dssetup_DsRoleUpgradeDownlevelServer *r)
210
 
{
211
 
        p->rng_fault_state = true;
212
 
        return WERR_NOT_SUPPORTED;
213
 
}
214
 
 
215
 
/****************************************************************
216
 
****************************************************************/
217
 
 
218
 
WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p,
219
 
                                                  struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
220
 
{
221
 
        p->rng_fault_state = true;
222
 
        return WERR_NOT_SUPPORTED;
223
 
}
224