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/nbt_server/dgram | |
parent | 481e80afc46d92be8e5c5c4325a9ef9ddb86c907 (diff) | |
download | samba-63ddff3d7b59fef8c8f2340803b85cde33a49402.tar.gz samba-63ddff3d7b59fef8c8f2340803b85cde33a49402.tar.bz2 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/nbt_server/dgram')
-rw-r--r-- | source4/nbt_server/dgram/ntlogon.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source4/nbt_server/dgram/ntlogon.c b/source4/nbt_server/dgram/ntlogon.c index d035c2f00a..17a6c6f0af 100644 --- a/source4/nbt_server/dgram/ntlogon.c +++ b/source4/nbt_server/dgram/ntlogon.c @@ -26,6 +26,44 @@ #include "smbd/service_task.h" #include "lib/socket/socket.h" + +/* + reply to a SAM LOGON request + */ +static void nbtd_ntlogon_sam_logon(struct dgram_mailslot_handler *dgmslot, + struct nbt_dgram_packet *packet, + const char *src_address, int src_port, + struct nbt_ntlogon_packet *ntlogon) +{ + struct nbt_name *name = &packet->data.msg.dest_name; + struct nbt_ntlogon_packet reply; + struct nbt_ntlogon_sam_logon_reply *logon; + + /* only answer sam logon requests on the PDC or LOGON names */ + if (name->type != NBT_NAME_PDC && name->type != NBT_NAME_LOGON) { + return; + } + + /* setup a SAM LOGON reply */ + ZERO_STRUCT(reply); + reply.command = NTLOGON_SAM_LOGON_REPLY; + logon = &reply.req.reply; + + logon->server = talloc_asprintf(packet, "\\\\%s", lp_netbios_name()); + logon->user_name = ntlogon->req.logon.user_name; + logon->domain = lp_workgroup(); + logon->nt_version = 1; + logon->lmnt_token = 0xFFFF; + logon->lm20_token = 0xFFFF; + + packet->data.msg.dest_name.type = 0; + + dgram_mailslot_ntlogon_reply(dgmslot->dgmsock, + packet, + ntlogon->req.logon.mailslot_name, + &reply); +} + /* handle incoming ntlogon mailslot requests */ @@ -60,6 +98,9 @@ void nbtd_mailslot_ntlogon_handler(struct dgram_mailslot_handler *dgmslot, NDR_PRINT_DEBUG(nbt_ntlogon_packet, ntlogon); switch (ntlogon->command) { + case NTLOGON_SAM_LOGON: + nbtd_ntlogon_sam_logon(dgmslot, packet, src_address, src_port, ntlogon); + break; default: DEBUG(2,("unknown ntlogon op %d from %s:%d\n", ntlogon->command, src_address, src_port)); |