summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-09-07 11:41:05 +0200
committerGünther Deschner <gd@samba.org>2010-09-09 23:07:11 +0200
commit5fc7d14b064d83b40c65a8c41ea05a9b43af6f5d (patch)
treef58881249cf040b6793ebd07d8167853ac62abb2 /source3
parentfe30e359670d67e9a8b8ccd22d4eb6d363f88827 (diff)
downloadsamba-5fc7d14b064d83b40c65a8c41ea05a9b43af6f5d.tar.gz
samba-5fc7d14b064d83b40c65a8c41ea05a9b43af6f5d.tar.bz2
samba-5fc7d14b064d83b40c65a8c41ea05a9b43af6f5d.zip
s3-nmbd: use nbt_netlogon_packet in process_logon_packet().
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/nmbd/nmbd_processlogon.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 357d00b413..8750ea1fac 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -311,7 +311,6 @@ void process_logon_packet(struct packet_struct *p, char *buf,int len,
fstring my_name;
fstring reply_name;
char outbuf[1024];
- int code;
uint16 token = 0;
uint32 ntversion = 0;
uint16 lmnttoken = 0;
@@ -327,6 +326,10 @@ void process_logon_packet(struct packet_struct *p, char *buf,int len,
const struct sockaddr_storage *pss;
struct in_addr ip;
+ DATA_BLOB blob_in;
+ enum ndr_err_code ndr_err;
+ struct nbt_netlogon_packet request;
+
in_addr_to_sockaddr_storage(&ss, p->ip);
pss = iface_ip((struct sockaddr *)&ss);
if (!pss) {
@@ -347,10 +350,25 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
fstrcpy(my_name, global_myname());
- code = get_safe_SVAL(buf,len,buf,0,-1);
- DEBUG(4,("process_logon_packet: Logon from %s: code = 0x%x\n", inet_ntoa(p->ip), code));
+ ZERO_STRUCT(request);
+
+ blob_in = data_blob_const(buf, len);
+
+ ndr_err = ndr_pull_struct_blob(&blob_in, talloc_tos(), &request,
+ (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(1,("process_logon_packet: Failed to pull logon packet\n"));
+ return;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_DEBUG(nbt_netlogon_packet, &request);
+ }
+
+ DEBUG(4,("process_logon_packet: Logon from %s: code = 0x%x\n",
+ inet_ntoa(p->ip), request.command));
- switch (code) {
+ switch (request.command) {
case 0: {
fstring mach_str, user_str, getdc_str;
char *q = buf + 2;
@@ -925,7 +943,8 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
break;
default:
- DEBUG(3,("process_logon_packet: Unknown domain request %d\n",code));
+ DEBUG(3,("process_logon_packet: Unknown domain request %d\n",
+ request.command));
return;
}
}