summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-06-12 12:38:22 +0200
committerAndrew Bartlett <abartlet@samba.org>2009-06-18 13:49:25 +1000
commitefe6552f0c1b2cf7e7f95987e7c808667166a303 (patch)
treecae01772b8433e1ba5361cc0ce979a861c702742 /librpc
parentf666da6940c2cc0c82419ec68b1a83bddfe680c9 (diff)
downloadsamba-efe6552f0c1b2cf7e7f95987e7c808667166a303.tar.gz
samba-efe6552f0c1b2cf7e7f95987e7c808667166a303.tar.bz2
samba-efe6552f0c1b2cf7e7f95987e7c808667166a303.zip
NETLOGON pipe improvements
Patch for bug #4939 This refactors the NETLOGON code related to this bug: - Introduces a new "SYNCSTATE" enum required by the "DatabaseSync2" call (acc. to WSPP) - Make "DatabaseSync" dependant from "DatabaseSync2" (acc. to WSPP) - Let "DatabaseSync2" return NT_STATUS_NOT_IMPLEMENTED (I'm not sure if this is also true when a domain is running in mixed mode) - Make "LogonControl" and "LogonControl2" dependant form "LogonControl2Ex" (acc. to WSPP) - Let "LogonControl2Ex" return WERR_NOT_SUPPORTED for now
Diffstat (limited to 'librpc')
-rw-r--r--librpc/gen_ndr/cli_netlogon.c6
-rw-r--r--librpc/gen_ndr/cli_netlogon.h4
-rw-r--r--librpc/gen_ndr/ndr_netlogon.c68
-rw-r--r--librpc/gen_ndr/ndr_netlogon.h1
-rw-r--r--librpc/gen_ndr/netlogon.h31
-rw-r--r--librpc/gen_ndr/srv_netlogon.c8
-rw-r--r--librpc/idl/netlogon.idl17
7 files changed, 103 insertions, 32 deletions
diff --git a/librpc/gen_ndr/cli_netlogon.c b/librpc/gen_ndr/cli_netlogon.c
index eb726f0ed6..d3efab6780 100644
--- a/librpc/gen_ndr/cli_netlogon.c
+++ b/librpc/gen_ndr/cli_netlogon.c
@@ -637,7 +637,7 @@ NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli,
const char *logon_server /* [in] [unique,charset(UTF16)] */,
enum netr_LogonControlCode function_code /* [in] */,
uint32_t level /* [in] */,
- union netr_CONTROL_QUERY_INFORMATION *info /* [out] [ref,switch_is(level)] */,
+ union netr_CONTROL_QUERY_INFORMATION *query /* [out] [ref,switch_is(level)] */,
WERROR *werror)
{
struct netr_LogonControl r;
@@ -671,7 +671,7 @@ NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli,
}
/* Return variables */
- *info = *r.out.info;
+ *query = *r.out.query;
/* Return result */
if (werror) {
@@ -837,7 +837,7 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli,
struct netr_Authenticator *credential /* [in] [ref] */,
struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
enum netr_SamDatabaseID database_id /* [in] */,
- uint16_t restart_state /* [in] */,
+ enum SyncStateEnum restart_state /* [in] */,
uint32_t *sync_context /* [in,out] [ref] */,
struct netr_DELTA_ENUM_ARRAY **delta_enum_array /* [out] [ref] */,
uint32_t preferredmaximumlength /* [in] */)
diff --git a/librpc/gen_ndr/cli_netlogon.h b/librpc/gen_ndr/cli_netlogon.h
index 718fcde3d7..ffb877e21b 100644
--- a/librpc/gen_ndr/cli_netlogon.h
+++ b/librpc/gen_ndr/cli_netlogon.h
@@ -116,7 +116,7 @@ NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli,
const char *logon_server /* [in] [unique,charset(UTF16)] */,
enum netr_LogonControlCode function_code /* [in] */,
uint32_t level /* [in] */,
- union netr_CONTROL_QUERY_INFORMATION *info /* [out] [ref,switch_is(level)] */,
+ union netr_CONTROL_QUERY_INFORMATION *query /* [out] [ref,switch_is(level)] */,
WERROR *werror);
NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
@@ -148,7 +148,7 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli,
struct netr_Authenticator *credential /* [in] [ref] */,
struct netr_Authenticator *return_authenticator /* [in,out] [ref] */,
enum netr_SamDatabaseID database_id /* [in] */,
- uint16_t restart_state /* [in] */,
+ enum SyncStateEnum restart_state /* [in] */,
uint32_t *sync_context /* [in,out] [ref] */,
struct netr_DELTA_ENUM_ARRAY **delta_enum_array /* [out] [ref] */,
uint32_t preferredmaximumlength /* [in] */);
diff --git a/librpc/gen_ndr/ndr_netlogon.c b/librpc/gen_ndr/ndr_netlogon.c
index c1bdce4abd..8db8c11276 100644
--- a/librpc/gen_ndr/ndr_netlogon.c
+++ b/librpc/gen_ndr/ndr_netlogon.c
@@ -6500,6 +6500,38 @@ _PUBLIC_ void ndr_print_netr_NegotiateFlags(struct ndr_print *ndr, const char *n
ndr->depth--;
}
+static enum ndr_err_code ndr_push_SyncStateEnum(struct ndr_push *ndr, int ndr_flags, enum SyncStateEnum r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_SyncStateEnum(struct ndr_pull *ndr, int ndr_flags, enum SyncStateEnum *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_SyncStateEnum(struct ndr_print *ndr, const char *name, enum SyncStateEnum r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case SYNCSTATE_NORMAL_STATE: val = "SYNCSTATE_NORMAL_STATE"; break;
+ case SYNCSTATE_DOMAIN_STATE: val = "SYNCSTATE_DOMAIN_STATE"; break;
+ case SYNCSTATE_GROUP_STATE: val = "SYNCSTATE_GROUP_STATE"; break;
+ case SYNCSTATE_UAS_BUILT_IN_GROUP_STATE: val = "SYNCSTATE_UAS_BUILT_IN_GROUP_STATE"; break;
+ case SYNCSTATE_USER_STATE: val = "SYNCSTATE_USER_STATE"; break;
+ case SYNCSTATE_GROUP_MEMBER_STATE: val = "SYNCSTATE_GROUP_MEMBER_STATE"; break;
+ case SYNCSTATE_ALIAS_STATE: val = "SYNCSTATE_ALIAS_STATE"; break;
+ case SYNCSTATE_ALIAS_MEMBER_STATE: val = "SYNCSTATE_ALIAS_MEMBER_STATE"; break;
+ case SYNCSTATE_SAM_DONE_STATE: val = "SYNCSTATE_SAM_DONE_STATE"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
static enum ndr_err_code ndr_push_netr_ChangeLogFlags(struct ndr_push *ndr, int ndr_flags, uint16_t r)
{
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
@@ -11110,11 +11142,11 @@ static enum ndr_err_code ndr_push_netr_LogonControl(struct ndr_push *ndr, int fl
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.level));
}
if (flags & NDR_OUT) {
- if (r->out.info == NULL) {
+ if (r->out.query == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
- NDR_CHECK(ndr_push_netr_CONTROL_QUERY_INFORMATION(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.query, r->in.level));
+ NDR_CHECK(ndr_push_netr_CONTROL_QUERY_INFORMATION(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.query));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -11124,7 +11156,7 @@ static enum ndr_err_code ndr_pull_netr_LogonControl(struct ndr_pull *ndr, int fl
{
uint32_t _ptr_logon_server;
TALLOC_CTX *_mem_save_logon_server_0;
- TALLOC_CTX *_mem_save_info_0;
+ TALLOC_CTX *_mem_save_query_0;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -11148,18 +11180,18 @@ static enum ndr_err_code ndr_pull_netr_LogonControl(struct ndr_pull *ndr, int fl
}
NDR_CHECK(ndr_pull_netr_LogonControlCode(ndr, NDR_SCALARS, &r->in.function_code));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.level));
- NDR_PULL_ALLOC(ndr, r->out.info);
- ZERO_STRUCTP(r->out.info);
+ NDR_PULL_ALLOC(ndr, r->out.query);
+ ZERO_STRUCTP(r->out.query);
}
if (flags & NDR_OUT) {
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
- NDR_PULL_ALLOC(ndr, r->out.info);
+ NDR_PULL_ALLOC(ndr, r->out.query);
}
- _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
- NDR_CHECK(ndr_pull_netr_CONTROL_QUERY_INFORMATION(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+ _mem_save_query_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.query, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.query, r->in.level));
+ NDR_CHECK(ndr_pull_netr_CONTROL_QUERY_INFORMATION(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.query));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_query_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -11188,10 +11220,10 @@ _PUBLIC_ void ndr_print_netr_LogonControl(struct ndr_print *ndr, const char *nam
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "netr_LogonControl");
ndr->depth++;
- ndr_print_ptr(ndr, "info", r->out.info);
+ ndr_print_ptr(ndr, "query", r->out.query);
ndr->depth++;
- ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
- ndr_print_netr_CONTROL_QUERY_INFORMATION(ndr, "info", r->out.info);
+ ndr_print_set_switch_value(ndr, r->out.query, r->in.level);
+ ndr_print_netr_CONTROL_QUERY_INFORMATION(ndr, "query", r->out.query);
ndr->depth--;
ndr_print_WERROR(ndr, "result", r->out.result);
ndr->depth--;
@@ -11668,7 +11700,7 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync2(struct ndr_push *ndr, int f
}
NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
NDR_CHECK(ndr_push_netr_SamDatabaseID(ndr, NDR_SCALARS, r->in.database_id));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.restart_state));
+ NDR_CHECK(ndr_push_SyncStateEnum(ndr, NDR_SCALARS, r->in.restart_state));
if (r->in.sync_context == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -11736,7 +11768,7 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int f
NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_netr_SamDatabaseID(ndr, NDR_SCALARS, &r->in.database_id));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.restart_state));
+ NDR_CHECK(ndr_pull_SyncStateEnum(ndr, NDR_SCALARS, &r->in.restart_state));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sync_context);
}
@@ -11811,7 +11843,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *na
ndr_print_netr_Authenticator(ndr, "return_authenticator", r->in.return_authenticator);
ndr->depth--;
ndr_print_netr_SamDatabaseID(ndr, "database_id", r->in.database_id);
- ndr_print_uint16(ndr, "restart_state", r->in.restart_state);
+ ndr_print_SyncStateEnum(ndr, "restart_state", r->in.restart_state);
ndr_print_ptr(ndr, "sync_context", r->in.sync_context);
ndr->depth++;
ndr_print_uint32(ndr, "sync_context", *r->in.sync_context);
diff --git a/librpc/gen_ndr/ndr_netlogon.h b/librpc/gen_ndr/ndr_netlogon.h
index e057551006..2dfc0edc21 100644
--- a/librpc/gen_ndr/ndr_netlogon.h
+++ b/librpc/gen_ndr/ndr_netlogon.h
@@ -192,6 +192,7 @@ void ndr_print_netr_CONTROL_QUERY_INFORMATION(struct ndr_print *ndr, const char
void ndr_print_netr_LogonControlCode(struct ndr_print *ndr, const char *name, enum netr_LogonControlCode r);
void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_DATA_INFORMATION *r);
void ndr_print_netr_NegotiateFlags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_SyncStateEnum(struct ndr_print *ndr, const char *name, enum SyncStateEnum r);
void ndr_print_netr_ChangeLogFlags(struct ndr_print *ndr, const char *name, uint16_t r);
void ndr_print_netr_ChangeLogObject(struct ndr_print *ndr, const char *name, const union netr_ChangeLogObject *r);
enum ndr_err_code ndr_push_netr_ChangeLogEntry(struct ndr_push *ndr, int ndr_flags, const struct netr_ChangeLogEntry *r);
diff --git a/librpc/gen_ndr/netlogon.h b/librpc/gen_ndr/netlogon.h
index 892e770bad..7010e80843 100644
--- a/librpc/gen_ndr/netlogon.h
+++ b/librpc/gen_ndr/netlogon.h
@@ -744,6 +744,33 @@ union netr_CONTROL_DATA_INFORMATION {
#define NETLOGON_NEG_AUTHENTICATED_RPC_LSASS ( 0x20000000 )
#define NETLOGON_NEG_AUTHENTICATED_RPC ( 0x40000000 )
+enum SyncStateEnum
+#ifndef USE_UINT_ENUMS
+ {
+ SYNCSTATE_NORMAL_STATE=0,
+ SYNCSTATE_DOMAIN_STATE=1,
+ SYNCSTATE_GROUP_STATE=2,
+ SYNCSTATE_UAS_BUILT_IN_GROUP_STATE=3,
+ SYNCSTATE_USER_STATE=4,
+ SYNCSTATE_GROUP_MEMBER_STATE=5,
+ SYNCSTATE_ALIAS_STATE=6,
+ SYNCSTATE_ALIAS_MEMBER_STATE=7,
+ SYNCSTATE_SAM_DONE_STATE=8
+}
+#else
+ { __donnot_use_enum_SyncStateEnum=0x7FFFFFFF}
+#define SYNCSTATE_NORMAL_STATE ( 0 )
+#define SYNCSTATE_DOMAIN_STATE ( 1 )
+#define SYNCSTATE_GROUP_STATE ( 2 )
+#define SYNCSTATE_UAS_BUILT_IN_GROUP_STATE ( 3 )
+#define SYNCSTATE_USER_STATE ( 4 )
+#define SYNCSTATE_GROUP_MEMBER_STATE ( 5 )
+#define SYNCSTATE_ALIAS_STATE ( 6 )
+#define SYNCSTATE_ALIAS_MEMBER_STATE ( 7 )
+#define SYNCSTATE_SAM_DONE_STATE ( 8 )
+#endif
+;
+
/* bitmap netr_ChangeLogFlags */
#define NETR_CHANGELOG_IMMEDIATE_REPL_REQUIRED ( 0x0001 )
#define NETR_CHANGELOG_CHANGED_PASSWORD ( 0x0002 )
@@ -1228,7 +1255,7 @@ struct netr_LogonControl {
} in;
struct {
- union netr_CONTROL_QUERY_INFORMATION *info;/* [ref,switch_is(level)] */
+ union netr_CONTROL_QUERY_INFORMATION *query;/* [ref,switch_is(level)] */
WERROR result;
} out;
@@ -1290,7 +1317,7 @@ struct netr_DatabaseSync2 {
const char *computername;/* [charset(UTF16)] */
struct netr_Authenticator *credential;/* [ref] */
enum netr_SamDatabaseID database_id;
- uint16_t restart_state;
+ enum SyncStateEnum restart_state;
uint32_t preferredmaximumlength;
struct netr_Authenticator *return_authenticator;/* [ref] */
uint32_t *sync_context;/* [ref] */
diff --git a/librpc/gen_ndr/srv_netlogon.c b/librpc/gen_ndr/srv_netlogon.c
index 4515ca0a82..be92d4a4dd 100644
--- a/librpc/gen_ndr/srv_netlogon.c
+++ b/librpc/gen_ndr/srv_netlogon.c
@@ -1050,8 +1050,8 @@ static bool api_netr_LogonControl(pipes_struct *p)
}
ZERO_STRUCT(r->out);
- r->out.info = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
- if (r->out.info == NULL) {
+ r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
+ if (r->out.query == NULL) {
talloc_free(r);
return false;
}
@@ -4092,8 +4092,8 @@ NTSTATUS rpc_netlogon_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
case NDR_NETR_LOGONCONTROL: {
struct netr_LogonControl *r = (struct netr_LogonControl *)_r;
ZERO_STRUCT(r->out);
- r->out.info = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION);
- if (r->out.info == NULL) {
+ r->out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION);
+ if (r->out.query == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl
index 65f62da017..4a90c2c87c 100644
--- a/librpc/idl/netlogon.idl
+++ b/librpc/idl/netlogon.idl
@@ -728,7 +728,6 @@ interface netlogon
[size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
} netr_DELTA_ENUM_ARRAY;
-
NTSTATUS netr_DatabaseDeltas(
[in] [string,charset(UTF16)] uint16 logon_server[],
[in] [string,charset(UTF16)] uint16 computername[],
@@ -882,7 +881,7 @@ interface netlogon
[in,unique] [string,charset(UTF16)] uint16 *logon_server,
[in] netr_LogonControlCode function_code,
[in] uint32 level,
- [out,ref,switch_is(level)] netr_CONTROL_QUERY_INFORMATION *info
+ [out,ref,switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query
);
@@ -970,13 +969,25 @@ interface netlogon
/*****************/
/* Function 0x10 */
+ typedef enum {
+ SYNCSTATE_NORMAL_STATE = 0,
+ SYNCSTATE_DOMAIN_STATE = 1,
+ SYNCSTATE_GROUP_STATE = 2,
+ SYNCSTATE_UAS_BUILT_IN_GROUP_STATE = 3,
+ SYNCSTATE_USER_STATE = 4,
+ SYNCSTATE_GROUP_MEMBER_STATE = 5,
+ SYNCSTATE_ALIAS_STATE = 6,
+ SYNCSTATE_ALIAS_MEMBER_STATE = 7,
+ SYNCSTATE_SAM_DONE_STATE = 8
+ } SyncStateEnum;
+
NTSTATUS netr_DatabaseSync2(
[in] [string,charset(UTF16)] uint16 logon_server[],
[in] [string,charset(UTF16)] uint16 computername[],
[in,ref] netr_Authenticator *credential,
[in,out,ref] netr_Authenticator *return_authenticator,
[in] netr_SamDatabaseID database_id,
- [in] uint16 restart_state,
+ [in] SyncStateEnum restart_state,
[in,out,ref] uint32 *sync_context,
[out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array,
[in] uint32 preferredmaximumlength