[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha3-238-g0e2f6d4
Stefan Metzmacher
metze at samba.org
Thu Apr 17 14:40:30 GMT 2008
The branch, v4-0-test has been updated
via 0e2f6d481b3e35ed392b2b3340b244c77593819c (commit)
via 690c12cd2afd0fba626576fbae3f28ffdae63be2 (commit)
from c74c67c38383b43efd707934e8c457b757e49db1 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit 0e2f6d481b3e35ed392b2b3340b244c77593819c
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Apr 17 16:26:59 2008 +0200
nbt.idl: fix parsing und pushing of dom_sids by using dom_sid0
metze
commit 690c12cd2afd0fba626576fbae3f28ffdae63be2
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Apr 17 15:01:45 2008 +0200
libndr: add dom_sid0 type that can later be used for CLDAP and MAILSLOT ntlogon packets
metze
-----------------------------------------------------------------------
Summary of changes:
source/librpc/idl/nbt.idl | 10 +++----
source/librpc/idl/security.idl | 3 ++
source/librpc/ndr/libndr.h | 4 +++
source/librpc/ndr/ndr_sec_helper.c | 51 ++++++++++++++++++++++++++++++++++++
4 files changed, 62 insertions(+), 6 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/librpc/idl/nbt.idl b/source/librpc/idl/nbt.idl
index aa88360..dddfa4e 100644
--- a/source/librpc/idl/nbt.idl
+++ b/source/librpc/idl/nbt.idl
@@ -440,9 +440,8 @@ interface nbt
nstring unicode_domain;
uint32 db_count;
nbt_db_change dbchange[db_count];
- [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
- [flag(NDR_ALIGN4)] DATA_BLOB _pad2;
- dom_sid sid;
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
@@ -560,9 +559,8 @@ interface nbt
nstring user_name;
astring mailslot_name;
uint32 acct_control;
- [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
- [flag(NDR_ALIGN4)] DATA_BLOB _pad;
- dom_sid sid;
+ [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+ [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
uint32 nt_version;
uint16 lmnt_token;
uint16 lm20_token;
diff --git a/source/librpc/idl/security.idl b/source/librpc/idl/security.idl
index 753fad8..314846c 100644
--- a/source/librpc/idl/security.idl
+++ b/source/librpc/idl/security.idl
@@ -22,6 +22,9 @@ cpp_quote("#define dom_sid2 dom_sid")
/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
cpp_quote("#define dom_sid28 dom_sid")
+/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
+cpp_quote("#define dom_sid0 dom_sid")
+
[
pointer_default(unique)
]
diff --git a/source/librpc/ndr/libndr.h b/source/librpc/ndr/libndr.h
index 2439c38..b719be2 100644
--- a/source/librpc/ndr/libndr.h
+++ b/source/librpc/ndr/libndr.h
@@ -336,6 +336,10 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip);
void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn);
diff --git a/source/librpc/ndr/ndr_sec_helper.c b/source/librpc/ndr/ndr_sec_helper.c
index 5a0178b..1256d7d 100644
--- a/source/librpc/ndr/ndr_sec_helper.c
+++ b/source/librpc/ndr/ndr_sec_helper.c
@@ -48,6 +48,11 @@ size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
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
*/
@@ -128,6 +133,11 @@ 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);
+}
+
/*
parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
@@ -225,3 +235,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);
+}
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list