diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-04-13 05:50:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:31 -0500 |
commit | 63ddff3d7b59fef8c8f2340803b85cde33a49402 (patch) | |
tree | bf97774f6d6e74dc2091b40b8b0088a073bbda6f /source4/libcli/dgram | |
parent | 481e80afc46d92be8e5c5c4325a9ef9ddb86c907 (diff) | |
download | samba-63ddff3d7b59fef8c8f2340803b85cde33a49402.tar.gz samba-63ddff3d7b59fef8c8f2340803b85cde33a49402.tar.xz samba-63ddff3d7b59fef8c8f2340803b85cde33a49402.zip |
r6323: added server side support for dgram NTLOGON requests. NT4 workstations can now login
to a Samba4 domain.
(This used to be commit df146d64ebce6b462c08a1f30919390fcf8196cb)
Diffstat (limited to 'source4/libcli/dgram')
-rw-r--r-- | source4/libcli/dgram/libdgram.h | 1 | ||||
-rw-r--r-- | source4/libcli/dgram/mailslot.c | 20 | ||||
-rw-r--r-- | source4/libcli/dgram/netlogon.c | 8 | ||||
-rw-r--r-- | source4/libcli/dgram/ntlogon.c | 8 |
4 files changed, 28 insertions, 9 deletions
diff --git a/source4/libcli/dgram/libdgram.h b/source4/libcli/dgram/libdgram.h index af278d2ab6..b8ca9e2fe5 100644 --- a/source4/libcli/dgram/libdgram.h +++ b/source4/libcli/dgram/libdgram.h @@ -109,6 +109,7 @@ struct dgram_mailslot_handler *dgram_mailslot_temp(struct nbt_dgram_socket *dgms const char *mailslot_name, dgram_mailslot_handler_t handler, void *private); +DATA_BLOB dgram_mailslot_data(struct nbt_dgram_packet *dgram); NTSTATUS dgram_mailslot_send(struct nbt_dgram_socket *dgmsock, diff --git a/source4/libcli/dgram/mailslot.c b/source4/libcli/dgram/mailslot.c index ca9a66a729..d7c0870ded 100644 --- a/source4/libcli/dgram/mailslot.c +++ b/source4/libcli/dgram/mailslot.c @@ -167,7 +167,7 @@ NTSTATUS dgram_mailslot_send(struct nbt_dgram_socket *dgmsock, msg = &packet.data.msg; /* this length calculation is very crude - it should be based on gensize calls */ - msg->length = 138 + strlen(mailslot_name) + request->length; + msg->length = 138 + strlen(mailslot_name) + request->length; msg->offset = 0; msg->source_name = *src_name; @@ -194,3 +194,21 @@ NTSTATUS dgram_mailslot_send(struct nbt_dgram_socket *dgmsock, return status; } + +/* + return the mailslot data portion from a mailslot packet +*/ +DATA_BLOB dgram_mailslot_data(struct nbt_dgram_packet *dgram) +{ + struct smb_trans_body *trans = &dgram->data.msg.body.smb.body.trans; + DATA_BLOB ret = trans->data; + int pad = trans->data_offset - (70 + strlen(trans->mailslot_name)); + + if (pad < 0 || pad > ret.length) { + DEBUG(2,("Badly formatted data in mailslot - pad = %d\n", pad)); + return data_blob(NULL, 0); + } + ret.data += pad; + ret.length -= pad; + return ret; +} diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index a030ca73c2..208117845b 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -101,16 +101,16 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, struct nbt_dgram_packet *dgram, struct nbt_netlogon_packet *netlogon) { - DATA_BLOB *data = &dgram->data.msg.body.smb.body.trans.data; + DATA_BLOB data = dgram_mailslot_data(dgram); NTSTATUS status; - status = ndr_pull_struct_blob(data, mem_ctx, netlogon, + status = ndr_pull_struct_blob(&data, mem_ctx, netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to parse netlogon packet of length %d\n", - data->length)); + data.length)); #if 0 - file_save("netlogon.dat", data->data, data->length); + file_save("netlogon.dat", data.data, data.length); #endif } return status; diff --git a/source4/libcli/dgram/ntlogon.c b/source4/libcli/dgram/ntlogon.c index 7f18e8cec6..1c1f138b1e 100644 --- a/source4/libcli/dgram/ntlogon.c +++ b/source4/libcli/dgram/ntlogon.c @@ -101,16 +101,16 @@ NTSTATUS dgram_mailslot_ntlogon_parse(struct dgram_mailslot_handler *dgmslot, struct nbt_dgram_packet *dgram, struct nbt_ntlogon_packet *ntlogon) { - DATA_BLOB *data = &dgram->data.msg.body.smb.body.trans.data; + DATA_BLOB data = dgram_mailslot_data(dgram); NTSTATUS status; - status = ndr_pull_struct_blob(data, mem_ctx, ntlogon, + status = ndr_pull_struct_blob(&data, mem_ctx, ntlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_ntlogon_packet); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to parse ntlogon packet of length %d\n", - data->length)); + data.length)); #if 0 - file_save("ntlogon.dat", data->data, data->length); + file_save("ntlogon.dat", data.data, data.length); #endif } return status; |