diff --git a/source3/include/proto.h b/source3/include/proto.h index 2164ff0b437..5bb5f2c36da 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -312,7 +312,6 @@ enum protocol_types get_Protocol(void); void set_Protocol(enum protocol_types p); void gfree_names(void); void gfree_all( void ); -const char *my_netbios_names(int i); bool set_netbios_aliases(const char **str_array); bool init_names(void); bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf, diff --git a/source3/lib/util_names.c b/source3/lib/util_names.c index 097328906b7..ade9a0570c2 100644 --- a/source3/lib/util_names.c +++ b/source3/lib/util_names.c @@ -83,11 +83,6 @@ void gfree_names(void) free_netbios_names_array(); } -const char *my_netbios_names(int i) -{ - return smb_my_netbios_names[i]; -} - bool set_netbios_aliases(const char **str_array) { size_t namecount; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index ab1bb88892c..1f7e81a5473 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -436,6 +436,7 @@ static void msg_reload_nmbd_services(struct messaging_context *msg, reload_nmbd_services( True ); reopen_logs(); reload_interfaces(0); + nmbd_init_my_netbios_names(); } static void msg_nmbd_send_packet(struct messaging_context *msg, @@ -990,8 +991,9 @@ static bool open_sockets(bool isdaemon, int port) if ( !reload_nmbd_services(False) ) return(-1); - if(!init_names()) + if (!nmbd_init_my_netbios_names()) { return -1; + } reload_nmbd_services( True ); diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c index f3578b1f1b3..b95c2e2f17d 100644 --- a/source3/nmbd/nmbd_mynames.c +++ b/source3/nmbd/nmbd_mynames.c @@ -25,6 +25,75 @@ extern uint16_t samba_nb_type; /* Samba's NetBIOS type. */ +static const char **mynames = NULL; + +static bool add_unique_netbios_name(const char *name) +{ + size_t i, num_names = talloc_array_length(mynames); + char *str = NULL; + const char **tmp = NULL; + + for (i=0; i= 0) && (i < num_names)) { + return mynames[i]; + } + + return NULL; +} + /**************************************************************************** Fail funtion when registering my netbios names. **************************************************************************/ diff --git a/source3/nmbd/nmbd_proto.h b/source3/nmbd/nmbd_proto.h index 4ff5de0fbb3..4cfb58980f8 100644 --- a/source3/nmbd/nmbd_proto.h +++ b/source3/nmbd/nmbd_proto.h @@ -118,6 +118,8 @@ void add_logon_names(void); /* The following definitions come from nmbd/nmbd_mynames.c */ +bool nmbd_init_my_netbios_names(void); +const char *my_netbios_names(int i); void register_my_workgroup_one_subnet(struct subnet_record *subrec); bool register_my_workgroup_and_names(void); void release_wins_names(void);