summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-04-17 18:29:48 +0200
committerGünther Deschner <gd@samba.org>2008-04-17 18:49:30 +0200
commit4f46c2d9268ffb418e4f43baf479c03384e2ddda (patch)
tree2c55ac27bd9dca6bc61a600d7cfb90ffcdec1fa0
parent452789ca801867e3ad99101f81180a468902d90b (diff)
downloadsamba-4f46c2d9268ffb418e4f43baf479c03384e2ddda.tar.gz
samba-4f46c2d9268ffb418e4f43baf479c03384e2ddda.tar.bz2
samba-4f46c2d9268ffb418e4f43baf479c03384e2ddda.zip
IDL: Re-run make idl and hand merge some required functions from Samba 4.
Guenther (This used to be commit edb0092e4d66496181de4e21c91d398d54208e60)
-rw-r--r--source3/librpc/gen_ndr/nbt.h10
-rw-r--r--source3/librpc/gen_ndr/ndr_nbt.c54
-rw-r--r--source3/librpc/gen_ndr/security.h1
-rw-r--r--source3/librpc/ndr/ndr_sec_helper.c26
-rw-r--r--source3/librpc/ndr/sid.c41
5 files changed, 94 insertions, 38 deletions
diff --git a/source3/librpc/gen_ndr/nbt.h b/source3/librpc/gen_ndr/nbt.h
index 0e7447563b..151a94ba20 100644
--- a/source3/librpc/gen_ndr/nbt.h
+++ b/source3/librpc/gen_ndr/nbt.h
@@ -493,9 +493,8 @@ struct nbt_netlogon_announce_uas {
const char * unicode_domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
uint32_t db_count;
struct nbt_db_change *dbchange;
- uint32_t sid_size;/* [value(ndr_size_dom_sid(&sid,ndr->flags))] */
- DATA_BLOB _pad2;/* [flag(LIBNDR_FLAG_ALIGN4)] */
- struct dom_sid sid;
+ uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
+ struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
@@ -607,9 +606,8 @@ struct nbt_ntlogon_sam_logon {
const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
uint32_t acct_control;
- uint32_t sid_size;/* [value(ndr_size_dom_sid(&sid,ndr->flags))] */
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
- struct dom_sid sid;
+ uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
+ struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
diff --git a/source3/librpc/gen_ndr/ndr_nbt.c b/source3/librpc/gen_ndr/ndr_nbt.c
index 1d36c4e005..c617641564 100644
--- a/source3/librpc/gen_ndr/ndr_nbt.c
+++ b/source3/librpc/gen_ndr/ndr_nbt.c
@@ -2075,20 +2075,18 @@ static enum ndr_err_code ndr_push_nbt_netlogon_announce_uas(struct ndr_push *ndr
for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
NDR_CHECK(ndr_push_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
}
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid(&r->sid, ndr->flags)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
{
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad2));
- ndr->flags = _flags_save_DATA_BLOB;
+ struct ndr_push *_ndr_sid;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
}
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->sid));
}
return NDR_ERR_SUCCESS;
}
@@ -2143,18 +2141,16 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_announce_uas(struct ndr_pull *ndr
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dbchange_0, 0);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
{
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad2));
- ndr->flags = _flags_save_DATA_BLOB;
+ struct ndr_pull *_ndr_sid;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
+ NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
}
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->sid));
}
return NDR_ERR_SUCCESS;
}
@@ -2184,9 +2180,8 @@ _PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const c
}
}
ndr->depth--;
- ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid(&r->sid, ndr->flags):r->sid_size);
- ndr_print_DATA_BLOB(ndr, "_pad2", r->_pad2);
- ndr_print_dom_sid(ndr, "sid", &r->sid);
+ ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
+ ndr_print_dom_sid0(ndr, "sid", &r->sid);
ndr_print_uint32(ndr, "nt_version", r->nt_version);
ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
@@ -3024,20 +3019,18 @@ static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon(struct ndr_push *ndr, in
ndr->flags = _flags_save_string;
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->acct_control));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid(&r->sid, ndr->flags)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
{
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ struct ndr_push *_ndr_sid;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
}
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->sid));
}
return NDR_ERR_SUCCESS;
}
@@ -3068,18 +3061,16 @@ static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->acct_control));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
{
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ struct ndr_pull *_ndr_sid;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
+ NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
}
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->sid));
}
return NDR_ERR_SUCCESS;
}
@@ -3093,9 +3084,8 @@ _PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char
ndr_print_string(ndr, "user_name", r->user_name);
ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
ndr_print_uint32(ndr, "acct_control", r->acct_control);
- ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid(&r->sid, ndr->flags):r->sid_size);
- ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
- ndr_print_dom_sid(ndr, "sid", &r->sid);
+ ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
+ ndr_print_dom_sid0(ndr, "sid", &r->sid);
ndr_print_uint32(ndr, "nt_version", r->nt_version);
ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
diff --git a/source3/librpc/gen_ndr/security.h b/source3/librpc/gen_ndr/security.h
index a17fd512f7..04655b178e 100644
--- a/source3/librpc/gen_ndr/security.h
+++ b/source3/librpc/gen_ndr/security.h
@@ -5,6 +5,7 @@
#include "librpc/gen_ndr/misc.h"
#define dom_sid2 dom_sid
#define dom_sid28 dom_sid
+#define dom_sid0 dom_sid
#ifndef _HEADER_security
#define _HEADER_security
diff --git a/source3/librpc/ndr/ndr_sec_helper.c b/source3/librpc/ndr/ndr_sec_helper.c
index f8bad6ca61..18d343799e 100644
--- a/source3/librpc/ndr/ndr_sec_helper.c
+++ b/source3/librpc/ndr/ndr_sec_helper.c
@@ -31,6 +31,26 @@ size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
return 8 + 4*sid->num_auths;
}
+size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
+{
+ struct dom_sid zero_sid;
+
+ if (!sid) return 0;
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return 0;
+ }
+
+ return 8 + 4*sid->num_auths;
+}
+
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
+{
+ return ndr_size_dom_sid28(sid, flags);
+}
+
/*
return the wire size of a security_ace
*/
@@ -89,3 +109,9 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d
{
ndr_print_dom_sid(ndr, name, sid);
}
+
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ ndr_print_dom_sid(ndr, name, sid);
+}
+
diff --git a/source3/librpc/ndr/sid.c b/source3/librpc/ndr/sid.c
index b6ec045806..ed27375de1 100644
--- a/source3/librpc/ndr/sid.c
+++ b/source3/librpc/ndr/sid.c
@@ -187,3 +187,44 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
return NDR_ERR_SUCCESS;
}
+
+/*
+ parse a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->data_size == ndr->offset) {
+ ZERO_STRUCTP(sid);
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_pull_dom_sid(ndr, ndr_flags, sid);
+}
+
+/*
+ push a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ struct dom_sid zero_sid;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (!sid) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}