2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
13 Copyright (C) Andrew Bartlett 2010
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 3 of the License, or
18 (at your option) any later version.
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #include "lib/param/loadparm_server_role.h"
30 #include "libds/common/roles.h"
32 /*******************************************************************
33 Set the server type we will announce as via nmbd.
34 ********************************************************************/
36 static const struct srv_role_tab {
40 { ROLE_STANDALONE, "ROLE_STANDALONE" },
41 { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
42 { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
43 { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
47 const char* server_role_str(uint32_t role)
50 for (i=0; srv_role_tab[i].role_str; i++) {
51 if (role == srv_role_tab[i].role) {
52 return srv_role_tab[i].role_str;
59 * Set the server role based on security, domain logons and domain master
61 int lp_find_server_role(int server_role, int security, bool domain_logons, bool domain_master)
65 if (server_role != ROLE_AUTO) {
69 /* If server_role is set to ROLE_AUTO, figure out the correct role */
70 role = ROLE_STANDALONE;
75 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
80 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
82 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
83 role = ROLE_STANDALONE;
87 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
88 role = ROLE_DOMAIN_BDC;
91 role = ROLE_DOMAIN_MEMBER;
95 role = ROLE_DOMAIN_CONTROLLER;
98 role = ROLE_DOMAIN_MEMBER;
105 role = ROLE_DOMAIN_PDC;
107 role = ROLE_DOMAIN_BDC;
112 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
120 * Set the server role based on security, domain logons and domain master
122 int lp_find_security(int server_role, int security)
124 if (security != SEC_AUTO) {
128 switch (server_role) {
130 case ROLE_STANDALONE:
132 case ROLE_DOMAIN_MEMBER:
133 #if (defined(HAVE_ADS) || _SAMBA_BUILD_ >= 4)
138 case ROLE_DOMAIN_PDC:
139 case ROLE_DOMAIN_BDC: