mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Did more integration of Lukes code ready for the first release.
I've now got WINS registration working, and refresh working. Its looking pretty good so far, but needs lots of testing.
This commit is contained in:
parent
bc4a299437
commit
045014aa57
@ -1962,14 +1962,6 @@ merits of each are discussed in the README file.
|
|||||||
|
|
||||||
.B Example:
|
.B Example:
|
||||||
protocol = LANMAN1
|
protocol = LANMAN1
|
||||||
.SS proxy name resolution (G)
|
|
||||||
|
|
||||||
This is a boolean that controls if nmbd will respond to broadcast name
|
|
||||||
queries on behalf of other hosts. You may need to set this to no for
|
|
||||||
some older clients.
|
|
||||||
|
|
||||||
.B Default:
|
|
||||||
proxy name resolution = yes
|
|
||||||
.SS public (S)
|
.SS public (S)
|
||||||
A synonym for this parameter is 'guest ok'.
|
A synonym for this parameter is 'guest ok'.
|
||||||
|
|
||||||
@ -2548,6 +2540,33 @@ only to areas that are outside the directory tree being exported.
|
|||||||
.B Example:
|
.B Example:
|
||||||
wide links = no
|
wide links = no
|
||||||
|
|
||||||
|
.SS wins proxy (G)
|
||||||
|
|
||||||
|
This is a boolean that controls if nmbd will respond to broadcast name
|
||||||
|
queries on behalf of other hosts. You may need to set this to no for
|
||||||
|
some older clients.
|
||||||
|
|
||||||
|
.B Default:
|
||||||
|
wins proxy = no
|
||||||
|
.SS wins support (G)
|
||||||
|
|
||||||
|
This boolean controls if Samba will act as a WINS server. You should
|
||||||
|
normally set this to true unless you already have another WINS server
|
||||||
|
on the network.
|
||||||
|
|
||||||
|
.B Default:
|
||||||
|
wins support = yes
|
||||||
|
.SS wins server (G)
|
||||||
|
|
||||||
|
This specifies the DNS name of the WINS server that Samba should
|
||||||
|
register with. If you have a WINS server on your network then you
|
||||||
|
should set this to the WINS servers name.
|
||||||
|
|
||||||
|
This option only takes effect if Samba is not acting as a WINS server
|
||||||
|
itself.
|
||||||
|
|
||||||
|
.B Default:
|
||||||
|
wins server =
|
||||||
.SS workgroup (G)
|
.SS workgroup (G)
|
||||||
|
|
||||||
This controls what workgroup your server will appear to be in when
|
This controls what workgroup your server will appear to be in when
|
||||||
|
@ -3599,6 +3599,7 @@ static BOOL list_servers()
|
|||||||
pstring param;
|
pstring param;
|
||||||
int uLevel = 1;
|
int uLevel = 1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
BOOL ok = False;
|
||||||
|
|
||||||
/* now send a SMBtrans command with api ServerEnum? */
|
/* now send a SMBtrans command with api ServerEnum? */
|
||||||
p = param;
|
p = param;
|
||||||
@ -3646,6 +3647,7 @@ static BOOL list_servers()
|
|||||||
sname,
|
sname,
|
||||||
comment_offset?rdata+comment_offset-converter:"");
|
comment_offset?rdata+comment_offset-converter:"");
|
||||||
|
|
||||||
|
ok=True;
|
||||||
p2 += 26;
|
p2 += 26;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3683,6 +3685,7 @@ static BOOL list_servers()
|
|||||||
sname,
|
sname,
|
||||||
comment_offset?rdata+comment_offset-converter:"");
|
comment_offset?rdata+comment_offset-converter:"");
|
||||||
|
|
||||||
|
ok=True;
|
||||||
p2 += 26;
|
p2 += 26;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3691,7 +3694,7 @@ static BOOL list_servers()
|
|||||||
if (rparam) free(rparam);
|
if (rparam) free(rparam);
|
||||||
if (rdata) free(rdata);
|
if (rdata) free(rdata);
|
||||||
|
|
||||||
return(count>0);
|
return(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* NTAS uses 2, NT uses 1, WfWg uses 0 */
|
||||||
|
#define MAINTAIN_LIST 2
|
||||||
|
#define ELECTION_VERSION 2
|
||||||
|
|
||||||
#define MAX_DGRAM_SIZE (80*18+64)
|
#define MAX_DGRAM_SIZE (80*18+64)
|
||||||
#define MIN_DGRAM_SIZE 12
|
#define MIN_DGRAM_SIZE 12
|
||||||
|
|
||||||
@ -39,6 +43,8 @@
|
|||||||
#define NB__FLAG 0x60
|
#define NB__FLAG 0x60
|
||||||
#define NB_FLGMSK 0x60
|
#define NB_FLGMSK 0x60
|
||||||
|
|
||||||
|
#define REFRESH_TIME (15*60)
|
||||||
|
|
||||||
#define NAME_PERMANENT(p) ((p) & NB_PERM)
|
#define NAME_PERMANENT(p) ((p) & NB_PERM)
|
||||||
#define NAME_ACTIVE(p) ((p) & NB_ACTIVE)
|
#define NAME_ACTIVE(p) ((p) & NB_ACTIVE)
|
||||||
#define NAME_CONFLICT(p) ((p) & NB_CONFL)
|
#define NAME_CONFLICT(p) ((p) & NB_CONFL)
|
||||||
|
@ -1820,8 +1820,7 @@ int read_udp_socket(int fd,char *buf,int len)
|
|||||||
bzero((char *)&sock,socklen);
|
bzero((char *)&sock,socklen);
|
||||||
bzero((char *)&lastip,sizeof(lastip));
|
bzero((char *)&lastip,sizeof(lastip));
|
||||||
ret = recvfrom(fd,buf,len,0,&sock,&socklen);
|
ret = recvfrom(fd,buf,len,0,&sock,&socklen);
|
||||||
if (ret <= 0)
|
if (ret <= 0) {
|
||||||
{
|
|
||||||
DEBUG(2,("read socket failed. ERRNO=%d\n",errno));
|
DEBUG(2,("read socket failed. ERRNO=%d\n",errno));
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ extern int lp_maxxmit(void);
|
|||||||
extern int lp_maxmux(void);
|
extern int lp_maxmux(void);
|
||||||
extern int lp_mangledstack(void);
|
extern int lp_mangledstack(void);
|
||||||
extern BOOL lp_wins_support(void);
|
extern BOOL lp_wins_support(void);
|
||||||
|
extern BOOL lp_wins_proxy(void);
|
||||||
extern BOOL lp_preferred_master(void);
|
extern BOOL lp_preferred_master(void);
|
||||||
extern BOOL lp_domain_master(void);
|
extern BOOL lp_domain_master(void);
|
||||||
extern BOOL lp_domain_logons(void);
|
extern BOOL lp_domain_logons(void);
|
||||||
@ -82,7 +83,6 @@ extern BOOL lp_strip_dot(void);
|
|||||||
extern BOOL lp_encrypted_passwords(void);
|
extern BOOL lp_encrypted_passwords(void);
|
||||||
extern BOOL lp_syslog_only(void);
|
extern BOOL lp_syslog_only(void);
|
||||||
extern BOOL lp_browse_list(void);
|
extern BOOL lp_browse_list(void);
|
||||||
extern BOOL lp_proxy_name_resolution(void);
|
|
||||||
extern int lp_numservices(void);
|
extern int lp_numservices(void);
|
||||||
extern int lp_keepalive(void);
|
extern int lp_keepalive(void);
|
||||||
extern int lp_passwordlevel(void);
|
extern int lp_passwordlevel(void);
|
||||||
|
@ -211,9 +211,7 @@ void announce_host(void)
|
|||||||
struct work_record *work;
|
struct work_record *work;
|
||||||
|
|
||||||
if (!ip_equal(bcast_ip,d->bcast_ip))
|
if (!ip_equal(bcast_ip,d->bcast_ip))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
for (work = d->workgrouplist; work; work = work->next)
|
for (work = d->workgrouplist; work; work = work->next)
|
||||||
{
|
{
|
||||||
@ -221,8 +219,7 @@ void announce_host(void)
|
|||||||
struct server_record *s;
|
struct server_record *s;
|
||||||
BOOL announce = False;
|
BOOL announce = False;
|
||||||
|
|
||||||
if (work->needannounce)
|
if (work->needannounce) {
|
||||||
{
|
|
||||||
/* drop back to a max 3 minute announce - this is to prevent a
|
/* drop back to a max 3 minute announce - this is to prevent a
|
||||||
single lost packet from stuffing things up for too long */
|
single lost packet from stuffing things up for too long */
|
||||||
work->announce_interval = MIN(work->announce_interval,3*60);
|
work->announce_interval = MIN(work->announce_interval,3*60);
|
||||||
@ -232,27 +229,27 @@ void announce_host(void)
|
|||||||
/* announce every minute at first then progress to every 12 mins */
|
/* announce every minute at first then progress to every 12 mins */
|
||||||
if (work->lastannounce_time &&
|
if (work->lastannounce_time &&
|
||||||
(t - work->lastannounce_time) < work->announce_interval)
|
(t - work->lastannounce_time) < work->announce_interval)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (work->announce_interval < 12*60) work->announce_interval += 60;
|
if (work->announce_interval < 12*60)
|
||||||
|
work->announce_interval += 60;
|
||||||
|
|
||||||
work->lastannounce_time = t;
|
work->lastannounce_time = t;
|
||||||
|
|
||||||
DEBUG(2,("Sending announcement to subnet %s for workgroup %s\n",
|
DEBUG(2,("Sending announcement to subnet %s for workgroup %s\n",
|
||||||
inet_ntoa(d->bcast_ip),work->work_group));
|
inet_ntoa(d->bcast_ip),work->work_group));
|
||||||
|
|
||||||
if (!ip_equal(bcast_ip,d->bcast_ip))
|
if (!ip_equal(bcast_ip,d->bcast_ip)) {
|
||||||
{
|
|
||||||
stype &= ~(SV_TYPE_POTENTIAL_BROWSER | SV_TYPE_MASTER_BROWSER |
|
stype &= ~(SV_TYPE_POTENTIAL_BROWSER | SV_TYPE_MASTER_BROWSER |
|
||||||
SV_TYPE_DOMAIN_MASTER | SV_TYPE_BACKUP_BROWSER |
|
SV_TYPE_DOMAIN_MASTER | SV_TYPE_BACKUP_BROWSER |
|
||||||
SV_TYPE_DOMAIN_CTRL | SV_TYPE_DOMAIN_MEMBER);
|
SV_TYPE_DOMAIN_CTRL | SV_TYPE_DOMAIN_MEMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (s = work->serverlist; s; s = s->next)
|
for (s = work->serverlist; s; s = s->next) {
|
||||||
{
|
if (strequal(myname, s->serv.name)) {
|
||||||
if (strequal(myname, s->serv.name)) { announce = True; break; }
|
announce = True;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (announce)
|
if (announce)
|
||||||
@ -286,7 +283,8 @@ void announce_host(void)
|
|||||||
|
|
||||||
send_mailslot_reply(BROWSE_MAILSLOT,ClientDGRAM,outbuf,
|
send_mailslot_reply(BROWSE_MAILSLOT,ClientDGRAM,outbuf,
|
||||||
PTR_DIFF(p,outbuf),
|
PTR_DIFF(p,outbuf),
|
||||||
my_name,work->work_group,0,0x1e,d->bcast_ip,myip);
|
my_name,work->work_group,0,
|
||||||
|
0x1e,d->bcast_ip,myip);
|
||||||
|
|
||||||
CVAL(outbuf,0) = 12; /* domain announce */
|
CVAL(outbuf,0) = 12; /* domain announce */
|
||||||
|
|
||||||
|
@ -55,11 +55,6 @@ int workgroup_count = 0; /* unique index key: one for each workgroup */
|
|||||||
SV_TYPE_PRINTQ_SERVER | SV_TYPE_POTENTIAL_BROWSER)
|
SV_TYPE_PRINTQ_SERVER | SV_TYPE_POTENTIAL_BROWSER)
|
||||||
|
|
||||||
/* here are my election parameters */
|
/* here are my election parameters */
|
||||||
|
|
||||||
/* NTAS uses 2, NT uses 1, WfWg uses 0 */
|
|
||||||
#define MAINTAIN_LIST 2
|
|
||||||
#define ELECTION_VERSION 2
|
|
||||||
|
|
||||||
#define MSBROWSE "\001\002__MSBROWSE__\002"
|
#define MSBROWSE "\001\002__MSBROWSE__\002"
|
||||||
|
|
||||||
|
|
||||||
@ -137,8 +132,7 @@ static struct work_record *make_workgroup(char *name)
|
|||||||
/* NTAS uses ???????? */
|
/* NTAS uses ???????? */
|
||||||
work->ElectionCriterion = (MAINTAIN_LIST<<1)|(ELECTION_VERSION<<8);
|
work->ElectionCriterion = (MAINTAIN_LIST<<1)|(ELECTION_VERSION<<8);
|
||||||
work->ElectionCriterion |= (lp_os_level() << 24);
|
work->ElectionCriterion |= (lp_os_level() << 24);
|
||||||
if (lp_domain_master())
|
if (lp_domain_master()) {
|
||||||
{
|
|
||||||
work->ElectionCriterion |= 0x80;
|
work->ElectionCriterion |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +161,8 @@ static void remove_old_servers(struct work_record *work, time_t t)
|
|||||||
if (s->prev) s->prev->next = s->next;
|
if (s->prev) s->prev->next = s->next;
|
||||||
if (s->next) s->next->prev = s->prev;
|
if (s->next) s->next->prev = s->prev;
|
||||||
|
|
||||||
if (work->serverlist == s) work->serverlist = s->next;
|
if (work->serverlist == s)
|
||||||
|
work->serverlist = s->next;
|
||||||
|
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
@ -232,7 +227,7 @@ static void add_domain(struct domain_record *d)
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
static void add_browse_cache(struct browse_cache_record *b)
|
static void add_browse_cache(struct browse_cache_record *b)
|
||||||
{
|
{
|
||||||
struct browse_cache_record *b2;
|
struct browse_cache_record *b2;
|
||||||
|
|
||||||
if (!browserlist)
|
if (!browserlist)
|
||||||
{
|
{
|
||||||
@ -442,7 +437,8 @@ static struct domain_record *make_domain(struct in_addr ip, struct in_addr mask)
|
|||||||
add a domain entry. creates a workgroup, if necessary, and adds the domain
|
add a domain entry. creates a workgroup, if necessary, and adds the domain
|
||||||
to the named a workgroup.
|
to the named a workgroup.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
struct domain_record *add_domain_entry(struct in_addr source_ip, struct in_addr source_mask,
|
struct domain_record *add_domain_entry(struct in_addr source_ip,
|
||||||
|
struct in_addr source_mask,
|
||||||
char *name, BOOL add)
|
char *name, BOOL add)
|
||||||
{
|
{
|
||||||
struct domain_record *d;
|
struct domain_record *d;
|
||||||
@ -456,14 +452,16 @@ struct domain_record *add_domain_entry(struct in_addr source_ip, struct in_addr
|
|||||||
if ((d = find_domain(source_ip)) ||
|
if ((d = find_domain(source_ip)) ||
|
||||||
(d = make_domain(source_ip, source_mask)))
|
(d = make_domain(source_ip, source_mask)))
|
||||||
{
|
{
|
||||||
find_workgroupstruct(d, name, add);
|
struct work_record *w = find_workgroupstruct(d, name, add);
|
||||||
|
|
||||||
/* add WORKGROUP(1e) and WORKGROUP(00) entries into name database
|
/* add WORKGROUP(1e) and WORKGROUP(00) entries into name database
|
||||||
or register with WINS server, if it's our workgroup */
|
or register with WINS server, if it's our workgroup */
|
||||||
if (strequal(lp_workgroup(), name))
|
if (strequal(lp_workgroup(), name))
|
||||||
{
|
{
|
||||||
|
extern pstring ServerComment;
|
||||||
add_name_entry(name,0x1e,NB_ACTIVE|NB_GROUP);
|
add_name_entry(name,0x1e,NB_ACTIVE|NB_GROUP);
|
||||||
add_name_entry(name,0x0 ,NB_ACTIVE|NB_GROUP);
|
add_name_entry(name,0x0 ,NB_ACTIVE|NB_GROUP);
|
||||||
|
add_server_entry(d,w,myname,w->ServerType,0,ServerComment,True);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(3,("Added domain name entry %s at %s\n", name,inet_ntoa(ip)));
|
DEBUG(3,("Added domain name entry %s at %s\n", name,inet_ntoa(ip)));
|
||||||
@ -541,8 +539,10 @@ struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
add a server entry
|
add a server entry
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
struct server_record *add_server_entry(struct domain_record *d, struct work_record *work,
|
struct server_record *add_server_entry(struct domain_record *d,
|
||||||
char *name,int servertype, int ttl,char *comment,
|
struct work_record *work,
|
||||||
|
char *name,int servertype,
|
||||||
|
int ttl,char *comment,
|
||||||
BOOL replace)
|
BOOL replace)
|
||||||
{
|
{
|
||||||
BOOL newentry=False;
|
BOOL newentry=False;
|
||||||
|
@ -39,10 +39,6 @@ extern pstring ServerComment;
|
|||||||
|
|
||||||
/* here are my election parameters */
|
/* here are my election parameters */
|
||||||
|
|
||||||
/* NTAS uses 2, NT uses 1, WfWg uses 0 */
|
|
||||||
#define MAINTAIN_LIST 2
|
|
||||||
#define ELECTION_VERSION 2
|
|
||||||
|
|
||||||
extern time_t StartupTime;
|
extern time_t StartupTime;
|
||||||
|
|
||||||
#define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER)
|
#define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER)
|
||||||
|
@ -245,29 +245,6 @@ uint16 initiate_netbios_packet(int fd,int quest_type,char *name,int name_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void send_name_reg(void)
|
|
||||||
{
|
|
||||||
struct packet_struct p;
|
|
||||||
struct nmb_packet *nmb = &p.packet.nmb;
|
|
||||||
int rcode = 0;
|
|
||||||
|
|
||||||
nmb->header.opcode = 5;
|
|
||||||
nmb->header.response = True;
|
|
||||||
nmb->header.nm_flags.bcast = False;
|
|
||||||
nmb->header.nm_flags.recursion_available = CanRecurse;
|
|
||||||
nmb->header.nm_flags.recursion_desired = CanRecurse;
|
|
||||||
nmb->header.nm_flags.trunc = False;
|
|
||||||
nmb->header.nm_flags.authoritative = True;
|
|
||||||
nmb->header.qdcount = 0;
|
|
||||||
nmb->header.ancount = 1;
|
|
||||||
nmb->header.nscount = 0;
|
|
||||||
nmb->header.arcount = 0;
|
|
||||||
nmb->header.rcode = rcode;
|
|
||||||
|
|
||||||
send_packet(&p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
wrapper function to override a broadcast message and send it to the WINS
|
wrapper function to override a broadcast message and send it to the WINS
|
||||||
name server instead, if it exists. if wins is false, and there has been no
|
name server instead, if it exists. if wins is false, and there has been no
|
||||||
@ -349,7 +326,8 @@ void queue_netbios_packet(int fd,int quest_type,enum cmd_type cmd,char *name,
|
|||||||
|
|
||||||
if (id == 0) return;
|
if (id == 0) return;
|
||||||
|
|
||||||
if ((n = make_name_query_record(cmd,id,fd,name,name_type,bcast,recurse,to_ip)))
|
if ((n =
|
||||||
|
make_name_query_record(cmd,id,fd,name,name_type,bcast,recurse,to_ip)))
|
||||||
{
|
{
|
||||||
add_response_record(n);
|
add_response_record(n);
|
||||||
}
|
}
|
||||||
@ -453,13 +431,41 @@ void listen_for_packets(BOOL run_election)
|
|||||||
if (FD_ISSET(ClientNMB,&fds))
|
if (FD_ISSET(ClientNMB,&fds))
|
||||||
{
|
{
|
||||||
struct packet_struct *packet = read_packet(ClientNMB, NMB_PACKET);
|
struct packet_struct *packet = read_packet(ClientNMB, NMB_PACKET);
|
||||||
if (packet) queue_packet(packet);
|
if (packet) {
|
||||||
|
#if 0
|
||||||
|
if (ip_equal(packet->ip,myip) &&
|
||||||
|
(packet->port == NMB_PORT || packet->port == DGRAM_PORT)) {
|
||||||
|
DEBUG(3,("discarding packet from %s:%d\n",
|
||||||
|
inet_ntoa(packet->ip),packet->port));
|
||||||
|
DEBUG(3,("myip=%s eq=%d\n",
|
||||||
|
inet_ntoa(myip),ip_equal(packet->ip,myip)));
|
||||||
|
free_packet(packet);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
queue_packet(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(ClientDGRAM,&fds))
|
if (FD_ISSET(ClientDGRAM,&fds))
|
||||||
{
|
{
|
||||||
struct packet_struct *packet = read_packet(ClientDGRAM, DGRAM_PACKET);
|
struct packet_struct *packet = read_packet(ClientDGRAM, DGRAM_PACKET);
|
||||||
if (packet) queue_packet(packet);
|
if (packet) {
|
||||||
|
#if 0
|
||||||
|
if (ip_equal(packet->ip,myip) &&
|
||||||
|
(packet->port == NMB_PORT || packet->port == DGRAM_PORT)) {
|
||||||
|
DEBUG(3,("discarding packet from %s:%d\n",
|
||||||
|
inet_ntoa(packet->ip),packet->port));
|
||||||
|
DEBUG(3,("myip=%s eq=%d\n",
|
||||||
|
inet_ntoa(myip),ip_equal(packet->ip,myip)));
|
||||||
|
free_packet(packet);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
queue_packet(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +621,7 @@ BOOL send_mailslot_reply(char *mailslot,int fd,char *buf,int len,char *srcname,
|
|||||||
|
|
||||||
p.ip = dest_ip;
|
p.ip = dest_ip;
|
||||||
p.port = DGRAM_PORT;
|
p.port = DGRAM_PORT;
|
||||||
p.fd = fd;
|
p.fd = ClientDGRAM;
|
||||||
p.timestamp = time(NULL);
|
p.timestamp = time(NULL);
|
||||||
p.packet_type = DGRAM_PACKET;
|
p.packet_type = DGRAM_PACKET;
|
||||||
|
|
||||||
|
@ -228,12 +228,10 @@ void remove_name_entry(char *name,int type)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void add_name_entry(char *name,int type,int nb_flags)
|
void add_name_entry(char *name,int type,int nb_flags)
|
||||||
{
|
{
|
||||||
if (lp_wins_support())
|
/* always add our own entries */
|
||||||
{
|
|
||||||
/* we are a WINS server. */
|
|
||||||
add_netbios_entry(name,type,nb_flags,0,SELF,myip);
|
add_netbios_entry(name,type,nb_flags,0,SELF,myip);
|
||||||
}
|
|
||||||
else
|
if (!lp_wins_support())
|
||||||
{
|
{
|
||||||
struct in_addr ip;
|
struct in_addr ip;
|
||||||
ip = ipzero;
|
ip = ipzero;
|
||||||
@ -254,11 +252,12 @@ void add_my_names(void)
|
|||||||
|
|
||||||
ip = ipzero;
|
ip = ipzero;
|
||||||
|
|
||||||
add_netbios_entry(myname,0x20,NB_ACTIVE,0,SELF,ip);
|
add_name_entry(myname,0x20,NB_ACTIVE);
|
||||||
add_netbios_entry(myname,0x03,NB_ACTIVE,0,SELF,ip);
|
add_name_entry(myname,0x03,NB_ACTIVE);
|
||||||
add_netbios_entry(myname,0x00,NB_ACTIVE,0,SELF,ip);
|
add_name_entry(myname,0x00,NB_ACTIVE);
|
||||||
add_netbios_entry(myname,0x1f,NB_ACTIVE,0,SELF,ip);
|
add_name_entry(myname,0x1f,NB_ACTIVE);
|
||||||
add_netbios_entry("*",0x01,NB_ACTIVE,0,SELF,ip);
|
|
||||||
|
add_netbios_entry("*",0x0,NB_ACTIVE,0,SELF,ip);
|
||||||
add_netbios_entry("__SAMBA__",0x20,NB_ACTIVE,0,SELF,ip);
|
add_netbios_entry("__SAMBA__",0x20,NB_ACTIVE,0,SELF,ip);
|
||||||
add_netbios_entry("__SAMBA__",0x00,NB_ACTIVE,0,SELF,ip);
|
add_netbios_entry("__SAMBA__",0x00,NB_ACTIVE,0,SELF,ip);
|
||||||
|
|
||||||
@ -267,6 +266,20 @@ void add_my_names(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
refresh my own names
|
||||||
|
******************************************************************/
|
||||||
|
void refresh_my_names(time_t t)
|
||||||
|
{
|
||||||
|
static time_t lasttime = 0;
|
||||||
|
|
||||||
|
if (t - lasttime < REFRESH_TIME)
|
||||||
|
return;
|
||||||
|
lasttime = t;
|
||||||
|
|
||||||
|
add_my_names();
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
expires old names in the namelist
|
expires old names in the namelist
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
@ -755,11 +768,13 @@ extern void reply_name_query(struct packet_struct *p)
|
|||||||
a name we own or it is for a Primary Domain Controller name */
|
a name we own or it is for a Primary Domain Controller name */
|
||||||
if (bcast && n->source != SELF && name_type != 0x1b)
|
if (bcast && n->source != SELF && name_type != 0x1b)
|
||||||
{
|
{
|
||||||
|
if (!lp_wins_proxy() || same_net(p->ip,n->ip,Netmask)) {
|
||||||
/* never reply with a negative response to broadcast queries */
|
/* never reply with a negative response to broadcast queries */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* name is directed query, or it's self, or it's a PDC type name */
|
/* we will reply */
|
||||||
ttl = n->death_time - p->timestamp;
|
ttl = n->death_time - p->timestamp;
|
||||||
retip = n->ip;
|
retip = n->ip;
|
||||||
nb_flags = n->nb_flags;
|
nb_flags = n->nb_flags;
|
||||||
@ -823,23 +838,19 @@ static void response_netbios_packet(struct packet_struct *p)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nmb->answers->rr_type == NMB_STATUS)
|
if (nmb->answers->rr_type == NMB_STATUS) {
|
||||||
{
|
|
||||||
DEBUG(3,("Name status "));
|
DEBUG(3,("Name status "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nmb->answers->rr_type == NMB_QUERY)
|
if (nmb->answers->rr_type == NMB_QUERY) {
|
||||||
{
|
|
||||||
DEBUG(3,("Name query "));
|
DEBUG(3,("Name query "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nmb->answers->rr_type == NMB_REG)
|
if (nmb->answers->rr_type == NMB_REG) {
|
||||||
{
|
|
||||||
DEBUG(3,("Name registration "));
|
DEBUG(3,("Name registration "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nmb->answers->rr_type == NMB_REL)
|
if (nmb->answers->rr_type == NMB_REL) {
|
||||||
{
|
|
||||||
DEBUG(3,("Name release "));
|
DEBUG(3,("Name release "));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,8 +859,7 @@ static void response_netbios_packet(struct packet_struct *p)
|
|||||||
inet_ntoa(p->ip),
|
inet_ntoa(p->ip),
|
||||||
BOOLSTR(bcast)));
|
BOOLSTR(bcast)));
|
||||||
|
|
||||||
if (!(n = find_name_query(nmb->header.name_trn_id)))
|
if (!(n = find_name_query(nmb->header.name_trn_id))) {
|
||||||
{
|
|
||||||
DEBUG(3,("unknown response (received too late or from nmblookup?)\n"));
|
DEBUG(3,("unknown response (received too late or from nmblookup?)\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -285,6 +285,7 @@ static void process(void)
|
|||||||
|
|
||||||
while (True)
|
while (True)
|
||||||
{
|
{
|
||||||
|
time_t t = time(NULL);
|
||||||
run_election = check_elections();
|
run_election = check_elections();
|
||||||
listen_for_packets(run_election);
|
listen_for_packets(run_election);
|
||||||
|
|
||||||
@ -296,7 +297,8 @@ static void process(void)
|
|||||||
announce_master();
|
announce_master();
|
||||||
|
|
||||||
expire_names_and_servers();
|
expire_names_and_servers();
|
||||||
expire_netbios_response_entries(time(NULL)-10);
|
expire_netbios_response_entries(t-10);
|
||||||
|
refresh_my_names(t);
|
||||||
|
|
||||||
write_browse_list();
|
write_browse_list();
|
||||||
do_browser_lists();
|
do_browser_lists();
|
||||||
|
@ -149,6 +149,7 @@ typedef struct
|
|||||||
int os_level;
|
int os_level;
|
||||||
int max_ttl;
|
int max_ttl;
|
||||||
BOOL bWINSsupport;
|
BOOL bWINSsupport;
|
||||||
|
BOOL bWINSproxy;
|
||||||
BOOL bPreferredMaster;
|
BOOL bPreferredMaster;
|
||||||
BOOL bDomainMaster;
|
BOOL bDomainMaster;
|
||||||
BOOL bDomainLogons;
|
BOOL bDomainLogons;
|
||||||
@ -163,7 +164,6 @@ typedef struct
|
|||||||
BOOL bReadbmpx;
|
BOOL bReadbmpx;
|
||||||
BOOL bSyslogOnly;
|
BOOL bSyslogOnly;
|
||||||
BOOL bBrowseList;
|
BOOL bBrowseList;
|
||||||
BOOL bProxyNameResolution;
|
|
||||||
} global;
|
} global;
|
||||||
|
|
||||||
static global Globals;
|
static global Globals;
|
||||||
@ -414,13 +414,13 @@ struct parm_struct
|
|||||||
{"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL},
|
{"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL},
|
||||||
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL},
|
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL},
|
||||||
{"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL},
|
{"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL},
|
||||||
|
{"wins proxy", P_BOOL, P_GLOBAL, &Globals.bWINSproxy, NULL},
|
||||||
{"wins server", P_STRING, P_GLOBAL, &Globals.szWINSserver, NULL},
|
{"wins server", P_STRING, P_GLOBAL, &Globals.szWINSserver, NULL},
|
||||||
{"preferred master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL},
|
{"preferred master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL},
|
||||||
{"prefered master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL},
|
{"prefered master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL},
|
||||||
{"domain master", P_BOOL, P_GLOBAL, &Globals.bDomainMaster, NULL},
|
{"domain master", P_BOOL, P_GLOBAL, &Globals.bDomainMaster, NULL},
|
||||||
{"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL},
|
{"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL},
|
||||||
{"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL},
|
{"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL},
|
||||||
{"proxy name resolution",P_BOOL,P_GLOBAL,&Globals.bProxyNameResolution,NULL},
|
|
||||||
|
|
||||||
{"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL},
|
{"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL},
|
||||||
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL},
|
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL},
|
||||||
@ -578,8 +578,8 @@ static void init_globals(void)
|
|||||||
Globals.bDomainMaster = False;
|
Globals.bDomainMaster = False;
|
||||||
Globals.bDomainLogons = False;
|
Globals.bDomainLogons = False;
|
||||||
Globals.bBrowseList = True;
|
Globals.bBrowseList = True;
|
||||||
Globals.bProxyNameResolution = True;
|
|
||||||
Globals.bWINSsupport = True;
|
Globals.bWINSsupport = True;
|
||||||
|
Globals.bWINSproxy = False;
|
||||||
|
|
||||||
#ifdef KANJI
|
#ifdef KANJI
|
||||||
coding_system = interpret_coding_system (KANJI, SJIS_CODE);
|
coding_system = interpret_coding_system (KANJI, SJIS_CODE);
|
||||||
@ -706,6 +706,7 @@ FN_GLOBAL_STRING(lp_logon_script,&Globals.szLogonScript)
|
|||||||
FN_GLOBAL_STRING(lp_wins_server,&Globals.szWINSserver)
|
FN_GLOBAL_STRING(lp_wins_server,&Globals.szWINSserver)
|
||||||
|
|
||||||
FN_GLOBAL_BOOL(lp_wins_support,&Globals.bWINSsupport)
|
FN_GLOBAL_BOOL(lp_wins_support,&Globals.bWINSsupport)
|
||||||
|
FN_GLOBAL_BOOL(lp_wins_proxy,&Globals.bWINSproxy)
|
||||||
FN_GLOBAL_BOOL(lp_domain_master,&Globals.bDomainMaster)
|
FN_GLOBAL_BOOL(lp_domain_master,&Globals.bDomainMaster)
|
||||||
FN_GLOBAL_BOOL(lp_domain_logons,&Globals.bDomainLogons)
|
FN_GLOBAL_BOOL(lp_domain_logons,&Globals.bDomainLogons)
|
||||||
FN_GLOBAL_BOOL(lp_preferred_master,&Globals.bPreferredMaster)
|
FN_GLOBAL_BOOL(lp_preferred_master,&Globals.bPreferredMaster)
|
||||||
@ -721,7 +722,6 @@ FN_GLOBAL_BOOL(lp_strip_dot,&Globals.bStripDot)
|
|||||||
FN_GLOBAL_BOOL(lp_encrypted_passwords,&Globals.bEncryptPasswords)
|
FN_GLOBAL_BOOL(lp_encrypted_passwords,&Globals.bEncryptPasswords)
|
||||||
FN_GLOBAL_BOOL(lp_syslog_only,&Globals.bSyslogOnly)
|
FN_GLOBAL_BOOL(lp_syslog_only,&Globals.bSyslogOnly)
|
||||||
FN_GLOBAL_BOOL(lp_browse_list,&Globals.bBrowseList)
|
FN_GLOBAL_BOOL(lp_browse_list,&Globals.bBrowseList)
|
||||||
FN_GLOBAL_BOOL(lp_proxy_name_resolution,&Globals.bProxyNameResolution)
|
|
||||||
|
|
||||||
FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
|
FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
|
||||||
FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
|
FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
|
||||||
|
Loading…
Reference in New Issue
Block a user