summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-19 07:31:17 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-19 07:31:17 +0000
commitde3f0b424f5c89b9c084c5b0d7af46585d1cbf0e (patch)
tree463d4442129c31a43d530c0388c8e5a08a7a596d /source4
parentd60fe829703e1a88858784425d8b670b2b007e5c (diff)
downloadsamba-de3f0b424f5c89b9c084c5b0d7af46585d1cbf0e.tar.gz
samba-de3f0b424f5c89b9c084c5b0d7af46585d1cbf0e.tar.bz2
samba-de3f0b424f5c89b9c084c5b0d7af46585d1cbf0e.zip
after discussions with lukeh, I think we found a alignment bug in old
versions of midl, as used to build LSA. Work around it here. (This used to be commit b3bd2bf10badd60d7c4952c6e1687568b413ee47)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/lsa.idl8
-rw-r--r--source4/librpc/ndr/ndr_echo.c93
-rw-r--r--source4/librpc/ndr/ndr_echo.h11
-rw-r--r--source4/librpc/ndr/ndr_lsa.c22
-rw-r--r--source4/librpc/ndr/ndr_lsa.h8
5 files changed, 116 insertions, 26 deletions
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl
index d85b7605dc..afb6d849fb 100644
--- a/source4/librpc/idl/lsa.idl
+++ b/source4/librpc/idl/lsa.idl
@@ -132,6 +132,7 @@
} lsa_PDAccountInfo;
typedef struct {
+ uint16 unknown; /* an midl padding bug? */
uint16 role;
} lsa_ServerRole;
@@ -155,12 +156,13 @@
} lsa_ModificationInfo;
typedef struct {
- uint32 shutdown_on_full;
+ uint8 shutdown_on_full;
} lsa_AuditFullSetInfo;
typedef struct {
- uint32 shutdown_on_full;
- uint32 log_is_full;
+ uint16 unknown; /* an midl padding bug? */
+ uint8 shutdown_on_full;
+ uint8 log_is_full;
} lsa_AuditFullQueryInfo;
typedef struct {
diff --git a/source4/librpc/ndr/ndr_echo.c b/source4/librpc/ndr/ndr_echo.c
index c3c3f7161b..7377f845c8 100644
--- a/source4/librpc/ndr/ndr_echo.c
+++ b/source4/librpc/ndr/ndr_echo.c
@@ -40,10 +40,7 @@ NTSTATUS ndr_push_echo_SourceData(struct ndr_push *ndr, struct echo_SourceData *
NTSTATUS ndr_push_TestCall(struct ndr_push *ndr, struct TestCall *r)
{
- NDR_CHECK(ndr_push_ptr(ndr, r->in.s));
- if (r->in.s) {
- NDR_CHECK(ndr_push_unistr(ndr, r->in.s));
- }
+ NDR_CHECK(ndr_push_uint16(ndr, r->in.level));
return NT_STATUS_OK;
}
@@ -94,8 +91,62 @@ NTSTATUS ndr_pull_echo_SourceData(struct ndr_pull *ndr, struct echo_SourceData *
return NT_STATUS_OK;
}
+NTSTATUS ndr_pull_echo_ServerRole(struct ndr_pull *ndr, int ndr_flags, struct echo_ServerRole *r)
+{
+ NDR_CHECK(ndr_pull_struct_start(ndr));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 2));
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->role));
+ ndr_pull_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_echo_PolicyInformation(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union echo_PolicyInformation *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_struct_start(ndr));
+ NDR_CHECK(ndr_pull_uint16(ndr, level));
+ switch (*level) {
+ case 6: {
+ NDR_CHECK(ndr_pull_echo_ServerRole(ndr, NDR_SCALARS, &r->role));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
+ }
+ ndr_pull_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ switch (*level) {
+ case 6:
+ NDR_CHECK(ndr_pull_echo_ServerRole(ndr, NDR_BUFFERS, &r->role));
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
+ }
+done:
+ return NT_STATUS_OK;
+}
+
NTSTATUS ndr_pull_TestCall(struct ndr_pull *ndr, struct TestCall *r)
{
+ uint32 _ptr_info;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info));
+ if (_ptr_info) {
+ NDR_ALLOC(ndr, r->out.info);
+ } else {
+ r->out.info = NULL;
+ }
+ if (r->out.info) {
+ { uint16 _level = r->in.level;
+ NDR_CHECK(ndr_pull_echo_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
+ if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
+ }
+ }
return NT_STATUS_OK;
}
@@ -195,6 +246,27 @@ void ndr_print_echo_SourceData(struct ndr_print *ndr, const char *name, int flag
ndr->depth--;
}
+void ndr_print_echo_ServerRole(struct ndr_print *ndr, const char *name, struct echo_ServerRole *r)
+{
+ ndr_print_struct(ndr, name, "echo_ServerRole");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "role", r->role);
+ ndr->depth--;
+}
+
+void ndr_print_echo_PolicyInformation(struct ndr_print *ndr, const char *name, uint16 level, union echo_PolicyInformation *r)
+{
+ ndr_print_union(ndr, name, level, "echo_PolicyInformation");
+ switch (level) {
+ case 6:
+ ndr_print_echo_ServerRole(ndr, "role", &r->role);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
void ndr_print_TestCall(struct ndr_print *ndr, const char *name, int flags, struct TestCall *r)
{
ndr_print_struct(ndr, name, "TestCall");
@@ -202,17 +274,18 @@ void ndr_print_TestCall(struct ndr_print *ndr, const char *name, int flags, stru
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "TestCall");
ndr->depth++;
- ndr_print_ptr(ndr, "s", r->in.s);
- ndr->depth++;
- if (r->in.s) {
- ndr_print_unistr(ndr, "s", r->in.s);
- }
- ndr->depth--;
+ ndr_print_uint16(ndr, "level", r->in.level);
ndr->depth--;
}
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "TestCall");
ndr->depth++;
+ ndr_print_ptr(ndr, "info", r->out.info);
+ ndr->depth++;
+ if (r->out.info) {
+ ndr_print_echo_PolicyInformation(ndr, "info", r->in.level, r->out.info);
+ }
+ ndr->depth--;
ndr->depth--;
}
ndr->depth--;
diff --git a/source4/librpc/ndr/ndr_echo.h b/source4/librpc/ndr/ndr_echo.h
index ba82a6ad67..a5f6a2998e 100644
--- a/source4/librpc/ndr/ndr_echo.h
+++ b/source4/librpc/ndr/ndr_echo.h
@@ -56,12 +56,21 @@ struct echo_SourceData {
};
+struct echo_ServerRole {
+ uint16 role;
+};
+
+union echo_PolicyInformation {
+/* [case(6)] */ struct echo_ServerRole role;
+};
+
struct TestCall {
struct {
- const char *s;
+ uint16 level;
} in;
struct {
+ union echo_PolicyInformation *info;
} out;
};
diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c
index d7fb5c45e2..3b540b3614 100644
--- a/source4/librpc/ndr/ndr_lsa.c
+++ b/source4/librpc/ndr/ndr_lsa.c
@@ -762,7 +762,8 @@ NTSTATUS ndr_pull_lsa_ServerRole(struct ndr_pull *ndr, int ndr_flags, struct lsa
{
NDR_CHECK(ndr_pull_struct_start(ndr));
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
- NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_align(ndr, 2));
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->unknown));
NDR_CHECK(ndr_pull_uint16(ndr, &r->role));
ndr_pull_struct_end(ndr);
buffers:
@@ -823,8 +824,8 @@ NTSTATUS ndr_pull_lsa_AuditFullSetInfo(struct ndr_pull *ndr, int ndr_flags, stru
{
NDR_CHECK(ndr_pull_struct_start(ndr));
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->shutdown_on_full));
+ NDR_CHECK(ndr_pull_align(ndr, 1));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->shutdown_on_full));
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
@@ -836,9 +837,10 @@ NTSTATUS ndr_pull_lsa_AuditFullQueryInfo(struct ndr_pull *ndr, int ndr_flags, st
{
NDR_CHECK(ndr_pull_struct_start(ndr));
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->shutdown_on_full));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->log_is_full));
+ NDR_CHECK(ndr_pull_align(ndr, 2));
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->unknown));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->shutdown_on_full));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->log_is_full));
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
@@ -2007,6 +2009,7 @@ void ndr_print_lsa_ServerRole(struct ndr_print *ndr, const char *name, struct ls
{
ndr_print_struct(ndr, name, "lsa_ServerRole");
ndr->depth++;
+ ndr_print_uint16(ndr, "unknown", r->unknown);
ndr_print_uint16(ndr, "role", r->role);
ndr->depth--;
}
@@ -2046,7 +2049,7 @@ void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *name, str
{
ndr_print_struct(ndr, name, "lsa_AuditFullSetInfo");
ndr->depth++;
- ndr_print_uint32(ndr, "shutdown_on_full", r->shutdown_on_full);
+ ndr_print_uint8(ndr, "shutdown_on_full", r->shutdown_on_full);
ndr->depth--;
}
@@ -2054,8 +2057,9 @@ void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char *name, s
{
ndr_print_struct(ndr, name, "lsa_AuditFullQueryInfo");
ndr->depth++;
- ndr_print_uint32(ndr, "shutdown_on_full", r->shutdown_on_full);
- ndr_print_uint32(ndr, "log_is_full", r->log_is_full);
+ ndr_print_uint16(ndr, "unknown", r->unknown);
+ ndr_print_uint8(ndr, "shutdown_on_full", r->shutdown_on_full);
+ ndr_print_uint8(ndr, "log_is_full", r->log_is_full);
ndr->depth--;
}
diff --git a/source4/librpc/ndr/ndr_lsa.h b/source4/librpc/ndr/ndr_lsa.h
index ac6b91aa55..72d1cdb9ad 100644
--- a/source4/librpc/ndr/ndr_lsa.h
+++ b/source4/librpc/ndr/ndr_lsa.h
@@ -202,6 +202,7 @@ struct lsa_PDAccountInfo {
};
struct lsa_ServerRole {
+ uint16 unknown;
uint16 role;
};
@@ -225,12 +226,13 @@ struct lsa_ModificationInfo {
};
struct lsa_AuditFullSetInfo {
- uint32 shutdown_on_full;
+ uint8 shutdown_on_full;
};
struct lsa_AuditFullQueryInfo {
- uint32 shutdown_on_full;
- uint32 log_is_full;
+ uint16 unknown;
+ uint8 shutdown_on_full;
+ uint8 log_is_full;
};
struct lsa_DnsDomainInfo {