2 Unix SMB/Netbios implementation.
4 NBT netbios routines and daemon - version 2
5 Copyright (C) Andrew Tridgell 1994-1997
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 14 jan 96: lkcl@pires.co.uk
24 added multiple workgroup domain master support
30 extern int ClientDGRAM;
32 #define TEST_CODE /* want to debug unknown browse packets */
34 extern int DEBUGLEVEL;
36 extern pstring myname;
39 /****************************************************************************
40 process a domain logon packet
42 **************************************************************************/
43 void process_logon_packet(struct packet_struct *p,char *buf,int len)
45 struct dgram_packet *dgram = &p->packet.dgram;
48 BOOL add_slashes = False;
51 char unknown_byte = 0;
52 uint16 request_count = 0;
55 if (!lp_domain_logons())
57 DEBUG(3,("No domain logons\n"));
67 char *machine = buf+2;
68 char *user = skip_string(machine,1);
70 logname = skip_string(user,1);
71 tmp = skip_string(logname,1);
72 unknown_byte = CVAL(tmp,0);
73 request_count = SVAL(tmp,1);
77 strcpy(reply_name,myname);
80 DEBUG(3,("Domain login request from %s(%s) user=%s token=%x\n",
81 machine,inet_ntoa(p->ip),user,token));
86 char *machine = buf+2;
87 logname = skip_string(machine,1);
88 token = SVAL(skip_string(logname,1),0);
90 strcpy(reply_name,lp_domain_controller());
93 /* oo! no domain controller. must be us, then */
94 strcpy(reply_name,myname);
99 /* refer logon request to the domain controller */
103 strupper(reply_name);
104 DEBUG(3,("GETDC request from %s(%s), reporting %s 0x%x token=%x\n",
105 machine,inet_ntoa(p->ip), reply_name, reply_code,token));
110 DEBUG(3,("Unknown domain request %d\n",code));
115 bzero(outbuf,sizeof(outbuf));
117 SSVAL(q,0,reply_code);
120 if (token == 0xffff || /* LM 2.0 or later */
121 token == 0xfffe) /* WfWg networking */
128 strcpy(q, reply_name);
130 q = skip_string(q,1);
132 if (token == 0xffff) /* LM 2.0 or later */
142 send_mailslot_reply(True, logname,ClientDGRAM,outbuf,PTR_DIFF(q,outbuf),
143 myname,&dgram->source_name.name[0],0x20,0,p->ip,