1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

nameannounce.c

nameresp.c
nameserv.c
nameservreply.c
proto.h : Removed broadcast and recurse parameters in the
queue_netbios_pkt_wins() call - they are not needed as they
should always be 'false' and 'true' respectively.
Also fixed a bug with secure name registration (WINS
server code).
server.c: Finally fixed problem with error 267 being
returned to Win95. It is needed by NT. This is a horrid
fix and I would appreciate a better one :-).

Jeremy (jallison@whistle.com)
This commit is contained in:
Jeremy Allison -
parent 56e8e890ec
commit fa1305d189
6 changed files with 42 additions and 32 deletions

View File

@ -502,7 +502,6 @@ struct response_record *queue_netbios_pkt_wins(
int fd,int quest_type,enum state_type state,
char *name,int name_type,int nb_flags, time_t ttl,
int server_type, char *my_name, char *my_comment,
BOOL bcast,BOOL recurse,
struct in_addr send_ip, struct in_addr reply_to_ip);
struct response_record *queue_netbios_packet(struct subnet_record *d,
int fd,int quest_type,enum state_type state,char *name,

View File

@ -430,7 +430,7 @@ workgroup %s\n", am_master, work->work_group));
NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
name, type, 0,0,0,
work->work_group,NULL,
False, True, ipzero, ipzero);
ipzero, ipzero);
}
else if(lp_wins_support())
{

View File

@ -117,7 +117,7 @@ static void dead_netbios_entry(struct subnet_record *d,
add_name_respond(d,n->fd,d->myip, n->response_id ,&n->name,
n->nb_flags, GET_TTL(0),
n->reply_to_ip, False, n->reply_to_ip);
n->reply_to_ip, True, n->reply_to_ip);
if (!n->bcast && n->num_msgs == 0)
{
@ -250,7 +250,6 @@ struct response_record *queue_netbios_pkt_wins(
int fd,int quest_type,enum state_type state,
char *name,int name_type,int nb_flags, time_t ttl,
int server_type, char *my_name, char *my_comment,
BOOL bcast,BOOL recurse,
struct in_addr send_ip, struct in_addr reply_to_ip)
{
/* XXXX note: please see rfc1001.txt section 10 for details on this
@ -260,30 +259,29 @@ struct response_record *queue_netbios_pkt_wins(
*/
if ((!lp_wins_support()) && (*lp_wins_server()))
{
{
/* samba is not a WINS server, and we are using a WINS server */
struct in_addr real_wins_ip;
real_wins_ip = *interpret_addr2(lp_wins_server());
if (!zero_ip(real_wins_ip))
if (!zero_ip(real_wins_ip))
{
bcast = False;
send_ip = real_wins_ip;
}
else
else
{
/* oops. smb.conf's wins server parameter MUST be a host_name
or an ip_address. */
DEBUG(0,("invalid smb.conf parameter 'wins server'\n"));
}
}
}
if (zero_ip(send_ip)) return NULL;
return queue_netbios_packet(wins_subnet,fd, quest_type, state,
name, name_type, nb_flags, ttl,
server_type,my_name,my_comment,
bcast, recurse, send_ip, reply_to_ip);
False, True, send_ip, reply_to_ip);
}

View File

@ -103,7 +103,7 @@ void remove_name_entry(struct subnet_record *d, char *name,int type)
/* not a WINS server: we have to release them on the network */
queue_netbios_pkt_wins(ClientNMB,NMB_REL,NAME_RELEASE,
name, type, 0, 0,0,NULL,NULL,
False, True, ipzero, ipzero);
ipzero, ipzero);
}
}
else
@ -163,7 +163,7 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags)
queue_netbios_pkt_wins(ClientNMB,
re_reg ? NMB_REG_REFRESH : NMB_REG, NAME_REGISTER,
name, type, nb_flags, GET_TTL(0),0,NULL,NULL,
False, True, ipzero, ipzero);
ipzero, ipzero);
}
}
else
@ -308,7 +308,7 @@ for domain master on workgroup %s\n", myworkgroup));
NAME_QUERY_DOMAIN,
myworkgroup, 0x1b,
0, 0,0,NULL,NULL,
False, True, ipzero, ipzero);
ipzero, ipzero);
}
}
}

View File

