diff options
34 files changed, 5662 insertions, 43 deletions
diff --git a/librpc/gen_ndr/srv_dfs.c b/librpc/gen_ndr/srv_dfs.c index 00afa36ec1..f4b73d8015 100644 --- a/librpc/gen_ndr/srv_dfs.c +++ b/librpc/gen_ndr/srv_dfs.c @@ -1748,6 +1748,183 @@ void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_netdfs_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_netdfs_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_DFS_GETMANAGERVERSION: { + struct dfs_GetManagerVersion *r = _r; + ZERO_STRUCT(r->out); + r->out.version = talloc_zero(mem_ctx, enum dfs_ManagerVersion); + if (r->out.version == NULL) { + return NT_STATUS_NO_MEMORY; + } + + _dfs_GetManagerVersion(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ADD: { + struct dfs_Add *r = _r; + r->out.result = _dfs_Add(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_REMOVE: { + struct dfs_Remove *r = _r; + r->out.result = _dfs_Remove(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_SETINFO: { + struct dfs_SetInfo *r = _r; + r->out.result = _dfs_SetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_GETINFO: { + struct dfs_GetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union dfs_Info); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _dfs_GetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ENUM: { + struct dfs_Enum *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.total = r->in.total; + r->out.result = _dfs_Enum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_RENAME: { + struct dfs_Rename *r = _r; + r->out.result = _dfs_Rename(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_MOVE: { + struct dfs_Move *r = _r; + r->out.result = _dfs_Move(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_MANAGERGETCONFIGINFO: { + struct dfs_ManagerGetConfigInfo *r = _r; + r->out.result = _dfs_ManagerGetConfigInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_MANAGERSENDSITEINFO: { + struct dfs_ManagerSendSiteInfo *r = _r; + r->out.result = _dfs_ManagerSendSiteInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ADDFTROOT: { + struct dfs_AddFtRoot *r = _r; + ZERO_STRUCT(r->out); + r->out.unknown2 = r->in.unknown2; + r->out.result = _dfs_AddFtRoot(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_REMOVEFTROOT: { + struct dfs_RemoveFtRoot *r = _r; + ZERO_STRUCT(r->out); + r->out.unknown = r->in.unknown; + r->out.result = _dfs_RemoveFtRoot(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ADDSTDROOT: { + struct dfs_AddStdRoot *r = _r; + r->out.result = _dfs_AddStdRoot(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_REMOVESTDROOT: { + struct dfs_RemoveStdRoot *r = _r; + r->out.result = _dfs_RemoveStdRoot(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_MANAGERINITIALIZE: { + struct dfs_ManagerInitialize *r = _r; + r->out.result = _dfs_ManagerInitialize(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ADDSTDROOTFORCED: { + struct dfs_AddStdRootForced *r = _r; + r->out.result = _dfs_AddStdRootForced(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_GETDCADDRESS: { + struct dfs_GetDcAddress *r = _r; + ZERO_STRUCT(r->out); + r->out.server_fullname = r->in.server_fullname; + r->out.is_root = r->in.is_root; + r->out.ttl = r->in.ttl; + r->out.result = _dfs_GetDcAddress(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_SETDCADDRESS: { + struct dfs_SetDcAddress *r = _r; + r->out.result = _dfs_SetDcAddress(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_FLUSHFTTABLE: { + struct dfs_FlushFtTable *r = _r; + r->out.result = _dfs_FlushFtTable(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ADD2: { + struct dfs_Add2 *r = _r; + r->out.result = _dfs_Add2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_REMOVE2: { + struct dfs_Remove2 *r = _r; + r->out.result = _dfs_Remove2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_ENUMEX: { + struct dfs_EnumEx *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.total = r->in.total; + r->out.result = _dfs_EnumEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DFS_SETINFO2: { + struct dfs_SetInfo2 *r = _r; + r->out.result = _dfs_SetInfo2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_netdfs_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "netdfs", "netdfs", &ndr_table_netdfs, api_netdfs_cmds, sizeof(api_netdfs_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_dfs.h b/librpc/gen_ndr/srv_dfs.h index fe9234b21d..89f3ed1a18 100644 --- a/librpc/gen_ndr/srv_dfs.h +++ b/librpc/gen_ndr/srv_dfs.h @@ -25,5 +25,29 @@ WERROR _dfs_Remove2(pipes_struct *p, struct dfs_Remove2 *r); WERROR _dfs_EnumEx(pipes_struct *p, struct dfs_EnumEx *r); WERROR _dfs_SetInfo2(pipes_struct *p, struct dfs_SetInfo2 *r); void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_netdfs_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r); +WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r); +WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r); +WERROR _dfs_SetInfo(pipes_struct *p, struct dfs_SetInfo *r); +WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r); +WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r); +WERROR _dfs_Rename(pipes_struct *p, struct dfs_Rename *r); +WERROR _dfs_Move(pipes_struct *p, struct dfs_Move *r); +WERROR _dfs_ManagerGetConfigInfo(pipes_struct *p, struct dfs_ManagerGetConfigInfo *r); +WERROR _dfs_ManagerSendSiteInfo(pipes_struct *p, struct dfs_ManagerSendSiteInfo *r); +WERROR _dfs_AddFtRoot(pipes_struct *p, struct dfs_AddFtRoot *r); +WERROR _dfs_RemoveFtRoot(pipes_struct *p, struct dfs_RemoveFtRoot *r); +WERROR _dfs_AddStdRoot(pipes_struct *p, struct dfs_AddStdRoot *r); +WERROR _dfs_RemoveStdRoot(pipes_struct *p, struct dfs_RemoveStdRoot *r); +WERROR _dfs_ManagerInitialize(pipes_struct *p, struct dfs_ManagerInitialize *r); +WERROR _dfs_AddStdRootForced(pipes_struct *p, struct dfs_AddStdRootForced *r); +WERROR _dfs_GetDcAddress(pipes_struct *p, struct dfs_GetDcAddress *r); +WERROR _dfs_SetDcAddress(pipes_struct *p, struct dfs_SetDcAddress *r); +WERROR _dfs_FlushFtTable(pipes_struct *p, struct dfs_FlushFtTable *r); +WERROR _dfs_Add2(pipes_struct *p, struct dfs_Add2 *r); +WERROR _dfs_Remove2(pipes_struct *p, struct dfs_Remove2 *r); +WERROR _dfs_EnumEx(pipes_struct *p, struct dfs_EnumEx *r); +WERROR _dfs_SetInfo2(pipes_struct *p, struct dfs_SetInfo2 *r); NTSTATUS rpc_netdfs_init(void); #endif /* __SRV_NETDFS__ */ diff --git a/librpc/gen_ndr/srv_dssetup.c b/librpc/gen_ndr/srv_dssetup.c index abb890fa6a..dfa46e800b 100644 --- a/librpc/gen_ndr/srv_dssetup.c +++ b/librpc/gen_ndr/srv_dssetup.c @@ -839,6 +839,91 @@ void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_dssetup_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_dssetup_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION: { + struct dssetup_DsRoleGetPrimaryDomainInformation *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union dssetup_DsRoleInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _dssetup_DsRoleGetPrimaryDomainInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME: { + struct dssetup_DsRoleDnsNameToFlatName *r = _r; + r->out.result = _dssetup_DsRoleDnsNameToFlatName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEDCASDC: { + struct dssetup_DsRoleDcAsDc *r = _r; + r->out.result = _dssetup_DsRoleDcAsDc(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEDCASREPLICA: { + struct dssetup_DsRoleDcAsReplica *r = _r; + r->out.result = _dssetup_DsRoleDcAsReplica(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEDEMOTEDC: { + struct dssetup_DsRoleDemoteDc *r = _r; + r->out.result = _dssetup_DsRoleDemoteDc(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS: { + struct dssetup_DsRoleGetDcOperationProgress *r = _r; + r->out.result = _dssetup_DsRoleGetDcOperationProgress(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS: { + struct dssetup_DsRoleGetDcOperationResults *r = _r; + r->out.result = _dssetup_DsRoleGetDcOperationResults(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLECANCEL: { + struct dssetup_DsRoleCancel *r = _r; + r->out.result = _dssetup_DsRoleCancel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE: { + struct dssetup_DsRoleServerSaveStateForUpgrade *r = _r; + r->out.result = _dssetup_DsRoleServerSaveStateForUpgrade(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER: { + struct dssetup_DsRoleUpgradeDownlevelServer *r = _r; + r->out.result = _dssetup_DsRoleUpgradeDownlevelServer(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE: { + struct dssetup_DsRoleAbortDownlevelServerUpgrade *r = _r; + r->out.result = _dssetup_DsRoleAbortDownlevelServerUpgrade(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_dssetup_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "dssetup", "dssetup", &ndr_table_dssetup, api_dssetup_cmds, sizeof(api_dssetup_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_dssetup.h b/librpc/gen_ndr/srv_dssetup.h index 4122678274..33ec07de86 100644 --- a/librpc/gen_ndr/srv_dssetup.h +++ b/librpc/gen_ndr/srv_dssetup.h @@ -13,5 +13,17 @@ WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, struct dssetup_ WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, struct dssetup_DsRoleUpgradeDownlevelServer *r); WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_dssetup_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p, struct dssetup_DsRoleGetPrimaryDomainInformation *r); +WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p, struct dssetup_DsRoleDnsNameToFlatName *r); +WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p, struct dssetup_DsRoleDcAsDc *r); +WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p, struct dssetup_DsRoleDcAsReplica *r); +WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p, struct dssetup_DsRoleDemoteDc *r); +WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p, struct dssetup_DsRoleGetDcOperationProgress *r); +WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p, struct dssetup_DsRoleGetDcOperationResults *r); +WERROR _dssetup_DsRoleCancel(pipes_struct *p, struct dssetup_DsRoleCancel *r); +WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, struct dssetup_DsRoleServerSaveStateForUpgrade *r); +WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, struct dssetup_DsRoleUpgradeDownlevelServer *r); +WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); NTSTATUS rpc_dssetup_init(void); #endif /* __SRV_DSSETUP__ */ diff --git a/librpc/gen_ndr/srv_echo.c b/librpc/gen_ndr/srv_echo.c index 1912b8b9d5..6717e013a2 100644 --- a/librpc/gen_ndr/srv_echo.c +++ b/librpc/gen_ndr/srv_echo.c @@ -799,6 +799,115 @@ void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_rpcecho_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_ECHO_ADDONE: { + struct echo_AddOne *r = _r; + ZERO_STRUCT(r->out); + r->out.out_data = talloc_zero(mem_ctx, uint32_t); + if (r->out.out_data == NULL) { + return NT_STATUS_NO_MEMORY; + } + + _echo_AddOne(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_ECHODATA: { + struct echo_EchoData *r = _r; + ZERO_STRUCT(r->out); + r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.len); + if (r->out.out_data == NULL) { + return NT_STATUS_NO_MEMORY; + } + + _echo_EchoData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_SINKDATA: { + struct echo_SinkData *r = _r; + _echo_SinkData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_SOURCEDATA: { + struct echo_SourceData *r = _r; + ZERO_STRUCT(r->out); + r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.len); + if (r->out.data == NULL) { + return NT_STATUS_NO_MEMORY; + } + + _echo_SourceData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_TESTCALL: { + struct echo_TestCall *r = _r; + ZERO_STRUCT(r->out); + r->out.s2 = talloc_zero(mem_ctx, const char *); + if (r->out.s2 == NULL) { + return NT_STATUS_NO_MEMORY; + } + + _echo_TestCall(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_TESTCALL2: { + struct echo_TestCall2 *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union echo_Info); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _echo_TestCall2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_TESTSLEEP: { + struct echo_TestSleep *r = _r; + r->out.result = _echo_TestSleep(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_TESTENUM: { + struct echo_TestEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.foo1 = r->in.foo1; + r->out.foo2 = r->in.foo2; + r->out.foo3 = r->in.foo3; + _echo_TestEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_TESTSURROUNDING: { + struct echo_TestSurrounding *r = _r; + ZERO_STRUCT(r->out); + r->out.data = r->in.data; + _echo_TestSurrounding(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ECHO_TESTDOUBLEPOINTER: { + struct echo_TestDoublePointer *r = _r; + r->out.result = _echo_TestDoublePointer(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_rpcecho_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", &ndr_table_rpcecho, api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_echo.h b/librpc/gen_ndr/srv_echo.h index cb6dd6ac46..3e1cbd5059 100644 --- a/librpc/gen_ndr/srv_echo.h +++ b/librpc/gen_ndr/srv_echo.h @@ -12,5 +12,16 @@ void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r); void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r); uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r); void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_rpcecho_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +void _echo_AddOne(pipes_struct *p, struct echo_AddOne *r); +void _echo_EchoData(pipes_struct *p, struct echo_EchoData *r); +void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r); +void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r); +void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r); +NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r); +uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r); +void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r); +void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r); +uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r); NTSTATUS rpc_rpcecho_init(void); #endif /* __SRV_RPCECHO__ */ diff --git a/librpc/gen_ndr/srv_epmapper.c b/librpc/gen_ndr/srv_epmapper.c index b66bdf4e69..95692906f4 100644 --- a/librpc/gen_ndr/srv_epmapper.c +++ b/librpc/gen_ndr/srv_epmapper.c @@ -640,6 +640,93 @@ void epmapper_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_epmapper_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_epmapper_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_EPM_INSERT: { + struct epm_Insert *r = _r; + r->out.result = _epm_Insert(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_DELETE: { + struct epm_Delete *r = _r; + r->out.result = _epm_Delete(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_LOOKUP: { + struct epm_Lookup *r = _r; + ZERO_STRUCT(r->out); + r->out.entry_handle = r->in.entry_handle; + r->out.num_ents = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_ents == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.entries = talloc_zero_array(mem_ctx, struct epm_entry_t, r->in.max_ents); + if (r->out.entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _epm_Lookup(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_MAP: { + struct epm_Map *r = _r; + ZERO_STRUCT(r->out); + r->out.entry_handle = r->in.entry_handle; + r->out.num_towers = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_towers == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.towers = talloc_zero_array(mem_ctx, struct epm_twr_p_t, r->in.max_towers); + if (r->out.towers == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _epm_Map(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_LOOKUPHANDLEFREE: { + struct epm_LookupHandleFree *r = _r; + ZERO_STRUCT(r->out); + r->out.entry_handle = r->in.entry_handle; + r->out.result = _epm_LookupHandleFree(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_INQOBJECT: { + struct epm_InqObject *r = _r; + r->out.result = _epm_InqObject(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_MGMTDELETE: { + struct epm_MgmtDelete *r = _r; + r->out.result = _epm_MgmtDelete(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EPM_MAPAUTH: { + struct epm_MapAuth *r = _r; + r->out.result = _epm_MapAuth(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_epmapper_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "epmapper", "epmapper", &ndr_table_epmapper, api_epmapper_cmds, sizeof(api_epmapper_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_epmapper.h b/librpc/gen_ndr/srv_epmapper.h index 137d908240..4cf074778f 100644 --- a/librpc/gen_ndr/srv_epmapper.h +++ b/librpc/gen_ndr/srv_epmapper.h @@ -10,5 +10,14 @@ uint32 _epm_InqObject(pipes_struct *p, struct epm_InqObject *r); uint32 _epm_MgmtDelete(pipes_struct *p, struct epm_MgmtDelete *r); uint32 _epm_MapAuth(pipes_struct *p, struct epm_MapAuth *r); void epmapper_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_epmapper_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +uint32 _epm_Insert(pipes_struct *p, struct epm_Insert *r); +uint32 _epm_Delete(pipes_struct *p, struct epm_Delete *r); +uint32 _epm_Lookup(pipes_struct *p, struct epm_Lookup *r); +uint32 _epm_Map(pipes_struct *p, struct epm_Map *r); +uint32 _epm_LookupHandleFree(pipes_struct *p, struct epm_LookupHandleFree *r); +uint32 _epm_InqObject(pipes_struct *p, struct epm_InqObject *r); +uint32 _epm_MgmtDelete(pipes_struct *p, struct epm_MgmtDelete *r); +uint32 _epm_MapAuth(pipes_struct *p, struct epm_MapAuth *r); NTSTATUS rpc_epmapper_init(void); #endif /* __SRV_EPMAPPER__ */ diff --git a/librpc/gen_ndr/srv_eventlog.c b/librpc/gen_ndr/srv_eventlog.c index 9a87ee648c..4782a9da2f 100644 --- a/librpc/gen_ndr/srv_eventlog.c +++ b/librpc/gen_ndr/srv_eventlog.c @@ -1836,6 +1836,199 @@ void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_eventlog_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_eventlog_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_EVENTLOG_CLEAREVENTLOGW: { + struct eventlog_ClearEventLogW *r = _r; + r->out.result = _eventlog_ClearEventLogW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_BACKUPEVENTLOGW: { + struct eventlog_BackupEventLogW *r = _r; + r->out.result = _eventlog_BackupEventLogW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_CLOSEEVENTLOG: { + struct eventlog_CloseEventLog *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _eventlog_CloseEventLog(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_DEREGISTEREVENTSOURCE: { + struct eventlog_DeregisterEventSource *r = _r; + r->out.result = _eventlog_DeregisterEventSource(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_GETNUMRECORDS: { + struct eventlog_GetNumRecords *r = _r; + ZERO_STRUCT(r->out); + r->out.number = talloc_zero(mem_ctx, uint32_t); + if (r->out.number == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _eventlog_GetNumRecords(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_GETOLDESTRECORD: { + struct eventlog_GetOldestRecord *r = _r; + ZERO_STRUCT(r->out); + r->out.oldest_entry = talloc_zero(mem_ctx, uint32_t); + if (r->out.oldest_entry == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _eventlog_GetOldestRecord(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_CHANGENOTIFY: { + struct eventlog_ChangeNotify *r = _r; + r->out.result = _eventlog_ChangeNotify(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_OPENEVENTLOGW: { + struct eventlog_OpenEventLogW *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _eventlog_OpenEventLogW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_REGISTEREVENTSOURCEW: { + struct eventlog_RegisterEventSourceW *r = _r; + r->out.result = _eventlog_RegisterEventSourceW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_OPENBACKUPEVENTLOGW: { + struct eventlog_OpenBackupEventLogW *r = _r; + r->out.result = _eventlog_OpenBackupEventLogW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_READEVENTLOGW: { + struct eventlog_ReadEventLogW *r = _r; + ZERO_STRUCT(r->out); + r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.number_of_bytes); + if (r->out.data == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.sent_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.sent_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.real_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.real_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _eventlog_ReadEventLogW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_REPORTEVENTW: { + struct eventlog_ReportEventW *r = _r; + r->out.result = _eventlog_ReportEventW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_CLEAREVENTLOGA: { + struct eventlog_ClearEventLogA *r = _r; + r->out.result = _eventlog_ClearEventLogA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_BACKUPEVENTLOGA: { + struct eventlog_BackupEventLogA *r = _r; + r->out.result = _eventlog_BackupEventLogA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_OPENEVENTLOGA: { + struct eventlog_OpenEventLogA *r = _r; + r->out.result = _eventlog_OpenEventLogA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_REGISTEREVENTSOURCEA: { + struct eventlog_RegisterEventSourceA *r = _r; + r->out.result = _eventlog_RegisterEventSourceA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_OPENBACKUPEVENTLOGA: { + struct eventlog_OpenBackupEventLogA *r = _r; + r->out.result = _eventlog_OpenBackupEventLogA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_READEVENTLOGA: { + struct eventlog_ReadEventLogA *r = _r; + r->out.result = _eventlog_ReadEventLogA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_REPORTEVENTA: { + struct eventlog_ReportEventA *r = _r; + r->out.result = _eventlog_ReportEventA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_REGISTERCLUSTERSVC: { + struct eventlog_RegisterClusterSvc *r = _r; + r->out.result = _eventlog_RegisterClusterSvc(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_DEREGISTERCLUSTERSVC: { + struct eventlog_DeregisterClusterSvc *r = _r; + r->out.result = _eventlog_DeregisterClusterSvc(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_WRITECLUSTEREVENTS: { + struct eventlog_WriteClusterEvents *r = _r; + r->out.result = _eventlog_WriteClusterEvents(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_GETLOGINTORMATION: { + struct eventlog_GetLogIntormation *r = _r; + r->out.result = _eventlog_GetLogIntormation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_EVENTLOG_FLUSHEVENTLOG: { + struct eventlog_FlushEventLog *r = _r; + r->out.result = _eventlog_FlushEventLog(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_eventlog_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "eventlog", "eventlog", &ndr_table_eventlog, api_eventlog_cmds, sizeof(api_eventlog_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_eventlog.h b/librpc/gen_ndr/srv_eventlog.h index 3293bba507..c540f92242 100644 --- a/librpc/gen_ndr/srv_eventlog.h +++ b/librpc/gen_ndr/srv_eventlog.h @@ -26,5 +26,30 @@ NTSTATUS _eventlog_WriteClusterEvents(pipes_struct *p, struct eventlog_WriteClus NTSTATUS _eventlog_GetLogIntormation(pipes_struct *p, struct eventlog_GetLogIntormation *r); NTSTATUS _eventlog_FlushEventLog(pipes_struct *p, struct eventlog_FlushEventLog *r); void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_eventlog_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +NTSTATUS _eventlog_ClearEventLogW(pipes_struct *p, struct eventlog_ClearEventLogW *r); +NTSTATUS _eventlog_BackupEventLogW(pipes_struct *p, struct eventlog_BackupEventLogW *r); +NTSTATUS _eventlog_CloseEventLog(pipes_struct *p, struct eventlog_CloseEventLog *r); +NTSTATUS _eventlog_DeregisterEventSource(pipes_struct *p, struct eventlog_DeregisterEventSource *r); +NTSTATUS _eventlog_GetNumRecords(pipes_struct *p, struct eventlog_GetNumRecords *r); +NTSTATUS _eventlog_GetOldestRecord(pipes_struct *p, struct eventlog_GetOldestRecord *r); +NTSTATUS _eventlog_ChangeNotify(pipes_struct *p, struct eventlog_ChangeNotify *r); +NTSTATUS _eventlog_OpenEventLogW(pipes_struct *p, struct eventlog_OpenEventLogW *r); +NTSTATUS _eventlog_RegisterEventSourceW(pipes_struct *p, struct eventlog_RegisterEventSourceW *r); +NTSTATUS _eventlog_OpenBackupEventLogW(pipes_struct *p, struct eventlog_OpenBackupEventLogW *r); +NTSTATUS _eventlog_ReadEventLogW(pipes_struct *p, struct eventlog_ReadEventLogW *r); +NTSTATUS _eventlog_ReportEventW(pipes_struct *p, struct eventlog_ReportEventW *r); +NTSTATUS _eventlog_ClearEventLogA(pipes_struct *p, struct eventlog_ClearEventLogA *r); +NTSTATUS _eventlog_BackupEventLogA(pipes_struct *p, struct eventlog_BackupEventLogA *r); +NTSTATUS _eventlog_OpenEventLogA(pipes_struct *p, struct eventlog_OpenEventLogA *r); +NTSTATUS _eventlog_RegisterEventSourceA(pipes_struct *p, struct eventlog_RegisterEventSourceA *r); +NTSTATUS _eventlog_OpenBackupEventLogA(pipes_struct *p, struct eventlog_OpenBackupEventLogA *r); +NTSTATUS _eventlog_ReadEventLogA(pipes_struct *p, struct eventlog_ReadEventLogA *r); +NTSTATUS _eventlog_ReportEventA(pipes_struct *p, struct eventlog_ReportEventA *r); +NTSTATUS _eventlog_RegisterClusterSvc(pipes_struct *p, struct eventlog_RegisterClusterSvc *r); +NTSTATUS _eventlog_DeregisterClusterSvc(pipes_struct *p, struct eventlog_DeregisterClusterSvc *r); +NTSTATUS _eventlog_WriteClusterEvents(pipes_struct *p, struct eventlog_WriteClusterEvents *r); +NTSTATUS _eventlog_GetLogIntormation(pipes_struct *p, struct eventlog_GetLogIntormation *r); +NTSTATUS _eventlog_FlushEventLog(pipes_struct *p, struct eventlog_FlushEventLog *r); NTSTATUS rpc_eventlog_init(void); #endif /* __SRV_EVENTLOG__ */ diff --git a/librpc/gen_ndr/srv_initshutdown.c b/librpc/gen_ndr/srv_initshutdown.c index f0f3a7ba73..247d83fb03 100644 --- a/librpc/gen_ndr/srv_initshutdown.c +++ b/librpc/gen_ndr/srv_initshutdown.c @@ -240,6 +240,37 @@ void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_initshutdown_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_initshutdown_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_INITSHUTDOWN_INIT: { + struct initshutdown_Init *r = _r; + r->out.result = _initshutdown_Init(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_INITSHUTDOWN_ABORT: { + struct initshutdown_Abort *r = _r; + r->out.result = _initshutdown_Abort(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_INITSHUTDOWN_INITEX: { + struct initshutdown_InitEx *r = _r; + r->out.result = _initshutdown_InitEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_initshutdown_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "initshutdown", "initshutdown", &ndr_table_initshutdown, api_initshutdown_cmds, sizeof(api_initshutdown_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_initshutdown.h b/librpc/gen_ndr/srv_initshutdown.h index d638131c53..c4845a677d 100644 --- a/librpc/gen_ndr/srv_initshutdown.h +++ b/librpc/gen_ndr/srv_initshutdown.h @@ -5,5 +5,9 @@ WERROR _initshutdown_Init(pipes_struct *p, struct initshutdown_Init *r); WERROR _initshutdown_Abort(pipes_struct *p, struct initshutdown_Abort *r); WERROR _initshutdown_InitEx(pipes_struct *p, struct initshutdown_InitEx *r); void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_initshutdown_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _initshutdown_Init(pipes_struct *p, struct initshutdown_Init *r); +WERROR _initshutdown_Abort(pipes_struct *p, struct initshutdown_Abort *r); +WERROR _initshutdown_InitEx(pipes_struct *p, struct initshutdown_InitEx *r); NTSTATUS rpc_initshutdown_init(void); #endif /* __SRV_INITSHUTDOWN__ */ diff --git a/librpc/gen_ndr/srv_lsa.c b/librpc/gen_ndr/srv_lsa.c index fe95df35ee..9e32e64ee9 100644 --- a/librpc/gen_ndr/srv_lsa.c +++ b/librpc/gen_ndr/srv_lsa.c @@ -6383,6 +6383,770 @@ void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_lsarpc_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_lsarpc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_LSA_CLOSE: { + struct lsa_Close *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _lsa_Close(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_DELETE: { + struct lsa_Delete *r = _r; + r->out.result = _lsa_Delete(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMPRIVS: { + struct lsa_EnumPrivs *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.privs = talloc_zero(mem_ctx, struct lsa_PrivArray); + if (r->out.privs == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumPrivs(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYSECURITY: { + struct lsa_QuerySecurity *r = _r; + ZERO_STRUCT(r->out); + r->out.sdbuf = talloc_zero(mem_ctx, struct sec_desc_buf *); + if (r->out.sdbuf == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QuerySecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETSECOBJ: { + struct lsa_SetSecObj *r = _r; + r->out.result = _lsa_SetSecObj(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CHANGEPASSWORD: { + struct lsa_ChangePassword *r = _r; + r->out.result = _lsa_ChangePassword(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_OPENPOLICY: { + struct lsa_OpenPolicy *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_OpenPolicy(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYINFOPOLICY: { + struct lsa_QueryInfoPolicy *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union lsa_PolicyInformation *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QueryInfoPolicy(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETINFOPOLICY: { + struct lsa_SetInfoPolicy *r = _r; + r->out.result = _lsa_SetInfoPolicy(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CLEARAUDITLOG: { + struct lsa_ClearAuditLog *r = _r; + r->out.result = _lsa_ClearAuditLog(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREATEACCOUNT: { + struct lsa_CreateAccount *r = _r; + ZERO_STRUCT(r->out); + r->out.acct_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.acct_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_CreateAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMACCOUNTS: { + struct lsa_EnumAccounts *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sids = talloc_zero(mem_ctx, struct lsa_SidArray); + if (r->out.sids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumAccounts(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREATETRUSTEDDOMAIN: { + struct lsa_CreateTrustedDomain *r = _r; + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_CreateTrustedDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMTRUSTDOM: { + struct lsa_EnumTrustDom *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.domains = talloc_zero(mem_ctx, struct lsa_DomainList); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumTrustDom(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPNAMES: { + struct lsa_LookupNames *r = _r; + ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupNames(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPSIDS: { + struct lsa_LookupSids *r = _r; + ZERO_STRUCT(r->out); + r->out.names = r->in.names; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupSids(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREATESECRET: { + struct lsa_CreateSecret *r = _r; + ZERO_STRUCT(r->out); + r->out.sec_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.sec_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_CreateSecret(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_OPENACCOUNT: { + struct lsa_OpenAccount *r = _r; + ZERO_STRUCT(r->out); + r->out.acct_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.acct_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_OpenAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMPRIVSACCOUNT: { + struct lsa_EnumPrivsAccount *r = _r; + ZERO_STRUCT(r->out); + r->out.privs = talloc_zero(mem_ctx, struct lsa_PrivilegeSet *); + if (r->out.privs == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumPrivsAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ADDPRIVILEGESTOACCOUNT: { + struct lsa_AddPrivilegesToAccount *r = _r; + r->out.result = _lsa_AddPrivilegesToAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT: { + struct lsa_RemovePrivilegesFromAccount *r = _r; + r->out.result = _lsa_RemovePrivilegesFromAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_GETQUOTASFORACCOUNT: { + struct lsa_GetQuotasForAccount *r = _r; + r->out.result = _lsa_GetQuotasForAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETQUOTASFORACCOUNT: { + struct lsa_SetQuotasForAccount *r = _r; + r->out.result = _lsa_SetQuotasForAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_GETSYSTEMACCESSACCOUNT: { + struct lsa_GetSystemAccessAccount *r = _r; + ZERO_STRUCT(r->out); + r->out.access_mask = talloc_zero(mem_ctx, uint32_t); + if (r->out.access_mask == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_GetSystemAccessAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETSYSTEMACCESSACCOUNT: { + struct lsa_SetSystemAccessAccount *r = _r; + r->out.result = _lsa_SetSystemAccessAccount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_OPENTRUSTEDDOMAIN: { + struct lsa_OpenTrustedDomain *r = _r; + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_OpenTrustedDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYTRUSTEDDOMAININFO: { + struct lsa_QueryTrustedDomainInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union lsa_TrustedDomainInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QueryTrustedDomainInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN: { + struct lsa_SetInformationTrustedDomain *r = _r; + r->out.result = _lsa_SetInformationTrustedDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_OPENSECRET: { + struct lsa_OpenSecret *r = _r; + ZERO_STRUCT(r->out); + r->out.sec_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.sec_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_OpenSecret(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETSECRET: { + struct lsa_SetSecret *r = _r; + r->out.result = _lsa_SetSecret(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYSECRET: { + struct lsa_QuerySecret *r = _r; + ZERO_STRUCT(r->out); + r->out.new_val = r->in.new_val; + r->out.new_mtime = r->in.new_mtime; + r->out.old_val = r->in.old_val; + r->out.old_mtime = r->in.old_mtime; + r->out.result = _lsa_QuerySecret(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPPRIVVALUE: { + struct lsa_LookupPrivValue *r = _r; + ZERO_STRUCT(r->out); + r->out.luid = talloc_zero(mem_ctx, struct lsa_LUID); + if (r->out.luid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupPrivValue(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPPRIVNAME: { + struct lsa_LookupPrivName *r = _r; + ZERO_STRUCT(r->out); + r->out.name = talloc_zero(mem_ctx, struct lsa_StringLarge *); + if (r->out.name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupPrivName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPPRIVDISPLAYNAME: { + struct lsa_LookupPrivDisplayName *r = _r; + ZERO_STRUCT(r->out); + r->out.disp_name = talloc_zero(mem_ctx, struct lsa_StringLarge *); + if (r->out.disp_name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.returned_language_id = talloc_zero(mem_ctx, uint16_t); + if (r->out.returned_language_id == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupPrivDisplayName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_DELETEOBJECT: { + struct lsa_DeleteObject *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _lsa_DeleteObject(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT: { + struct lsa_EnumAccountsWithUserRight *r = _r; + ZERO_STRUCT(r->out); + r->out.sids = talloc_zero(mem_ctx, struct lsa_SidArray); + if (r->out.sids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumAccountsWithUserRight(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMACCOUNTRIGHTS: { + struct lsa_EnumAccountRights *r = _r; + ZERO_STRUCT(r->out); + r->out.rights = talloc_zero(mem_ctx, struct lsa_RightSet); + if (r->out.rights == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumAccountRights(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ADDACCOUNTRIGHTS: { + struct lsa_AddAccountRights *r = _r; + r->out.result = _lsa_AddAccountRights(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_REMOVEACCOUNTRIGHTS: { + struct lsa_RemoveAccountRights *r = _r; + r->out.result = _lsa_RemoveAccountRights(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID: { + struct lsa_QueryTrustedDomainInfoBySid *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union lsa_TrustedDomainInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QueryTrustedDomainInfoBySid(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETTRUSTEDDOMAININFO: { + struct lsa_SetTrustedDomainInfo *r = _r; + r->out.result = _lsa_SetTrustedDomainInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_DELETETRUSTEDDOMAIN: { + struct lsa_DeleteTrustedDomain *r = _r; + r->out.result = _lsa_DeleteTrustedDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_STOREPRIVATEDATA: { + struct lsa_StorePrivateData *r = _r; + r->out.result = _lsa_StorePrivateData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_RETRIEVEPRIVATEDATA: { + struct lsa_RetrievePrivateData *r = _r; + r->out.result = _lsa_RetrievePrivateData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_OPENPOLICY2: { + struct lsa_OpenPolicy2 *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_OpenPolicy2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_GETUSERNAME: { + struct lsa_GetUserName *r = _r; + ZERO_STRUCT(r->out); + r->out.account_name = r->in.account_name; + r->out.authority_name = r->in.authority_name; + r->out.result = _lsa_GetUserName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYINFOPOLICY2: { + struct lsa_QueryInfoPolicy2 *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union lsa_PolicyInformation *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QueryInfoPolicy2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETINFOPOLICY2: { + struct lsa_SetInfoPolicy2 *r = _r; + r->out.result = _lsa_SetInfoPolicy2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME: { + struct lsa_QueryTrustedDomainInfoByName *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union lsa_TrustedDomainInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QueryTrustedDomainInfoByName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETTRUSTEDDOMAININFOBYNAME: { + struct lsa_SetTrustedDomainInfoByName *r = _r; + r->out.result = _lsa_SetTrustedDomainInfoByName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_ENUMTRUSTEDDOMAINSEX: { + struct lsa_EnumTrustedDomainsEx *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.domains = talloc_zero(mem_ctx, struct lsa_DomainListEx); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_EnumTrustedDomainsEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREATETRUSTEDDOMAINEX: { + struct lsa_CreateTrustedDomainEx *r = _r; + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_CreateTrustedDomainEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CLOSETRUSTEDDOMAINEX: { + struct lsa_CloseTrustedDomainEx *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _lsa_CloseTrustedDomainEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_QUERYDOMAININFORMATIONPOLICY: { + struct lsa_QueryDomainInformationPolicy *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union lsa_DomainInformationPolicy *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_QueryDomainInformationPolicy(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_SETDOMAININFORMATIONPOLICY: { + struct lsa_SetDomainInformationPolicy *r = _r; + r->out.result = _lsa_SetDomainInformationPolicy(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_OPENTRUSTEDDOMAINBYNAME: { + struct lsa_OpenTrustedDomainByName *r = _r; + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_OpenTrustedDomainByName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_TESTCALL: { + struct lsa_TestCall *r = _r; + r->out.result = _lsa_TestCall(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPSIDS2: { + struct lsa_LookupSids2 *r = _r; + ZERO_STRUCT(r->out); + r->out.names = r->in.names; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupSids2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPNAMES2: { + struct lsa_LookupNames2 *r = _r; + ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupNames2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREATETRUSTEDDOMAINEX2: { + struct lsa_CreateTrustedDomainEx2 *r = _r; + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_CreateTrustedDomainEx2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRWRITE: { + struct lsa_CREDRWRITE *r = _r; + r->out.result = _lsa_CREDRWRITE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRREAD: { + struct lsa_CREDRREAD *r = _r; + r->out.result = _lsa_CREDRREAD(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRENUMERATE: { + struct lsa_CREDRENUMERATE *r = _r; + r->out.result = _lsa_CREDRENUMERATE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRWRITEDOMAINCREDENTIALS: { + struct lsa_CREDRWRITEDOMAINCREDENTIALS *r = _r; + r->out.result = _lsa_CREDRWRITEDOMAINCREDENTIALS(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRREADDOMAINCREDENTIALS: { + struct lsa_CREDRREADDOMAINCREDENTIALS *r = _r; + r->out.result = _lsa_CREDRREADDOMAINCREDENTIALS(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRDELETE: { + struct lsa_CREDRDELETE *r = _r; + r->out.result = _lsa_CREDRDELETE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRGETTARGETINFO: { + struct lsa_CREDRGETTARGETINFO *r = _r; + r->out.result = _lsa_CREDRGETTARGETINFO(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRPROFILELOADED: { + struct lsa_CREDRPROFILELOADED *r = _r; + r->out.result = _lsa_CREDRPROFILELOADED(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPNAMES3: { + struct lsa_LookupNames3 *r = _r; + ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupNames3(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRGETSESSIONTYPES: { + struct lsa_CREDRGETSESSIONTYPES *r = _r; + r->out.result = _lsa_CREDRGETSESSIONTYPES(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARREGISTERAUDITEVENT: { + struct lsa_LSARREGISTERAUDITEVENT *r = _r; + r->out.result = _lsa_LSARREGISTERAUDITEVENT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARGENAUDITEVENT: { + struct lsa_LSARGENAUDITEVENT *r = _r; + r->out.result = _lsa_LSARGENAUDITEVENT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARUNREGISTERAUDITEVENT: { + struct lsa_LSARUNREGISTERAUDITEVENT *r = _r; + r->out.result = _lsa_LSARUNREGISTERAUDITEVENT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION: { + struct lsa_lsaRQueryForestTrustInformation *r = _r; + ZERO_STRUCT(r->out); + r->out.forest_trust_info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation *); + if (r->out.forest_trust_info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_lsaRQueryForestTrustInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARSETFORESTTRUSTINFORMATION: { + struct lsa_LSARSETFORESTTRUSTINFORMATION *r = _r; + r->out.result = _lsa_LSARSETFORESTTRUSTINFORMATION(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_CREDRRENAME: { + struct lsa_CREDRRENAME *r = _r; + r->out.result = _lsa_CREDRRENAME(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPSIDS3: { + struct lsa_LookupSids3 *r = _r; + ZERO_STRUCT(r->out); + r->out.names = r->in.names; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupSids3(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LOOKUPNAMES4: { + struct lsa_LookupNames4 *r = _r; + ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList *); + if (r->out.domains == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _lsa_LookupNames4(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSAROPENPOLICYSCE: { + struct lsa_LSAROPENPOLICYSCE *r = _r; + r->out.result = _lsa_LSAROPENPOLICYSCE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE: { + struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r = _r; + r->out.result = _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE: { + struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r = _r; + r->out.result = _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_LSA_LSARADTREPORTSECURITYEVENT: { + struct lsa_LSARADTREPORTSECURITYEVENT *r = _r; + r->out.result = _lsa_LSARADTREPORTSECURITYEVENT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_lsarpc_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsarpc", &ndr_table_lsarpc, api_lsarpc_cmds, sizeof(api_lsarpc_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_lsa.h b/librpc/gen_ndr/srv_lsa.h index 63ea35f8e9..3e9eb1b42f 100644 --- a/librpc/gen_ndr/srv_lsa.h +++ b/librpc/gen_ndr/srv_lsa.h @@ -84,5 +84,88 @@ NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSA NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r); NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r); void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_lsarpc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r); +NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r); +NTSTATUS _lsa_EnumPrivs(pipes_struct *p, struct lsa_EnumPrivs *r); +NTSTATUS _lsa_QuerySecurity(pipes_struct *p, struct lsa_QuerySecurity *r); +NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r); +NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r); +NTSTATUS _lsa_OpenPolicy(pipes_struct *p, struct lsa_OpenPolicy *r); +NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p, struct lsa_QueryInfoPolicy *r); +NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r); +NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r); +NTSTATUS _lsa_CreateAccount(pipes_struct *p, struct lsa_CreateAccount *r); +NTSTATUS _lsa_EnumAccounts(pipes_struct *p, struct lsa_EnumAccounts *r); +NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r); +NTSTATUS _lsa_EnumTrustDom(pipes_struct *p, struct lsa_EnumTrustDom *r); +NTSTATUS _lsa_LookupNames(pipes_struct *p, struct lsa_LookupNames *r); +NTSTATUS _lsa_LookupSids(pipes_struct *p, struct lsa_LookupSids *r); +NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r); +NTSTATUS _lsa_OpenAccount(pipes_struct *p, struct lsa_OpenAccount *r); +NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p, struct lsa_EnumPrivsAccount *r); +NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p, struct lsa_AddPrivilegesToAccount *r); +NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p, struct lsa_RemovePrivilegesFromAccount *r); +NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r); +NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r); +NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p, struct lsa_GetSystemAccessAccount *r); +NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p, struct lsa_SetSystemAccessAccount *r); +NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r); +NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r); +NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r); +NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r); +NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r); +NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r); +NTSTATUS _lsa_LookupPrivValue(pipes_struct *p, struct lsa_LookupPrivValue *r); +NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r); +NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p, struct lsa_LookupPrivDisplayName *r); +NTSTATUS _lsa_DeleteObject(pipes_struct *p, struct lsa_DeleteObject *r); +NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r); +NTSTATUS _lsa_EnumAccountRights(pipes_struct *p, struct lsa_EnumAccountRights *r); +NTSTATUS _lsa_AddAccountRights(pipes_struct *p, struct lsa_AddAccountRights *r); +NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p, struct lsa_RemoveAccountRights *r); +NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r); +NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r); +NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r); +NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r); +NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r); +NTSTATUS _lsa_OpenPolicy2(pipes_struct *p, struct lsa_OpenPolicy2 *r); +NTSTATUS _lsa_GetUserName(pipes_struct *p, struct lsa_GetUserName *r); +NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r); +NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r); +NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r); +NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r); +NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r); +NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r); +NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r); +NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r); +NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r); +NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r); +NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r); +NTSTATUS _lsa_LookupSids2(pipes_struct *p, struct lsa_LookupSids2 *r); +NTSTATUS _lsa_LookupNames2(pipes_struct *p, struct lsa_LookupNames2 *r); +NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r); +NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r); +NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r); +NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r); +NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r); +NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r); +NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r); +NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r); +NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r); +NTSTATUS _lsa_LookupNames3(pipes_struct *p, struct lsa_LookupNames3 *r); +NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r); +NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r); +NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r); +NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r); +NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r); +NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r); +NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r); +NTSTATUS _lsa_LookupSids3(pipes_struct *p, struct lsa_LookupSids3 *r); +NTSTATUS _lsa_LookupNames4(pipes_struct *p, struct lsa_LookupNames4 *r); +NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r); +NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r); +NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r); +NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r); NTSTATUS rpc_lsarpc_init(void); #endif /* __SRV_LSARPC__ */ diff --git a/librpc/gen_ndr/srv_netlogon.c b/librpc/gen_ndr/srv_netlogon.c index 1bca23a7d2..c1e3a8aafd 100644 --- a/librpc/gen_ndr/srv_netlogon.c +++ b/librpc/gen_ndr/srv_netlogon.c @@ -3890,6 +3890,639 @@ void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_netlogon_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_netlogon_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_NETR_LOGONUASLOGON: { + struct netr_LogonUasLogon *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct netr_UasInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonUasLogon(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONUASLOGOFF: { + struct netr_LogonUasLogoff *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct netr_UasLogoffInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonUasLogoff(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONSAMLOGON: { + struct netr_LogonSamLogon *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.validation = talloc_zero(mem_ctx, union netr_Validation); + if (r->out.validation == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.authoritative = talloc_zero(mem_ctx, uint8_t); + if (r->out.authoritative == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonSamLogon(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONSAMLOGOFF: { + struct netr_LogonSamLogoff *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.result = _netr_LogonSamLogoff(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERREQCHALLENGE: { + struct netr_ServerReqChallenge *r = _r; + ZERO_STRUCT(r->out); + r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential); + if (r->out.return_credentials == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerReqChallenge(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERAUTHENTICATE: { + struct netr_ServerAuthenticate *r = _r; + ZERO_STRUCT(r->out); + r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential); + if (r->out.return_credentials == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerAuthenticate(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERPASSWORDSET: { + struct netr_ServerPasswordSet *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerPasswordSet(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DATABASEDELTAS: { + struct netr_DatabaseDeltas *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.sequence_num = r->in.sequence_num; + r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *); + if (r->out.delta_enum_array == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DatabaseDeltas(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DATABASESYNC: { + struct netr_DatabaseSync *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.sync_context = r->in.sync_context; + r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *); + if (r->out.delta_enum_array == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DatabaseSync(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_ACCOUNTDELTAS: { + struct netr_AccountDeltas *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.buffer = talloc_zero(mem_ctx, struct netr_AccountBuffer); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.count_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.count_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.total_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.total_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.recordid = talloc_zero(mem_ctx, struct netr_UAS_INFO_0); + if (r->out.recordid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_AccountDeltas(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_ACCOUNTSYNC: { + struct netr_AccountSync *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.recordid = r->in.recordid; + r->out.buffer = talloc_zero(mem_ctx, struct netr_AccountBuffer); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.count_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.count_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.total_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.total_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.next_reference = talloc_zero(mem_ctx, uint32_t); + if (r->out.next_reference == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_AccountSync(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_GETDCNAME: { + struct netr_GetDcName *r = _r; + ZERO_STRUCT(r->out); + r->out.dcname = talloc_zero(mem_ctx, const char *); + if (r->out.dcname == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_GetDcName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONCONTROL: { + struct netr_LogonControl *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonControl(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_GETANYDCNAME: { + struct netr_GetAnyDCName *r = _r; + ZERO_STRUCT(r->out); + r->out.dcname = talloc_zero(mem_ctx, const char *); + if (r->out.dcname == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_GetAnyDCName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONCONTROL2: { + struct netr_LogonControl2 *r = _r; + ZERO_STRUCT(r->out); + r->out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION); + if (r->out.query == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonControl2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERAUTHENTICATE2: { + struct netr_ServerAuthenticate2 *r = _r; + ZERO_STRUCT(r->out); + r->out.negotiate_flags = r->in.negotiate_flags; + r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential); + if (r->out.return_credentials == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerAuthenticate2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DATABASESYNC2: { + struct netr_DatabaseSync2 *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.sync_context = r->in.sync_context; + r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *); + if (r->out.delta_enum_array == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DatabaseSync2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DATABASEREDO: { + struct netr_DatabaseRedo *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY *); + if (r->out.delta_enum_array == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DatabaseRedo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONCONTROL2EX: { + struct netr_LogonControl2Ex *r = _r; + ZERO_STRUCT(r->out); + r->out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION); + if (r->out.query == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonControl2Ex(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRENUMERATETRUSTEDDOMAINS: { + struct netr_NetrEnumerateTrustedDomains *r = _r; + ZERO_STRUCT(r->out); + r->out.trusted_domains_blob = talloc_zero(mem_ctx, struct netr_Blob); + if (r->out.trusted_domains_blob == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_NetrEnumerateTrustedDomains(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRGETDCNAME: { + struct netr_DsRGetDCName *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRGetDCName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRLOGONDUMMYROUTINE1: { + struct netr_NETRLOGONDUMMYROUTINE1 *r = _r; + r->out.result = _netr_NETRLOGONDUMMYROUTINE1(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRLOGONSETSERVICEBITS: { + struct netr_NETRLOGONSETSERVICEBITS *r = _r; + r->out.result = _netr_NETRLOGONSETSERVICEBITS(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONGETTRUSTRID: { + struct netr_LogonGetTrustRid *r = _r; + ZERO_STRUCT(r->out); + r->out.rid = talloc_zero(mem_ctx, uint32_t); + if (r->out.rid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonGetTrustRid(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST: { + struct netr_NETRLOGONCOMPUTESERVERDIGEST *r = _r; + r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST: { + struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r = _r; + r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERAUTHENTICATE3: { + struct netr_ServerAuthenticate3 *r = _r; + ZERO_STRUCT(r->out); + r->out.negotiate_flags = r->in.negotiate_flags; + r->out.return_credentials = talloc_zero(mem_ctx, struct netr_Credential); + if (r->out.return_credentials == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.rid = talloc_zero(mem_ctx, uint32_t); + if (r->out.rid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerAuthenticate3(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRGETDCNAMEEX: { + struct netr_DsRGetDCNameEx *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRGetDCNameEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRGETSITENAME: { + struct netr_DsRGetSiteName *r = _r; + ZERO_STRUCT(r->out); + r->out.site = talloc_zero(mem_ctx, const char *); + if (r->out.site == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRGetSiteName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONGETDOMAININFO: { + struct netr_LogonGetDomainInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.info = talloc_zero(mem_ctx, union netr_DomainInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonGetDomainInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERPASSWORDSET2: { + struct netr_ServerPasswordSet2 *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerPasswordSet2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERPASSWORDGET: { + struct netr_ServerPasswordGet *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.password = talloc_zero(mem_ctx, struct samr_Password); + if (r->out.password == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerPasswordGet(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRLOGONSENDTOSAM: { + struct netr_NETRLOGONSENDTOSAM *r = _r; + r->out.result = _netr_NETRLOGONSENDTOSAM(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRADDRESSTOSITENAMESW: { + struct netr_DsRAddressToSitenamesW *r = _r; + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(mem_ctx, struct netr_DsRAddressToSitenamesWCtr *); + if (r->out.ctr == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRAddressToSitenamesW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRGETDCNAMEEX2: { + struct netr_DsRGetDCNameEx2 *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRGetDCNameEx2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN: { + struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r = _r; + r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX: { + struct netr_NetrEnumerateTrustedDomainsEx *r = _r; + ZERO_STRUCT(r->out); + r->out.dom_trust_list = talloc_zero(mem_ctx, struct netr_DomainTrustList); + if (r->out.dom_trust_list == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_NetrEnumerateTrustedDomainsEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRADDRESSTOSITENAMESEXW: { + struct netr_DsRAddressToSitenamesExW *r = _r; + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(mem_ctx, struct netr_DsRAddressToSitenamesExWCtr *); + if (r->out.ctr == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRAddressToSitenamesExW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRGETDCSITECOVERAGEW: { + struct netr_DsrGetDcSiteCoverageW *r = _r; + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(mem_ctx, struct DcSitesCtr *); + if (r->out.ctr == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsrGetDcSiteCoverageW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONSAMLOGONEX: { + struct netr_LogonSamLogonEx *r = _r; + ZERO_STRUCT(r->out); + r->out.flags = r->in.flags; + r->out.validation = talloc_zero(mem_ctx, union netr_Validation); + if (r->out.validation == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.authoritative = talloc_zero(mem_ctx, uint8_t); + if (r->out.authoritative == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonSamLogonEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRENUMERATEDOMAINTRUSTS: { + struct netr_DsrEnumerateDomainTrusts *r = _r; + ZERO_STRUCT(r->out); + r->out.trusts = talloc_zero(mem_ctx, struct netr_DomainTrustList); + if (r->out.trusts == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsrEnumerateDomainTrusts(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS: { + struct netr_DsrDeregisterDNSHostRecords *r = _r; + r->out.result = _netr_DsrDeregisterDNSHostRecords(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERTRUSTPASSWORDSGET: { + struct netr_ServerTrustPasswordsGet *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.password = talloc_zero(mem_ctx, struct samr_Password); + if (r->out.password == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.password2 = talloc_zero(mem_ctx, struct samr_Password); + if (r->out.password2 == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerTrustPasswordsGet(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_DSRGETFORESTTRUSTINFORMATION: { + struct netr_DsRGetForestTrustInformation *r = _r; + ZERO_STRUCT(r->out); + r->out.forest_trust_info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation *); + if (r->out.forest_trust_info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_DsRGetForestTrustInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_GETFORESTTRUSTINFORMATION: { + struct netr_GetForestTrustInformation *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.forest_trust_info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation *); + if (r->out.forest_trust_info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_GetForestTrustInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_LOGONSAMLOGONWITHFLAGS: { + struct netr_LogonSamLogonWithFlags *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.flags = r->in.flags; + r->out.validation = talloc_zero(mem_ctx, union netr_Validation); + if (r->out.validation == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.authoritative = talloc_zero(mem_ctx, uint8_t); + if (r->out.authoritative == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_LogonSamLogonWithFlags(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_NETR_SERVERGETTRUSTINFO: { + struct netr_ServerGetTrustInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.new_owf_password = talloc_zero(mem_ctx, struct samr_Password); + if (r->out.new_owf_password == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.old_owf_password = talloc_zero(mem_ctx, struct samr_Password); + if (r->out.old_owf_password == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.trust_info = talloc_zero(mem_ctx, struct netr_TrustInfo *); + if (r->out.trust_info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _netr_ServerGetTrustInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_netlogon_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "netlogon", "netlogon", &ndr_table_netlogon, api_netlogon_cmds, sizeof(api_netlogon_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_netlogon.h b/librpc/gen_ndr/srv_netlogon.h index d561706355..b9d9b7e28d 100644 --- a/librpc/gen_ndr/srv_netlogon.h +++ b/librpc/gen_ndr/srv_netlogon.h @@ -49,5 +49,53 @@ WERROR _netr_GetForestTrustInformation(pipes_struct *p, struct netr_GetForestTru NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, struct netr_LogonSamLogonWithFlags *r); NTSTATUS _netr_ServerGetTrustInfo(pipes_struct *p, struct netr_ServerGetTrustInfo *r); void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_netlogon_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _netr_LogonUasLogon(pipes_struct *p, struct netr_LogonUasLogon *r); +WERROR _netr_LogonUasLogoff(pipes_struct *p, struct netr_LogonUasLogoff *r); +NTSTATUS _netr_LogonSamLogon(pipes_struct *p, struct netr_LogonSamLogon *r); +NTSTATUS _netr_LogonSamLogoff(pipes_struct *p, struct netr_LogonSamLogoff *r); +NTSTATUS _netr_ServerReqChallenge(pipes_struct *p, struct netr_ServerReqChallenge *r); +NTSTATUS _netr_ServerAuthenticate(pipes_struct *p, struct netr_ServerAuthenticate *r); +NTSTATUS _netr_ServerPasswordSet(pipes_struct *p, struct netr_ServerPasswordSet *r); +NTSTATUS _netr_DatabaseDeltas(pipes_struct *p, struct netr_DatabaseDeltas *r); +NTSTATUS _netr_DatabaseSync(pipes_struct *p, struct netr_DatabaseSync *r); +NTSTATUS _netr_AccountDeltas(pipes_struct *p, struct netr_AccountDeltas *r); +NTSTATUS _netr_AccountSync(pipes_struct *p, struct netr_AccountSync *r); +WERROR _netr_GetDcName(pipes_struct *p, struct netr_GetDcName *r); +WERROR _netr_LogonControl(pipes_struct *p, struct netr_LogonControl *r); +WERROR _netr_GetAnyDCName(pipes_struct *p, struct netr_GetAnyDCName *r); +WERROR _netr_LogonControl2(pipes_struct *p, struct netr_LogonControl2 *r); +NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p, struct netr_ServerAuthenticate2 *r); +NTSTATUS _netr_DatabaseSync2(pipes_struct *p, struct netr_DatabaseSync2 *r); +NTSTATUS _netr_DatabaseRedo(pipes_struct *p, struct netr_DatabaseRedo *r); +WERROR _netr_LogonControl2Ex(pipes_struct *p, struct netr_LogonControl2Ex *r); +WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, struct netr_NetrEnumerateTrustedDomains *r); +WERROR _netr_DsRGetDCName(pipes_struct *p, struct netr_DsRGetDCName *r); +WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, struct netr_NETRLOGONDUMMYROUTINE1 *r); +WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, struct netr_NETRLOGONSETSERVICEBITS *r); +WERROR _netr_LogonGetTrustRid(pipes_struct *p, struct netr_LogonGetTrustRid *r); +WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); +WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); +NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, struct netr_ServerAuthenticate3 *r); +WERROR _netr_DsRGetDCNameEx(pipes_struct *p, struct netr_DsRGetDCNameEx *r); +WERROR _netr_DsRGetSiteName(pipes_struct *p, struct netr_DsRGetSiteName *r); +NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p, struct netr_LogonGetDomainInfo *r); +NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p, struct netr_ServerPasswordSet2 *r); +WERROR _netr_ServerPasswordGet(pipes_struct *p, struct netr_ServerPasswordGet *r); +WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p, struct netr_NETRLOGONSENDTOSAM *r); +WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p, struct netr_DsRAddressToSitenamesW *r); +WERROR _netr_DsRGetDCNameEx2(pipes_struct *p, struct netr_DsRGetDCNameEx2 *r); +WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p, struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r); +WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p, struct netr_NetrEnumerateTrustedDomainsEx *r); +WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, struct netr_DsRAddressToSitenamesExW *r); +WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, struct netr_DsrGetDcSiteCoverageW *r); +NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, struct netr_LogonSamLogonEx *r); +WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, struct netr_DsrEnumerateDomainTrusts *r); +WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p, struct netr_DsrDeregisterDNSHostRecords *r); +NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, struct netr_ServerTrustPasswordsGet *r); +WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, struct netr_DsRGetForestTrustInformation *r); +WERROR _netr_GetForestTrustInformation(pipes_struct *p, struct netr_GetForestTrustInformation *r); +NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, struct netr_LogonSamLogonWithFlags *r); +NTSTATUS _netr_ServerGetTrustInfo(pipes_struct *p, struct netr_ServerGetTrustInfo *r); NTSTATUS rpc_netlogon_init(void); #endif /* __SRV_NETLOGON__ */ diff --git a/librpc/gen_ndr/srv_ntsvcs.c b/librpc/gen_ndr/srv_ntsvcs.c index 0a93723d4f..50907acd31 100644 --- a/librpc/gen_ndr/srv_ntsvcs.c +++ b/librpc/gen_ndr/srv_ntsvcs.c @@ -4871,6 +4871,447 @@ void ntsvcs_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_ntsvcs_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_PNP_DISCONNECT: { + struct PNP_Disconnect *r = _r; + r->out.result = _PNP_Disconnect(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_CONNECT: { + struct PNP_Connect *r = _r; + r->out.result = _PNP_Connect(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETVERSION: { + struct PNP_GetVersion *r = _r; + ZERO_STRUCT(r->out); + r->out.version = talloc_zero(mem_ctx, uint16_t); + if (r->out.version == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _PNP_GetVersion(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETGLOBALSTATE: { + struct PNP_GetGlobalState *r = _r; + r->out.result = _PNP_GetGlobalState(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_INITDETECTION: { + struct PNP_InitDetection *r = _r; + r->out.result = _PNP_InitDetection(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_REPORTLOGON: { + struct PNP_ReportLogOn *r = _r; + r->out.result = _PNP_ReportLogOn(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_VALIDATEDEVICEINSTANCE: { + struct PNP_ValidateDeviceInstance *r = _r; + r->out.result = _PNP_ValidateDeviceInstance(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETROOTDEVICEINSTANCE: { + struct PNP_GetRootDeviceInstance *r = _r; + r->out.result = _PNP_GetRootDeviceInstance(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETRELATEDDEVICEINSTANCE: { + struct PNP_GetRelatedDeviceInstance *r = _r; + r->out.result = _PNP_GetRelatedDeviceInstance(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_ENUMERATESUBKEYS: { + struct PNP_EnumerateSubKeys *r = _r; + r->out.result = _PNP_EnumerateSubKeys(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETDEVICELIST: { + struct PNP_GetDeviceList *r = _r; + ZERO_STRUCT(r->out); + r->out.length = r->in.length; + r->out.buffer = talloc_zero_array(mem_ctx, uint16_t, *r->out.length); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _PNP_GetDeviceList(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETDEVICELISTSIZE: { + struct PNP_GetDeviceListSize *r = _r; + ZERO_STRUCT(r->out); + r->out.size = talloc_zero(mem_ctx, uint32_t); + if (r->out.size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _PNP_GetDeviceListSize(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETDEPTH: { + struct PNP_GetDepth *r = _r; + r->out.result = _PNP_GetDepth(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETDEVICEREGPROP: { + struct PNP_GetDeviceRegProp *r = _r; + ZERO_STRUCT(r->out); + r->out.reg_data_type = r->in.reg_data_type; + r->out.buffer_size = r->in.buffer_size; + r->out.needed = r->in.needed; + r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, *r->out.buffer_size); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _PNP_GetDeviceRegProp(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_SETDEVICEREGPROP: { + struct PNP_SetDeviceRegProp *r = _r; + r->out.result = _PNP_SetDeviceRegProp(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETCLASSINSTANCE: { + struct PNP_GetClassInstance *r = _r; + r->out.result = _PNP_GetClassInstance(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_CREATEKEY: { + struct PNP_CreateKey *r = _r; + r->out.result = _PNP_CreateKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_DELETEREGISTRYKEY: { + struct PNP_DeleteRegistryKey *r = _r; + r->out.result = _PNP_DeleteRegistryKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETCLASSCOUNT: { + struct PNP_GetClassCount *r = _r; + r->out.result = _PNP_GetClassCount(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETCLASSNAME: { + struct PNP_GetClassName *r = _r; + r->out.result = _PNP_GetClassName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_DELETECLASSKEY: { + struct PNP_DeleteClassKey *r = _r; + r->out.result = _PNP_DeleteClassKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETINTERFACEDEVICEALIAS: { + struct PNP_GetInterfaceDeviceAlias *r = _r; + r->out.result = _PNP_GetInterfaceDeviceAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETINTERFACEDEVICELIST: { + struct PNP_GetInterfaceDeviceList *r = _r; + r->out.result = _PNP_GetInterfaceDeviceList(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETINTERFACEDEVICELISTSIZE: { + struct PNP_GetInterfaceDeviceListSize *r = _r; + r->out.result = _PNP_GetInterfaceDeviceListSize(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_REGISTERDEVICECLASSASSOCIATION: { + struct PNP_RegisterDeviceClassAssociation *r = _r; + r->out.result = _PNP_RegisterDeviceClassAssociation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_UNREGISTERDEVICECLASSASSOCIATION: { + struct PNP_UnregisterDeviceClassAssociation *r = _r; + r->out.result = _PNP_UnregisterDeviceClassAssociation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETCLASSREGPROP: { + struct PNP_GetClassRegProp *r = _r; + r->out.result = _PNP_GetClassRegProp(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_SETCLASSREGPROP: { + struct PNP_SetClassRegProp *r = _r; + r->out.result = _PNP_SetClassRegProp(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_CREATEDEVINST: { + struct PNP_CreateDevInst *r = _r; + r->out.result = _PNP_CreateDevInst(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_DEVICEINSTANCEACTION: { + struct PNP_DeviceInstanceAction *r = _r; + r->out.result = _PNP_DeviceInstanceAction(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETDEVICESTATUS: { + struct PNP_GetDeviceStatus *r = _r; + r->out.result = _PNP_GetDeviceStatus(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_SETDEVICEPROBLEM: { + struct PNP_SetDeviceProblem *r = _r; + r->out.result = _PNP_SetDeviceProblem(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_DISABLEDEVINST: { + struct PNP_DisableDevInst *r = _r; + r->out.result = _PNP_DisableDevInst(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_UNINSTALLDEVINST: { + struct PNP_UninstallDevInst *r = _r; + r->out.result = _PNP_UninstallDevInst(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_ADDID: { + struct PNP_AddID *r = _r; + r->out.result = _PNP_AddID(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_REGISTERDRIVER: { + struct PNP_RegisterDriver *r = _r; + r->out.result = _PNP_RegisterDriver(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_QUERYREMOVE: { + struct PNP_QueryRemove *r = _r; + r->out.result = _PNP_QueryRemove(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_REQUESTDEVICEEJECT: { + struct PNP_RequestDeviceEject *r = _r; + r->out.result = _PNP_RequestDeviceEject(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_ISDOCKSTATIONPRESENT: { + struct PNP_IsDockStationPresent *r = _r; + r->out.result = _PNP_IsDockStationPresent(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_REQUESTEJECTPC: { + struct PNP_RequestEjectPC *r = _r; + r->out.result = _PNP_RequestEjectPC(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_HWPROFFLAGS: { + struct PNP_HwProfFlags *r = _r; + ZERO_STRUCT(r->out); + r->out.profile_flags = r->in.profile_flags; + r->out.veto_type = r->in.veto_type; + r->out.unknown5a = talloc_zero(mem_ctx, const char *); + if (r->out.unknown5a == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _PNP_HwProfFlags(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETHWPROFINFO: { + struct PNP_GetHwProfInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.result = _PNP_GetHwProfInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_ADDEMPTYLOGCONF: { + struct PNP_AddEmptyLogConf *r = _r; + r->out.result = _PNP_AddEmptyLogConf(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_FREELOGCONF: { + struct PNP_FreeLogConf *r = _r; + r->out.result = _PNP_FreeLogConf(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETFIRSTLOGCONF: { + struct PNP_GetFirstLogConf *r = _r; + r->out.result = _PNP_GetFirstLogConf(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETNEXTLOGCONF: { + struct PNP_GetNextLogConf *r = _r; + r->out.result = _PNP_GetNextLogConf(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETLOGCONFPRIORITY: { + struct PNP_GetLogConfPriority *r = _r; + r->out.result = _PNP_GetLogConfPriority(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_ADDRESDES: { + struct PNP_AddResDes *r = _r; + r->out.result = _PNP_AddResDes(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_FREERESDES: { + struct PNP_FreeResDes *r = _r; + r->out.result = _PNP_FreeResDes(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETNEXTRESDES: { + struct PNP_GetNextResDes *r = _r; + r->out.result = _PNP_GetNextResDes(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETRESDESDATA: { + struct PNP_GetResDesData *r = _r; + r->out.result = _PNP_GetResDesData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETRESDESDATASIZE: { + struct PNP_GetResDesDataSize *r = _r; + r->out.result = _PNP_GetResDesDataSize(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_MODIFYRESDES: { + struct PNP_ModifyResDes *r = _r; + r->out.result = _PNP_ModifyResDes(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_DETECTRESOURCELIMIT: { + struct PNP_DetectResourceLimit *r = _r; + r->out.result = _PNP_DetectResourceLimit(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_QUERYRESCONFLIST: { + struct PNP_QueryResConfList *r = _r; + r->out.result = _PNP_QueryResConfList(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_SETHWPROF: { + struct PNP_SetHwProf *r = _r; + r->out.result = _PNP_SetHwProf(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_QUERYARBITRATORFREEDATA: { + struct PNP_QueryArbitratorFreeData *r = _r; + r->out.result = _PNP_QueryArbitratorFreeData(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_QUERYARBITRATORFREESIZE: { + struct PNP_QueryArbitratorFreeSize *r = _r; + r->out.result = _PNP_QueryArbitratorFreeSize(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_RUNDETECTION: { + struct PNP_RunDetection *r = _r; + r->out.result = _PNP_RunDetection(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_REGISTERNOTIFICATION: { + struct PNP_RegisterNotification *r = _r; + r->out.result = _PNP_RegisterNotification(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_UNREGISTERNOTIFICATION: { + struct PNP_UnregisterNotification *r = _r; + r->out.result = _PNP_UnregisterNotification(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETCUSTOMDEVPROP: { + struct PNP_GetCustomDevProp *r = _r; + r->out.result = _PNP_GetCustomDevProp(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETVERSIONINTERNAL: { + struct PNP_GetVersionInternal *r = _r; + r->out.result = _PNP_GetVersionInternal(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETBLOCKEDDRIVERINFO: { + struct PNP_GetBlockedDriverInfo *r = _r; + r->out.result = _PNP_GetBlockedDriverInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_PNP_GETSERVERSIDEDEVICEINSTALLFLAGS: { + struct PNP_GetServerSideDeviceInstallFlags *r = _r; + r->out.result = _PNP_GetServerSideDeviceInstallFlags(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_ntsvcs_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "ntsvcs", "ntsvcs", &ndr_table_ntsvcs, api_ntsvcs_cmds, sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_ntsvcs.h b/librpc/gen_ndr/srv_ntsvcs.h index 16f91cde67..40d28a9e55 100644 --- a/librpc/gen_ndr/srv_ntsvcs.h +++ b/librpc/gen_ndr/srv_ntsvcs.h @@ -67,5 +67,71 @@ WERROR _PNP_GetVersionInternal(pipes_struct *p, struct PNP_GetVersionInternal *r WERROR _PNP_GetBlockedDriverInfo(pipes_struct *p, struct PNP_GetBlockedDriverInfo *r); WERROR _PNP_GetServerSideDeviceInstallFlags(pipes_struct *p, struct PNP_GetServerSideDeviceInstallFlags *r); void ntsvcs_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_ntsvcs_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _PNP_Disconnect(pipes_struct *p, struct PNP_Disconnect *r); +WERROR _PNP_Connect(pipes_struct *p, struct PNP_Connect *r); +WERROR _PNP_GetVersion(pipes_struct *p, struct PNP_GetVersion *r); +WERROR _PNP_GetGlobalState(pipes_struct *p, struct PNP_GetGlobalState *r); +WERROR _PNP_InitDetection(pipes_struct *p, struct PNP_InitDetection *r); +WERROR _PNP_ReportLogOn(pipes_struct *p, struct PNP_ReportLogOn *r); +WERROR _PNP_ValidateDeviceInstance(pipes_struct *p, struct PNP_ValidateDeviceInstance *r); +WERROR _PNP_GetRootDeviceInstance(pipes_struct *p, struct PNP_GetRootDeviceInstance *r); +WERROR _PNP_GetRelatedDeviceInstance(pipes_struct *p, struct PNP_GetRelatedDeviceInstance *r); +WERROR _PNP_EnumerateSubKeys(pipes_struct *p, struct PNP_EnumerateSubKeys *r); +WERROR _PNP_GetDeviceList(pipes_struct *p, struct PNP_GetDeviceList *r); +WERROR _PNP_GetDeviceListSize(pipes_struct *p, struct PNP_GetDeviceListSize *r); +WERROR _PNP_GetDepth(pipes_struct *p, struct PNP_GetDepth *r); +WERROR _PNP_GetDeviceRegProp(pipes_struct *p, struct PNP_GetDeviceRegProp *r); +WERROR _PNP_SetDeviceRegProp(pipes_struct *p, struct PNP_SetDeviceRegProp *r); +WERROR _PNP_GetClassInstance(pipes_struct *p, struct PNP_GetClassInstance *r); +WERROR _PNP_CreateKey(pipes_struct *p, struct PNP_CreateKey *r); +WERROR _PNP_DeleteRegistryKey(pipes_struct *p, struct PNP_DeleteRegistryKey *r); +WERROR _PNP_GetClassCount(pipes_struct *p, struct PNP_GetClassCount *r); +WERROR _PNP_GetClassName(pipes_struct *p, struct PNP_GetClassName *r); +WERROR _PNP_DeleteClassKey(pipes_struct *p, struct PNP_DeleteClassKey *r); +WERROR _PNP_GetInterfaceDeviceAlias(pipes_struct *p, struct PNP_GetInterfaceDeviceAlias *r); +WERROR _PNP_GetInterfaceDeviceList(pipes_struct *p, struct PNP_GetInterfaceDeviceList *r); +WERROR _PNP_GetInterfaceDeviceListSize(pipes_struct *p, struct PNP_GetInterfaceDeviceListSize *r); +WERROR _PNP_RegisterDeviceClassAssociation(pipes_struct *p, struct PNP_RegisterDeviceClassAssociation *r); +WERROR _PNP_UnregisterDeviceClassAssociation(pipes_struct *p, struct PNP_UnregisterDeviceClassAssociation *r); +WERROR _PNP_GetClassRegProp(pipes_struct *p, struct PNP_GetClassRegProp *r); +WERROR _PNP_SetClassRegProp(pipes_struct *p, struct PNP_SetClassRegProp *r); +WERROR _PNP_CreateDevInst(pipes_struct *p, struct PNP_CreateDevInst *r); +WERROR _PNP_DeviceInstanceAction(pipes_struct *p, struct PNP_DeviceInstanceAction *r); +WERROR _PNP_GetDeviceStatus(pipes_struct *p, struct PNP_GetDeviceStatus *r); +WERROR _PNP_SetDeviceProblem(pipes_struct *p, struct PNP_SetDeviceProblem *r); +WERROR _PNP_DisableDevInst(pipes_struct *p, struct PNP_DisableDevInst *r); +WERROR _PNP_UninstallDevInst(pipes_struct *p, struct PNP_UninstallDevInst *r); +WERROR _PNP_AddID(pipes_struct *p, struct PNP_AddID *r); +WERROR _PNP_RegisterDriver(pipes_struct *p, struct PNP_RegisterDriver *r); +WERROR _PNP_QueryRemove(pipes_struct *p, struct PNP_QueryRemove *r); +WERROR _PNP_RequestDeviceEject(pipes_struct *p, struct PNP_RequestDeviceEject *r); +WERROR _PNP_IsDockStationPresent(pipes_struct *p, struct PNP_IsDockStationPresent *r); +WERROR _PNP_RequestEjectPC(pipes_struct *p, struct PNP_RequestEjectPC *r); +WERROR _PNP_HwProfFlags(pipes_struct *p, struct PNP_HwProfFlags *r); +WERROR _PNP_GetHwProfInfo(pipes_struct *p, struct PNP_GetHwProfInfo *r); +WERROR _PNP_AddEmptyLogConf(pipes_struct *p, struct PNP_AddEmptyLogConf *r); +WERROR _PNP_FreeLogConf(pipes_struct *p, struct PNP_FreeLogConf *r); +WERROR _PNP_GetFirstLogConf(pipes_struct *p, struct PNP_GetFirstLogConf *r); +WERROR _PNP_GetNextLogConf(pipes_struct *p, struct PNP_GetNextLogConf *r); +WERROR _PNP_GetLogConfPriority(pipes_struct *p, struct PNP_GetLogConfPriority *r); +WERROR _PNP_AddResDes(pipes_struct *p, struct PNP_AddResDes *r); +WERROR _PNP_FreeResDes(pipes_struct *p, struct PNP_FreeResDes *r); +WERROR _PNP_GetNextResDes(pipes_struct *p, struct PNP_GetNextResDes *r); +WERROR _PNP_GetResDesData(pipes_struct *p, struct PNP_GetResDesData *r); +WERROR _PNP_GetResDesDataSize(pipes_struct *p, struct PNP_GetResDesDataSize *r); +WERROR _PNP_ModifyResDes(pipes_struct *p, struct PNP_ModifyResDes *r); +WERROR _PNP_DetectResourceLimit(pipes_struct *p, struct PNP_DetectResourceLimit *r); +WERROR _PNP_QueryResConfList(pipes_struct *p, struct PNP_QueryResConfList *r); +WERROR _PNP_SetHwProf(pipes_struct *p, struct PNP_SetHwProf *r); +WERROR _PNP_QueryArbitratorFreeData(pipes_struct *p, struct PNP_QueryArbitratorFreeData *r); +WERROR _PNP_QueryArbitratorFreeSize(pipes_struct *p, struct PNP_QueryArbitratorFreeSize *r); +WERROR _PNP_RunDetection(pipes_struct *p, struct PNP_RunDetection *r); +WERROR _PNP_RegisterNotification(pipes_struct *p, struct PNP_RegisterNotification *r); +WERROR _PNP_UnregisterNotification(pipes_struct *p, struct PNP_UnregisterNotification *r); +WERROR _PNP_GetCustomDevProp(pipes_struct *p, struct PNP_GetCustomDevProp *r); +WERROR _PNP_GetVersionInternal(pipes_struct *p, struct PNP_GetVersionInternal *r); +WERROR _PNP_GetBlockedDriverInfo(pipes_struct *p, struct PNP_GetBlockedDriverInfo *r); +WERROR _PNP_GetServerSideDeviceInstallFlags(pipes_struct *p, struct PNP_GetServerSideDeviceInstallFlags *r); NTSTATUS rpc_ntsvcs_init(void); #endif /* __SRV_NTSVCS__ */ diff --git a/librpc/gen_ndr/srv_samr.c b/librpc/gen_ndr/srv_samr.c index 9bda8785e1..7649a7d0cf 100644 --- a/librpc/gen_ndr/srv_samr.c +++ b/librpc/gen_ndr/srv_samr.c @@ -5476,6 +5476,791 @@ void samr_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_samr_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_SAMR_CONNECT: { + struct samr_Connect *r = _r; + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.connect_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_Connect(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CLOSE: { + struct samr_Close *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _samr_Close(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETSECURITY: { + struct samr_SetSecurity *r = _r; + r->out.result = _samr_SetSecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYSECURITY: { + struct samr_QuerySecurity *r = _r; + ZERO_STRUCT(r->out); + r->out.sdbuf = talloc_zero(mem_ctx, struct sec_desc_buf *); + if (r->out.sdbuf == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QuerySecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SHUTDOWN: { + struct samr_Shutdown *r = _r; + r->out.result = _samr_Shutdown(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_LOOKUPDOMAIN: { + struct samr_LookupDomain *r = _r; + ZERO_STRUCT(r->out); + r->out.sid = talloc_zero(mem_ctx, struct dom_sid2 *); + if (r->out.sid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_LookupDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ENUMDOMAINS: { + struct samr_EnumDomains *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(mem_ctx, struct samr_SamArray *); + if (r->out.sam == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.num_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_EnumDomains(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_OPENDOMAIN: { + struct samr_OpenDomain *r = _r; + ZERO_STRUCT(r->out); + r->out.domain_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.domain_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_OpenDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYDOMAININFO: { + struct samr_QueryDomainInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union samr_DomainInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryDomainInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETDOMAININFO: { + struct samr_SetDomainInfo *r = _r; + r->out.result = _samr_SetDomainInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CREATEDOMAINGROUP: { + struct samr_CreateDomainGroup *r = _r; + ZERO_STRUCT(r->out); + r->out.group_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.group_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.rid = talloc_zero(mem_ctx, uint32_t); + if (r->out.rid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_CreateDomainGroup(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ENUMDOMAINGROUPS: { + struct samr_EnumDomainGroups *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(mem_ctx, struct samr_SamArray *); + if (r->out.sam == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.num_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_EnumDomainGroups(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CREATEUSER: { + struct samr_CreateUser *r = _r; + ZERO_STRUCT(r->out); + r->out.user_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.user_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.rid = talloc_zero(mem_ctx, uint32_t); + if (r->out.rid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_CreateUser(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ENUMDOMAINUSERS: { + struct samr_EnumDomainUsers *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(mem_ctx, struct samr_SamArray *); + if (r->out.sam == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.num_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_EnumDomainUsers(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CREATEDOMALIAS: { + struct samr_CreateDomAlias *r = _r; + ZERO_STRUCT(r->out); + r->out.alias_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.alias_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.rid = talloc_zero(mem_ctx, uint32_t); + if (r->out.rid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_CreateDomAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ENUMDOMAINALIASES: { + struct samr_EnumDomainAliases *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(mem_ctx, struct samr_SamArray *); + if (r->out.sam == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.num_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_EnumDomainAliases(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETALIASMEMBERSHIP: { + struct samr_GetAliasMembership *r = _r; + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(mem_ctx, struct samr_Ids); + if (r->out.rids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetAliasMembership(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_LOOKUPNAMES: { + struct samr_LookupNames *r = _r; + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(mem_ctx, struct samr_Ids); + if (r->out.rids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.types = talloc_zero(mem_ctx, struct samr_Ids); + if (r->out.types == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_LookupNames(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_LOOKUPRIDS: { + struct samr_LookupRids *r = _r; + ZERO_STRUCT(r->out); + r->out.names = talloc_zero(mem_ctx, struct lsa_Strings); + if (r->out.names == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.types = talloc_zero(mem_ctx, struct samr_Ids); + if (r->out.types == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_LookupRids(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_OPENGROUP: { + struct samr_OpenGroup *r = _r; + ZERO_STRUCT(r->out); + r->out.group_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.group_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_OpenGroup(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYGROUPINFO: { + struct samr_QueryGroupInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union samr_GroupInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryGroupInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETGROUPINFO: { + struct samr_SetGroupInfo *r = _r; + r->out.result = _samr_SetGroupInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ADDGROUPMEMBER: { + struct samr_AddGroupMember *r = _r; + r->out.result = _samr_AddGroupMember(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_DELETEDOMAINGROUP: { + struct samr_DeleteDomainGroup *r = _r; + ZERO_STRUCT(r->out); + r->out.group_handle = r->in.group_handle; + r->out.result = _samr_DeleteDomainGroup(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_DELETEGROUPMEMBER: { + struct samr_DeleteGroupMember *r = _r; + r->out.result = _samr_DeleteGroupMember(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYGROUPMEMBER: { + struct samr_QueryGroupMember *r = _r; + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(mem_ctx, struct samr_RidTypeArray *); + if (r->out.rids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryGroupMember(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP: { + struct samr_SetMemberAttributesOfGroup *r = _r; + r->out.result = _samr_SetMemberAttributesOfGroup(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_OPENALIAS: { + struct samr_OpenAlias *r = _r; + ZERO_STRUCT(r->out); + r->out.alias_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.alias_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_OpenAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYALIASINFO: { + struct samr_QueryAliasInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union samr_AliasInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryAliasInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETALIASINFO: { + struct samr_SetAliasInfo *r = _r; + r->out.result = _samr_SetAliasInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_DELETEDOMALIAS: { + struct samr_DeleteDomAlias *r = _r; + ZERO_STRUCT(r->out); + r->out.alias_handle = r->in.alias_handle; + r->out.result = _samr_DeleteDomAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ADDALIASMEMBER: { + struct samr_AddAliasMember *r = _r; + r->out.result = _samr_AddAliasMember(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_DELETEALIASMEMBER: { + struct samr_DeleteAliasMember *r = _r; + r->out.result = _samr_DeleteAliasMember(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETMEMBERSINALIAS: { + struct samr_GetMembersInAlias *r = _r; + ZERO_STRUCT(r->out); + r->out.sids = talloc_zero(mem_ctx, struct lsa_SidArray); + if (r->out.sids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetMembersInAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_OPENUSER: { + struct samr_OpenUser *r = _r; + ZERO_STRUCT(r->out); + r->out.user_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.user_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_OpenUser(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_DELETEUSER: { + struct samr_DeleteUser *r = _r; + ZERO_STRUCT(r->out); + r->out.user_handle = r->in.user_handle; + r->out.result = _samr_DeleteUser(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYUSERINFO: { + struct samr_QueryUserInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union samr_UserInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryUserInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETUSERINFO: { + struct samr_SetUserInfo *r = _r; + r->out.result = _samr_SetUserInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CHANGEPASSWORDUSER: { + struct samr_ChangePasswordUser *r = _r; + r->out.result = _samr_ChangePasswordUser(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETGROUPSFORUSER: { + struct samr_GetGroupsForUser *r = _r; + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(mem_ctx, struct samr_RidWithAttributeArray *); + if (r->out.rids == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetGroupsForUser(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYDISPLAYINFO: { + struct samr_QueryDisplayInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.total_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.total_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.returned_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.returned_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.info = talloc_zero(mem_ctx, union samr_DispInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryDisplayInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETDISPLAYENUMERATIONINDEX: { + struct samr_GetDisplayEnumerationIndex *r = _r; + ZERO_STRUCT(r->out); + r->out.idx = talloc_zero(mem_ctx, uint32_t); + if (r->out.idx == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetDisplayEnumerationIndex(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN: { + struct samr_TestPrivateFunctionsDomain *r = _r; + r->out.result = _samr_TestPrivateFunctionsDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_TESTPRIVATEFUNCTIONSUSER: { + struct samr_TestPrivateFunctionsUser *r = _r; + r->out.result = _samr_TestPrivateFunctionsUser(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETUSERPWINFO: { + struct samr_GetUserPwInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct samr_PwInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetUserPwInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN: { + struct samr_RemoveMemberFromForeignDomain *r = _r; + r->out.result = _samr_RemoveMemberFromForeignDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYDOMAININFO2: { + struct samr_QueryDomainInfo2 *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union samr_DomainInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryDomainInfo2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYUSERINFO2: { + struct samr_QueryUserInfo2 *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union samr_UserInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryUserInfo2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYDISPLAYINFO2: { + struct samr_QueryDisplayInfo2 *r = _r; + ZERO_STRUCT(r->out); + r->out.total_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.total_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.returned_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.returned_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.info = talloc_zero(mem_ctx, union samr_DispInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryDisplayInfo2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETDISPLAYENUMERATIONINDEX2: { + struct samr_GetDisplayEnumerationIndex2 *r = _r; + ZERO_STRUCT(r->out); + r->out.idx = talloc_zero(mem_ctx, uint32_t); + if (r->out.idx == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetDisplayEnumerationIndex2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CREATEUSER2: { + struct samr_CreateUser2 *r = _r; + ZERO_STRUCT(r->out); + r->out.user_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.user_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.access_granted = talloc_zero(mem_ctx, uint32_t); + if (r->out.access_granted == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.rid = talloc_zero(mem_ctx, uint32_t); + if (r->out.rid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_CreateUser2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_QUERYDISPLAYINFO3: { + struct samr_QueryDisplayInfo3 *r = _r; + ZERO_STRUCT(r->out); + r->out.total_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.total_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.returned_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.returned_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.info = talloc_zero(mem_ctx, union samr_DispInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_QueryDisplayInfo3(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS: { + struct samr_AddMultipleMembersToAlias *r = _r; + r->out.result = _samr_AddMultipleMembersToAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS: { + struct samr_RemoveMultipleMembersFromAlias *r = _r; + r->out.result = _samr_RemoveMultipleMembersFromAlias(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_OEMCHANGEPASSWORDUSER2: { + struct samr_OemChangePasswordUser2 *r = _r; + r->out.result = _samr_OemChangePasswordUser2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CHANGEPASSWORDUSER2: { + struct samr_ChangePasswordUser2 *r = _r; + r->out.result = _samr_ChangePasswordUser2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETDOMPWINFO: { + struct samr_GetDomPwInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct samr_PwInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetDomPwInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CONNECT2: { + struct samr_Connect2 *r = _r; + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.connect_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_Connect2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETUSERINFO2: { + struct samr_SetUserInfo2 *r = _r; + r->out.result = _samr_SetUserInfo2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETBOOTKEYINFORMATION: { + struct samr_SetBootKeyInformation *r = _r; + r->out.result = _samr_SetBootKeyInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_GETBOOTKEYINFORMATION: { + struct samr_GetBootKeyInformation *r = _r; + ZERO_STRUCT(r->out); + r->out.unknown = talloc_zero(mem_ctx, uint32_t); + if (r->out.unknown == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_GetBootKeyInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CONNECT3: { + struct samr_Connect3 *r = _r; + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.connect_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_Connect3(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CONNECT4: { + struct samr_Connect4 *r = _r; + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.connect_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_Connect4(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CHANGEPASSWORDUSER3: { + struct samr_ChangePasswordUser3 *r = _r; + ZERO_STRUCT(r->out); + r->out.dominfo = talloc_zero(mem_ctx, struct samr_DomInfo1 *); + if (r->out.dominfo == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.reject = talloc_zero(mem_ctx, struct samr_ChangeReject *); + if (r->out.reject == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_ChangePasswordUser3(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_CONNECT5: { + struct samr_Connect5 *r = _r; + ZERO_STRUCT(r->out); + r->out.level_out = talloc_zero(mem_ctx, uint32_t); + if (r->out.level_out == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.info_out = talloc_zero(mem_ctx, union samr_ConnectInfo); + if (r->out.info_out == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.connect_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.connect_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_Connect5(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_RIDTOSID: { + struct samr_RidToSid *r = _r; + ZERO_STRUCT(r->out); + r->out.sid = talloc_zero(mem_ctx, struct dom_sid2 *); + if (r->out.sid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_RidToSid(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_SETDSRMPASSWORD: { + struct samr_SetDsrmPassword *r = _r; + r->out.result = _samr_SetDsrmPassword(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SAMR_VALIDATEPASSWORD: { + struct samr_ValidatePassword *r = _r; + ZERO_STRUCT(r->out); + r->out.rep = talloc_zero(mem_ctx, union samr_ValidatePasswordRep *); + if (r->out.rep == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _samr_ValidatePassword(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_samr_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "samr", "samr", &ndr_table_samr, api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_samr.h b/librpc/gen_ndr/srv_samr.h index 1a697f6b3b..4b308ebf29 100644 --- a/librpc/gen_ndr/srv_samr.h +++ b/librpc/gen_ndr/srv_samr.h @@ -70,5 +70,74 @@ NTSTATUS _samr_RidToSid(pipes_struct *p, struct samr_RidToSid *r); NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, struct samr_SetDsrmPassword *r); NTSTATUS _samr_ValidatePassword(pipes_struct *p, struct samr_ValidatePassword *r); void samr_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_samr_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +NTSTATUS _samr_Connect(pipes_struct *p, struct samr_Connect *r); +NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r); +NTSTATUS _samr_SetSecurity(pipes_struct *p, struct samr_SetSecurity *r); +NTSTATUS _samr_QuerySecurity(pipes_struct *p, struct samr_QuerySecurity *r); +NTSTATUS _samr_Shutdown(pipes_struct *p, struct samr_Shutdown *r); +NTSTATUS _samr_LookupDomain(pipes_struct *p, struct samr_LookupDomain *r); +NTSTATUS _samr_EnumDomains(pipes_struct *p, struct samr_EnumDomains *r); +NTSTATUS _samr_OpenDomain(pipes_struct *p, struct samr_OpenDomain *r); +NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, struct samr_QueryDomainInfo *r); +NTSTATUS _samr_SetDomainInfo(pipes_struct *p, struct samr_SetDomainInfo *r); +NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, struct samr_CreateDomainGroup *r); +NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, struct samr_EnumDomainGroups *r); +NTSTATUS _samr_CreateUser(pipes_struct *p, struct samr_CreateUser *r); +NTSTATUS _samr_EnumDomainUsers(pipes_struct *p, struct samr_EnumDomainUsers *r); +NTSTATUS _samr_CreateDomAlias(pipes_struct *p, struct samr_CreateDomAlias *r); +NTSTATUS _samr_EnumDomainAliases(pipes_struct *p, struct samr_EnumDomainAliases *r); +NTSTATUS _samr_GetAliasMembership(pipes_struct *p, struct samr_GetAliasMembership *r); +NTSTATUS _samr_LookupNames(pipes_struct *p, struct samr_LookupNames *r); +NTSTATUS _samr_LookupRids(pipes_struct *p, struct samr_LookupRids *r); +NTSTATUS _samr_OpenGroup(pipes_struct *p, struct samr_OpenGroup *r); +NTSTATUS _samr_QueryGroupInfo(pipes_struct *p, struct samr_QueryGroupInfo *r); +NTSTATUS _samr_SetGroupInfo(pipes_struct *p, struct samr_SetGroupInfo *r); +NTSTATUS _samr_AddGroupMember(pipes_struct *p, struct samr_AddGroupMember *r); +NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, struct samr_DeleteDomainGroup *r); +NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, struct samr_DeleteGroupMember *r); +NTSTATUS _samr_QueryGroupMember(pipes_struct *p, struct samr_QueryGroupMember *r); +NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, struct samr_SetMemberAttributesOfGroup *r); +NTSTATUS _samr_OpenAlias(pipes_struct *p, struct samr_OpenAlias *r); +NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, struct samr_QueryAliasInfo *r); +NTSTATUS _samr_SetAliasInfo(pipes_struct *p, struct samr_SetAliasInfo *r); +NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, struct samr_DeleteDomAlias *r); +NTSTATUS _samr_AddAliasMember(pipes_struct *p, struct samr_AddAliasMember *r); +NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, struct samr_DeleteAliasMember *r); +NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, struct samr_GetMembersInAlias *r); +NTSTATUS _samr_OpenUser(pipes_struct *p, struct samr_OpenUser *r); +NTSTATUS _samr_DeleteUser(pipes_struct *p, struct samr_DeleteUser *r); +NTSTATUS _samr_QueryUserInfo(pipes_struct *p, struct samr_QueryUserInfo *r); +NTSTATUS _samr_SetUserInfo(pipes_struct *p, struct samr_SetUserInfo *r); +NTSTATUS _samr_ChangePasswordUser(pipes_struct *p, struct samr_ChangePasswordUser *r); +NTSTATUS _samr_GetGroupsForUser(pipes_struct *p, struct samr_GetGroupsForUser *r); +NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p, struct samr_QueryDisplayInfo *r); +NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p, struct samr_GetDisplayEnumerationIndex *r); +NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p, struct samr_TestPrivateFunctionsDomain *r); +NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p, struct samr_TestPrivateFunctionsUser *r); +NTSTATUS _samr_GetUserPwInfo(pipes_struct *p, struct samr_GetUserPwInfo *r); +NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, struct samr_RemoveMemberFromForeignDomain *r); +NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p, struct samr_QueryDomainInfo2 *r); +NTSTATUS _samr_QueryUserInfo2(pipes_struct *p, struct samr_QueryUserInfo2 *r); +NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p, struct samr_QueryDisplayInfo2 *r); +NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p, struct samr_GetDisplayEnumerationIndex2 *r); +NTSTATUS _samr_CreateUser2(pipes_struct *p, struct samr_CreateUser2 *r); +NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p, struct samr_QueryDisplayInfo3 *r); +NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p, struct samr_AddMultipleMembersToAlias *r); +NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p, struct samr_RemoveMultipleMembersFromAlias *r); +NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p, struct samr_OemChangePasswordUser2 *r); +NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, struct samr_ChangePasswordUser2 *r); +NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, struct samr_GetDomPwInfo *r); +NTSTATUS _samr_Connect2(pipes_struct *p, struct samr_Connect2 *r); +NTSTATUS _samr_SetUserInfo2(pipes_struct *p, struct samr_SetUserInfo2 *r); +NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p, struct samr_SetBootKeyInformation *r); +NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p, struct samr_GetBootKeyInformation *r); +NTSTATUS _samr_Connect3(pipes_struct *p, struct samr_Connect3 *r); +NTSTATUS _samr_Connect4(pipes_struct *p, struct samr_Connect4 *r); +NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p, struct samr_ChangePasswordUser3 *r); +NTSTATUS _samr_Connect5(pipes_struct *p, struct samr_Connect5 *r); +NTSTATUS _samr_RidToSid(pipes_struct *p, struct samr_RidToSid *r); +NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, struct samr_SetDsrmPassword *r); +NTSTATUS _samr_ValidatePassword(pipes_struct *p, struct samr_ValidatePassword *r); NTSTATUS rpc_samr_init(void); #endif /* __SRV_SAMR__ */ diff --git a/librpc/gen_ndr/srv_srvsvc.c b/librpc/gen_ndr/srv_srvsvc.c index 501754d1d6..1286aad739 100644 --- a/librpc/gen_ndr/srv_srvsvc.c +++ b/librpc/gen_ndr/srv_srvsvc.c @@ -4190,6 +4190,498 @@ void srvsvc_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_srvsvc_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_srvsvc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_SRVSVC_NETCHARDEVENUM: { + struct srvsvc_NetCharDevEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetCharDevEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVGETINFO: { + struct srvsvc_NetCharDevGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union srvsvc_NetCharDevInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetCharDevGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVCONTROL: { + struct srvsvc_NetCharDevControl *r = _r; + r->out.result = _srvsvc_NetCharDevControl(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVQENUM: { + struct srvsvc_NetCharDevQEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetCharDevQEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVQGETINFO: { + struct srvsvc_NetCharDevQGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union srvsvc_NetCharDevQInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetCharDevQGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVQSETINFO: { + struct srvsvc_NetCharDevQSetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetCharDevQSetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVQPURGE: { + struct srvsvc_NetCharDevQPurge *r = _r; + r->out.result = _srvsvc_NetCharDevQPurge(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCHARDEVQPURGESELF: { + struct srvsvc_NetCharDevQPurgeSelf *r = _r; + r->out.result = _srvsvc_NetCharDevQPurgeSelf(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETCONNENUM: { + struct srvsvc_NetConnEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetConnEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETFILEENUM: { + struct srvsvc_NetFileEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetFileEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETFILEGETINFO: { + struct srvsvc_NetFileGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union srvsvc_NetFileInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetFileGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETFILECLOSE: { + struct srvsvc_NetFileClose *r = _r; + r->out.result = _srvsvc_NetFileClose(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSESSENUM: { + struct srvsvc_NetSessEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetSessEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSESSDEL: { + struct srvsvc_NetSessDel *r = _r; + r->out.result = _srvsvc_NetSessDel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREADD: { + struct srvsvc_NetShareAdd *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetShareAdd(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREENUMALL: { + struct srvsvc_NetShareEnumAll *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetShareEnumAll(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREGETINFO: { + struct srvsvc_NetShareGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union srvsvc_NetShareInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetShareGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHARESETINFO: { + struct srvsvc_NetShareSetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetShareSetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREDEL: { + struct srvsvc_NetShareDel *r = _r; + r->out.result = _srvsvc_NetShareDel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREDELSTICKY: { + struct srvsvc_NetShareDelSticky *r = _r; + r->out.result = _srvsvc_NetShareDelSticky(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHARECHECK: { + struct srvsvc_NetShareCheck *r = _r; + ZERO_STRUCT(r->out); + r->out.type = talloc_zero(mem_ctx, enum srvsvc_ShareType); + if (r->out.type == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetShareCheck(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSRVGETINFO: { + struct srvsvc_NetSrvGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union srvsvc_NetSrvInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetSrvGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSRVSETINFO: { + struct srvsvc_NetSrvSetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetSrvSetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETDISKENUM: { + struct srvsvc_NetDiskEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetDiskEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSERVERSTATISTICSGET: { + struct srvsvc_NetServerStatisticsGet *r = _r; + ZERO_STRUCT(r->out); + r->out.stats = talloc_zero(mem_ctx, struct srvsvc_Statistics *); + if (r->out.stats == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetServerStatisticsGet(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETTRANSPORTADD: { + struct srvsvc_NetTransportAdd *r = _r; + r->out.result = _srvsvc_NetTransportAdd(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETTRANSPORTENUM: { + struct srvsvc_NetTransportEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.transports = r->in.transports; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetTransportEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETTRANSPORTDEL: { + struct srvsvc_NetTransportDel *r = _r; + r->out.result = _srvsvc_NetTransportDel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETREMOTETOD: { + struct srvsvc_NetRemoteTOD *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct srvsvc_NetRemoteTODInfo *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetRemoteTOD(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSETSERVICEBITS: { + struct srvsvc_NetSetServiceBits *r = _r; + r->out.result = _srvsvc_NetSetServiceBits(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETPATHTYPE: { + struct srvsvc_NetPathType *r = _r; + ZERO_STRUCT(r->out); + r->out.pathtype = talloc_zero(mem_ctx, uint32_t); + if (r->out.pathtype == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetPathType(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETPATHCANONICALIZE: { + struct srvsvc_NetPathCanonicalize *r = _r; + ZERO_STRUCT(r->out); + r->out.pathtype = r->in.pathtype; + r->out.can_path = talloc_zero_array(mem_ctx, uint8_t, r->in.maxbuf); + if (r->out.can_path == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetPathCanonicalize(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETPATHCOMPARE: { + struct srvsvc_NetPathCompare *r = _r; + r->out.result = _srvsvc_NetPathCompare(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETNAMEVALIDATE: { + struct srvsvc_NetNameValidate *r = _r; + r->out.result = _srvsvc_NetNameValidate(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRPRNAMECANONICALIZE: { + struct srvsvc_NETRPRNAMECANONICALIZE *r = _r; + r->out.result = _srvsvc_NETRPRNAMECANONICALIZE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETPRNAMECOMPARE: { + struct srvsvc_NetPRNameCompare *r = _r; + r->out.result = _srvsvc_NetPRNameCompare(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREENUM: { + struct srvsvc_NetShareEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; + r->out.totalentries = talloc_zero(mem_ctx, uint32_t); + if (r->out.totalentries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetShareEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREDELSTART: { + struct srvsvc_NetShareDelStart *r = _r; + ZERO_STRUCT(r->out); + r->out.hnd = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.hnd == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetShareDelStart(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSHAREDELCOMMIT: { + struct srvsvc_NetShareDelCommit *r = _r; + ZERO_STRUCT(r->out); + r->out.hnd = r->in.hnd; + r->out.result = _srvsvc_NetShareDelCommit(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETGETFILESECURITY: { + struct srvsvc_NetGetFileSecurity *r = _r; + ZERO_STRUCT(r->out); + r->out.sd_buf = talloc_zero(mem_ctx, struct sec_desc_buf *); + if (r->out.sd_buf == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _srvsvc_NetGetFileSecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSETFILESECURITY: { + struct srvsvc_NetSetFileSecurity *r = _r; + r->out.result = _srvsvc_NetSetFileSecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSERVERTRANSPORTADDEX: { + struct srvsvc_NetServerTransportAddEx *r = _r; + r->out.result = _srvsvc_NetServerTransportAddEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETSERVERSETSERVICEBITSEX: { + struct srvsvc_NetServerSetServiceBitsEx *r = _r; + r->out.result = _srvsvc_NetServerSetServiceBitsEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSGETVERSION: { + struct srvsvc_NETRDFSGETVERSION *r = _r; + r->out.result = _srvsvc_NETRDFSGETVERSION(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSCREATELOCALPARTITION: { + struct srvsvc_NETRDFSCREATELOCALPARTITION *r = _r; + r->out.result = _srvsvc_NETRDFSCREATELOCALPARTITION(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSDELETELOCALPARTITION: { + struct srvsvc_NETRDFSDELETELOCALPARTITION *r = _r; + r->out.result = _srvsvc_NETRDFSDELETELOCALPARTITION(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE: { + struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r = _r; + r->out.result = _srvsvc_NETRDFSSETLOCALVOLUMESTATE(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSSETSERVERINFO: { + struct srvsvc_NETRDFSSETSERVERINFO *r = _r; + r->out.result = _srvsvc_NETRDFSSETSERVERINFO(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSCREATEEXITPOINT: { + struct srvsvc_NETRDFSCREATEEXITPOINT *r = _r; + r->out.result = _srvsvc_NETRDFSCREATEEXITPOINT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSDELETEEXITPOINT: { + struct srvsvc_NETRDFSDELETEEXITPOINT *r = _r; + r->out.result = _srvsvc_NETRDFSDELETEEXITPOINT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSMODIFYPREFIX: { + struct srvsvc_NETRDFSMODIFYPREFIX *r = _r; + r->out.result = _srvsvc_NETRDFSMODIFYPREFIX(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSFIXLOCALVOLUME: { + struct srvsvc_NETRDFSFIXLOCALVOLUME *r = _r; + r->out.result = _srvsvc_NETRDFSFIXLOCALVOLUME(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO: { + struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r = _r; + r->out.result = _srvsvc_NETRDFSMANAGERREPORTSITEINFO(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SRVSVC_NETRSERVERTRANSPORTDELEX: { + struct srvsvc_NETRSERVERTRANSPORTDELEX *r = _r; + r->out.result = _srvsvc_NETRSERVERTRANSPORTDELEX(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_srvsvc_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "srvsvc", "srvsvc", &ndr_table_srvsvc, api_srvsvc_cmds, sizeof(api_srvsvc_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_srvsvc.h b/librpc/gen_ndr/srv_srvsvc.h index c71e715a22..b96466c700 100644 --- a/librpc/gen_ndr/srv_srvsvc.h +++ b/librpc/gen_ndr/srv_srvsvc.h @@ -56,5 +56,60 @@ WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p, struct srvsvc_NETRDFSFIXLO WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r); WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p, struct srvsvc_NETRSERVERTRANSPORTDELEX *r); void srvsvc_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_srvsvc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _srvsvc_NetCharDevEnum(pipes_struct *p, struct srvsvc_NetCharDevEnum *r); +WERROR _srvsvc_NetCharDevGetInfo(pipes_struct *p, struct srvsvc_NetCharDevGetInfo *r); +WERROR _srvsvc_NetCharDevControl(pipes_struct *p, struct srvsvc_NetCharDevControl *r); +WERROR _srvsvc_NetCharDevQEnum(pipes_struct *p, struct srvsvc_NetCharDevQEnum *r); +WERROR _srvsvc_NetCharDevQGetInfo(pipes_struct *p, struct srvsvc_NetCharDevQGetInfo *r); +WERROR _srvsvc_NetCharDevQSetInfo(pipes_struct *p, struct srvsvc_NetCharDevQSetInfo *r); +WERROR _srvsvc_NetCharDevQPurge(pipes_struct *p, struct srvsvc_NetCharDevQPurge *r); +WERROR _srvsvc_NetCharDevQPurgeSelf(pipes_struct *p, struct srvsvc_NetCharDevQPurgeSelf *r); +WERROR _srvsvc_NetConnEnum(pipes_struct *p, struct srvsvc_NetConnEnum *r); +WERROR _srvsvc_NetFileEnum(pipes_struct *p, struct srvsvc_NetFileEnum *r); +WERROR _srvsvc_NetFileGetInfo(pipes_struct *p, struct srvsvc_NetFileGetInfo *r); +WERROR _srvsvc_NetFileClose(pipes_struct *p, struct srvsvc_NetFileClose *r); +WERROR _srvsvc_NetSessEnum(pipes_struct *p, struct srvsvc_NetSessEnum *r); +WERROR _srvsvc_NetSessDel(pipes_struct *p, struct srvsvc_NetSessDel *r); +WERROR _srvsvc_NetShareAdd(pipes_struct *p, struct srvsvc_NetShareAdd *r); +WERROR _srvsvc_NetShareEnumAll(pipes_struct *p, struct srvsvc_NetShareEnumAll *r); +WERROR _srvsvc_NetShareGetInfo(pipes_struct *p, struct srvsvc_NetShareGetInfo *r); +WERROR _srvsvc_NetShareSetInfo(pipes_struct *p, struct srvsvc_NetShareSetInfo *r); +WERROR _srvsvc_NetShareDel(pipes_struct *p, struct srvsvc_NetShareDel *r); +WERROR _srvsvc_NetShareDelSticky(pipes_struct *p, struct srvsvc_NetShareDelSticky *r); +WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r); +WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, struct srvsvc_NetSrvGetInfo *r); +WERROR _srvsvc_NetSrvSetInfo(pipes_struct *p, struct srvsvc_NetSrvSetInfo *r); +WERROR _srvsvc_NetDiskEnum(pipes_struct *p, struct srvsvc_NetDiskEnum *r); +WERROR _srvsvc_NetServerStatisticsGet(pipes_struct *p, struct srvsvc_NetServerStatisticsGet *r); +WERROR _srvsvc_NetTransportAdd(pipes_struct *p, struct srvsvc_NetTransportAdd *r); +WERROR _srvsvc_NetTransportEnum(pipes_struct *p, struct srvsvc_NetTransportEnum *r); +WERROR _srvsvc_NetTransportDel(pipes_struct *p, struct srvsvc_NetTransportDel *r); +WERROR _srvsvc_NetRemoteTOD(pipes_struct *p, struct srvsvc_NetRemoteTOD *r); +WERROR _srvsvc_NetSetServiceBits(pipes_struct *p, struct srvsvc_NetSetServiceBits *r); +WERROR _srvsvc_NetPathType(pipes_struct *p, struct srvsvc_NetPathType *r); +WERROR _srvsvc_NetPathCanonicalize(pipes_struct *p, struct srvsvc_NetPathCanonicalize *r); +WERROR _srvsvc_NetPathCompare(pipes_struct *p, struct srvsvc_NetPathCompare *r); +WERROR _srvsvc_NetNameValidate(pipes_struct *p, struct srvsvc_NetNameValidate *r); +WERROR _srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p, struct srvsvc_NETRPRNAMECANONICALIZE *r); +WERROR _srvsvc_NetPRNameCompare(pipes_struct *p, struct srvsvc_NetPRNameCompare *r); +WERROR _srvsvc_NetShareEnum(pipes_struct *p, struct srvsvc_NetShareEnum *r); +WERROR _srvsvc_NetShareDelStart(pipes_struct *p, struct srvsvc_NetShareDelStart *r); +WERROR _srvsvc_NetShareDelCommit(pipes_struct *p, struct srvsvc_NetShareDelCommit *r); +WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecurity *r); +WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecurity *r); +WERROR _srvsvc_NetServerTransportAddEx(pipes_struct *p, struct srvsvc_NetServerTransportAddEx *r); +WERROR _srvsvc_NetServerSetServiceBitsEx(pipes_struct *p, struct srvsvc_NetServerSetServiceBitsEx *r); +WERROR _srvsvc_NETRDFSGETVERSION(pipes_struct *p, struct srvsvc_NETRDFSGETVERSION *r); +WERROR _srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSCREATELOCALPARTITION *r); +WERROR _srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSDELETELOCALPARTITION *r); +WERROR _srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r); +WERROR _srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p, struct srvsvc_NETRDFSSETSERVERINFO *r); +WERROR _srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSCREATEEXITPOINT *r); +WERROR _srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSDELETEEXITPOINT *r); +WERROR _srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p, struct srvsvc_NETRDFSMODIFYPREFIX *r); +WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p, struct srvsvc_NETRDFSFIXLOCALVOLUME *r); +WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r); +WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p, struct srvsvc_NETRSERVERTRANSPORTDELEX *r); NTSTATUS rpc_srvsvc_init(void); #endif /* __SRV_SRVSVC__ */ diff --git a/librpc/gen_ndr/srv_svcctl.c b/librpc/gen_ndr/srv_svcctl.c index 645864bfed..ab5ad973ad 100644 --- a/librpc/gen_ndr/srv_svcctl.c +++ b/librpc/gen_ndr/srv_svcctl.c @@ -3609,6 +3609,569 @@ void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_svcctl_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_svcctl_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_SVCCTL_CLOSESERVICEHANDLE: { + struct svcctl_CloseServiceHandle *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _svcctl_CloseServiceHandle(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CONTROLSERVICE: { + struct svcctl_ControlService *r = _r; + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS); + if (r->out.service_status == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_ControlService(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_DELETESERVICE: { + struct svcctl_DeleteService *r = _r; + r->out.result = _svcctl_DeleteService(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_LOCKSERVICEDATABASE: { + struct svcctl_LockServiceDatabase *r = _r; + ZERO_STRUCT(r->out); + r->out.lock = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.lock == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_LockServiceDatabase(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY: { + struct svcctl_QueryServiceObjectSecurity *r = _r; + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.buffer_size); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceObjectSecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_SETSERVICEOBJECTSECURITY: { + struct svcctl_SetServiceObjectSecurity *r = _r; + r->out.result = _svcctl_SetServiceObjectSecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICESTATUS: { + struct svcctl_QueryServiceStatus *r = _r; + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS); + if (r->out.service_status == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceStatus(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_SETSERVICESTATUS: { + struct svcctl_SetServiceStatus *r = _r; + r->out.result = _svcctl_SetServiceStatus(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_UNLOCKSERVICEDATABASE: { + struct svcctl_UnlockServiceDatabase *r = _r; + ZERO_STRUCT(r->out); + r->out.lock = r->in.lock; + r->out.result = _svcctl_UnlockServiceDatabase(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS: { + struct svcctl_NotifyBootConfigStatus *r = _r; + r->out.result = _svcctl_NotifyBootConfigStatus(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_SCSETSERVICEBITSW: { + struct svcctl_SCSetServiceBitsW *r = _r; + r->out.result = _svcctl_SCSetServiceBitsW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CHANGESERVICECONFIGW: { + struct svcctl_ChangeServiceConfigW *r = _r; + ZERO_STRUCT(r->out); + r->out.tag_id = talloc_zero(mem_ctx, uint32_t); + if (r->out.tag_id == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_ChangeServiceConfigW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CREATESERVICEW: { + struct svcctl_CreateServiceW *r = _r; + ZERO_STRUCT(r->out); + r->out.TagId = r->in.TagId; + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_CreateServiceW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_ENUMDEPENDENTSERVICESW: { + struct svcctl_EnumDependentServicesW *r = _r; + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.service_status == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.services_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.services_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_EnumDependentServicesW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_ENUMSERVICESSTATUSW: { + struct svcctl_EnumServicesStatusW *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.service = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.service == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.services_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.services_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_EnumServicesStatusW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_OPENSCMANAGERW: { + struct svcctl_OpenSCManagerW *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_OpenSCManagerW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_OPENSERVICEW: { + struct svcctl_OpenServiceW *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_OpenServiceW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICECONFIGW: { + struct svcctl_QueryServiceConfigW *r = _r; + ZERO_STRUCT(r->out); + r->out.query = talloc_zero(mem_ctx, struct QUERY_SERVICE_CONFIG); + if (r->out.query == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceConfigW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICELOCKSTATUSW: { + struct svcctl_QueryServiceLockStatusW *r = _r; + ZERO_STRUCT(r->out); + r->out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS); + if (r->out.lock_status == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.required_buf_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.required_buf_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceLockStatusW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_STARTSERVICEW: { + struct svcctl_StartServiceW *r = _r; + r->out.result = _svcctl_StartServiceW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_GETSERVICEDISPLAYNAMEW: { + struct svcctl_GetServiceDisplayNameW *r = _r; + ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; + r->out.display_name = talloc_zero(mem_ctx, const char *); + if (r->out.display_name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_GetServiceDisplayNameW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_GETSERVICEKEYNAMEW: { + struct svcctl_GetServiceKeyNameW *r = _r; + ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; + r->out.key_name = talloc_zero(mem_ctx, const char *); + if (r->out.key_name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_GetServiceKeyNameW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_SCSETSERVICEBITSA: { + struct svcctl_SCSetServiceBitsA *r = _r; + r->out.result = _svcctl_SCSetServiceBitsA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CHANGESERVICECONFIGA: { + struct svcctl_ChangeServiceConfigA *r = _r; + ZERO_STRUCT(r->out); + r->out.tag_id = talloc_zero(mem_ctx, uint32_t); + if (r->out.tag_id == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_ChangeServiceConfigA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CREATESERVICEA: { + struct svcctl_CreateServiceA *r = _r; + ZERO_STRUCT(r->out); + r->out.TagId = talloc_zero(mem_ctx, uint32_t); + if (r->out.TagId == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_CreateServiceA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_ENUMDEPENDENTSERVICESA: { + struct svcctl_EnumDependentServicesA *r = _r; + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(mem_ctx, struct ENUM_SERVICE_STATUSA); + if (r->out.service_status == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.services_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.services_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_EnumDependentServicesA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_ENUMSERVICESSTATUSA: { + struct svcctl_EnumServicesStatusA *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.service = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.service == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.services_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.services_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_EnumServicesStatusA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_OPENSCMANAGERA: { + struct svcctl_OpenSCManagerA *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_OpenSCManagerA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_OPENSERVICEA: { + struct svcctl_OpenServiceA *r = _r; + r->out.result = _svcctl_OpenServiceA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICECONFIGA: { + struct svcctl_QueryServiceConfigA *r = _r; + ZERO_STRUCT(r->out); + r->out.query = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.query == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceConfigA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICELOCKSTATUSA: { + struct svcctl_QueryServiceLockStatusA *r = _r; + ZERO_STRUCT(r->out); + r->out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS); + if (r->out.lock_status == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.required_buf_size = talloc_zero(mem_ctx, uint32_t); + if (r->out.required_buf_size == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceLockStatusA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_STARTSERVICEA: { + struct svcctl_StartServiceA *r = _r; + r->out.result = _svcctl_StartServiceA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_GETSERVICEDISPLAYNAMEA: { + struct svcctl_GetServiceDisplayNameA *r = _r; + ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; + r->out.display_name = talloc_zero(mem_ctx, const char *); + if (r->out.display_name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_GetServiceDisplayNameA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_GETSERVICEKEYNAMEA: { + struct svcctl_GetServiceKeyNameA *r = _r; + ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; + r->out.key_name = talloc_zero(mem_ctx, const char *); + if (r->out.key_name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_GetServiceKeyNameA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_GETCURRENTGROUPESTATEW: { + struct svcctl_GetCurrentGroupeStateW *r = _r; + r->out.result = _svcctl_GetCurrentGroupeStateW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_ENUMSERVICEGROUPW: { + struct svcctl_EnumServiceGroupW *r = _r; + r->out.result = _svcctl_EnumServiceGroupW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CHANGESERVICECONFIG2A: { + struct svcctl_ChangeServiceConfig2A *r = _r; + r->out.result = _svcctl_ChangeServiceConfig2A(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_CHANGESERVICECONFIG2W: { + struct svcctl_ChangeServiceConfig2W *r = _r; + r->out.result = _svcctl_ChangeServiceConfig2W(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICECONFIG2A: { + struct svcctl_QueryServiceConfig2A *r = _r; + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceConfig2A(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICECONFIG2W: { + struct svcctl_QueryServiceConfig2W *r = _r; + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceConfig2W(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_QUERYSERVICESTATUSEX: { + struct svcctl_QueryServiceStatusEx *r = _r; + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.buffer == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _svcctl_QueryServiceStatusEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ENUMSERVICESSTATUSEXA: { + struct EnumServicesStatusExA *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.services = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.services == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.service_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.service_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.group_name = talloc_zero(mem_ctx, const char *); + if (r->out.group_name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _EnumServicesStatusExA(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_ENUMSERVICESSTATUSEXW: { + struct EnumServicesStatusExW *r = _r; + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.services = talloc_zero_array(mem_ctx, uint8_t, r->in.buf_size); + if (r->out.services == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.bytes_needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.bytes_needed == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.service_returned = talloc_zero(mem_ctx, uint32_t); + if (r->out.service_returned == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _EnumServicesStatusExW(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_SVCCTL_SCSENDTSMESSAGE: { + struct svcctl_SCSendTSMessage *r = _r; + r->out.result = _svcctl_SCSendTSMessage(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_svcctl_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "svcctl", "svcctl", &ndr_table_svcctl, api_svcctl_cmds, sizeof(api_svcctl_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_svcctl.h b/librpc/gen_ndr/srv_svcctl.h index 80a9ccb01f..d7bd2fb6cf 100644 --- a/librpc/gen_ndr/srv_svcctl.h +++ b/librpc/gen_ndr/srv_svcctl.h @@ -46,5 +46,50 @@ WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r); WERROR _EnumServicesStatusExW(pipes_struct *p, struct EnumServicesStatusExW *r); WERROR _svcctl_SCSendTSMessage(pipes_struct *p, struct svcctl_SCSendTSMessage *r); void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_svcctl_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _svcctl_CloseServiceHandle(pipes_struct *p, struct svcctl_CloseServiceHandle *r); +WERROR _svcctl_ControlService(pipes_struct *p, struct svcctl_ControlService *r); +WERROR _svcctl_DeleteService(pipes_struct *p, struct svcctl_DeleteService *r); +WERROR _svcctl_LockServiceDatabase(pipes_struct *p, struct svcctl_LockServiceDatabase *r); +WERROR _svcctl_QueryServiceObjectSecurity(pipes_struct *p, struct svcctl_QueryServiceObjectSecurity *r); +WERROR _svcctl_SetServiceObjectSecurity(pipes_struct *p, struct svcctl_SetServiceObjectSecurity *r); +WERROR _svcctl_QueryServiceStatus(pipes_struct *p, struct svcctl_QueryServiceStatus *r); +WERROR _svcctl_SetServiceStatus(pipes_struct *p, struct svcctl_SetServiceStatus *r); +WERROR _svcctl_UnlockServiceDatabase(pipes_struct *p, struct svcctl_UnlockServiceDatabase *r); +WERROR _svcctl_NotifyBootConfigStatus(pipes_struct *p, struct svcctl_NotifyBootConfigStatus *r); +WERROR _svcctl_SCSetServiceBitsW(pipes_struct *p, struct svcctl_SCSetServiceBitsW *r); +WERROR _svcctl_ChangeServiceConfigW(pipes_struct *p, struct svcctl_ChangeServiceConfigW *r); +WERROR _svcctl_CreateServiceW(pipes_struct *p, struct svcctl_CreateServiceW *r); +WERROR _svcctl_EnumDependentServicesW(pipes_struct *p, struct svcctl_EnumDependentServicesW *r); +WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, struct svcctl_EnumServicesStatusW *r); +WERROR _svcctl_OpenSCManagerW(pipes_struct *p, struct svcctl_OpenSCManagerW *r); +WERROR _svcctl_OpenServiceW(pipes_struct *p, struct svcctl_OpenServiceW *r); +WERROR _svcctl_QueryServiceConfigW(pipes_struct *p, struct svcctl_QueryServiceConfigW *r); +WERROR _svcctl_QueryServiceLockStatusW(pipes_struct *p, struct svcctl_QueryServiceLockStatusW *r); +WERROR _svcctl_StartServiceW(pipes_struct *p, struct svcctl_StartServiceW *r); +WERROR _svcctl_GetServiceDisplayNameW(pipes_struct *p, struct svcctl_GetServiceDisplayNameW *r); +WERROR _svcctl_GetServiceKeyNameW(pipes_struct *p, struct svcctl_GetServiceKeyNameW *r); +WERROR _svcctl_SCSetServiceBitsA(pipes_struct *p, struct svcctl_SCSetServiceBitsA *r); +WERROR _svcctl_ChangeServiceConfigA(pipes_struct *p, struct svcctl_ChangeServiceConfigA *r); +WERROR _svcctl_CreateServiceA(pipes_struct *p, struct svcctl_CreateServiceA *r); +WERROR _svcctl_EnumDependentServicesA(pipes_struct *p, struct svcctl_EnumDependentServicesA *r); +WERROR _svcctl_EnumServicesStatusA(pipes_struct *p, struct svcctl_EnumServicesStatusA *r); +WERROR _svcctl_OpenSCManagerA(pipes_struct *p, struct svcctl_OpenSCManagerA *r); +WERROR _svcctl_OpenServiceA(pipes_struct *p, struct svcctl_OpenServiceA *r); +WERROR _svcctl_QueryServiceConfigA(pipes_struct *p, struct svcctl_QueryServiceConfigA *r); +WERROR _svcctl_QueryServiceLockStatusA(pipes_struct *p, struct svcctl_QueryServiceLockStatusA *r); +WERROR _svcctl_StartServiceA(pipes_struct *p, struct svcctl_StartServiceA *r); +WERROR _svcctl_GetServiceDisplayNameA(pipes_struct *p, struct svcctl_GetServiceDisplayNameA *r); +WERROR _svcctl_GetServiceKeyNameA(pipes_struct *p, struct svcctl_GetServiceKeyNameA *r); +WERROR _svcctl_GetCurrentGroupeStateW(pipes_struct *p, struct svcctl_GetCurrentGroupeStateW *r); +WERROR _svcctl_EnumServiceGroupW(pipes_struct *p, struct svcctl_EnumServiceGroupW *r); +WERROR _svcctl_ChangeServiceConfig2A(pipes_struct *p, struct svcctl_ChangeServiceConfig2A *r); +WERROR _svcctl_ChangeServiceConfig2W(pipes_struct *p, struct svcctl_ChangeServiceConfig2W *r); +WERROR _svcctl_QueryServiceConfig2A(pipes_struct *p, struct svcctl_QueryServiceConfig2A *r); +WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, struct svcctl_QueryServiceConfig2W *r); +WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p, struct svcctl_QueryServiceStatusEx *r); +WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r); +WERROR _EnumServicesStatusExW(pipes_struct *p, struct EnumServicesStatusExW *r); +WERROR _svcctl_SCSendTSMessage(pipes_struct *p, struct svcctl_SCSendTSMessage *r); NTSTATUS rpc_svcctl_init(void); #endif /* __SRV_SVCCTL__ */ diff --git a/librpc/gen_ndr/srv_winreg.c b/librpc/gen_ndr/srv_winreg.c index ebceee3945..d18614f90b 100644 --- a/librpc/gen_ndr/srv_winreg.c +++ b/librpc/gen_ndr/srv_winreg.c @@ -2766,6 +2766,367 @@ void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_winreg_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_winreg_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_WINREG_OPENHKCR: { + struct winreg_OpenHKCR *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKCR(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKCU: { + struct winreg_OpenHKCU *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKCU(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKLM: { + struct winreg_OpenHKLM *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKLM(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKPD: { + struct winreg_OpenHKPD *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKPD(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKU: { + struct winreg_OpenHKU *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKU(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_CLOSEKEY: { + struct winreg_CloseKey *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _winreg_CloseKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_CREATEKEY: { + struct winreg_CreateKey *r = _r; + ZERO_STRUCT(r->out); + r->out.action_taken = r->in.action_taken; + r->out.new_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.new_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_CreateKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_DELETEKEY: { + struct winreg_DeleteKey *r = _r; + r->out.result = _winreg_DeleteKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_DELETEVALUE: { + struct winreg_DeleteValue *r = _r; + r->out.result = _winreg_DeleteValue(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_ENUMKEY: { + struct winreg_EnumKey *r = _r; + ZERO_STRUCT(r->out); + r->out.name = r->in.name; + r->out.keyclass = r->in.keyclass; + r->out.last_changed_time = r->in.last_changed_time; + r->out.result = _winreg_EnumKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_ENUMVALUE: { + struct winreg_EnumValue *r = _r; + ZERO_STRUCT(r->out); + r->out.name = r->in.name; + r->out.type = r->in.type; + r->out.value = r->in.value; + r->out.size = r->in.size; + r->out.length = r->in.length; + r->out.result = _winreg_EnumValue(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_FLUSHKEY: { + struct winreg_FlushKey *r = _r; + r->out.result = _winreg_FlushKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_GETKEYSECURITY: { + struct winreg_GetKeySecurity *r = _r; + ZERO_STRUCT(r->out); + r->out.sd = r->in.sd; + r->out.result = _winreg_GetKeySecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_LOADKEY: { + struct winreg_LoadKey *r = _r; + r->out.result = _winreg_LoadKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_NOTIFYCHANGEKEYVALUE: { + struct winreg_NotifyChangeKeyValue *r = _r; + r->out.result = _winreg_NotifyChangeKeyValue(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENKEY: { + struct winreg_OpenKey *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_QUERYINFOKEY: { + struct winreg_QueryInfoKey *r = _r; + ZERO_STRUCT(r->out); + r->out.classname = r->in.classname; + r->out.num_subkeys = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_subkeys == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.max_subkeylen = talloc_zero(mem_ctx, uint32_t); + if (r->out.max_subkeylen == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.max_classlen = talloc_zero(mem_ctx, uint32_t); + if (r->out.max_classlen == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.num_values = talloc_zero(mem_ctx, uint32_t); + if (r->out.num_values == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.max_valnamelen = talloc_zero(mem_ctx, uint32_t); + if (r->out.max_valnamelen == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.max_valbufsize = talloc_zero(mem_ctx, uint32_t); + if (r->out.max_valbufsize == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.secdescsize = talloc_zero(mem_ctx, uint32_t); + if (r->out.secdescsize == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.last_changed_time = talloc_zero(mem_ctx, NTTIME); + if (r->out.last_changed_time == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_QueryInfoKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_QUERYVALUE: { + struct winreg_QueryValue *r = _r; + ZERO_STRUCT(r->out); + r->out.type = r->in.type; + r->out.data = r->in.data; + r->out.data_size = r->in.data_size; + r->out.data_length = r->in.data_length; + r->out.result = _winreg_QueryValue(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_REPLACEKEY: { + struct winreg_ReplaceKey *r = _r; + r->out.result = _winreg_ReplaceKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_RESTOREKEY: { + struct winreg_RestoreKey *r = _r; + r->out.result = _winreg_RestoreKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_SAVEKEY: { + struct winreg_SaveKey *r = _r; + r->out.result = _winreg_SaveKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_SETKEYSECURITY: { + struct winreg_SetKeySecurity *r = _r; + r->out.result = _winreg_SetKeySecurity(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_SETVALUE: { + struct winreg_SetValue *r = _r; + r->out.result = _winreg_SetValue(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_UNLOADKEY: { + struct winreg_UnLoadKey *r = _r; + r->out.result = _winreg_UnLoadKey(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_INITIATESYSTEMSHUTDOWN: { + struct winreg_InitiateSystemShutdown *r = _r; + r->out.result = _winreg_InitiateSystemShutdown(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_ABORTSYSTEMSHUTDOWN: { + struct winreg_AbortSystemShutdown *r = _r; + r->out.result = _winreg_AbortSystemShutdown(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_GETVERSION: { + struct winreg_GetVersion *r = _r; + ZERO_STRUCT(r->out); + r->out.version = talloc_zero(mem_ctx, uint32_t); + if (r->out.version == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_GetVersion(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKCC: { + struct winreg_OpenHKCC *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKCC(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKDD: { + struct winreg_OpenHKDD *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKDD(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_QUERYMULTIPLEVALUES: { + struct winreg_QueryMultipleValues *r = _r; + ZERO_STRUCT(r->out); + r->out.values = r->in.values; + r->out.buffer = r->in.buffer; + r->out.buffer_size = r->in.buffer_size; + r->out.result = _winreg_QueryMultipleValues(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_INITIATESYSTEMSHUTDOWNEX: { + struct winreg_InitiateSystemShutdownEx *r = _r; + r->out.result = _winreg_InitiateSystemShutdownEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_SAVEKEYEX: { + struct winreg_SaveKeyEx *r = _r; + r->out.result = _winreg_SaveKeyEx(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKPT: { + struct winreg_OpenHKPT *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKPT(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_OPENHKPN: { + struct winreg_OpenHKPN *r = _r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _winreg_OpenHKPN(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WINREG_QUERYMULTIPLEVALUES2: { + struct winreg_QueryMultipleValues2 *r = _r; + r->out.result = _winreg_QueryMultipleValues2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_winreg_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", &ndr_table_winreg, api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_winreg.h b/librpc/gen_ndr/srv_winreg.h index cedbef3e88..f259150e5b 100644 --- a/librpc/gen_ndr/srv_winreg.h +++ b/librpc/gen_ndr/srv_winreg.h @@ -37,5 +37,41 @@ WERROR _winreg_OpenHKPT(pipes_struct *p, struct winreg_OpenHKPT *r); WERROR _winreg_OpenHKPN(pipes_struct *p, struct winreg_OpenHKPN *r); WERROR _winreg_QueryMultipleValues2(pipes_struct *p, struct winreg_QueryMultipleValues2 *r); void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_winreg_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _winreg_OpenHKCR(pipes_struct *p, struct winreg_OpenHKCR *r); +WERROR _winreg_OpenHKCU(pipes_struct *p, struct winreg_OpenHKCU *r); +WERROR _winreg_OpenHKLM(pipes_struct *p, struct winreg_OpenHKLM *r); +WERROR _winreg_OpenHKPD(pipes_struct *p, struct winreg_OpenHKPD *r); +WERROR _winreg_OpenHKU(pipes_struct *p, struct winreg_OpenHKU *r); +WERROR _winreg_CloseKey(pipes_struct *p, struct winreg_CloseKey *r); +WERROR _winreg_CreateKey(pipes_struct *p, struct winreg_CreateKey *r); +WERROR _winreg_DeleteKey(pipes_struct *p, struct winreg_DeleteKey *r); +WERROR _winreg_DeleteValue(pipes_struct *p, struct winreg_DeleteValue *r); +WERROR _winreg_EnumKey(pipes_struct *p, struct winreg_EnumKey *r); +WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r); +WERROR _winreg_FlushKey(pipes_struct *p, struct winreg_FlushKey *r); +WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r); +WERROR _winreg_LoadKey(pipes_struct *p, struct winreg_LoadKey *r); +WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct winreg_NotifyChangeKeyValue *r); +WERROR _winreg_OpenKey(pipes_struct *p, struct winreg_OpenKey *r); +WERROR _winreg_QueryInfoKey(pipes_struct *p, struct winreg_QueryInfoKey *r); +WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r); +WERROR _winreg_ReplaceKey(pipes_struct *p, struct winreg_ReplaceKey *r); +WERROR _winreg_RestoreKey(pipes_struct *p, struct winreg_RestoreKey *r); +WERROR _winreg_SaveKey(pipes_struct *p, struct winreg_SaveKey *r); +WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r); +WERROR _winreg_SetValue(pipes_struct *p, struct winreg_SetValue *r); +WERROR _winreg_UnLoadKey(pipes_struct *p, struct winreg_UnLoadKey *r); +WERROR _winreg_InitiateSystemShutdown(pipes_struct *p, struct winreg_InitiateSystemShutdown *r); +WERROR _winreg_AbortSystemShutdown(pipes_struct *p, struct winreg_AbortSystemShutdown *r); +WERROR _winreg_GetVersion(pipes_struct *p, struct winreg_GetVersion *r); +WERROR _winreg_OpenHKCC(pipes_struct *p, struct winreg_OpenHKCC *r); +WERROR _winreg_OpenHKDD(pipes_struct *p, struct winreg_OpenHKDD *r); +WERROR _winreg_QueryMultipleValues(pipes_struct *p, struct winreg_QueryMultipleValues *r); +WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, struct winreg_InitiateSystemShutdownEx *r); +WERROR _winreg_SaveKeyEx(pipes_struct *p, struct winreg_SaveKeyEx *r); +WERROR _winreg_OpenHKPT(pipes_struct *p, struct winreg_OpenHKPT *r); +WERROR _winreg_OpenHKPN(pipes_struct *p, struct winreg_OpenHKPN *r); +WERROR _winreg_QueryMultipleValues2(pipes_struct *p, struct winreg_QueryMultipleValues2 *r); NTSTATUS rpc_winreg_init(void); #endif /* __SRV_WINREG__ */ diff --git a/librpc/gen_ndr/srv_wkssvc.c b/librpc/gen_ndr/srv_wkssvc.c index 015451bdee..1838af1214 100644 --- a/librpc/gen_ndr/srv_wkssvc.c +++ b/librpc/gen_ndr/srv_wkssvc.c @@ -2406,6 +2406,288 @@ void wkssvc_get_pipe_fns(struct api_struct **fns, int *n_fns) *n_fns = sizeof(api_wkssvc_cmds) / sizeof(struct api_struct); } +NTSTATUS rpc_wkssvc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r) +{ + if (cli->pipes_struct == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + switch (opnum) + { + case NDR_WKSSVC_NETWKSTAGETINFO: { + struct wkssvc_NetWkstaGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union wkssvc_NetWkstaInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetWkstaGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETWKSTASETINFO: { + struct wkssvc_NetWkstaSetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _wkssvc_NetWkstaSetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETWKSTAENUMUSERS: { + struct wkssvc_NetWkstaEnumUsers *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; + r->out.entries_read = talloc_zero(mem_ctx, uint32_t); + if (r->out.entries_read == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetWkstaEnumUsers(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRWKSTAUSERGETINFO: { + struct wkssvc_NetrWkstaUserGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, union wkssvc_NetrWkstaUserInfo); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrWkstaUserGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRWKSTAUSERSETINFO: { + struct wkssvc_NetrWkstaUserSetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_err = r->in.parm_err; + r->out.result = _wkssvc_NetrWkstaUserSetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETWKSTATRANSPORTENUM: { + struct wkssvc_NetWkstaTransportEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; + r->out.total_entries = talloc_zero(mem_ctx, uint32_t); + if (r->out.total_entries == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetWkstaTransportEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRWKSTATRANSPORTADD: { + struct wkssvc_NetrWkstaTransportAdd *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_err = r->in.parm_err; + r->out.result = _wkssvc_NetrWkstaTransportAdd(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRWKSTATRANSPORTDEL: { + struct wkssvc_NetrWkstaTransportDel *r = _r; + r->out.result = _wkssvc_NetrWkstaTransportDel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRUSEADD: { + struct wkssvc_NetrUseAdd *r = _r; + ZERO_STRUCT(r->out); + r->out.parm_err = r->in.parm_err; + r->out.result = _wkssvc_NetrUseAdd(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRUSEGETINFO: { + struct wkssvc_NetrUseGetInfo *r = _r; + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(mem_ctx, union wkssvc_NetrUseGetInfoCtr); + if (r->out.ctr == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrUseGetInfo(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRUSEDEL: { + struct wkssvc_NetrUseDel *r = _r; + r->out.result = _wkssvc_NetrUseDel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRUSEENUM: { + struct wkssvc_NetrUseEnum *r = _r; + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; + r->out.entries_read = talloc_zero(mem_ctx, uint32_t); + if (r->out.entries_read == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrUseEnum(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRMESSAGEBUFFERSEND: { + struct wkssvc_NetrMessageBufferSend *r = _r; + r->out.result = _wkssvc_NetrMessageBufferSend(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET: { + struct wkssvc_NetrWorkstationStatisticsGet *r = _r; + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(mem_ctx, struct wkssvc_NetrWorkstationStatistics *); + if (r->out.info == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrWorkstationStatisticsGet(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRLOGONDOMAINNAMEADD: { + struct wkssvc_NetrLogonDomainNameAdd *r = _r; + r->out.result = _wkssvc_NetrLogonDomainNameAdd(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL: { + struct wkssvc_NetrLogonDomainNameDel *r = _r; + r->out.result = _wkssvc_NetrLogonDomainNameDel(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRJOINDOMAIN: { + struct wkssvc_NetrJoinDomain *r = _r; + r->out.result = _wkssvc_NetrJoinDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRUNJOINDOMAIN: { + struct wkssvc_NetrUnjoinDomain *r = _r; + r->out.result = _wkssvc_NetrUnjoinDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN: { + struct wkssvc_NetrRenameMachineInDomain *r = _r; + r->out.result = _wkssvc_NetrRenameMachineInDomain(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRVALIDATENAME: { + struct wkssvc_NetrValidateName *r = _r; + r->out.result = _wkssvc_NetrValidateName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRGETJOININFORMATION: { + struct wkssvc_NetrGetJoinInformation *r = _r; + ZERO_STRUCT(r->out); + r->out.name_buffer = r->in.name_buffer; + r->out.name_type = talloc_zero(mem_ctx, enum wkssvc_NetJoinStatus); + if (r->out.name_type == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrGetJoinInformation(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRGETJOINABLEOUS: { + struct wkssvc_NetrGetJoinableOus *r = _r; + ZERO_STRUCT(r->out); + r->out.num_ous = r->in.num_ous; + r->out.ous = talloc_zero(mem_ctx, const char **); + if (r->out.ous == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrGetJoinableOus(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRJOINDOMAIN2: { + struct wkssvc_NetrJoinDomain2 *r = _r; + r->out.result = _wkssvc_NetrJoinDomain2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRUNJOINDOMAIN2: { + struct wkssvc_NetrUnjoinDomain2 *r = _r; + r->out.result = _wkssvc_NetrUnjoinDomain2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2: { + struct wkssvc_NetrRenameMachineInDomain2 *r = _r; + r->out.result = _wkssvc_NetrRenameMachineInDomain2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRVALIDATENAME2: { + struct wkssvc_NetrValidateName2 *r = _r; + r->out.result = _wkssvc_NetrValidateName2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRGETJOINABLEOUS2: { + struct wkssvc_NetrGetJoinableOus2 *r = _r; + ZERO_STRUCT(r->out); + r->out.num_ous = r->in.num_ous; + r->out.ous = talloc_zero(mem_ctx, const char **); + if (r->out.ous == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrGetJoinableOus2(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME: { + struct wkssvc_NetrAddAlternateComputerName *r = _r; + r->out.result = _wkssvc_NetrAddAlternateComputerName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME: { + struct wkssvc_NetrRemoveAlternateComputerName *r = _r; + r->out.result = _wkssvc_NetrRemoveAlternateComputerName(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME: { + struct wkssvc_NetrSetPrimaryComputername *r = _r; + r->out.result = _wkssvc_NetrSetPrimaryComputername(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + case NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES: { + struct wkssvc_NetrEnumerateComputerNames *r = _r; + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(mem_ctx, struct wkssvc_ComputerNamesCtr *); + if (r->out.ctr == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wkssvc_NetrEnumerateComputerNames(cli->pipes_struct, r); + return NT_STATUS_OK; + } + + default: + return NT_STATUS_NOT_IMPLEMENTED; + } +} + NTSTATUS rpc_wkssvc_init(void) { return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wkssvc", "wkssvc", &ndr_table_wkssvc, api_wkssvc_cmds, sizeof(api_wkssvc_cmds) / sizeof(struct api_struct)); diff --git a/librpc/gen_ndr/srv_wkssvc.h b/librpc/gen_ndr/srv_wkssvc.h index b1bda66134..dd8eb7752a 100644 --- a/librpc/gen_ndr/srv_wkssvc.h +++ b/librpc/gen_ndr/srv_wkssvc.h @@ -33,5 +33,37 @@ WERROR _wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p, struct wkssvc_Ne WERROR _wkssvc_NetrSetPrimaryComputername(pipes_struct *p, struct wkssvc_NetrSetPrimaryComputername *r); WERROR _wkssvc_NetrEnumerateComputerNames(pipes_struct *p, struct wkssvc_NetrEnumerateComputerNames *r); void wkssvc_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_wkssvc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); +WERROR _wkssvc_NetWkstaGetInfo(pipes_struct *p, struct wkssvc_NetWkstaGetInfo *r); +WERROR _wkssvc_NetWkstaSetInfo(pipes_struct *p, struct wkssvc_NetWkstaSetInfo *r); +WERROR _wkssvc_NetWkstaEnumUsers(pipes_struct *p, struct wkssvc_NetWkstaEnumUsers *r); +WERROR _wkssvc_NetrWkstaUserGetInfo(pipes_struct *p, struct wkssvc_NetrWkstaUserGetInfo *r); +WERROR _wkssvc_NetrWkstaUserSetInfo(pipes_struct *p, struct wkssvc_NetrWkstaUserSetInfo *r); +WERROR _wkssvc_NetWkstaTransportEnum(pipes_struct *p, struct wkssvc_NetWkstaTransportEnum *r); +WERROR _wkssvc_NetrWkstaTransportAdd(pipes_struct *p, struct wkssvc_NetrWkstaTransportAdd *r); +WERROR _wkssvc_NetrWkstaTransportDel(pipes_struct *p, struct wkssvc_NetrWkstaTransportDel *r); +WERROR _wkssvc_NetrUseAdd(pipes_struct *p, struct wkssvc_NetrUseAdd *r); +WERROR _wkssvc_NetrUseGetInfo(pipes_struct *p, struct wkssvc_NetrUseGetInfo *r); +WERROR _wkssvc_NetrUseDel(pipes_struct *p, struct wkssvc_NetrUseDel *r); +WERROR _wkssvc_NetrUseEnum(pipes_struct *p, struct wkssvc_NetrUseEnum *r); +WERROR _wkssvc_NetrMessageBufferSend(pipes_struct *p, struct wkssvc_NetrMessageBufferSend *r); +WERROR _wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p, struct wkssvc_NetrWorkstationStatisticsGet *r); +WERROR _wkssvc_NetrLogonDomainNameAdd(pipes_struct *p, struct wkssvc_NetrLogonDomainNameAdd *r); +WERROR _wkssvc_NetrLogonDomainNameDel(pipes_struct *p, struct wkssvc_NetrLogonDomainNameDel *r); +WERROR _wkssvc_NetrJoinDomain(pipes_struct *p, struct wkssvc_NetrJoinDomain *r); +WERROR _wkssvc_NetrUnjoinDomain(pipes_struct *p, struct wkssvc_NetrUnjoinDomain *r); +WERROR _wkssvc_NetrRenameMachineInDomain(pipes_struct *p, struct wkssvc_NetrRenameMachineInDomain *r); +WERROR _wkssvc_NetrValidateName(pipes_struct *p, struct wkssvc_NetrValidateName *r); +WERROR _wkssvc_NetrGetJoinInformation(pipes_struct *p, struct wkssvc_NetrGetJoinInformation *r); +WERROR _wkssvc_NetrGetJoinableOus(pipes_struct *p, struct wkssvc_NetrGetJoinableOus *r); +WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r); +WERROR _wkssvc_NetrUnjoinDomain2(pipes_struct *p, struct wkssvc_NetrUnjoinDomain2 *r); +WERROR _wkssvc_NetrRenameMachineInDomain2(pipes_struct *p, struct wkssvc_NetrRenameMachineInDomain2 *r); +WERROR _wkssvc_NetrValidateName2(pipes_struct *p, struct wkssvc_NetrValidateName2 *r); +WERROR _wkssvc_NetrGetJoinableOus2(pipes_struct *p, struct wkssvc_NetrGetJoinableOus2 *r); +WERROR _wkssvc_NetrAddAlternateComputerName(pipes_struct *p, struct wkssvc_NetrAddAlternateComputerName *r); +WERROR _wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p, struct wkssvc_NetrRemoveAlternateComputerName *r); +WERROR _wkssvc_NetrSetPrimaryComputername(pipes_struct *p, struct wkssvc_NetrSetPrimaryComputername *r); +WERROR _wkssvc_NetrEnumerateComputerNames(pipes_struct *p, struct wkssvc_NetrEnumerateComputerNames *r); NTSTATUS rpc_wkssvc_init(void); #endif /* __SRV_WKSSVC__ */ diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index 05edda9acb..6604abe91e 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -48,9 +48,9 @@ sub DeclLevel($$) return $res; } -sub AllocOutVar($$$$) +sub AllocOutVar($$$$$) { - my ($e, $mem_ctx, $name, $env) = @_; + my ($e, $mem_ctx, $name, $env, $fail) = @_; my $l = $e->{LEVELS}[0]; @@ -76,12 +76,54 @@ sub AllocOutVar($$$$) } pidl "if ($name == NULL) {"; - pidl "\ttalloc_free($mem_ctx);"; - pidl "\treturn false;"; + $fail->(); pidl "}"; pidl ""; } +sub CallWithStruct($$$$) +{ + my ($pipes_struct, $mem_ctx, $fn, $fail) = @_; + my $env = GenerateFunctionOutEnv($fn); + my $hasout = 0; + foreach (@{$fn->{ELEMENTS}}) { + if (grep(/out/, @{$_->{DIRECTION}})) { $hasout = 1; } + } + + pidl "ZERO_STRUCT(r->out);" if ($hasout); + + my $proto = "_$fn->{NAME}(pipes_struct *p, struct $fn->{NAME} *r"; + my $ret = "_$fn->{NAME}($pipes_struct, r"; + foreach (@{$fn->{ELEMENTS}}) { + my @dir = @{$_->{DIRECTION}}; + if (grep(/in/, @dir) and grep(/out/, @dir)) { + pidl "r->out.$_->{NAME} = r->in.$_->{NAME};"; + } + } + + foreach (@{$fn->{ELEMENTS}}) { + my @dir = @{$_->{DIRECTION}}; + if (grep(/in/, @dir) and grep(/out/, @dir)) { + # noop + } elsif (grep(/out/, @dir) and not + has_property($_, "represent_as")) { + AllocOutVar($_, $mem_ctx, "r->out.$_->{NAME}", $env, $fail); + } + } + $ret .= ")"; + $proto .= ");"; + + if ($fn->{RETURN_TYPE}) { + $ret = "r->out.result = $ret"; + $proto = "$fn->{RETURN_TYPE} $proto"; + } else { + $proto = "void $proto"; + } + + pidl_hdr "$proto"; + pidl "$ret;"; +} + sub ParseFunction($$) { my ($if,$fn) = @_; @@ -128,44 +170,12 @@ sub ParseFunction($$) pidl "}"; pidl ""; - my $env = GenerateFunctionOutEnv($fn); - my $hasout = 0; - foreach (@{$fn->{ELEMENTS}}) { - if (grep(/out/, @{$_->{DIRECTION}})) { $hasout = 1; } - } - - pidl "ZERO_STRUCT(r->out);" if ($hasout); - - my $proto = "_$fn->{NAME}(pipes_struct *p, struct $fn->{NAME} *r"; - my $ret = "_$fn->{NAME}(p, r"; - foreach (@{$fn->{ELEMENTS}}) { - my @dir = @{$_->{DIRECTION}}; - if (grep(/in/, @dir) and grep(/out/, @dir)) { - pidl "r->out.$_->{NAME} = r->in.$_->{NAME};"; - } - } - - foreach (@{$fn->{ELEMENTS}}) { - my @dir = @{$_->{DIRECTION}}; - if (grep(/in/, @dir) and grep(/out/, @dir)) { - # noop - } elsif (grep(/out/, @dir) and not - has_property($_, "represent_as")) { - AllocOutVar($_, "r", "r->out.$_->{NAME}", $env); + CallWithStruct("p", "r", $fn, + sub { + pidl "\ttalloc_free(r);"; + pidl "\treturn false;"; } - } - $ret .= ")"; - $proto .= ");"; - - if ($fn->{RETURN_TYPE}) { - $ret = "r->out.result = $ret"; - $proto = "$fn->{RETURN_TYPE} $proto"; - } else { - $proto = "void $proto"; - } - - pidl_hdr "$proto"; - pidl "$ret;"; + ); pidl ""; pidl "if (p->rng_fault_state) {"; @@ -204,6 +214,45 @@ sub ParseFunction($$) pidl ""; } +sub ParseDispatchFunction($) +{ + my ($if) = @_; + + pidl_hdr "NTSTATUS rpc_$if->{NAME}_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r);"; + pidl "NTSTATUS rpc_$if->{NAME}_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)"; + pidl "{"; + indent; + pidl "if (cli->pipes_struct == NULL) {"; + pidl "\treturn NT_STATUS_INVALID_PARAMETER;"; + pidl "}"; + pidl ""; + pidl "switch (opnum)"; + pidl "{"; + indent; + foreach my $fn (@{$if->{FUNCTIONS}}) { + next if ($fn->{PROPERTIES}{noopnum}); + my $op = "NDR_".uc($fn->{NAME}); + pidl "case $op: {"; + indent; + pidl "struct $fn->{NAME} *r = _r;"; + CallWithStruct("cli->pipes_struct", "mem_ctx", $fn, + sub { pidl "return NT_STATUS_NO_MEMORY;"; }); + pidl "return NT_STATUS_OK;"; + deindent; + pidl "}"; + pidl ""; + } + + pidl "default:"; + pidl "\treturn NT_STATUS_NOT_IMPLEMENTED;"; + deindent; + pidl "}"; + deindent; + pidl "}"; + + pidl ""; +} + sub ParseInterface($) { my $if = shift; @@ -244,6 +293,8 @@ sub ParseInterface($) pidl "}"; pidl ""; + ParseDispatchFunction($if); + pidl_hdr "NTSTATUS rpc_$if->{NAME}_init(void);"; pidl "NTSTATUS rpc_$if->{NAME}_init(void)"; pidl "{"; diff --git a/source3/include/client.h b/source3/include/client.h index 86b4bee662..09fdb81462 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -95,6 +95,9 @@ struct rpc_pipe_client { /* The following is only non-null on a netlogon pipe. */ struct dcinfo *dc; + + /* Used by internal rpc_pipe_client */ + pipes_struct *pipes_struct; }; /* Transport encryption state. */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 03c021683a..9ce6a9d7f1 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5244,6 +5244,10 @@ NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host, NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path, const struct ndr_syntax_id *abstract_syntax, struct rpc_pipe_client **presult); +NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *abstract_syntax, + NTSTATUS (*dispatch) (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r), + struct auth_serversupplied_info *serversupplied_info, + struct rpc_pipe_client **presult); NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli, const struct ndr_syntax_id *interface, struct rpc_pipe_client **presult); diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h index 1a1fd83060..48019a421d 100644 --- a/source3/librpc/rpc/dcerpc.h +++ b/source3/librpc/rpc/dcerpc.h @@ -57,7 +57,7 @@ struct rpc_request { enum dcerpc_transport_t { NCA_UNKNOWN, NCACN_NP, NCACN_IP_TCP, NCACN_IP_UDP, NCACN_VNS_IPC, NCACN_VNS_SPP, NCACN_AT_DSP, NCADG_AT_DDP, NCALRPC, NCACN_UNIX_STREAM, - NCADG_UNIX_DGRAM, NCACN_HTTP, NCADG_IPX, NCACN_SPX }; + NCADG_UNIX_DGRAM, NCACN_HTTP, NCADG_IPX, NCACN_SPX, NCACN_INTERNAL }; /** this describes a binding to a particular transport/pipe */ diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 0a606f2438..6e2ffc933b 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -4170,3 +4170,42 @@ NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } + +/** + * Create a new RPC client context which uses a local dispatch function. + */ +NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *abstract_syntax, + NTSTATUS (*dispatch) (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r), + struct auth_serversupplied_info *serversupplied_info, + struct rpc_pipe_client **presult) +{ + struct rpc_pipe_client *result; + + result = TALLOC_ZERO_P(mem_ctx, struct rpc_pipe_client); + if (result == NULL) { + return NT_STATUS_NO_MEMORY; + } + + result->transport_type = NCACN_INTERNAL; + + result->abstract_syntax = *abstract_syntax; + result->transfer_syntax = ndr_transfer_syntax; + result->dispatch = dispatch; + + result->pipes_struct = TALLOC_ZERO_P(mem_ctx, pipes_struct); + if (result->pipes_struct == NULL) { + TALLOC_FREE(result); + return NT_STATUS_NO_MEMORY; + } + result->pipes_struct->mem_ctx = mem_ctx; + result->pipes_struct->server_info = serversupplied_info; + result->pipes_struct->pipe_bound = true; + + result->max_xmit_frag = -1; + result->max_recv_frag = -1; + + *presult = result; + return NT_STATUS_OK; +} + + diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c index 9c3205eca3..6c40f09ab8 100644 --- a/source3/rpc_client/ndr.c +++ b/source3/rpc_client/ndr.c @@ -25,7 +25,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, - uint32 opnum, void *r) + uint32_t opnum, void *r) { prs_struct q_ps, r_ps; const struct ndr_interface_call *call; |