1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3:libsmb: get rid of cli_state_remote_name

Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Luk Claes 2012-05-19 17:31:50 +02:00 committed by Stefan Metzmacher
parent 987e81b0ee
commit 4f6f4ea93c
19 changed files with 59 additions and 55 deletions

View File

@ -37,6 +37,7 @@
#include "trans2.h"
#include "libsmb/nmblib.h"
#include "include/ntioctl.h"
#include "../libcli/smb/smbXcli_base.h"
#ifndef REGISTER
#define REGISTER 0
@ -4495,7 +4496,7 @@ static int cmd_show_connect( void )
return 1;
}
d_printf("//%s/%s\n", cli_state_remote_name(targetcli), targetcli->share);
d_printf("//%s/%s\n", smbXcli_conn_remote_name(targetcli->conn), targetcli->share);
return 0;
}

View File

@ -24,6 +24,7 @@
#include "lib/netapi/netapi_private.h"
#include "libsmb/libsmb.h"
#include "rpc_client/cli_pipe.h"
#include "../libcli/smb/smbXcli_base.h"
/********************************************************************
********************************************************************/
@ -48,7 +49,7 @@ static struct client_ipc_connection *ipc_cm_find(
struct client_ipc_connection *p;
for (p = priv_ctx->ipc_connections; p; p = p->next) {
const char *remote_name = cli_state_remote_name(p->cli);
const char *remote_name = smbXcli_conn_remote_name(p->cli->conn);
if (strequal(remote_name, server_name)) {
return p;
@ -172,7 +173,7 @@ static NTSTATUS pipe_cm_find(struct client_ipc_connection *ipc,
return NT_STATUS_PIPE_EMPTY;
}
ipc_remote_name = cli_state_remote_name(ipc->cli);
ipc_remote_name = smbXcli_conn_remote_name(ipc->cli->conn);
if (strequal(ipc_remote_name, p->pipe->desthost)
&& ndr_syntax_id_equal(&p->pipe->abstract_syntax,

View File

@ -1210,7 +1210,7 @@ NTSTATUS libnet_join_ok(const char *netbios_domain_name,
DEBUG(0,("libnet_join_ok: failed to get schannel session "
"key from server %s for domain %s. Error was %s\n",
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
netbios_domain_name, nt_errstr(status)));
cli_shutdown(cli);
return status;
@ -1232,7 +1232,7 @@ NTSTATUS libnet_join_ok(const char *netbios_domain_name,
DEBUG(0,("libnet_join_ok: failed to open schannel session "
"on netlogon pipe to server %s for domain %s. "
"Error was %s\n",
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
netbios_domain_name, nt_errstr(status)));
return status;
}
@ -1979,7 +1979,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
create_local_private_krb5_conf_for_domain(
r->out.dns_domain_name, r->out.netbios_domain_name,
NULL, smbXcli_conn_remote_sockaddr(cli->conn),
cli_state_remote_name(cli));
smbXcli_conn_remote_name(cli->conn));
if (r->out.domain_is_ad && r->in.account_ou &&
!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) {

View File

@ -1920,7 +1920,7 @@ static ADS_STATUS cli_session_setup_spnego(struct cli_state *cli,
if (user && *user && cli->got_kerberos_mechanism && cli->use_kerberos) {
ADS_STATUS rc;
const char *remote_name = cli_state_remote_name(cli);
const char *remote_name = smbXcli_conn_remote_name(cli->conn);
if (pass && *pass) {
int ret;
@ -2335,7 +2335,7 @@ struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
* Add the sharename
*/
tmp = talloc_asprintf_strupper_m(talloc_tos(), "\\\\%s\\%s",
cli_state_remote_name(cli), share);
smbXcli_conn_remote_name(cli->conn), share);
if (tmp == NULL) {
TALLOC_FREE(req);
return NULL;

View File

@ -25,6 +25,7 @@
#include "msdfs.h"
#include "trans2.h"
#include "libsmb/nmblib.h"
#include "../libcli/smb/smbXcli_base.h"
/********************************************************************
Important point.
@ -329,7 +330,7 @@ static struct cli_state *cli_cm_find(struct cli_state *cli,
/* Search to the start of the list. */
for (p = cli; p; p = DLIST_PREV(p)) {
const char *remote_name =
cli_state_remote_name(p);
smbXcli_conn_remote_name(p->conn);
if (strequal(server, remote_name) &&
strequal(share,p->share)) {
@ -340,7 +341,7 @@ static struct cli_state *cli_cm_find(struct cli_state *cli,
/* Search to the end of the list. */
for (p = cli->next; p; p = p->next) {
const char *remote_name =
cli_state_remote_name(p);
smbXcli_conn_remote_name(p->conn);
if (strequal(server, remote_name) &&
strequal(share,p->share)) {
@ -412,7 +413,7 @@ void cli_cm_display(struct cli_state *cli)
for (i=0; cli; cli = cli->next,i++ ) {
d_printf("%d:\tserver=%s, share=%s\n",
i, cli_state_remote_name(cli), cli->share);
i, smbXcli_conn_remote_name(cli->conn), cli->share);
}
}
@ -579,7 +580,7 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx,
}
return talloc_asprintf(ctx, "%c%s%c%s%c%s",
path_sep,
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
path_sep,
cli->share,
path_sep,
@ -859,7 +860,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
status = cli_cm_open(ctx,
rootcli,
cli_state_remote_name(rootcli),
smbXcli_conn_remote_name(rootcli->conn),
"IPC$",
dfs_auth_info,
false,
@ -1044,7 +1045,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
return false;
}
remote_name = cli_state_remote_name(cli);
remote_name = smbXcli_conn_remote_name(cli->conn);
cnum = cli_state_get_tid(cli);
/* special case. never check for a referral on the IPC$ share */

View File

@ -360,11 +360,6 @@ void cli_shutdown(struct cli_state *cli)
_cli_shutdown(cli);
}
const char *cli_state_remote_name(struct cli_state *cli)
{
return smbXcli_conn_remote_name(cli->conn);
}
const char *cli_state_remote_realm(struct cli_state *cli)
{
return cli->remote_realm;

View File

@ -690,7 +690,7 @@ NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
}
status = gensec_set_target_hostname(auth_generic_state->gensec_security,
cli_state_remote_name(cli));
smbXcli_conn_remote_name(cli->conn));
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}

View File

@ -80,6 +80,7 @@
#include "../librpc/gen_ndr/rap.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "libsmb/clirap.h"
#include "../libcli/smb/smbXcli_base.h"
#define WORDSIZE 2
#define DWORDSIZE 4
@ -1535,7 +1536,7 @@ bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_n
} else {
DEBUG(4, ("cli_get_pdc_name: machine %s failed the "
"NetServerEnum call. Error was : %s.\n",
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
win_errstr(W_ERROR(cli->rap_error))));
}
}
@ -1756,7 +1757,7 @@ bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
* PURPOSE: Remotes a NetServerEnum2 API call to the current server
* requesting server_info_0 level information of machines
* matching the given server type. If the returned server
* list contains the machine name contained in cli_state_remote_name()
* list contains the machine name contained in smbXcli_conn_remote_name(->conn)
* then we conclude the server type checks out. This routine
* is useful to retrieve list of server's of a certain
* type when all you have is a null session connection and
@ -1791,7 +1792,7 @@ bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 sty
+RAP_MACHNAME_LEN]; /* workgroup */
bool found_server = false;
int res = -1;
const char *remote_name = cli_state_remote_name(cli);
const char *remote_name = smbXcli_conn_remote_name(cli->conn);
/* send a SMBtrans command with api NetServerEnum */
p = make_header(param, RAP_NetServerEnum2,

View File

@ -30,6 +30,7 @@
#include "rpc_client/cli_pipe.h"
#include "../librpc/gen_ndr/ndr_srvsvc_c.h"
#include "libsmb/nmblib.h"
#include "../libcli/smb/smbXcli_base.h"
/*
* Routine to open a directory
@ -554,7 +555,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
}
workgroup = talloc_strdup(frame, wg_ptr);
server = talloc_strdup(frame, cli_state_remote_name(cli));
server = talloc_strdup(frame, smbXcli_conn_remote_name(cli->conn));
cli_shutdown(cli);
@ -2003,7 +2004,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
}
/*d_printf(">>>rename: resolved path as %s\n", targetpath2);*/
if (strcmp(cli_state_remote_name(targetcli1), cli_state_remote_name(targetcli2)) ||
if (strcmp(smbXcli_conn_remote_name(targetcli1->conn), smbXcli_conn_remote_name(targetcli2->conn)) ||
strcmp(targetcli1->share, targetcli2->share))
{
/* can't rename across file systems */

View File

@ -32,6 +32,7 @@
#include "rpc_client/cli_lsarpc.h"
#include "libcli/security/security.h"
#include "libsmb/nmblib.h"
#include "../libcli/smb/smbXcli_base.h"
/*
* Check a server for being alive and well.
@ -293,7 +294,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
if (!cli_state_has_tcon(srv->cli)) {
/* Ensure we have accurate auth info */
SMBC_call_auth_fn(ctx, context,
cli_state_remote_name(srv->cli),
smbXcli_conn_remote_name(srv->cli->conn),
srv->cli->share,
pp_workgroup,
pp_username,
@ -371,7 +372,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
*/
if (srv) {
const char *remote_name =
cli_state_remote_name(srv->cli);
smbXcli_conn_remote_name(srv->cli->conn);
srv->dev = (dev_t)(str_checksum(remote_name) ^
str_checksum(srv->cli->share));
@ -697,7 +698,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
if (!srv) {
return NULL;
}
server = cli_state_remote_name(srv->cli);
server = smbXcli_conn_remote_name(srv->cli->conn);
share = srv->cli->share;
/*

View File

@ -171,7 +171,6 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
bool cli_state_encryption_on(struct cli_state *cli);
void cli_nt_pipes_close(struct cli_state *cli);
void cli_shutdown(struct cli_state *cli);
const char *cli_state_remote_name(struct cli_state *cli);
const char *cli_state_remote_realm(struct cli_state *cli);
uint16_t cli_state_get_vc_num(struct cli_state *cli);
uint32_t cli_state_server_session_key(struct cli_state *cli);

View File

@ -35,6 +35,7 @@
#include "libsmb/libsmb.h"
#include "auth/gensec/gensec.h"
#include "auth/credentials/credentials.h"
#include "../libcli/smb/smbXcli_base.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_CLI
@ -2608,7 +2609,7 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
result->abstract_syntax = *abstract_syntax;
result->transfer_syntax = ndr_transfer_syntax_ndr;
result->desthost = talloc_strdup(result, cli_state_remote_name(cli));
result->desthost = talloc_strdup(result, smbXcli_conn_remote_name(cli->conn));
result->srv_name_slash = talloc_asprintf_strupper_m(
result, "\\\\%s", result->desthost);
@ -2661,7 +2662,7 @@ static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli,
{
switch (transport) {
case NCACN_IP_TCP:
return rpc_pipe_open_tcp(NULL, cli_state_remote_name(cli),
return rpc_pipe_open_tcp(NULL, smbXcli_conn_remote_name(cli->conn),
interface, presult);
case NCACN_NP:
return rpc_pipe_open_np(cli, interface, presult);

View File

@ -28,6 +28,7 @@
#include "passdb.h"
#include "libsmb/libsmb.h"
#include "auth/gensec/gensec.h"
#include "../libcli/smb/smbXcli_base.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_CLI
@ -57,7 +58,7 @@ static NTSTATUS get_schannel_session_key_common(struct rpc_pipe_client *netlogon
}
status = rpccli_netlogon_setup_creds(netlogon_pipe,
cli_state_remote_name(cli), /* server name */
smbXcli_conn_remote_name(cli->conn), /* server name */
domain, /* domain */
lp_netbios_name(), /* client name */
machine_account, /* machine account name */
@ -69,14 +70,14 @@ static NTSTATUS get_schannel_session_key_common(struct rpc_pipe_client *netlogon
DEBUG(3, ("get_schannel_session_key_common: "
"rpccli_netlogon_setup_creds failed with result %s "
"to server %s, domain %s, machine account %s.\n",
nt_errstr(status), cli_state_remote_name(cli), domain,
nt_errstr(status), smbXcli_conn_remote_name(cli->conn), domain,
machine_account ));
return status;
}
if (((*pneg_flags) & NETLOGON_NEG_SCHANNEL) == 0) {
DEBUG(3, ("get_schannel_session_key: Server %s did not offer schannel\n",
cli_state_remote_name(cli)));
smbXcli_conn_remote_name(cli->conn)));
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
@ -103,7 +104,7 @@ static NTSTATUS get_schannel_session_key_auth_ntlmssp(struct cli_state *cli,
cli, &ndr_table_netlogon, NCACN_NP,
GENSEC_OID_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY,
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
domain, username, password, &netlogon_pipe);
if (!NT_STATUS_IS_OK(status)) {
return status;
@ -145,7 +146,7 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("cli_rpc_pipe_open_ntlmssp_auth_schannel: failed to get schannel session "
"key from server %s for domain %s.\n",
cli_state_remote_name(cli), domain ));
smbXcli_conn_remote_name(cli->conn), domain ));
return status;
}
@ -184,7 +185,7 @@ NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("cli_rpc_pipe_open_schannel: failed to get schannel session "
"key from server %s for domain %s.\n",
cli_state_remote_name(cli), domain ));
smbXcli_conn_remote_name(cli->conn), domain ));
return status;
}

View File

@ -32,6 +32,7 @@
#include "passdb.h"
#include "libsmb/libsmb.h"
#include "auth/gensec/gensec.h"
#include "../libcli/smb/smbXcli_base.h"
enum pipe_auth_type_spnego {
PIPE_AUTH_TYPE_SPNEGO_NONE = 0,
@ -707,7 +708,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
default_transport,
oid,
pipe_default_auth_level,
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
get_cmdline_auth_info_domain(auth_info),
get_cmdline_auth_info_username(auth_info),
get_cmdline_auth_info_password(auth_info),
@ -721,7 +722,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
default_transport,
pipe_default_auth_type,
pipe_default_auth_level,
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
get_cmdline_auth_info_domain(auth_info),
get_cmdline_auth_info_username(auth_info),
get_cmdline_auth_info_password(auth_info),

View File

@ -28,6 +28,7 @@
#include "utils/net.h"
#include "libsmb/libsmb.h"
#include "libsmb/clirap.h"
#include "../libcli/smb/smbXcli_base.h"
/* The following messages were for error checking that is not properly
reported at the moment. Which should be reinstated? */
@ -702,7 +703,7 @@ static int rap_printq_info(struct net_context *c, int argc, const char **argv)
if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli)))
return -1;
d_printf(PRINTQ_ENUM_DISPLAY, cli_state_remote_name(cli)); /* list header */
d_printf(PRINTQ_ENUM_DISPLAY, smbXcli_conn_remote_name(cli->conn)); /* list header */
ret = cli_NetPrintQGetInfo(cli, argv[0], enum_queue, enum_jobs);
cli_shutdown(cli);
return ret;
@ -763,7 +764,7 @@ int net_rap_printq(struct net_context *c, int argc, const char **argv)
if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli)))
return -1;
d_printf(PRINTQ_ENUM_DISPLAY, cli_state_remote_name(cli)); /* list header */
d_printf(PRINTQ_ENUM_DISPLAY, smbXcli_conn_remote_name(cli->conn)); /* list header */
ret = cli_NetPrintQEnum(cli, enum_queue, enum_jobs);
cli_shutdown(cli);
return ret;

