summaryrefslogtreecommitdiff
path: root/source3/namelogon.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-03-09 14:58:22 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-03-09 14:58:22 +0000
commitb581d0324098f12a5bcb1941e698339a84e44a93 (patch)
treee6582f6847cc0df3377b7d722f4d3f8f2b573659 /source3/namelogon.c
parent3046a0d7c29ad6a5bdafe763c90aa521ac8aa93a (diff)
downloadsamba-b581d0324098f12a5bcb1941e698339a84e44a93.tar.gz
samba-b581d0324098f12a5bcb1941e698339a84e44a93.tar.bz2
samba-b581d0324098f12a5bcb1941e698339a84e44a93.zip
1) updated ipc.c NetUserGetInfo - load \\%L\%U instead of \\%L\HOMES
because the share must be browseable by a w95 client 2) send_mailslot_reply - unique or group datagram argument added. 3) netlogon.c - rewrote response packet to do the right thing for w95. 4) server.c reply_nt1() - added OEMDomainstring to the end. 5) (deep breath) reworked the nmbd-browsing code a little bit. i discovered two months ago that becoming a primary domain controller (and domain master browser) is done independently of becoming a backup domain controller (logon server) is done independently of becoming a local master browser. therefore, three sets of state-machines (instead of just one) are in place - each of which is responsible for taking samba through the required stages to become: a logon server; a domain master browser; and a local master browser. each of these three things can occur independently on each interface, _including_ the wins pseudo-interface. the only slight caveat is that the wins pseudo-interface, by virtue of _not_ being a broadcast interface, does _not_ register as a local master browser with the wins server, as this doesn't make sense. lkcl (This used to be commit 88c6a00c3c1b430307f512986185b5ed7aea7181)
Diffstat (limited to 'source3/namelogon.c')
-rw-r--r--source3/namelogon.c77
1 files changed, 46 insertions, 31 deletions
diff --git a/source3/namelogon.c b/source3/namelogon.c
index aacf32c280..3fab49cedd 100644
--- a/source3/namelogon.c
+++ b/source3/namelogon.c
@@ -54,86 +54,101 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len)
pstring outbuf;
int code,reply_code;
struct work_record *work;
+ char unknown_byte = 0;
+ uint16 request_count = 0;
+ uint16 token = 0;
if (!d) return;
- if (!(work = find_workgroupstruct(d,dgram->dest_name.name, False)))
- return;
+ if (!(work = find_workgroupstruct(d,dgram->dest_name.name, False))) return;
- if (!lp_domain_logons()) {
+ if (!lp_domain_logons())
+ {
DEBUG(3,("No domain logons\n"));
return;
}
code = SVAL(buf,0);
- switch (code) {
+ switch (code)
+ {
case 0:
{
char *machine = buf+2;
char *user = skip_string(machine,1);
+ char *tmp;
logname = skip_string(user,1);
- reply_code = 6;
+ tmp = skip_string(logname,1);
+ unknown_byte = CVAL(tmp,0);
+ request_count = SVAL(tmp,1);
+ token = SVAL(tmp,3);
+
+ reply_code = 0x6;
strcpy(reply_name,myname);
strupper(reply_name);
add_slashes = True;
- DEBUG(3,("Domain login request from %s(%s) user=%s\n",
- machine,inet_ntoa(p->ip),user));
- }
+ DEBUG(3,("Domain login request from %s(%s) user=%s token=%x\n",
+ machine,inet_ntoa(p->ip),user,token));
break;
+ }
case 7:
{
char *machine = buf+2;
logname = skip_string(machine,1);
- reply_code = 7;
+ token = SVAL(skip_string(logname,1),0);
+
strcpy(reply_name,lp_domain_controller());
- if (!*reply_name) {
+ if (!*reply_name)
+ {
+ /* oo! no domain controller. must be us, then */
strcpy(reply_name,myname);
reply_code = 0xC;
}
- strupper(reply_name);
- DEBUG(3,("GETDC request from %s(%s), reporting %s 0x%2x\n",
- machine,inet_ntoa(p->ip), reply_name, reply_code));
+ else
+ {
+ /* refer logon request to the domain controller */
+ reply_code = 0x7;
}
+
+ strupper(reply_name);
+ DEBUG(3,("GETDC request from %s(%s), reporting %s 0x%x token=%x\n",
+ machine,inet_ntoa(p->ip), reply_name, reply_code,token));
break;
+ }
default:
+ {
DEBUG(3,("Unknown domain request %d\n",code));
return;
}
+ }
bzero(outbuf,sizeof(outbuf));
q = outbuf;
SSVAL(q,0,reply_code);
q += 2;
- if (add_slashes) {
+
+ if (token == 0xffff || /* LM 2.0 or later */
+ token == 0xfffe) /* WfWg networking */
+ {
+ if (add_slashes)
+ {
strcpy(q,"\\\\");
q += 2;
}
- StrnCpy(q,reply_name,16);
+ strcpy(q, reply_name);
+ strupper(q);
q = skip_string(q,1);
- if (reply_code == 0xC)
- {
- if ( PTR_DIFF (q,outbuf) & 1 )
+ if (token == 0xffff) /* LM 2.0 or later */
{
- q++;
- }
-
- PutUniCode(q,reply_name);
- q += 2*(strlen(reply_name) + 1);
-
- PutUniCode(q,lp_workgroup());
- q += 2*(strlen(lp_workgroup()) + 1);
-
- SIVAL(q,0,1);
- q += 4;
- SSVAL(q,0,0xFFFF);
+ SSVAL(q,0,token);
q += 2;
}
+ }
SSVAL(q,0,0xFFFF);
q += 2;
- send_mailslot_reply(logname,ClientDGRAM,outbuf,PTR_DIFF(q,outbuf),
+ send_mailslot_reply(True, logname,ClientDGRAM,outbuf,PTR_DIFF(q,outbuf),
myname,&dgram->source_name.name[0],0x20,0,p->ip,
*iface_ip(p->ip));
}