source: vendor/3.6.23/source3/lib/util_names.c

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 2.4 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Andrew Tridgell 1992-1998
5 Copyright (C) Jeremy Allison 2001-2007
6 Copyright (C) Simo Sorce 2001
7 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
8 Copyright (C) James Peach 2006
9 Copyright (C) Andrew Bartlett 2010
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
27static char *smb_myname;
28static char *smb_myworkgroup;
29
30/***********************************************************************
31 Allocate and set myname. Ensure upper case.
32***********************************************************************/
33
34bool set_global_myname(const char *myname)
35{
36 SAFE_FREE(smb_myname);
37 smb_myname = SMB_STRDUP(myname);
38 if (!smb_myname)
39 return False;
40 strupper_m(smb_myname);
41 return True;
42}
43
44const char *global_myname(void)
45{
46 return smb_myname;
47}
48
49/***********************************************************************
50 Allocate and set myworkgroup. Ensure upper case.
51***********************************************************************/
52
53bool set_global_myworkgroup(const char *myworkgroup)
54{
55 SAFE_FREE(smb_myworkgroup);
56 smb_myworkgroup = SMB_STRDUP(myworkgroup);
57 if (!smb_myworkgroup)
58 return False;
59 strupper_m(smb_myworkgroup);
60 return True;
61}
62
63const char *lp_workgroup(void)
64{
65 return smb_myworkgroup;
66}
67
68/******************************************************************
69 get the default domain/netbios name to be used when dealing
70 with our passdb list of accounts
71******************************************************************/
72
73const char *get_global_sam_name(void)
74{
75 if (IS_DC) {
76 return lp_workgroup();
77 }
78 return global_myname();
79}
80
81void gfree_netbios_names(void)
82{
83 SAFE_FREE( smb_myname );
84 SAFE_FREE( smb_myworkgroup );
85}
Note: See TracBrowser for help on using the repository browser.