View File

@ -207,7 +207,7 @@ int run_rpc_command(struct net_context *c,
NCACN_IP_TCP : NCACN_NP,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY,
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
lp_workgroup(), c->opt_user_name,
c->opt_password, &pipe_hnd);
} else {
@ -353,7 +353,7 @@ static NTSTATUS rpc_oldjoin_internals(struct net_context *c,
if (!NT_STATUS_IS_OK(result)) {
DEBUG(0,("rpc_oldjoin_internals: netlogon pipe open to machine %s failed. "
"error was %s\n",
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
nt_errstr(result) ));
return result;
}
@ -3983,7 +3983,7 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c,
/* open share source */
nt_status = connect_to_service(c, &cp_clistate.cli_share_src,
smbXcli_conn_remote_sockaddr(cli->conn),
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
info502.name, "A:");
if (!NT_STATUS_IS_OK(nt_status))
goto done;

View File

@ -123,7 +123,7 @@ NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
} else {
DEBUG(0,("net_rpc_join_ok: failed to get schannel session "
"key from server %s for domain %s. Error was %s\n",
cli_state_remote_name(cli), domain, nt_errstr(ntret) ));
smbXcli_conn_remote_name(cli->conn), domain, nt_errstr(ntret) ));
cli_shutdown(cli);
return ntret;
}
@ -144,7 +144,7 @@ NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
if (!NT_STATUS_IS_OK(ntret)) {
DEBUG(0,("net_rpc_join_ok: failed to open schannel session "
"on netlogon pipe to server %s for domain %s. Error was %s\n",
cli_state_remote_name(cli), domain, nt_errstr(ntret) ));
smbXcli_conn_remote_name(cli->conn), domain, nt_errstr(ntret) ));
/*
* Note: here, we have:
* (pipe_hnd != NULL) if and only if NT_STATUS_IS_OK(ntret)
@ -513,7 +513,7 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
}
/* double-check, connection from scratch */
status = net_rpc_join_ok(c, domain, cli_state_remote_name(cli),
status = net_rpc_join_ok(c, domain, smbXcli_conn_remote_name(cli->conn),
smbXcli_conn_remote_sockaddr(cli->conn));
retval = NT_STATUS_IS_OK(status) ? 0 : -1;

View File

@ -369,9 +369,9 @@ NTSTATUS net_copy_file(struct net_context *c,
d_printf(_("copying [\\\\%s\\%s%s] => [\\\\%s\\%s%s] "
"%s ACLs and %s DOS Attributes %s\n"),
cli_state_remote_name(cli_share_src),
smbXcli_conn_remote_name(cli_share_src->conn),
cli_share_src->share, src_name,
cli_state_remote_name(cli_share_dst),
smbXcli_conn_remote_name(cli_share_dst->conn),
cli_share_dst->share, dst_name,
copy_acls ? _("with") : _("without"),
copy_attrs ? _("with") : _("without"),
@ -389,7 +389,7 @@ NTSTATUS net_copy_file(struct net_context *c,
if (!NT_STATUS_IS_OK(nt_status)) {
d_fprintf(stderr,
_("Error reading file [\\\\%s\\%s%s]: %s\n"),
cli_state_remote_name(cli_share_src),
smbXcli_conn_remote_name(cli_share_src->conn),
cli_share_src->share,
src_name, nt_errstr(nt_status));
goto out;
@ -404,7 +404,7 @@ NTSTATUS net_copy_file(struct net_context *c,
if (!NT_STATUS_IS_OK(nt_status)) {
d_fprintf(stderr,
_("Error writing file: [\\\\%s\\%s%s]: %s\n"),
cli_state_remote_name(cli_share_dst),
smbXcli_conn_remote_name(cli_share_dst->conn),
cli_share_dst->share,
dst_name, nt_errstr(nt_status));
goto out;
@ -1916,7 +1916,7 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
/* open print$-share on the src server */
nt_status = connect_to_service(c, &cli_share_src,
smbXcli_conn_remote_sockaddr(cli->conn),
cli_state_remote_name(cli),
smbXcli_conn_remote_name(cli->conn),
"print$", "A:");
if (!NT_STATUS_IS_OK(nt_status))
goto done;
@ -1927,7 +1927,7 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
/* open print$-share on the dst server */
nt_status = connect_to_service(c, &cli_share_dst,
smbXcli_conn_remote_sockaddr(cli_dst->conn),
cli_state_remote_name(cli_dst),
smbXcli_conn_remote_name(cli_dst->conn),
"print$", "A:");
if (!NT_STATUS_IS_OK(nt_status))
return nt_status;

View File

@ -2212,7 +2212,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
NCACN_NP,
GENSEC_OID_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY,
cli_state_remote_name(conn->cli),
smbXcli_conn_remote_name(conn->cli->conn),
domain_name,
machine_account,
machine_password,
@ -2451,7 +2451,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
(conn->cli, &ndr_table_lsarpc, NCACN_NP,
GENSEC_OID_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY,
cli_state_remote_name(conn->cli),
smbXcli_conn_remote_name(conn->cli->conn),
conn->cli->domain, conn->cli->user_name, conn->cli->password,
&conn->lsa_pipe);