1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

s3: Use cli_connect_nb in do_message_op

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun May 29 10:11:54 CEST 2011 on sn-devel-104
This commit is contained in:
Volker Lendecke 2011-05-29 00:59:12 +02:00 committed by Volker Lendecke
parent 8a3199e00d
commit edfa62f2a0

View File

@ -5037,46 +5037,16 @@ static int do_tar_op(const char *base_directory)
static int do_message_op(struct user_auth_info *a_info)
{
struct sockaddr_storage ss;
struct nmb_name called, calling;
fstring server_name;
char name_type_hex[10];
int msg_port;
NTSTATUS status;
make_nmb_name(&calling, calling_name, 0x0);
make_nmb_name(&called , desthost, name_type);
strlcpy(server_name, desthost,sizeof(server_name));
snprintf(name_type_hex, sizeof(name_type_hex), "#%X", name_type);
strlcat(server_name, name_type_hex,sizeof(server_name));
zero_sockaddr(&ss);
if (have_ip)
ss = dest_ss;
/* we can only do messages over port 139 (to windows clients at least) */
msg_port = port ? port : 139;
if (!(cli=cli_initialise())) {
d_printf("Connection to %s failed\n", desthost);
return 1;
}
cli_set_port(cli, msg_port);
status = cli_connect(cli, server_name, &ss);
status = cli_connect_nb(desthost, have_ip ? &dest_ss : NULL,
port ? port : 139, name_type,
calling_name, Undefined, &cli);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to %s failed. Error %s\n", desthost, nt_errstr(status));
return 1;
}
if (!cli_session_request(cli, &calling, &called)) {
d_printf("session request failed\n");
cli_shutdown(cli);
return 1;
}
send_message(get_cmdline_auth_info_username(a_info));
cli_shutdown(cli);