1 This is a extremely rough patch that 'fixes' Samba3 nmbd to allow a
2 join from a WinXP client to a Samba4 server. Note that it hard-codes
3 the domain GUID. Please only use for testing Samba4 - do not apply
7 Index: nmbd/nmbd_processlogon.c
8 ===================================================================
9 --- nmbd/nmbd_processlogon.c (revision 4247)
10 +++ nmbd/nmbd_processlogon.c (working copy)
16 +int push_components(unsigned char *q, const char *s)
26 + while ((p = strchr(s, '.'))) {
37 + memcpy(q+1, s, l+1);
43 /****************************************************************************
44 Process a domain logon packet
45 **************************************************************************/
47 void process_logon_packet(struct packet_struct *p, char *buf,int len,
52 get_mydnsdomname(domain);
55 + pstrcpy(domain, "bludom.tridgell.net");
57 if (SVAL(uniuser, 0) == 0) {
58 SIVAL(q, 0, SAMLOGON_AD_UNK_R); /* user unknown */
61 SIVAL(q, 0, ADS_PDC|ADS_GC|ADS_LDAP|ADS_DS|
62 ADS_KDC|ADS_TIMESERV|ADS_CLOSEST|ADS_WRITABLE);
64 + SIVAL(q, 0, ADS_PDC|ADS_DS|
65 + ADS_TIMESERV|ADS_CLOSEST|ADS_WRITABLE);
68 /* Push Domain GUID */
73 + smb_string_to_uuid("b0eac516-4a33-8675-4127-6bf058911234", &domain_guid);
75 + dump_data(0, domain_guid.node, 6);
77 smb_uuid_pack(domain_guid, &flat_guid);
78 memcpy(q, &flat_guid.info, UUID_FLAT_SIZE);
79 - q += UUID_FLAT_SIZE;
82 - str_offset = q - q_orig;
85 - while ((component = strtok(dc, "."))) {
87 - size = push_ascii(&q[1], component, -1, 0);
91 + dump_data(0, q, 16);
96 + q += UUID_FLAT_SIZE;
99 - SCVAL(q, 0, 0xc0 | ((str_offset >> 8) & 0x3F));
100 - SCVAL(q, 1, str_offset & 0xFF);
102 + const char *dnsname = "192.168.115.1";
105 - size = push_ascii(&q[1], hostname, -1, 0);
108 - SCVAL(q, 0, 0xc0 | ((str_offset >> 8) & 0x3F));
109 - SCVAL(q, 1, str_offset & 0xFF);
112 - /* NETBIOS of domain */
113 - size = push_ascii(&q[1], lp_workgroup(), -1, STR_UPPER);
121 - /* NETBIOS of hostname */
122 - size = push_ascii(&q[1], my_name, -1, 0);
131 - if (SVAL(uniuser, 0) != 0) {
132 - size = push_ascii(&q[1], ascuser, -1, 0);
135 + q += push_components(q, domain);
136 + q += push_components(q, domain);
137 + q += push_components(q, dnsname);
138 + q += push_components(q, lp_workgroup());
139 + q += push_components(q, my_name);
140 + q += push_components(q, "");
141 + if (SVAL(uniuser, 0)) {
142 + q += push_components(q, ascuser);
144 + q += push_components(q, "Default-First-Site-Name");
145 + q += push_components(q, "Default-First-Site-Name");
149 - size = push_ascii(&q[1], "Default-First-Site-Name", -1, 0);
153 - /* Site name (2) */
154 - str_offset = q - q_orig;
155 - SCVAL(q, 0, 0xc0 | ((str_offset >> 8) & 0x3F));
156 - SCVAL(q, 1, str_offset & 0xFF);
159 - SCVAL(q, 0, PTR_DIFF(q,q1));
160 - SCVAL(q, 1, 0x10); /* unknown */
162 - SIVAL(q, 0, 0x00000002);
163 - q += 4; /* unknown */
164 + SCVAL(q, 0, 0x10); /* unknown */
165 + SIVAL(q, 1, 0x00000002);
167 SIVAL(q, 0, (iface_ip(p->ip))->s_addr);
169 SIVAL(q, 0, 0x00000000);
173 /* tell the client what version we are */
174 - SIVAL(q, 0, ((ntversion < 11) || (SEC_ADS != lp_security())) ? 1 : 13);
177 SSVAL(q, 4, 0xffff); /* our lmnttoken */
178 SSVAL(q, 6, 0xffff); /* our lm20token */