diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 41 | ||||
-rw-r--r-- | source3/utils/testparm.c | 3 |
2 files changed, 34 insertions, 10 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 837fc87fac..291bfecba0 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -7,6 +7,7 @@ Copyright (C) Simo Sorce 2001 Copyright (C) Alexander Bokovoy 2002 + Copyright (C) Stefan (metze) Metzmacher 2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -126,7 +127,10 @@ typedef struct char *szSocketAddress; char *szNISHomeMapName; char *szAnnounceVersion; /* This is initialised in init_globals */ + char *szWorkgroup; + char *szNetbiosName; char **szNetbiosAliases; + char *szNetbiosScope; char *szDomainOtherSIDs; char *szNameResolveOrder; char *szPanicAction; @@ -708,12 +712,12 @@ static struct parm_struct parm_table[] = { {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER}, {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER}, {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE}, - {"workgroup", P_USTRING, P_GLOBAL, NULL, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, + {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkgroup, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"realm", P_USTRING, P_GLOBAL, &Globals.szRealm, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"ADS server", P_STRING, P_GLOBAL, &Globals.szADSserver, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, - {"netbios name", P_UGSTRING, P_GLOBAL, NULL, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, + {"netbios name", P_USTRING, P_GLOBAL, &Globals.szNetbiosName, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, handle_netbios_aliases, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, - {"netbios scope", P_UGSTRING, P_GLOBAL, NULL, handle_netbios_scope, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, + {"netbios scope", P_USTRING, P_GLOBAL, &Globals.szNetbiosScope, handle_netbios_scope, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, {"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_DEVELOPER}, {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER}, @@ -1258,7 +1262,13 @@ static void init_globals(void) * Allow the default PASSWD_CHAT to be overridden in local.h. */ string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT); + + set_global_myname(myhostname()); + string_set(&Globals.szNetbiosName,global_myname()); + set_global_myworkgroup(WORKGROUP); + string_set(&Globals.szWorkgroup, lp_workgroup()); + string_set(&Globals.szPasswdProgram, ""); string_set(&Globals.szPrintcapname, PRINTCAP_NAME); string_set(&Globals.szPidDir, dyn_PIDDIR); @@ -1847,7 +1857,7 @@ char *lp_parm_string(const char *servicename, const char *type, const char *opti /* local prototypes */ static int map_parameter(const char *pszParmName); -static BOOL set_boolean(BOOL *pb, char *pszParmValue); +static BOOL set_boolean(BOOL *pb, const char *pszParmValue); static int getservicebyname(const char *pszServiceName, service * pserviceDest); static void copy_service(service * pserviceDest, @@ -2113,7 +2123,7 @@ static int map_parameter(const char *pszParmName) represent a boolean. ***************************************************************************/ -static BOOL set_boolean(BOOL *pb, char *pszParmValue) +static BOOL set_boolean(BOOL *pb, const char *pszParmValue) { BOOL bRetval; @@ -2351,28 +2361,41 @@ BOOL lp_file_list_changed(void) static BOOL handle_netbios_name(const char *pszParmValue, char **ptr) { + BOOL ret; pstring netbios_name; pstrcpy(netbios_name, pszParmValue); standard_sub_basic(current_user_info.smb_name, netbios_name,sizeof(netbios_name)); - set_global_myname(netbios_name); + ret = set_global_myname(netbios_name); + string_set(&Globals.szNetbiosName,global_myname()); + DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n", global_myname())); - return (True); + return ret; } static BOOL handle_workgroup(const char *pszParmValue, char **ptr) { - return set_global_myworkgroup(pszParmValue); + BOOL ret; + + ret = set_global_myworkgroup(pszParmValue); + string_set(&Globals.szWorkgroup,lp_workgroup()); + + return ret; } static BOOL handle_netbios_scope(const char *pszParmValue, char **ptr) { - return set_global_scope(pszParmValue); + BOOL ret; + + ret = set_global_scope(pszParmValue); + string_set(&Globals.szNetbiosScope,global_scope()); + + return ret; } static BOOL handle_netbios_aliases(const char *pszParmValue, char **ptr) diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 95c4b2b265..36b2bdfc6d 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -190,7 +190,7 @@ int main(int argc, const char *argv[]) int ret = 0; int opt; poptContext pc; - static char *term_code = ""; + static const char *term_code = ""; static char *new_local_machine = NULL; const char *cname; const char *caddr; @@ -202,6 +202,7 @@ int main(int argc, const char *argv[]) {"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"}, {"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"}, {"encoding", 't', POPT_ARG_STRING, &term_code, 0, "Print parameters with encoding"}, + {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version}, {0,0,0,0} }; |