enum protocol_types get_Protocol(void);
void set_Protocol(enum protocol_types p);
bool all_zero(const uint8_t *ptr, size_t size);
-bool set_global_scope(const char *scope);
-const char *global_scope(void);
void gfree_names(void);
void gfree_all( void );
const char *my_netbios_names(int i);
char *lp_passwd_chat(void);
const char *lp_passwordserver(void);
const char *lp_name_resolve_order(void);
+const char *lp_netbios_scope(void);
const char *lp_workgroup(void);
const char *lp_realm(void);
const char *lp_dnsdomain(void);
case 'i':
if (arg) {
- set_global_scope(arg);
+ lp_set_cmdline("netbios scope", arg);
}
break;
static char *smb_myname;
static char *smb_myworkgroup;
-static char *smb_scope;
static int smb_num_netbios_names;
static char **smb_my_netbios_names;
-/***********************************************************************
- Allocate and set scope. Ensure upper case.
-***********************************************************************/
-
-bool set_global_scope(const char *scope)
-{
- SAFE_FREE(smb_scope);
- smb_scope = SMB_STRDUP(scope);
- if (!smb_scope)
- return False;
- strupper_m(smb_scope);
- return True;
-}
-
-/*********************************************************************
- Ensure scope is never null string.
-*********************************************************************/
-
-const char *global_scope(void)
-{
- if (!smb_scope)
- set_global_scope("");
- return smb_scope;
-}
-
static void free_netbios_names_array(void)
{
int i;
void gfree_names(void)
{
gfree_netbios_names();
- SAFE_FREE( smb_scope );
free_netbios_names_array();
free_local_machine_name();
}
strupper_m(unix_name);
push_ascii(n->name, unix_name, sizeof(n->name), STR_TERMINATE);
n->name_type = (unsigned int)type & 0xFF;
- push_ascii(n->scope, global_scope(), 64, STR_TERMINATE);
+ push_ascii(n->scope, lp_netbios_scope(), 64, STR_TERMINATE);
}
/*******************************************************************
char *result;
char *p;
- result = talloc_array(mem_ctx, char, 33 + strlen(global_scope()) + 2);
+ result = talloc_array(mem_ctx, char, 33 + strlen(lp_netbios_scope()) + 2);
if (result == NULL) {
return NULL;
}
p[0] = '\0';
/* Add the scope string. */
- for( i = 0, len = 0; *(global_scope()) != '\0'; i++, len++ ) {
- switch( (global_scope())[i] ) {
+ for( i = 0, len = 0; *(lp_netbios_scope()) != '\0'; i++, len++ ) {
+ switch( (lp_netbios_scope())[i] ) {
case '\0':
p[0] = len;
if( len > 0 )
len = -1;
break;
default:
- p[len+1] = (global_scope())[i];
+ p[len+1] = (lp_netbios_scope())[i];
break;
}
}
/* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */
pull_ascii(scope, dgram->dest_name.scope, 64, 64, STR_TERMINATE);
- if (!strequal(scope, global_scope())) {
+ if (!strequal(scope, lp_netbios_scope())) {
DEBUG(7,("process_browse_packet: Discarding datagram from IP %s. Scope (%s) \
-mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, global_scope()));
+mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, lp_netbios_scope()));
return;
}
/* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */
pull_ascii(scope, dgram->dest_name.scope, 64, 64, STR_TERMINATE);
- if (!strequal(scope, global_scope())) {
+ if (!strequal(scope, lp_netbios_scope())) {
DEBUG(7,("process_lanman_packet: Discarding datagram from IP %s. Scope (%s) \
-mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, global_scope()));
+mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, lp_netbios_scope()));
return;
}
}
/****************************************************************************
- Convert a wins.tdb record to a struct name_record. Add in our global_scope().
+ Convert a wins.tdb record to a struct name_record. Add in our lp_netbios_scope().
*****************************************************************************/
static struct name_record *wins_record_to_name_record(TDB_DATA key, TDB_DATA data)
push_ascii_nstring(namerec->name.name, (const char *)key.dptr);
namerec->name.name_type = key.dptr[sizeof(unstring)];
/* Add the scope. */
- push_ascii(namerec->name.scope, global_scope(), 64, STR_TERMINATE);
+ push_ascii(namerec->name.scope, lp_netbios_scope(), 64, STR_TERMINATE);
/* We're using a byte-by-byte compare, so we must be sure that
* unused space doesn't have garbage in it.
static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
static bool handle_realm( int snum, const char *pszParmValue, char **ptr );
static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
-static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
static bool handle_dos_charset( int snum, const char *pszParmValue, char **ptr );
static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
.type = P_USTRING,
.p_class = P_GLOBAL,
.ptr = &Globals.szNetbiosScope,
- .special = handle_netbios_scope,
+ .special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
},
FN_GLOBAL_CONST_STRING(lp_passwordserver, &Globals.szPasswordServer)
FN_GLOBAL_CONST_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
FN_GLOBAL_CONST_STRING(lp_workgroup, &Globals.szWorkgroup)
+FN_GLOBAL_CONST_STRING(lp_netbios_scope, &Globals.szNetbiosScope)
FN_GLOBAL_CONST_STRING(lp_realm, &Globals.szRealmUpper)
FN_GLOBAL_CONST_STRING(lp_dnsdomain, &Globals.szDnsDomain)
FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
return ret;
}
-static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
-{
- bool ret;
-
- ret = set_global_scope(pszParmValue);
- string_set(&Globals.szNetbiosScope,global_scope());
-
- return ret;
-}
-
static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
{
TALLOC_FREE(Globals.szNetbiosAliases);
.workgroup = lp_workgroup,
.netbios_name = global_myname,
- .netbios_scope = global_scope,
+ .netbios_scope = lp_netbios_scope,
.lanman_auth = lp_lanman_auth,
.ntlm_auth = lp_ntlm_auth,
strupper_m(unix_name);
push_ascii(n->name, unix_name, sizeof(n->name), STR_TERMINATE);
n->name_type = (unsigned int)type & 0xFF;
- push_ascii(n->scope, global_scope(), 64, STR_TERMINATE);
+ push_ascii(n->scope, lp_netbios_scope(), 64, STR_TERMINATE);
}
static bool do_nodestatus(struct messaging_context *msg_ctx,