summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/idl/ntlmssp.idl70
-rw-r--r--librpc/ndr/ndr_ntlmssp.c60
-rw-r--r--librpc/ndr/ndr_ntlmssp.h3
3 files changed, 132 insertions, 1 deletions
diff --git a/librpc/idl/ntlmssp.idl b/librpc/idl/ntlmssp.idl
index 6106617b95..53e2639fe4 100644
--- a/librpc/idl/ntlmssp.idl
+++ b/librpc/idl/ntlmssp.idl
@@ -107,4 +107,74 @@ interface ntlmssp
[relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *Workstation;
[switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
} NEGOTIATE_MESSAGE;
+
+ typedef enum {
+ MsvAvEOL = 0,
+ MsvAvNbComputerName = 1,
+ MsvAvNbDomainName = 2,
+ MsvAvDnsComputerName = 3,
+ MsvAvDnsDomainName = 4,
+ MsvAvDnsTreeName = 5,
+ MsvAvFlags = 6,
+ MsvAvTimestamp = 7,
+ MsAvRestrictions = 8,
+ MsvAvTargetName = 9,
+ MsvChannelBindings = 10
+ } ntlmssp_AvId;
+
+ typedef struct {
+ uint32 Size;
+ [value(0)] uint32 Z4;
+ boolean32 IntegrityLevel;
+ uint32 SubjectIntegrityLevel;
+ uint8 MachineId[32];
+ } Restriction_Encoding;
+
+ typedef [bitmap32bit] bitmap {
+ NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT = 0x00000001,
+ NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE = 0x00000002
+ } ntlmssp_AvFlags;
+
+ typedef [gensize,nodiscriminant,flag(NDR_NOALIGN)] union {
+ [case(MsvAvEOL)] ;
+ [case(MsvAvNbComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbComputerName;
+ [case(MsvAvNbDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbDomainName;
+ [case(MsvAvDnsComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsComputerName;
+ [case(MsvAvDnsDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsDomainName;
+ [case(MsvAvDnsTreeName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsTreeName;
+ [case(MsvAvFlags)] ntlmssp_AvFlags AvFlags;
+ [case(MsvAvTimestamp)] NTTIME AvTimestamp;
+ [case(MsAvRestrictions)] Restriction_Encoding AvRestrictions;
+ [case(MsvAvTargetName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvTargetName;
+ [case(MsvChannelBindings)] uint8 ChannelBindings[16];
+ [default] [flag(NDR_REMAINING)] DATA_BLOB blob;
+ } ntlmssp_AvValue;
+
+ typedef [public,flag(NDR_NOALIGN)] struct {
+ ntlmssp_AvId AvId;
+ [value(ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0))] uint16 AvLen;
+ [subcontext(0),subcontext_size(AvLen),switch_is(AvId)] ntlmssp_AvValue Value;
+ } AV_PAIR;
+
+ typedef [gensize,nopush,nopull,flag(NDR_NOALIGN)] struct {
+ uint32 count;
+ AV_PAIR pair[count];
+ } AV_PAIR_LIST;
+
+ /* NTLMSSP challenge message */
+
+ typedef [public,flag(NDR_PAHEX)] struct {
+ [charset(DOS),value("NTLMSSP")] uint8 Signature[8];
+ [value(NtLmChallenge)] ntlmssp_MessageType MessageType;
+ [value(ndr_ntlmssp_string_length(NegotiateFlags, TargetName))] uint16 TargetNameLen;
+ [value(TargetNameLen)] uint16 TargetNameMaxLen;
+ [relative] [subcontext(0),subcontext_size(TargetNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *TargetName;
+ NEGOTIATE NegotiateFlags;
+ uint8 ServerChallenge[8];
+ uint8 Reserved[8];
+ [value(ndr_size_AV_PAIR_LIST(TargetInfo, ndr->iconv_convenience, ndr->flags))] uint16 TargetInfoLen;
+ [value(TargetInfoLen)] uint16 TargetNameInfoMaxLen;
+ [relative] [subcontext(0),subcontext_size(TargetInfoLen)] AV_PAIR_LIST *TargetInfo;
+ [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version;
+ } CHALLENGE_MESSAGE;
}
diff --git a/librpc/ndr/ndr_ntlmssp.c b/librpc/ndr/ndr_ntlmssp.c
index 115c7abd02..b91b1433e2 100644
--- a/librpc/ndr/ndr_ntlmssp.c
+++ b/librpc/ndr/ndr_ntlmssp.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "../librpc/ndr/ndr_ntlmssp.h"
+#include "../librpc/gen_ndr/ndr_ntlmssp.h"
_PUBLIC_ size_t ndr_ntlmssp_string_length(uint32_t negotiate_flags, const char *s)
{
@@ -47,3 +48,62 @@ _PUBLIC_ uint32_t ndr_ntlmssp_negotiated_string_flags(uint32_t negotiate_flags)
return flags;
}
+
+_PUBLIC_ enum ndr_err_code ndr_push_AV_PAIR_LIST(struct ndr_push *ndr, int ndr_flags, const struct AV_PAIR_LIST *r)
+{
+ uint32_t cntr_pair_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_push_AV_PAIR(ndr, NDR_SCALARS, &r->pair[cntr_pair_0]));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_push_AV_PAIR(ndr, NDR_BUFFERS, &r->pair[cntr_pair_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR_LIST *r)
+{
+ uint32_t cntr_pair_0;
+ TALLOC_CTX *_mem_save_pair_0;
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t offset = 0;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ r->count = 0;
+ if (ndr->data_size > 0) {
+ NDR_PULL_NEED_BYTES(ndr, 4);
+ }
+ while (offset + 4 <= ndr->data_size) {
+ uint16_t length;
+ uint16_t type;
+ type = SVAL(ndr->data + offset, 0);
+ if (type == MsvAvEOL) {
+ r->count++;
+ break;
+ }
+ length = SVAL(ndr->data + offset, 2);
+ offset += length + 4;
+ r->count++;
+ }
+ NDR_PULL_ALLOC_N(ndr, r->pair, r->count);
+ _mem_save_pair_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->pair, 0);
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_pull_AV_PAIR(ndr, NDR_SCALARS, &r->pair[cntr_pair_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pair_0, 0);
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ _mem_save_pair_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->pair, 0);
+ for (cntr_pair_0 = 0; cntr_pair_0 < r->count; cntr_pair_0++) {
+ NDR_CHECK(ndr_pull_AV_PAIR(ndr, NDR_BUFFERS, &r->pair[cntr_pair_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pair_0, 0);
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/librpc/ndr/ndr_ntlmssp.h b/librpc/ndr/ndr_ntlmssp.h
index ef00a2e347..4b21b4fa10 100644
--- a/librpc/ndr/ndr_ntlmssp.h
+++ b/librpc/ndr/ndr_ntlmssp.h
@@ -21,4 +21,5 @@
_PUBLIC_ size_t ndr_ntlmssp_string_length(uint32_t negotiate_flags, const char *s);
_PUBLIC_ uint32_t ndr_ntlmssp_negotiated_string_flags(uint32_t negotiate_flags);
-
+_PUBLIC_ enum ndr_err_code ndr_push_AV_PAIR_LIST(struct ndr_push *ndr, int ndr_flags, const struct AV_PAIR_LIST *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR_LIST(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR_LIST *r);