Changeset 988 for vendor/current/source3/lib/netapi/cm.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
-
vendor/current/source3/lib/netapi/cm.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/netapi/cm.c
r740 r988 19 19 20 20 #include "includes.h" 21 #include " popt_common.h"21 #include ".h" 22 22 23 23 #include "lib/netapi/netapi.h" … … 25 25 #include "libsmb/libsmb.h" 26 26 #include "rpc_client/cli_pipe.h" 27 27 28 28 29 /******************************************************************** … … 49 50 50 51 for (p = priv_ctx->ipc_connections; p; p = p->next) { 51 if (strequal(p->cli->desthost, server_name)) { 52 const char *remote_name = smbXcli_conn_remote_name(p->cli->conn); 53 54 if (strequal(remote_name, server_name)) { 52 55 return p; 53 56 } … … 64 67 struct client_ipc_connection **pp) 65 68 { 66 struct libnetapi_private_ctx *priv_ctx = 67 (struct libnetapi_private_ctx *)ctx->private_data; 69 struct libnetapi_private_ctx *priv_ctx; 68 70 struct user_auth_info *auth_info = NULL; 69 71 struct cli_state *cli_ipc = NULL; 70 72 struct client_ipc_connection *p; 73 71 74 72 75 if (!ctx || !pp || !server_name) { 73 76 return WERR_INVALID_PARAM; 74 77 } 78 79 75 80 76 81 p = ipc_cm_find(priv_ctx, server_name); … … 84 89 return WERR_NOMEM; 85 90 } 86 auth_info->signing_state = Undefined;91 auth_info->signing_state = ; 87 92 set_cmdline_auth_info_use_kerberos(auth_info, ctx->use_kerberos); 88 93 set_cmdline_auth_info_username(auth_info, ctx->username); … … 103 108 } 104 109 105 cli_ipc = cli_cm_open(ctx, NULL, 106 server_name, "IPC$", 107 auth_info, 108 false, false, 109 PROTOCOL_NT1, 110 0, 0x20); 111 if (cli_ipc) { 112 cli_set_username(cli_ipc, ctx->username); 113 cli_set_password(cli_ipc, ctx->password); 114 cli_set_domain(cli_ipc, ctx->workgroup); 110 status = cli_cm_open(ctx, NULL, 111 server_name, "IPC$", 112 auth_info, 113 false, false, 114 lp_client_max_protocol(), 115 0, 0x20, &cli_ipc); 116 if (!NT_STATUS_IS_OK(status)) { 117 cli_ipc = NULL; 115 118 } 116 119 TALLOC_FREE(auth_info); … … 122 125 } 123 126 124 p = TALLOC_ZERO_P(ctx, struct client_ipc_connection);127 p = (ctx, struct client_ipc_connection); 125 128 if (p == NULL) { 126 129 return WERR_NOMEM; … … 155 158 156 159 static NTSTATUS pipe_cm_find(struct client_ipc_connection *ipc, 157 const struct ndr_ syntax_id *interface,160 const struct ndr_e, 158 161 struct rpc_pipe_client **presult) 159 162 { … … 161 164 162 165 for (p = ipc->pipe_connections; p; p = p->next) { 163 164 if (!rpc_pipe_np_smb_conn(p->pipe)) { 166 const char *ipc_remote_name; 167 168 if (!rpccli_is_connected(p->pipe)) { 165 169 return NT_STATUS_PIPE_EMPTY; 166 170 } 167 171 168 if (strequal(ipc->cli->desthost, p->pipe->desthost) 172 ipc_remote_name = smbXcli_conn_remote_name(ipc->cli->conn); 173 174 if (strequal(ipc_remote_name, p->pipe->desthost) 169 175 && ndr_syntax_id_equal(&p->pipe->abstract_syntax, 170 interface)) {176 )) { 171 177 *presult = p->pipe; 172 178 return NT_STATUS_OK; … … 182 188 static NTSTATUS pipe_cm_connect(TALLOC_CTX *mem_ctx, 183 189 struct client_ipc_connection *ipc, 184 const struct ndr_ syntax_id *interface,190 const struct ndr_e, 185 191 struct rpc_pipe_client **presult) 186 192 { … … 188 194 NTSTATUS status; 189 195 190 p = TALLOC_ZERO_ARRAY(mem_ctx, struct client_pipe_connection, 1);196 p = (mem_ctx, struct client_pipe_connection, 1); 191 197 if (!p) { 192 198 return NT_STATUS_NO_MEMORY; 193 199 } 194 200 195 status = cli_rpc_pipe_open_noauth(ipc->cli, interface, &p->pipe);201 status = cli_rpc_pipe_open_noauth(ipc->cli, e, &p->pipe); 196 202 if (!NT_STATUS_IS_OK(status)) { 197 203 TALLOC_FREE(p); … … 210 216 static NTSTATUS pipe_cm_open(TALLOC_CTX *ctx, 211 217 struct client_ipc_connection *ipc, 212 const struct ndr_ syntax_id *interface,218 const struct ndr_e, 213 219 struct rpc_pipe_client **presult) 214 220 { 215 if (NT_STATUS_IS_OK(pipe_cm_find(ipc, interface, presult))) {221 if (NT_STATUS_IS_OK(pipe_cm_find(ipc, e, presult))) { 216 222 return NT_STATUS_OK; 217 223 } 218 224 219 return pipe_cm_connect(ctx, ipc, interface, presult);225 return pipe_cm_connect(ctx, ipc, e, presult); 220 226 } 221 227 … … 225 231 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx, 226 232 const char *server_name, 227 const struct ndr_ syntax_id *interface,233 const struct ndr_e, 228 234 struct rpc_pipe_client **presult) 229 235 { … … 242 248 } 243 249 244 status = pipe_cm_open(ctx, ipc, interface, &result);250 status = pipe_cm_open(ctx, ipc, e, &result); 245 251 if (!NT_STATUS_IS_OK(status)) { 246 252 libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s", 247 get_pipe_name_from_syntax(talloc_tos(), interface),253 , 248 254 get_friendly_nt_error_msg(status)); 249 255 return WERR_DEST_NOT_FOUND; … … 260 266 WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx, 261 267 const char *server_name, 262 const struct ndr_ syntax_id *interface,268 const struct ndr_e, 263 269 struct dcerpc_binding_handle **binding_handle) 264 270 { … … 268 274 *binding_handle = NULL; 269 275 270 result = libnetapi_open_pipe(ctx, server_name, interface, &pipe_cli);276 result = libnetapi_open_pipe(ctx, server_name, e, &pipe_cli); 271 277 if (!W_ERROR_IS_OK(result)) { 272 278 return result;
Note:
See TracChangeset
for help on using the changeset viewer.
