summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-11-28 05:52:31 +0000
committerAndrew Tridgell <tridge@samba.org>1997-11-28 05:52:31 +0000
commite89611985b35155770648c8f16ddd19acfb5ee13 (patch)
treea8b911c59fe33e43c43c1b07aac396c63c330d58
parent84215c9b91f3c5130b172a3bbc83c7ddd66c5cb8 (diff)
downloadsamba-e89611985b35155770648c8f16ddd19acfb5ee13.tar.gz
samba-e89611985b35155770648c8f16ddd19acfb5ee13.tar.xz
samba-e89611985b35155770648c8f16ddd19acfb5ee13.zip
pass the mailslot name to process_logon_packet()
- fixed process_logon_packet() to always send the reply to/from the correct netbios name (it should match the query) - only do a NT style QUERYFORPDC if the query came in on a NT_LOGON_MAILSLOT Luke, can you check to see if these changes work in your branch with NT logons?
-rw-r--r--source/include/proto.h3
-rw-r--r--source/namelogon.c55
-rw-r--r--source/namepacket.c4
3 files changed, 38 insertions, 24 deletions
diff --git a/source/include/proto.h b/source/include/proto.h
index 1b8d5be1417..c47b7582f30 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -547,7 +547,8 @@ BOOL check_elections(void);
/*The following definitions come from namelogon.c */
-void process_logon_packet(struct packet_struct *p,char *buf,int len);
+void process_logon_packet(struct packet_struct *p,char *buf,int len,
+ char *mailslot);
/*The following definitions come from namepacket.c */
diff --git a/source/namelogon.c b/source/namelogon.c
index 697a11a16a4..08e0f036077 100644
--- a/source/namelogon.c
+++ b/source/namelogon.c
@@ -36,9 +36,9 @@ extern pstring myname;
/****************************************************************************
process a domain logon packet
-
**************************************************************************/
-void process_logon_packet(struct packet_struct *p,char *buf,int len)
+void process_logon_packet(struct packet_struct *p,char *buf,int len,
+ char *mailslot)
{
struct dgram_packet *dgram = &p->packet.dgram;
pstring my_name;
@@ -57,9 +57,9 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
uint32 domainsidsize;
uint16 requestcount;
char *domainsid;
+ char *getdc;
char *uniuser; /* Unicode user name */
pstring ascuser;
- char *mailslot;
char *unicomp; /* Unicode computer name */
struct smb_passwd *smb_pass; /* To check if machine account exists */
@@ -83,8 +83,8 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
char *machine = q;
char *user = skip_string(machine,1);
- mailslot = skip_string(user,1);
- q = skip_string(mailslot,1);
+ getdc = skip_string(user,1);
+ q = skip_string(getdc,1);
unknown_byte = CVAL(q,0);
request_count = SVAL(q,1);
token = SVAL(q,3);
@@ -107,9 +107,12 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
dump_data(4, outbuf, PTR_DIFF(q, outbuf));
- send_mailslot_reply(True, mailslot, ClientDGRAM,
+ send_mailslot_reply(True, getdc, ClientDGRAM,
outbuf,PTR_DIFF(q,outbuf),
- my_name,&dgram->source_name.name[0],0x20,0,
+ dgram->dest_name.name,
+ dgram->source_name.name,
+ dgram->dest_name.name_type,
+ dgram->source_name.name_type,
p->ip, *iface_ip(p->ip));
break;
}
@@ -119,8 +122,8 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
char *q = buf + 2;
char *machine = q;
- mailslot = skip_string(machine,1);
- unicomp = skip_string(mailslot,1);
+ getdc = skip_string(machine,1);
+ unicomp = skip_string(getdc,1);
q = align2(unicomp, buf);
@@ -138,14 +141,18 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
strcpy(reply_name,my_name);
strcpy(q, reply_name); q = skip_string(q, 1); /* PDC name */
- q = align2(q, buf);
+ if (strcmp(mailslot, NT_LOGON_MAILSLOT)==0) {
+ q = align2(q, buf);
- PutUniCode(q, my_name); q = skip_unicode_string(q, 1); /* PDC name */
- PutUniCode(q, lp_workgroup()); q = skip_unicode_string(q, 1); /* Domain name. */
+ PutUniCode(q, my_name); /* PDC name */
+ q = skip_unicode_string(q, 1);
+ PutUniCode(q, lp_workgroup()); /* Domain name*/
+ q = skip_unicode_string(q, 1);
- SIVAL(q, 0, ntversion); q += 4;
- SSVAL(q, 0, lmnttoken); q += 2;
- SSVAL(q, 0, lm20token); q += 2;
+ SIVAL(q, 0, ntversion); q += 4;
+ SSVAL(q, 0, lmnttoken); q += 2;
+ SSVAL(q, 0, lm20token); q += 2;
+ }
DEBUG(3,("GETDC request from %s(%s), reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
machine,inet_ntoa(p->ip), reply_name, lp_workgroup(),
@@ -154,9 +161,12 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
dump_data(4, outbuf, PTR_DIFF(q, outbuf));
- send_mailslot_reply(True, mailslot,ClientDGRAM,
+ send_mailslot_reply(True, getdc,ClientDGRAM,
outbuf,PTR_DIFF(q,outbuf),
- my_name,&dgram->source_name.name[0],0x20,0,
+ dgram->dest_name.name,
+ dgram->source_name.name,
+ dgram->dest_name.name_type,
+ dgram->source_name.name_type,
p->ip, *iface_ip(p->ip));
return;
}
@@ -168,8 +178,8 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
requestcount = SVAL(q, 0); q += 2;
unicomp = q;
uniuser = skip_unicode_string(unicomp,1);
- mailslot = skip_unicode_string(uniuser,1);
- q = skip_string(mailslot,1);
+ getdc = skip_unicode_string(uniuser,1);
+ q = skip_string(getdc,1);
allowableaccount = IVAL(q, 0); q += 4;
domainsidsize = IVAL(q, 0); q += 4;
domainsid = q;
@@ -221,9 +231,12 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
dump_data(4, outbuf, PTR_DIFF(q, outbuf));
- send_mailslot_reply(True, mailslot,ClientDGRAM,
+ send_mailslot_reply(True, getdc,ClientDGRAM,
outbuf,PTR_DIFF(q,outbuf),
- my_name,&dgram->source_name.name[0],0x20,0,
+ dgram->dest_name.name,
+ dgram->source_name.name,
+ dgram->dest_name.name_type,
+ dgram->source_name.name_type,
p->ip, *iface_ip(p->ip));
break;
}
diff --git a/source/namepacket.c b/source/namepacket.c
index 626e50b788a..be099340c39 100644
--- a/source/namepacket.c
+++ b/source/namepacket.c
@@ -382,13 +382,13 @@ static void process_dgram(struct packet_struct *p)
/* datagram packet received for the domain log on mailslot */
if (strequal(smb_buf(buf),NET_LOGON_MAILSLOT)) {
- process_logon_packet(p,buf2,len);
+ process_logon_packet(p,buf2,len, NET_LOGON_MAILSLOT);
return;
}
/* datagram packet received for the NT domain log on mailslot */
if (strequal(smb_buf(buf),NT_LOGON_MAILSLOT)) {
- process_logon_packet(p,buf2,len);
+ process_logon_packet(p,buf2,len, NT_LOGON_MAILSLOT);
return;
}
}