/****************************************************************************
process a domain logon packet
+
+ 08aug96 lkcl@pires.co.uk
+ reply_code == 0xC courtesy of jim@oxfordcc.co.uk forwarded by
+ lewis2@server.uwindsor.ca
**************************************************************************/
void process_logon_packet(struct packet_struct *p,char *buf,int len)
{
reply_code = 7;
reply_name = lp_domain_controller();
if (!*reply_name) {
- DEBUG(3,("No domain controller configured\n"));
- return;
+ reply_name = myname;
+ reply_code = 0xC;
}
- DEBUG(3,("GETDC request from %s(%s)\n",
- machine,inet_ntoa(p->ip)));
+ DEBUG(3,("GETDC request from %s(%s), reporting %s 0x%2x\n",
+ machine,inet_ntoa(p->ip), reply_name, reply_code));
}
break;
default:
StrnCpy(q,reply_name,16);
strupper(q);
q = skip_string(q,1);
+
+ if (reply_code == 0xC)
+ {
+ if ( PTR_DIFF (q,outbuf) & 1 )
+ {
+ q++;
+ }
+
+ StrnCpy(q,reply_name,16);
+ strupper(q);
+ q = skip_string(q,1);
+
+ StrnCpy(q,lp_workgroup(),16);
+ strupper(q);
+ q = skip_string(q,1);
+
+ SIVAL(q,0,1);
+ q += 4;
+ SSVAL(q,0,0xFFFF);
+ q += 2;
+ }
+
SSVAL(q,0,0xFFFF);
q += 2;
struct subnet_record *d = find_subnet(ipaddr);
if (d)
{
+ add_netbios_entry(d,name,0x00,NB_ACTIVE,0,source,ipaddr,True,True);
add_netbios_entry(d,name,0x20,NB_ACTIVE,0,source,ipaddr,True,True);
}
}
#define SNLEN 15 /* service name length */
#define QNLEN 12 /* queue name maximum length */
+#define MAJOR_VERSION 2
+#define MINOR_VERSION 0
+
extern int Client;
static int CopyExpanded(int cnum, int snum, char** dst, char* src, int* n)
*rdata_len = 0;
- SSVAL(*rparam,0,NERR_Success);
+ SSVAL(*rparam,0,NERR_badpass);
SSVAL(*rparam,2,0); /* converter word */
DEBUG(3,("Set password for <%s>\n",user));
- if (!password_ok(user,pass1,strlen(pass1),NULL,False) ||
- !chgpasswd(user,pass1,pass2))
- SSVAL(*rparam,0,NERR_badpass);
+ if (password_ok(user,pass1,strlen(pass1),NULL,False) &&
+ chgpasswd(user,pass1,pass2))
+ {
+ SSVAL(*rparam,0,NERR_Success);
+ }
bzero(pass1,sizeof(fstring));
bzero(pass2,sizeof(fstring));
}
if (servers) free(servers);
- SCVAL(p,0,2); /* version_major */
- SCVAL(p,1,0); /* version_minor */
+ SCVAL(p,0,MAJOR_VERSION);
+ SCVAL(p,1,MINOR_VERSION);
SIVAL(p,2,servertype);
+
if (mdrcnt == struct_len) {
SIVAL(p,6,0);
} else {
p2 = skip_string(p2,1);
p += 4;
- SCVAL(p,0,2); /* major version?? */
- SCVAL(p,1,1); /* minor version?? */
+ SCVAL(p,0,MAJOR_VERSION);
+ SCVAL(p,1,MINOR_VERSION);
p += 2;
SIVAL(p,0,PTR_DIFF(p2,*rdata));