summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/charset.c11
-rw-r--r--source3/nameelect.c4
-rw-r--r--source3/nameservresp.c31
-rw-r--r--source3/param/loadparm.c6
4 files changed, 46 insertions, 6 deletions
diff --git a/source3/lib/charset.c b/source3/lib/charset.c
index 6b4f0b07bc..55e2239b55 100644
--- a/source3/lib/charset.c
+++ b/source3/lib/charset.c
@@ -232,6 +232,15 @@ void codepage_initialise(int client_codepage)
{
int i;
unsigned char (*cp)[4] = NULL;
+ static BOOL done = False;
+
+ if(done == True)
+ {
+ DEBUG(6,
+ ("codepage_initialise: called twice - ignoring second client code page = %d\n",
+ client_codepage));
+ return;
+ }
DEBUG(6,("codepage_initialise: client code page = %d\n", client_codepage));
@@ -259,6 +268,8 @@ void codepage_initialise(int client_codepage)
for(i = 0; (cp[i][0] != '\0') && (cp[i][1] != '\0'); i++)
add_dos_char(cp[i][0], (BOOL)cp[i][2], cp[i][1], (BOOL)cp[i][3]);
}
+
+ done = True;
}
/*******************************************************************
diff --git a/source3/nameelect.c b/source3/nameelect.c
index 0ae8c9766d..06f3e870af 100644
--- a/source3/nameelect.c
+++ b/source3/nameelect.c
@@ -641,6 +641,10 @@ void unbecome_domain_master(struct subnet_record *d, struct work_record *work,
how it was registered. */
remove_name_entry(d,work->work_group,0x1b);
}
+
+ /* Unregister the 1b name from the WINS server. */
+ if(wins_subnet != NULL)
+ remove_name_entry(wins_subnet, myworkgroup, 0x1b);
}
}
diff --git a/source3/nameservresp.c b/source3/nameservresp.c
index 2fb38a0407..a88481d06b 100644
--- a/source3/nameservresp.c
+++ b/source3/nameservresp.c
@@ -143,21 +143,40 @@ static void response_name_reg(struct nmb_name *ans_name,
NAME_QUERY_SRV_CHK, and NAME_QUERY_FIND_MST dealt with here.
****************************************************************************/
static void response_server_check(struct nmb_name *ans_name,
- struct response_record *n, struct subnet_record *d)
+ struct response_record *n, struct subnet_record *d, struct packet_struct *p)
{
+ struct nmb_packet *nmb = &p->packet.nmb;
+ struct in_addr send_ip;
+ enum state_type cmd;
+
+ /* This next fix was from Bernhard Laeser <nlaesb@ascom.ch>
+ who noticed we were replying directly back to the server
+ we sent to - rather than reading the response.
+ */
+
+ if (nmb->header.rcode == 0 && nmb->answers->rdata)
+ putip((char*)&send_ip,&nmb->answers->rdata[2]);
+ else
+ {
+
+ DEBUG(2,("response_server_check: name query for %s failed\n",
+ namestr(ans_name)));
+ return;
+ }
+
/* issue another state: this time to do a name status check */
- enum state_type cmd = (n->state == NAME_QUERY_DOM_SRV_CHK) ?
+ cmd = (n->state == NAME_QUERY_DOM_SRV_CHK) ?
NAME_STATUS_DOM_SRV_CHK : NAME_STATUS_SRV_CHK;
- /* initiate a name status check on the server that replied
- in addition, the workgroup being checked has been stored
+ /* initiate a name status check on address given in the reply
+ record. In addition, the workgroup being checked has been stored
in the response_record->my_name (see announce_master) we
also propagate this into the same field. */
queue_netbios_packet(d,ClientNMB,NMB_STATUS, cmd,
ans_name->name, ans_name->name_type,
0,0,0,n->my_name,NULL,
- False,False,n->send_ip,n->reply_to_ip);
+ False,False,send_ip,n->reply_to_ip);
}
@@ -720,7 +739,7 @@ static void response_process(struct subnet_record *d, struct packet_struct *p,
case NAME_QUERY_SRV_CHK:
case NAME_QUERY_FIND_MST:
{
- response_server_check(ans_name, n, d);
+ response_server_check(ans_name, n, d, p);
break;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index df4d72cf20..8c048ad079 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1500,6 +1500,12 @@ static BOOL handle_valid_chars(char *pszParmValue,char **ptr)
{
string_set(ptr,pszParmValue);
+ /* A dependency here is that the parameter client code page must be
+ set before this is called - as calling codepage_initialise()
+ would overwrite the valid char lines.
+ */
+ codepage_initialise(lp_client_code_page());
+
add_char_string(pszParmValue);
return(True);
}