summaryrefslogtreecommitdiff
path: root/source3/param/loadparm.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-12-21 23:15:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:55 -0500
commit107fe91d2b93a34be9fe056da46810dec66aa343 (patch)
tree2f015595a39b984b4d59c560fe49009060b730c1 /source3/param/loadparm.c
parent25f13bb0f1b51704a64d9014121402ef1a1e5e84 (diff)
downloadsamba-107fe91d2b93a34be9fe056da46810dec66aa343.tar.gz
samba-107fe91d2b93a34be9fe056da46810dec66aa343.tar.bz2
samba-107fe91d2b93a34be9fe056da46810dec66aa343.zip
r12414: Remove the unnecessary SMB_STRDUP in server_role_str() + reuse the role
translation elsewhere. Guenther (This used to be commit 6c4a6da3dc7cecce09890a0da7d97b9d1bb47827)
Diffstat (limited to 'source3/param/loadparm.c')
-rw-r--r--source3/param/loadparm.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index ca47e48d8c..fa61a8aedb 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -4098,6 +4098,28 @@ static void lp_save_defaults(void)
Set the server type we will announce as via nmbd.
********************************************************************/
+static const struct srv_role_tab {
+ uint32 role;
+ const char *role_str;
+} srv_role_tab [] = {
+ { ROLE_STANDALONE, "ROLE_STANDALONE" },
+ { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
+ { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
+ { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
+ { 0, NULL }
+};
+
+const char* server_role_str(uint32 role)
+{
+ int i = 0;
+ for (i=0; srv_role_tab[i].role_str; i++) {
+ if (role == srv_role_tab[i].role) {
+ return srv_role_tab[i].role_str;
+ }
+ }
+ return NULL;
+}
+
static void set_server_role(void)
{
server_role = ROLE_STANDALONE;
@@ -4141,22 +4163,7 @@ static void set_server_role(void)
break;
}
- DEBUG(10, ("set_server_role: role = "));
-
- switch(server_role) {
- case ROLE_STANDALONE:
- DEBUGADD(10, ("ROLE_STANDALONE\n"));
- break;
- case ROLE_DOMAIN_MEMBER:
- DEBUGADD(10, ("ROLE_DOMAIN_MEMBER\n"));
- break;
- case ROLE_DOMAIN_BDC:
- DEBUGADD(10, ("ROLE_DOMAIN_BDC\n"));
- break;
- case ROLE_DOMAIN_PDC:
- DEBUGADD(10, ("ROLE_DOMAIN_PDC\n"));
- break;
- }
+ DEBUG(10, ("set_server_role: role = %s", server_role_str(server_role)));
}
/***********************************************************