diff options
author | Gerald Carter <jerry@samba.org> | 2006-02-03 22:19:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:06:23 -0500 |
commit | 0af1500fc0bafe61019f1b2ab1d9e1d369221240 (patch) | |
tree | 653fc2533795458d5f9696402285d9f14e527a21 /source3/rpc_client | |
parent | 21a30a1346c9f9a25659a0cea0d276d8c2e6ddca (diff) | |
download | samba-0af1500fc0bafe61019f1b2ab1d9e1d369221240.tar.gz samba-0af1500fc0bafe61019f1b2ab1d9e1d369221240.tar.xz samba-0af1500fc0bafe61019f1b2ab1d9e1d369221240.zip |
r13316: Let the carnage begin....
Sync with trunk as off r13315
(This used to be commit 17e63ac4ed8325c0d44fe62b2442449f3298559f)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_dfs.c | 673 | ||||
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 111 | ||||
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 28 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 6 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.c | 7 |
5 files changed, 683 insertions, 142 deletions
diff --git a/source3/rpc_client/cli_dfs.c b/source3/rpc_client/cli_dfs.c index 78df220ac2a..8b94d6ed9d4 100644 --- a/source3/rpc_client/cli_dfs.c +++ b/source3/rpc_client/cli_dfs.c @@ -1,183 +1,632 @@ -/* - Unix SMB/CIFS implementation. - RPC pipe client - Copyright (C) Tim Potter 2000-2001, - Copyright (C) Jeremy Allison 2005. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ #include "includes.h" -/* Query DFS support */ - -NTSTATUS rpccli_dfs_exist(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - BOOL *dfs_exists) +NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 *exist_flag) { prs_struct qbuf, rbuf; - DFS_Q_DFS_EXIST q; - DFS_R_DFS_EXIST r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - + NETDFS_Q_DFS_GETMANAGERVERSION q; + NETDFS_R_DFS_GETMANAGERVERSION r; + ZERO_STRUCT(q); ZERO_STRUCT(r); - + /* Marshall data and send request */ - - init_dfs_q_dfs_exist(&q); - - CLI_DO_RPC( cli, mem_ctx, PI_NETDFS, DFS_EXIST, + + if (!init_netdfs_q_dfs_GetManagerVersion(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_GETMANAGERVERSION, q, r, - qbuf, rbuf, - dfs_io_q_dfs_exist, - dfs_io_r_dfs_exist, + qbuf, rbuf, + netdfs_io_q_dfs_GetManagerVersion, + netdfs_io_r_dfs_GetManagerVersion, NT_STATUS_UNSUCCESSFUL); - + + /* Return variables */ + *exist_flag = r.exist_flag; + /* Return result */ - - *dfs_exists = (r.status != 0); - - result = NT_STATUS_OK; - - return result; + return NT_STATUS_OK; } -NTSTATUS rpccli_dfs_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *entrypath, const char *servername, - const char *sharename, const char *comment, uint32 flags) +NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, const char *comment, uint32 flags) { prs_struct qbuf, rbuf; - DFS_Q_DFS_ADD q; - DFS_R_DFS_ADD r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - + NETDFS_Q_DFS_ADD q; + NETDFS_R_DFS_ADD r; + ZERO_STRUCT(q); ZERO_STRUCT(r); - + /* Marshall data and send request */ - - init_dfs_q_dfs_add(&q, entrypath, servername, sharename, comment, - flags); - - CLI_DO_RPC( cli, mem_ctx, PI_NETDFS, DFS_ADD, + + if (!init_netdfs_q_dfs_Add(&q, path, server, share, comment, flags)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADD, q, r, - qbuf, rbuf, - dfs_io_q_dfs_add, - dfs_io_r_dfs_add, + qbuf, rbuf, + netdfs_io_q_dfs_Add, + netdfs_io_r_dfs_Add, NT_STATUS_UNSUCCESSFUL); - + + /* Return variables */ + /* Return result */ - - result = werror_to_ntstatus(r.status); - - return result; + return werror_to_ntstatus(r.status); } -NTSTATUS rpccli_dfs_remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *entrypath, const char *servername, - const char *sharename) +NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share) { prs_struct qbuf, rbuf; - DFS_Q_DFS_REMOVE q; - DFS_R_DFS_REMOVE r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - + NETDFS_Q_DFS_REMOVE q; + NETDFS_R_DFS_REMOVE r; + ZERO_STRUCT(q); ZERO_STRUCT(r); - + /* Marshall data and send request */ - - init_dfs_q_dfs_remove(&q, entrypath, servername, sharename); - - CLI_DO_RPC( cli, mem_ctx, PI_NETDFS, DFS_REMOVE, + + if (!init_netdfs_q_dfs_Remove(&q, path, server, share)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVE, q, r, - qbuf, rbuf, - dfs_io_q_dfs_remove, - dfs_io_r_dfs_remove, + qbuf, rbuf, + netdfs_io_q_dfs_Remove, + netdfs_io_r_dfs_Remove, NT_STATUS_UNSUCCESSFUL); - + + /* Return variables */ + /* Return result */ + return werror_to_ntstatus(r.status); +} - result = werror_to_ntstatus(r.status); +NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_SETINFO q; + NETDFS_R_DFS_SETINFO r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_SetInfo(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_SETINFO, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_SetInfo, + netdfs_io_r_dfs_SetInfo, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - return result; +NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, uint32 level, NETDFS_DFS_INFO_CTR *info) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_GETINFO q; + NETDFS_R_DFS_GETINFO r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_GetInfo(&q, path, server, share, level)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_GETINFO, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_GetInfo, + netdfs_io_r_dfs_GetInfo, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + *info = r.info; + + /* Return result */ + return werror_to_ntstatus(r.status); } -NTSTATUS rpccli_dfs_get_info(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *entrypath, const char *servername, - const char *sharename, uint32 info_level, - DFS_INFO_CTR *ctr) +NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_ENUM q; + NETDFS_R_DFS_ENUM r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_Enum(&q, level, bufsize, info, unknown, total)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ENUM, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_Enum, + netdfs_io_r_dfs_Enum, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + *info = r.info; + *total = r.total; + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { prs_struct qbuf, rbuf; - DFS_Q_DFS_GET_INFO q; - DFS_R_DFS_GET_INFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + NETDFS_Q_DFS_RENAME q; + NETDFS_R_DFS_RENAME r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_Rename(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_RENAME, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_Rename, + netdfs_io_r_dfs_Rename, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_MOVE q; + NETDFS_R_DFS_MOVE r; + ZERO_STRUCT(q); ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_Move(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MOVE, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_Move, + netdfs_io_r_dfs_Move, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_MANAGERGETCONFIGINFO q; + NETDFS_R_DFS_MANAGERGETCONFIGINFO r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_ManagerGetConfigInfo(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MANAGERGETCONFIGINFO, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_ManagerGetConfigInfo, + netdfs_io_r_dfs_ManagerGetConfigInfo, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - init_dfs_q_dfs_get_info(&q, entrypath, servername, sharename, - info_level); +NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_MANAGERSENDSITEINFO q; + NETDFS_R_DFS_MANAGERSENDSITEINFO r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_ManagerSendSiteInfo(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MANAGERSENDSITEINFO, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_ManagerSendSiteInfo, + netdfs_io_r_dfs_ManagerSendSiteInfo, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - CLI_DO_RPC( cli, mem_ctx, PI_NETDFS, DFS_GET_INFO, +NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_ADDFTROOT q; + NETDFS_R_DFS_ADDFTROOT r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_AddFtRoot(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADDFTROOT, q, r, - qbuf, rbuf, - dfs_io_q_dfs_get_info, - dfs_io_r_dfs_get_info, + qbuf, rbuf, + netdfs_io_q_dfs_AddFtRoot, + netdfs_io_r_dfs_AddFtRoot, NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_REMOVEFTROOT q; + NETDFS_R_DFS_REMOVEFTROOT r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_RemoveFtRoot(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVEFTROOT, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_RemoveFtRoot, + netdfs_io_r_dfs_RemoveFtRoot, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + /* Return result */ + return werror_to_ntstatus(r.status); +} - result = werror_to_ntstatus(r.status); - *ctr = r.ctr; +NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_ADDSTDROOT q; + NETDFS_R_DFS_ADDSTDROOT r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); - return result; + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_AddStdRoot(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADDSTDROOT, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_AddStdRoot, + netdfs_io_r_dfs_AddStdRoot, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); } -/* Enumerate dfs shares */ +NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_REMOVESTDROOT q; + NETDFS_R_DFS_REMOVESTDROOT r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_RemoveStdRoot(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVESTDROOT, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_RemoveStdRoot, + netdfs_io_r_dfs_RemoveStdRoot, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} -NTSTATUS rpccli_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint32 info_level, DFS_INFO_CTR *ctr) +NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { prs_struct qbuf, rbuf; - DFS_Q_DFS_ENUM q; - DFS_R_DFS_ENUM r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + NETDFS_Q_DFS_MANAGERINITIALIZE q; + NETDFS_R_DFS_MANAGERINITIALIZE r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_ManagerInitialize(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MANAGERINITIALIZE, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_ManagerInitialize, + netdfs_io_r_dfs_ManagerInitialize, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_ADDSTDROOTFORCED q; + NETDFS_R_DFS_ADDSTDROOTFORCED r; + ZERO_STRUCT(q); ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_AddStdRootForced(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADDSTDROOTFORCED, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_AddStdRootForced, + netdfs_io_r_dfs_AddStdRootForced, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_GETDCADDRESS q; + NETDFS_R_DFS_GETDCADDRESS r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_GetDcAddress(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_GETDCADDRESS, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_GetDcAddress, + netdfs_io_r_dfs_GetDcAddress, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - init_dfs_q_dfs_enum(&q, info_level, ctr); +NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_SETDCADDRESS q; + NETDFS_R_DFS_SETDCADDRESS r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_SetDcAddress(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_SETDCADDRESS, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_SetDcAddress, + netdfs_io_r_dfs_SetDcAddress, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - r.ctr = ctr; +NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_FLUSHFTTABLE q; + NETDFS_R_DFS_FLUSHFTTABLE r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_FlushFtTable(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_FLUSHFTTABLE, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_FlushFtTable, + netdfs_io_r_dfs_FlushFtTable, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - CLI_DO_RPC( cli, mem_ctx, PI_NETDFS, DFS_ENUM, +NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_ADD2 q; + NETDFS_R_DFS_ADD2 r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_Add2(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADD2, q, r, - qbuf, rbuf, - dfs_io_q_dfs_enum, - dfs_io_r_dfs_enum, + qbuf, rbuf, + netdfs_io_q_dfs_Add2, + netdfs_io_r_dfs_Add2, NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} +NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_REMOVE2 q; + NETDFS_R_DFS_REMOVE2 r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_Remove2(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVE2, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_Remove2, + netdfs_io_r_dfs_Remove2, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + /* Return result */ + return werror_to_ntstatus(r.status); +} - result = werror_to_ntstatus(r.status); +NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_ENUMEX q; + NETDFS_R_DFS_ENUMEX r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_EnumEx(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ENUMEX, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_EnumEx, + netdfs_io_r_dfs_EnumEx, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); +} - return result; +NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + prs_struct qbuf, rbuf; + NETDFS_Q_DFS_SETINFO2 q; + NETDFS_R_DFS_SETINFO2 r; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + if (!init_netdfs_q_dfs_SetInfo2(&q)) + return NT_STATUS_INVALID_PARAMETER; + + CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_SETINFO2, + q, r, + qbuf, rbuf, + netdfs_io_q_dfs_SetInfo2, + netdfs_io_r_dfs_SetInfo2, + NT_STATUS_UNSUCCESSFUL); + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.status); } + diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index aa1cb95fda1..9331d090931 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -277,7 +277,9 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol, int num_names, - const char **names, DOM_SID **sids, + const char **names, + const char ***dom_names, + DOM_SID **sids, uint32 **types) { prs_struct qbuf, rbuf; @@ -331,6 +333,15 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, goto done; } + if (dom_names != NULL) { + *dom_names = TALLOC_ARRAY(mem_ctx, const char *, num_names); + if (*dom_names == NULL) { + DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); + result = NT_STATUS_NO_MEMORY; + goto done; + } + } + for (i = 0; i < num_names; i++) { DOM_RID2 *t_rids = r.dom_rid; uint32 dom_idx = t_rids[i].rid_idx; @@ -339,19 +350,27 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, /* Translate optimised sid through domain index array */ - if (dom_idx != 0xffffffff) { + if (dom_idx == 0xffffffff) { + /* Nothing to do, this is unknown */ + ZERO_STRUCTP(sid); + (*types)[i] = SID_NAME_UNKNOWN; + continue; + } - sid_copy(sid, &ref.ref_dom[dom_idx].ref_dom.sid); + sid_copy(sid, &ref.ref_dom[dom_idx].ref_dom.sid); - if (dom_rid != 0xffffffff) { - sid_append_rid(sid, dom_rid); - } + if (dom_rid != 0xffffffff) { + sid_append_rid(sid, dom_rid); + } - (*types)[i] = t_rids[i].type; - } else { - ZERO_STRUCTP(sid); - (*types)[i] = SID_NAME_UNKNOWN; + (*types)[i] = t_rids[i].type; + + if (dom_names == NULL) { + continue; } + + (*dom_names)[i] = rpcstr_pull_unistr2_talloc( + *dom_names, &ref.ref_dom[dom_idx].uni_dom_name); } done: @@ -1298,6 +1317,42 @@ done: return result; } +NTSTATUS rpccli_lsa_open_trusted_domain_by_name(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, const char *name, uint32 access_mask, + POLICY_HND *trustdom_pol) +{ + prs_struct qbuf, rbuf; + LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME q; + LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME r; + NTSTATUS result; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Initialise input parameters */ + + init_lsa_q_open_trusted_domain_by_name(&q, pol, name, access_mask); + + /* Marshall data and send request */ + + CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENTRUSTDOMBYNAME, + q, r, + qbuf, rbuf, + lsa_io_q_open_trusted_domain_by_name, + lsa_io_r_open_trusted_domain_by_name, + NT_STATUS_UNSUCCESSFUL); + + /* Return output parameters */ + + result = r.status; + + if (NT_STATUS_IS_OK(result)) { + *trustdom_pol = r.handle; + } + + return result; +} + NTSTATUS rpccli_lsa_query_trusted_domain_info_by_sid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol, @@ -1372,3 +1427,39 @@ done: return result; } + +NTSTATUS cli_lsa_query_domain_info_policy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, + uint16 info_class, LSA_DOM_INFO_UNION **info) +{ + prs_struct qbuf, rbuf; + LSA_Q_QUERY_DOM_INFO_POLICY q; + LSA_R_QUERY_DOM_INFO_POLICY r; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Marshall data and send request */ + + init_q_query_dom_info(&q, pol, info_class); + + CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYDOMINFOPOL, + q, r, + qbuf, rbuf, + lsa_io_q_query_dom_info, + lsa_io_r_query_dom_info, + NT_STATUS_UNSUCCESSFUL); + + result = r.status; + + if (!NT_STATUS_IS_OK(result)) { + goto done; + } + + *info = r.info; + +done: + return result; +} + diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index b5addf33751..3dc26f61c93 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -468,8 +468,8 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, if (dc_unc != NULL) { char *tmp; - if (rpcstr_pull_unistr2_talloc(mem_ctx, &tmp, - &r.uni_dc_unc) < 0) { + tmp = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dc_unc); + if (tmp == NULL) { return WERR_GENERAL_FAILURE; } if (*tmp == '\\') tmp += 1; @@ -485,8 +485,8 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, if (dc_address != NULL) { char *tmp; - if (rpcstr_pull_unistr2_talloc(mem_ctx, &tmp, - &r.uni_dc_address) < 0) { + tmp = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dc_address); + if (tmp == NULL) { return WERR_GENERAL_FAILURE; } if (*tmp == '\\') tmp += 1; @@ -509,14 +509,14 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, } if ((domain_name_out != NULL) && - (rpcstr_pull_unistr2_talloc(mem_ctx, domain_name_out, - &r.uni_domain_name) < 1)) { + ((*domain_name_out = rpcstr_pull_unistr2_talloc( + mem_ctx, &r.uni_domain_name)) == NULL)) { return WERR_GENERAL_FAILURE; } if ((forest_name != NULL) && - (rpcstr_pull_unistr2_talloc(mem_ctx, forest_name, - &r.uni_forest_name) < 1)) { + ((*forest_name = rpcstr_pull_unistr2_talloc( + mem_ctx, &r.uni_forest_name)) == NULL)) { return WERR_GENERAL_FAILURE; } @@ -525,14 +525,14 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, } if ((dc_site_name != NULL) && - (rpcstr_pull_unistr2_talloc(mem_ctx, dc_site_name, - &r.uni_dc_site_name) < 1)) { + ((*dc_site_name = rpcstr_pull_unistr2_talloc( + mem_ctx, &r.uni_dc_site_name)) == NULL)) { return WERR_GENERAL_FAILURE; } if ((client_site_name != NULL) && - (rpcstr_pull_unistr2_talloc(mem_ctx, client_site_name, - &r.uni_client_site_name) < 1)) { + ((*client_site_name = rpcstr_pull_unistr2_talloc( + mem_ctx, &r.uni_client_site_name)) == NULL)) { return WERR_GENERAL_FAILURE; } @@ -571,8 +571,8 @@ WERROR rpccli_netlogon_dsr_getsitename(struct rpc_pipe_client *cli, } if ((site_name != NULL) && - (rpcstr_pull_unistr2_talloc(mem_ctx, site_name, - &r.uni_site_name) < 1)) { + ((*site_name = rpcstr_pull_unistr2_talloc( + mem_ctx, &r.uni_site_name)) == NULL)) { return WERR_GENERAL_FAILURE; } diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 23c66acf26e..9cc350bef1b 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -927,7 +927,7 @@ static NTSTATUS create_krb5_auth_bind_req( struct rpc_pipe_client *cli, /* Create the ticket for the service principal and return it in a gss-api wrapped blob. */ ret = cli_krb5_get_ticket(a->service_principal, 0, &tkt, - &a->session_key, (uint32)AP_OPTS_MUTUAL_REQUIRED); + &a->session_key, (uint32)AP_OPTS_MUTUAL_REQUIRED, NULL); if (ret) { DEBUG(1,("create_krb5_auth_bind_req: cli_krb5_get_ticket for principal %s " @@ -2699,7 +2699,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli, /* Only get a new TGT if username/password are given. */ if (username && password) { - int ret = kerberos_kinit_password(username, password, 0, NULL, NULL); + int ret = kerberos_kinit_password(username, password, 0, NULL, NULL, NULL, False, 0); if (ret) { cli_rpc_pipe_close(result); return NULL; @@ -2737,7 +2737,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli, Close an open named pipe over SMB. Free any authentication data. ****************************************************************************/ -void cli_rpc_pipe_close(struct rpc_pipe_client *cli) + void cli_rpc_pipe_close(struct rpc_pipe_client *cli) { if (!cli_close(cli->cli, cli->fnum)) { DEBUG(0,("cli_rpc_pipe_close: cli_close failed on pipe %s " diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index fb95da97aef..744d8174a0a 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -360,7 +360,8 @@ NTSTATUS rpccli_samr_del_groupmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c NTSTATUS rpccli_samr_query_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol, uint16 switch_value, + const POLICY_HND *user_pol, + uint16 switch_value, SAM_USERINFO_CTR **ctr) { prs_struct qbuf, rbuf; @@ -1549,7 +1550,7 @@ NTSTATUS rpccli_samr_create_dom_user(struct rpc_pipe_client *cli, TALLOC_CTX *me /* Set userinfo */ NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol, uint16 switch_value, + const POLICY_HND *user_pol, uint16 switch_value, DATA_BLOB *sess_key, SAM_USERINFO_CTR *ctr) { prs_struct qbuf, rbuf; @@ -1600,7 +1601,7 @@ NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* Set userinfo2 */ NTSTATUS rpccli_samr_set_userinfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol, uint16 switch_value, + const POLICY_HND *user_pol, uint16 switch_value, DATA_BLOB *sess_key, SAM_USERINFO_CTR *ctr) { prs_struct qbuf, rbuf; |