* Plaintext mode needed, assume plaintext supplied.
*/
buf = talloc_array(talloc_tos(), uint8_t, 0);
- buf = smb_bytes_push_str(buf, cli_ucs2(cli), pass, passlen+1,
+ buf = smb_bytes_push_str(buf, smbXcli_conn_use_unicode(cli->conn), pass, passlen+1,
&converted_size);
if (tevent_req_nomem(buf, req)) {
return tevent_req_post(req, ev);
if (tevent_req_nomem(tmp, req)) {
return tevent_req_post(req, ev);
}
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), tmp, strlen(tmp)+1,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), tmp, strlen(tmp)+1,
NULL);
TALLOC_FREE(tmp);
if (tevent_req_nomem(tmp, req)) {
return tevent_req_post(req, ev);
}
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), tmp, strlen(tmp)+1,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), tmp, strlen(tmp)+1,
NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Unix", 5, NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Samba", 6, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "Unix", 5, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "Samba", 6, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
bytes = talloc_array(state, uint8_t, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "", 1, /* username */
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "", 1, /* username */
NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "", 1, /* workgroup */
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "", 1, /* workgroup */
NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Unix", 5, NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Samba", 6, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "Unix", 5, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "Samba", 6, NULL);
if (bytes == NULL) {
TALLOC_FREE(req);
SIVAL(vwv+11, 0, cli_session_setup_capabilities(cli, 0));
bytes = talloc_array(state, uint8_t, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), pass, strlen(pass)+1,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), pass, strlen(pass)+1,
&passlen);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
- SSVAL(vwv + (cli_ucs2(cli) ? 8 : 7), 0, passlen);
+ SSVAL(vwv + (smbXcli_conn_use_unicode(cli->conn) ? 8 : 7), 0, passlen);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
user, strlen(user)+1, NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
workgroup, strlen(workgroup)+1, NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
"Unix", 5, NULL);
version = talloc_asprintf(talloc_tos(), "Samba %s",
if (tevent_req_nomem(version, req)){
return tevent_req_post(req, ev);
}
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
version, strlen(version)+1, NULL);
TALLOC_FREE(version);
data_blob_free(&lm_response);
data_blob_free(&nt_response);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
user, strlen(user)+1, NULL);
/*
if (tevent_req_nomem(workgroup_upper, req)) {
return tevent_req_post(req, ev);
}
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
workgroup_upper, strlen(workgroup_upper)+1,
NULL);
TALLOC_FREE(workgroup_upper);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Unix", 5, NULL);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "Samba", 6, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "Unix", 5, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "Samba", 6, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
state->blob.data += thistime;
state->blob.length -= thistime;
- state->buf = smb_bytes_push_str(state->buf, cli_ucs2(state->cli),
+ state->buf = smb_bytes_push_str(state->buf, smbXcli_conn_use_unicode(state->cli->conn),
"Unix", 5, NULL);
- state->buf = smb_bytes_push_str(state->buf, cli_ucs2(state->cli),
+ state->buf = smb_bytes_push_str(state->buf, smbXcli_conn_use_unicode(state->cli->conn),
"Samba", 6, NULL);
if (state->buf == NULL) {
return false;
TALLOC_FREE(req);
return NULL;
}
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), tmp, strlen(tmp)+1,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), tmp, strlen(tmp)+1,
NULL);
TALLOC_FREE(tmp);
bytes = talloc_array(talloc_tos(), uint8_t, 0);
bytes = smb_bytes_push_bytes(bytes, 4, NULL, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
service, strlen(service)+1, NULL);
bytes = smb_bytes_push_bytes(bytes, 4, NULL, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
pass, strlen(pass)+1, NULL);
bytes = smb_bytes_push_bytes(bytes, 4, NULL, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
dev, strlen(dev)+1, NULL);
status = cli_smb(talloc_tos(), cli, SMBtcon, 0, 0, NULL,
}
SSVAL(param, 0, 0x03); /* max referral level */
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
path, strlen(path)+1,
NULL);
if (!param) {
return old_state;
}
-/****************************************************************************
- convenience routine to find if we negotiated ucs2
-****************************************************************************/
-
-bool cli_ucs2(struct cli_state *cli)
-{
- return smbXcli_conn_use_unicode(cli->conn);
-}
-
/****************************************************************************
Initialize Domain, user or password.
****************************************************************************/
SSVAL(state->param, 0, level);
state->param = trans2_bytes_push_str(
- state->param, cli_ucs2(cli), path, strlen(path)+1, NULL);
+ state->param, smbXcli_conn_use_unicode(cli->conn), path, strlen(path)+1, NULL);
if (tevent_req_nomem(state->param, req)) {
return tevent_req_post(req, ev);
}
return tevent_req_post(req, ev);
}
state->data = trans2_bytes_push_str(
- state->data, cli_ucs2(cli), oldname, strlen(oldname)+1, NULL);
+ state->data, smbXcli_conn_use_unicode(cli->conn), oldname, strlen(oldname)+1, NULL);
subreq = cli_setpathinfo_send(
state, ev, cli, level, newname,
{
struct tevent_req *req = NULL, *subreq = NULL;
struct readlink_state *state = NULL;
- uint32_t maxbytelen = (uint32_t)(cli_ucs2(cli) ? len*3 : len);
+ uint32_t maxbytelen = (uint32_t)(smbXcli_conn_use_unicode(cli->conn) ? len*3 : len);
req = tevent_req_create(mem_ctx, &state, struct readlink_state);
if (req == NULL) {
}
/* The returned data is a pushed string, not raw data. */
if (!convert_string_talloc(state,
- cli_ucs2(cli) ? CH_UTF16LE : CH_DOS,
+ smbXcli_conn_use_unicode(cli->conn) ? CH_UTF16LE : CH_DOS,
CH_UNIX,
state->data,
state->num_data,
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname_src,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_src,
strlen(fname_src)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[talloc_get_size(bytes)-1] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname_dst,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_dst,
strlen(fname_dst)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname_src,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_src,
strlen(fname_src)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[talloc_get_size(bytes)-1] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname_dst,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_dst,
strlen(fname_dst)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname,
strlen(fname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), dname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), dname,
strlen(dname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), dname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), dname,
strlen(dname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
SCVAL(vwv+23, 1, SecurityFlags);
bytes = talloc_array(state, uint8_t, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli),
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
fname, strlen(fname)+1,
&converted_len);
/* sigh. this copes with broken netapp filer behaviour */
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "", 1, NULL);
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "", 1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
return tevent_req_post(req, ev);
}
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
fname, strlen(fname),
&converted_len);
if (tevent_req_nomem(param, req)) {
}
bytes = talloc_array(state, uint8_t, 0);
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname,
strlen(fname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname,
strlen(fname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname,
strlen(fname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[talloc_get_size(bytes)-1] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), "",
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), "",
1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname,
strlen(fname)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), path,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), path,
strlen(path)+1, NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
SSVAL(param,2,0);
SSVAL(param,4,0);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
path, strlen(path)+1,
NULL);
param_len = talloc_get_size(param);
memset(state->param, '\0', 6);
SSVAL(state->param, 0, SMB_POSIX_PATH_OPEN);
- state->param = trans2_bytes_push_str(state->param, cli_ucs2(cli), fname,
+ state->param = trans2_bytes_push_str(state->param, smbXcli_conn_use_unicode(cli->conn), fname,
strlen(fname)+1, NULL);
if (tevent_req_nomem(state->param, req)) {
}
SSVAL(state->param, 0, level);
state->param = trans2_bytes_push_str(
- state->param, cli_ucs2(cli), fname, strlen(fname)+1, NULL);
+ state->param, smbXcli_conn_use_unicode(cli->conn), fname, strlen(fname)+1, NULL);
if (tevent_req_nomem(state->param, req)) {
return tevent_req_post(req, ev);
}
return tevent_req_post(req, ev);
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), mask,
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), mask,
strlen(mask)+1, NULL);
bytes = smb_bytes_push_bytes(bytes, 5, (const uint8_t *)&zero, 2);
return;
}
bytes[0] = 4;
- bytes = smb_bytes_push_str(bytes, cli_ucs2(state->cli), "",
+ bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(state->cli->conn), "",
1, NULL);
bytes = smb_bytes_push_bytes(bytes, 5, state->search_status,
sizeof(state->search_status));
SSVAL(state->param, 6, state->info_level);
SIVAL(state->param, 8, 0);
- state->param = trans2_bytes_push_str(state->param, cli_ucs2(cli),
+ state->param = trans2_bytes_push_str(state->param, smbXcli_conn_use_unicode(cli->conn),
state->mask, strlen(state->mask)+1,
NULL);
if (tevent_req_nomem(state->param, req)) {
data_blob_free(&last_name_raw);
} else {
state->param = trans2_bytes_push_str(state->param,
- cli_ucs2(state->cli),
+ smbXcli_conn_use_unicode(state->cli->conn),
state->mask,
strlen(state->mask)+1,
NULL);
/* The returned data is a pushed string, not raw data. */
if (!convert_string_talloc(talloc_tos(),
- cli_ucs2(cli) ? CH_UTF16LE : CH_DOS,
+ smbXcli_conn_use_unicode(cli->conn) ? CH_UTF16LE : CH_DOS,
CH_UNIX,
rdata + 4,
len,
DATA_BLOB data);
NTSTATUS cli_echo_recv(struct tevent_req *req);
NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
-bool cli_ucs2(struct cli_state *cli);
bool is_andx_req(uint8_t cmd);
NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
uint8_t smb_command, uint8_t additional_flags,
#include "system/filesys.h"
#include "torture/proto.h"
#include "libsmb/libsmb.h"
+#include "../libcli/smb/smbXcli_base.h"
#define VERBOSE 0
#define OP_MIN 0
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
fname, strlen(fname)+1, NULL);
if (param == NULL) return True;
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
newfname, strlen(newfname)+1, NULL);
if (param == NULL) return True;
if (param == NULL) return True;
SSVAL(param, 0, level);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
dname, strlen(dname)+1, NULL);
if (param == NULL) return True;
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
fname, strlen(fname)+1, NULL);
if (param == NULL) return True;
SSVAL(param, 0, level);
SSVAL(param, 2, 0);
SSVAL(param, 4, 0);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
newfname, strlen(newfname)+1, NULL);
if (param == NULL) return True;
if (param == NULL) return True;
SSVAL(param, 0, level);
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
dname, strlen(dname)+1, NULL);
if (param == NULL) return True;