@ -98,7 +98,7 @@ void add_name_respond(struct subnet_record *d, int fd, struct in_addr from_ip,
/* see rfc1002.txt - 4.2.10 and 4.2.11 */
send_name_response(fd,from_ip, response_id, NMB_REG,
new_owner,
True, False,
True, True,
name, nb_flags, ttl, reply_to_ip);
}
@ -183,7 +183,6 @@ void reply_name_reg(struct packet_struct *p)
int qname_type = question->name_type;
BOOL bcast = nmb->header.nm_flags.bcast;
BOOL release_is_to_wins_server = nmb->header.nm_flags.recursion_desired;
int ttl = GET_TTL(nmb->additional->ttl);
int nb_flags = nmb->additional->rdata[0];
@ -314,21 +313,21 @@ void reply_name_reg(struct packet_struct *p)
/* initiate some enquiries to the current owner. */
queue_netbios_packet(d,ClientNMB,NMB_QUERY,
NAME_REGISTER_CHALLENGE,
reply_name->name,reply_name->name_type,
nb_flags,0,0,NULL,NULL,
True, False,
NAME_REGISTER_CHALLENGE,
reply_name->name,reply_name->name_type,
nb_flags,0,0,NULL,NULL,
False, False,
n->ip_flgs[0].ip, p->ip);
}
else
{
/* Send a NAME REGISTRATION RESPONSE (pos/neg) see rfc1002.txt 4.2.13-14
/* Send a NAME REGISTRATION RESPONSE (pos/neg) see rfc1002.txt 4.2.5-6
or an END-NODE CHALLENGE REGISTRATION RESPONSE see rfc1002.txt 4.2.7
*/
send_name_response(p->fd,p->ip, nmb->header.name_trn_id, NMB_REG,
success,
release_is_to_wins_server, False,
True, True,
reply_name, nb_flags, ttl, ip);
}
}
@ -517,8 +516,8 @@ void reply_name_query(struct packet_struct *p)
int name_type = question->name_type;
BOOL bcast = nmb->header.nm_flags.bcast;
BOOL query_is_to_wins_server = nmb->header.nm_flags.recursion_desired;
BOOL query_is_to_wins_server = (!bcast &&
nmb->header.nm_flags.recursion_desired);
int ttl=0;
int rcode = 0;
int nb_flags = 0;
@ -527,6 +526,7 @@ void reply_name_query(struct packet_struct *p)
struct subnet_record *d = NULL;
BOOL success = True;
struct name_record *n = NULL;
BOOL acting_as_wins_server = lp_wins_support();
/* directed queries are for WINS server: broadcasts are local SELF queries.
the exception is Domain Master names. */
@ -656,11 +656,12 @@ void reply_name_query(struct packet_struct *p)
/* see rfc1002.txt 4.2.13 */
reply_netbios_packet(p,nmb->header.name_trn_id,
rcode,NMB_QUERY,0,
query_is_to_wins_server, /* recursion_available flag */
True, /* recursion_desired_flag */
&nmb->question.question_name,
0x20, 0x01,
ttl,
rdata, success ? 6 : 0);
rcode,NMB_QUERY,0,
(query_is_to_wins_server && acting_as_wins_server ?
True : False), /* recursion_available flag */
True, /* recursion_desired_flag */
&nmb->question.question_name,
0x20, 0x01,
ttl,
rdata, success ? 6 : 0);
}

View File

@ -1985,9 +1985,10 @@ struct
int new_smb_error;
int old_smb_error;
int protocol_level;
char *valid_remote_arch;
} old_client_errmap[] =
{
{ERRbaddirectory, ERRbadpath, (int)PROTOCOL_NT1},
{ERRbaddirectory, ERRbadpath, (int)PROTOCOL_NT1, "WinNT"},
{0,0,0}
};
@ -1996,6 +1997,7 @@ struct
****************************************************************************/
int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int line)
{
extern fstring remote_arch;
int eclass=def_class;
int ecode=def_code;
int i=0;
@ -2024,9 +2026,19 @@ int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int
/* Make sure we don't return error codes that old
clients don't understand. */
/* JRA - unfortunately, WinNT needs some error codes
for apps to work correctly, Win95 will break if
these error codes are returned. But they both
negotiate the *same* protocol. So we need to use
the revolting 'remote_arch' string to tie break.
There must be a better way of doing this...
*/
for(i = 0; old_client_errmap[i].new_smb_error != 0; i++)
{
if((Protocol < old_client_errmap[i].protocol_level) &&
if(((Protocol < old_client_errmap[i].protocol_level) ||
!strcsequal( old_client_errmap[i].valid_remote_arch, remote_arch)) &&
(old_client_errmap[i].new_smb_error == ecode))
{
ecode = old_client_errmap[i].old_smb_error;