2 Unix SMB/Netbios implementation.
4 NBT netbios routines and daemon - version 2
5 Copyright (C) Andrew Tridgell 1994-1995
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
41 **************************************************************************/
42 void process_logon_packet(struct packet_struct
*p
,char *buf
,int len
)
44 struct dgram_packet
*dgram
= &p
->packet
.dgram
;
45 struct in_addr ip
= dgram
->header
.source_ip
;
46 struct subnet_record
*d
= find_subnet(ip
);
49 BOOL add_slashes
= False
;
52 struct work_record
*work
;
56 if (!(work
= find_workgroupstruct(d
,dgram
->dest_name
.name
, False
)))
59 if (!lp_domain_logons()) {
60 DEBUG(3,("No domain logons\n"));
63 if (!listening_name(work
, &dgram
->dest_name
))
65 DEBUG(4,("Not listening to that domain\n"));
73 char *machine
= buf
+2;
74 char *user
= skip_string(machine
,1);
75 logname
= skip_string(user
,1);
79 DEBUG(3,("Domain login request from %s(%s) user=%s\n",
80 machine
,inet_ntoa(p
->ip
),user
));
85 char *machine
= buf
+2;
86 logname
= skip_string(machine
,1);
88 reply_name
= lp_domain_controller();
90 DEBUG(3,("No domain controller configured\n"));
93 DEBUG(3,("GETDC request from %s(%s)\n",
94 machine
,inet_ntoa(p
->ip
)));
98 DEBUG(3,("Unknown domain request %d\n",code
));
102 bzero(outbuf
,sizeof(outbuf
));
104 SSVAL(q
,0,reply_code
);
110 StrnCpy(q
,reply_name
,16);
112 q
= skip_string(q
,1);
116 send_mailslot_reply(logname
,ClientDGRAM
,outbuf
,PTR_DIFF(q
,outbuf
),
117 myname
,&dgram
->source_name
.name
[0],0x20,0,p
->ip
,