diff options
author | Andrew Tridgell <tridge@samba.org> | 1996-08-16 13:03:26 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1996-08-16 13:03:26 +0000 |
commit | f63d4c830aa88d20ababe4c3543bff7becc3a506 (patch) | |
tree | 286125d72593631440f3b92c85dac62b3ec2e42f /source3/nameannounce.c | |
parent | b990567a8c8afe8a085eb7865c7704925334a4b5 (diff) | |
download | samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.tar.gz samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.tar.bz2 samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.zip |
- added the "remote announce" option
- made the lp_string() code able to handle any length string
- got rid of the obsolete lmhosts code, instead users should use
"interfaces" and "remote announce". lmhosts now is just used as a IP
to netbios name map
- cleanup the inet_address() code
(This used to be commit be2b67940302b2e63890cb865fe3948c2206ea91)
Diffstat (limited to 'source3/nameannounce.c')
-rw-r--r-- | source3/nameannounce.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source3/nameannounce.c b/source3/nameannounce.c index 4c1ef78f9e..0127ae03e3 100644 --- a/source3/nameannounce.c +++ b/source3/nameannounce.c @@ -50,6 +50,8 @@ extern int workgroup_count; extern struct in_addr ipgrp; + + /**************************************************************************** send a announce request to the local net **************************************************************************/ @@ -578,3 +580,52 @@ void announce_master(void) } } } + + + +/**************************************************************************** + do all the "remote" announcements. These are used to put ourselves + on a remote browse list. They are done blind, no checking is done to + see if there is actually a browse master at the other end. + **************************************************************************/ +void announce_remote(void) +{ + char *s,*ptr; + static time_t last_time = 0; + time_t t = time(NULL); + pstring s2; + struct in_addr addr; + char *comment,*workgroup; + int stype = SV_TYPE_WORKSTATION | SV_TYPE_SERVER | SV_TYPE_PRINTQ_SERVER | + SV_TYPE_SERVER_UNIX; + + if (last_time && t < last_time + REMOTE_ANNOUNCE_INTERVAL) + return; + + last_time = t; + + s = lp_remote_announce(); + if (!*s) return; + + comment = lp_serverstring(); + workgroup = lp_workgroup(); + + for (ptr=s; next_token(&ptr,s2,NULL); ) { + /* the entries are of the form a.b.c.d/WORKGROUP with + WORKGROUP being optional */ + char *wgroup; + + wgroup = strchr(s2,'/'); + if (wgroup) *wgroup++ = 0; + if (!wgroup || !*wgroup) + wgroup = workgroup; + + addr = *interpret_addr2(s2); + + do_announce_host(ANN_HostAnnouncement,myname,0x20,*iface_ip(addr), + wgroup,0x1e,addr, + REMOTE_ANNOUNCE_INTERVAL, + myname,stype,comment); + } + +} |