From 2b759339601ad853588cb74e986a7a88301aea17 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 10 Nov 2009 19:49:41 +0100 Subject: s3: Convert libsmb/cli_message to the async API --- source3/client/client.c | 54 +++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) (limited to 'source3/client') diff --git a/source3/client/client.c b/source3/client/client.c index 6b273b47b0..435ede904e 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -243,51 +243,29 @@ static size_t push_source(uint8_t *buf, size_t n, void *priv) static void send_message(const char *username) { - int total_len = 0; - int grp_id; - - if (!cli_message_start(cli, desthost, username, &grp_id)) { - d_printf("message start: %s\n", cli_errstr(cli)); - return; - } - - - d_printf("Connected. Type your message, ending it with a Control-D\n"); - - while (!feof(stdin) && total_len < 1600) { - int maxlen = MIN(1600 - total_len,127); - char msg[1024]; - int l=0; - int c; - - ZERO_ARRAY(msg); + char buf[1600]; + NTSTATUS status; + int i; - for (l=0;l 0) && (strlen(msg) == 0)) { + i = 0; + while (i= 1600) - d_printf("the message was truncated to 1600 bytes\n"); - else - d_printf("sent %d bytes\n",total_len); - - if (!cli_message_end(cli, grp_id)) { - d_printf("SMBsendend failed (%s)\n",cli_errstr(cli)); - return; + status = cli_message(cli, desthost, username, buf); + if (!NT_STATUS_IS_OK(status)) { + d_fprintf(stderr, "cli_message returned %s\n", + nt_errstr(status)); } } -- cgit