#include "libcli/security/proto.h"
#include "param/param.h"
#include "lib/registry/registry.h"
-
-static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx)
-{
- struct cli_credentials *result;
-
- if (!(result = cli_credentials_init(mem_ctx))) {
- return NULL;
- }
-
- cli_credentials_set_conf(result, global_loadparm);
- cli_credentials_set_anonymous(result);
-
- return result;
-}
+#include "libcli/resolve/resolve.h"
/*
* This tests a RPC call using an invalid vuid
struct dcerpc_pipe *lsa_pipe;
struct cli_credentials *anon_creds;
struct smb_composite_sesssetup setup;
+ struct smbcli_options options;
mem_ctx = talloc_init("torture_bind_authcontext");
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
- NULL);
+ lp_resolve_context(torture->lp_ctx),
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
goto done;
}
- lsa_pipe = dcerpc_pipe_init(mem_ctx, cli->transport->socket->event.ctx);
+ lsa_pipe = dcerpc_pipe_init(mem_ctx, cli->transport->socket->event.ctx,
+ lp_iconv_convenience(torture->lp_ctx));
if (lsa_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
goto done;
}
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) {
d_printf("create_anon_creds failed\n");
goto done;
}
static bool bindtest(struct smbcli_state *cli,
struct cli_credentials *credentials,
+ struct loadparm_context *lp_ctx,
uint8_t auth_type, uint8_t auth_level)
{
TALLOC_CTX *mem_ctx;
}
lsa_pipe = dcerpc_pipe_init(mem_ctx,
- cli->transport->socket->event.ctx);
+ cli->transport->socket->event.ctx,
+ lp_iconv_convenience(lp_ctx));
if (lsa_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
}
status = dcerpc_bind_auth(lsa_pipe, &ndr_table_lsarpc,
- credentials, auth_type, auth_level,
+ credentials, lp_ctx, auth_type, auth_level,
NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("dcerpc_bind_auth failed: %s\n", nt_errstr(status));
NTSTATUS status;
bool ret = false;
struct smbcli_state *cli;
+ struct smbcli_options options;
mem_ctx = talloc_init("torture_bind_authcontext");
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
+ lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
- NULL);
+ lp_resolve_context(torture->lp_ctx),
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
ret = true;
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY);
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY);
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
DCERPC_AUTH_LEVEL_INTEGRITY);
- ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO,
+ ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
DCERPC_AUTH_LEVEL_PRIVACY);
done:
static NTSTATUS get_usr_handle(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
uint8_t auth_type,
uint8_t auth_level,
uint32_t user_rid,access_granted;
samr_pipe = dcerpc_pipe_init(mem_ctx,
- cli->transport->socket->event.ctx);
+ cli->transport->socket->event.ctx,
+ lp_iconv_convenience(lp_ctx));
if (samr_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
status = NT_STATUS_NO_MEMORY;
if (admin_creds != NULL) {
status = dcerpc_bind_auth(samr_pipe, &ndr_table_samr,
- admin_creds, auth_type, auth_level,
+ admin_creds, lp_ctx, auth_type, auth_level,
NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("dcerpc_bind_auth failed: %s\n",
*/
static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
const char *username, const char *password,
char **domain_name,
return false;
}
- status = get_usr_handle(cli, tmp_ctx, admin_creds,
+ status = get_usr_handle(cli, tmp_ctx, lp_ctx, admin_creds,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY,
username, domain_name, &samr_pipe, &wks_handle,
user_sid);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("get_wks_handle failed: %s\n", nt_errstr(status));
+ d_printf("get_usr_handle failed: %s\n", nt_errstr(status));
goto done;
}
*/
static bool delete_user(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
const char *username)
{
return false;
}
- status = get_usr_handle(cli, mem_ctx, admin_creds,
+ status = get_usr_handle(cli, mem_ctx, lp_ctx, admin_creds,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY,
username, &dom_name, &samr_pipe,
*/
static bool join3(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
bool use_level25,
struct cli_credentials *admin_creds,
struct cli_credentials *wks_creds)
}
status = get_usr_handle(
- cli, mem_ctx, admin_creds,
+ cli, mem_ctx, lp_ctx, admin_creds,
DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY,
talloc_asprintf(mem_ctx, "%s$",
*/
static bool auth2(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *wks_cred)
{
TALLOC_CTX *mem_ctx;
}
net_pipe = dcerpc_pipe_init(mem_ctx,
- cli->transport->socket->event.ctx);
+ cli->transport->socket->event.ctx,
+ lp_iconv_convenience(lp_ctx));
if (net_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
*/
static bool schan(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *wks_creds,
struct cli_credentials *user_creds)
{
}
net_pipe = dcerpc_pipe_init(mem_ctx,
- cli->transport->socket->event.ctx);
+ cli->transport->socket->event.ctx,
+ lp_iconv_convenience(lp_ctx));
if (net_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
#if 1
net_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
status = dcerpc_bind_auth(net_pipe, &ndr_table_netlogon,
- wks_creds, DCERPC_AUTH_TYPE_SCHANNEL,
+ wks_creds, lp_ctx, DCERPC_AUTH_TYPE_SCHANNEL,
DCERPC_AUTH_LEVEL_PRIVACY,
NULL);
#else
generate_random_buffer(chal.data, chal.length);
names_blob = NTLMv2_generate_names_blob(
- mem_ctx, cli_credentials_get_workstation(user_creds),
+ mem_ctx, lp_iconv_convenience(lp_ctx),
+ cli_credentials_get_workstation(user_creds),
cli_credentials_get_domain(user_creds));
status = cli_credentials_get_ntlm_response(
user_creds, mem_ctx, &flags, chal, names_blob,
*/
static bool leave(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *admin_creds,
struct cli_credentials *wks_creds)
{
NULL, "%s$", cli_credentials_get_workstation(wks_creds));
bool ret;
- ret = delete_user(cli, admin_creds, wks_name);
+ ret = delete_user(cli, lp_ctx, admin_creds, wks_name);
talloc_free(wks_name);
return ret;
}
struct cli_credentials *wks_creds;
const char *wks_name;
int i;
+ struct smbcli_options options;
wks_name = torture_setting_string(torture, "wksname", NULL);
if (wks_name == NULL) {
return false;
}
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) {
d_printf("create_anon_creds failed\n");
goto done;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(mem_ctx, &cli,
torture_setting_string(torture, "host", NULL),
- "IPC$", NULL, anon_creds, NULL);
+ lp_smb_ports(torture->lp_ctx),
+ "IPC$", NULL, anon_creds,
+ lp_resolve_context(torture->lp_ctx),
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
generate_random_str(wks_creds, 8),
CRED_SPECIFIED);
- if (!join3(cli, false, cmdline_credentials, wks_creds)) {
+ if (!join3(cli, torture->lp_ctx, false, cmdline_credentials, wks_creds)) {
d_printf("join failed\n");
goto done;
}
int j;
- if (!auth2(cli, wks_creds)) {
+ if (!auth2(cli, torture->lp_ctx, wks_creds)) {
d_printf("auth2 failed\n");
goto done;
}
for (j=0; j<2; j++) {
- if (!schan(cli, wks_creds, cmdline_credentials)) {
+ if (!schan(cli, torture->lp_ctx, wks_creds, cmdline_credentials)) {
d_printf("schan failed\n");
goto done;
}
}
}
- if (!leave(cli, cmdline_credentials, wks_creds)) {
+ if (!leave(cli, torture->lp_ctx, cmdline_credentials, wks_creds)) {
d_printf("leave failed\n");
goto done;
}
* credentials
*/
-static bool test_join3(TALLOC_CTX *mem_ctx,
+static bool test_join3(struct torture_context *tctx,
bool use_level25,
struct cli_credentials *smb_creds,
struct cli_credentials *samr_creds,
bool ret = false;
struct smbcli_state *cli;
struct cli_credentials *wks_creds;
+ struct smbcli_options options;
- status = smbcli_full_connection(mem_ctx, &cli,
- lp_parm_string(global_loadparm, NULL, "torture", "host"),
- "IPC$", NULL, smb_creds, NULL);
+ lp_smbcli_options(tctx->lp_ctx, &options);
+
+ status = smbcli_full_connection(tctx, &cli,
+ torture_setting_string(tctx, "host", NULL),
+ lp_smb_ports(tctx->lp_ctx),
+ "IPC$", NULL, smb_creds,
+ lp_resolve_context(tctx->lp_ctx),
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
goto done;
}
- cli_credentials_set_conf(wks_creds, global_loadparm);
+ cli_credentials_set_conf(wks_creds, tctx->lp_ctx);
cli_credentials_set_secure_channel_type(wks_creds, SEC_CHAN_WKSTA);
cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED);
cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED);
generate_random_str(wks_creds, 8),
CRED_SPECIFIED);
- if (!join3(cli, use_level25, samr_creds, wks_creds)) {
+ if (!join3(cli, tctx->lp_ctx, use_level25, samr_creds, wks_creds)) {
d_printf("join failed\n");
goto done;
}
cmdline_credentials, cli_credentials_get_domain(wks_creds),
CRED_SPECIFIED);
- if (!auth2(cli, wks_creds)) {
+ if (!auth2(cli, tctx->lp_ctx, wks_creds)) {
d_printf("auth2 failed\n");
goto done;
}
- if (!leave(cli, samr_creds, wks_creds)) {
+ if (!leave(cli, tctx->lp_ctx, samr_creds, wks_creds)) {
d_printf("leave failed\n");
goto done;
}
bool torture_samba3_sessionkey(struct torture_context *torture)
{
- TALLOC_CTX *mem_ctx;
bool ret = false;
struct cli_credentials *anon_creds;
const char *wks_name;
wks_name = torture_setting_string(torture, "wksname", get_myname());
- mem_ctx = talloc_init("torture_samba3_sessionkey");
-
- if (mem_ctx == NULL) {
- d_printf("talloc_init failed\n");
- return false;
- }
-
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(torture))) {
d_printf("create_anon_creds failed\n");
goto done;
}
/* Samba3 in the build farm right now does this happily. Need
* to fix :-) */
- if (test_join3(mem_ctx, false, anon_creds, NULL, wks_name)) {
+ if (test_join3(torture, false, anon_creds, NULL, wks_name)) {
d_printf("join using anonymous bind on an anonymous smb "
"connection succeeded -- HUH??\n");
ret = false;
}
}
- if (!test_join3(mem_ctx, false, anon_creds, cmdline_credentials,
+ if (!test_join3(torture, false, anon_creds, cmdline_credentials,
wks_name)) {
d_printf("join using ntlmssp bind on an anonymous smb "
"connection failed\n");
ret = false;
}
- if (!test_join3(mem_ctx, false, cmdline_credentials, NULL, wks_name)) {
+ if (!test_join3(torture, false, cmdline_credentials, NULL, wks_name)) {
d_printf("join using anonymous bind on an authenticated smb "
"connection failed\n");
ret = false;
}
- if (!test_join3(mem_ctx, false, cmdline_credentials,
+ if (!test_join3(torture, false, cmdline_credentials,
cmdline_credentials,
wks_name)) {
d_printf("join using ntlmssp bind on an authenticated smb "
* The following two are tests for setuserinfolevel 25
*/
- if (!test_join3(mem_ctx, true, anon_creds, cmdline_credentials,
+ if (!test_join3(torture, true, anon_creds, cmdline_credentials,
wks_name)) {
d_printf("join using ntlmssp bind on an anonymous smb "
"connection failed\n");
ret = false;
}
- if (!test_join3(mem_ctx, true, cmdline_credentials, NULL, wks_name)) {
+ if (!test_join3(torture, true, cmdline_credentials, NULL, wks_name)) {
d_printf("join using anonymous bind on an authenticated smb "
"connection failed\n");
ret = false;
*/
static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_tree *tree,
const char *pipe_name,
const struct ndr_interface_table *iface,
NTSTATUS status;
if (!(result = dcerpc_pipe_init(
- mem_ctx, tree->session->transport->socket->event.ctx))) {
+ mem_ctx, tree->session->transport->socket->event.ctx,
+ lp_iconv_convenience(lp_ctx)))) {
return NT_STATUS_NO_MEMORY;
}
* Find out the user SID on this connection
*/
-static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree)
+static struct dom_sid *whoami(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ struct smbcli_tree *tree)
{
struct dcerpc_pipe *lsa;
struct lsa_GetUserName r;
struct lsa_StringPointer authority_name_p;
struct dom_sid *result;
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\lsarpc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\lsarpc",
&ndr_table_lsarpc, &lsa);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) Could not bind to LSA: %s\n",
struct cli_credentials *anon_creds;
struct cli_credentials *user_creds;
char *domain_name;
+ struct smbcli_options options;
if (!(mem_ctx = talloc_new(torture))) {
return false;
}
+ lp_smbcli_options(torture->lp_ctx, &options);
+
status = smbcli_full_connection(
mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
- "IPC$", NULL, cmdline_credentials, NULL);
+ lp_smb_ports(torture->lp_ctx),
+ "IPC$", NULL, cmdline_credentials,
+ lp_resolve_context(torture->lp_ctx),
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));
goto done;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("(%s) whoami on auth'ed connection failed\n",
__location__);
ret = false;
talloc_free(cli);
- if (!(anon_creds = create_anon_creds(mem_ctx))) {
+ if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) {
d_printf("(%s) create_anon_creds failed\n", __location__);
ret = false;
goto done;
status = smbcli_full_connection(
mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
- "IPC$", NULL, anon_creds, NULL);
+ lp_smb_ports(torture->lp_ctx),
+ "IPC$", NULL, anon_creds,
+ lp_resolve_context(torture->lp_ctx),
+ NULL, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) anon smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));
goto done;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("(%s) whoami on anon connection failed\n",
__location__);
ret = false;
generate_random_str(user_creds, 8),
CRED_SPECIFIED);
- if (!create_user(mem_ctx, cli, cmdline_credentials,
+ if (!create_user(mem_ctx, cli, torture->lp_ctx, cmdline_credentials,
cli_credentials_get_username(user_creds),
cli_credentials_get_password(user_creds),
&domain_name, &created_sid)) {
goto done;
}
- if (!(user_sid = whoami(mem_ctx, tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, tree))) {
d_printf("(%s) whoami on user connection failed\n",
__location__);
ret = false;
}
delete:
- if (!delete_user(cli, cmdline_credentials,
+ if (!delete_user(cli, torture->lp_ctx,
+ cmdline_credentials,
cli_credentials_get_username(user_creds))) {
d_printf("(%s) delete_user failed\n", __location__);
ret = false;
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
talloc_free(mem_ctx);
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\pipe\\srvsvc",
- &ndr_table_srvsvc, &p);
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree,
+ "\\pipe\\srvsvc", &ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
__location__, nt_errstr(status));
if (!(torture_open_connection_share(
mem_ctx, &cli,
- torture_setting_string(torture, "host", NULL),
+ torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
goto done;
}
if (!(net_pipe = dcerpc_pipe_init(
- mem_ctx, cli->transport->socket->event.ctx))) {
+ mem_ctx, cli->transport->socket->event.ctx,
+ lp_iconv_convenience(torture->lp_ctx)))) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
}
}
static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_session *sess,
const char *sharename)
{
return NULL;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\srvsvc",
&ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
}
static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_session *sess,
const char *sharename,
struct security_descriptor *sd)
return NT_STATUS_UNSUCCESSFUL;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\srvsvc",
&ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
}
bool try_tcon(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct security_descriptor *orig_sd,
struct smbcli_session *session,
const char *sharename, const struct dom_sid *user_sid,
return false;
}
- status = set_sharesec(mem_ctx, session, sharename, sd);
+ status = set_sharesec(mem_ctx, lp_ctx, session, sharename, sd);
if (!NT_STATUS_IS_OK(status)) {
d_printf("custom set_sharesec failed: %s\n",
nt_errstr(status));
done:
smbcli_rmdir(rmdir_tree, "sharesec_testdir");
- status = set_sharesec(mem_ctx, session, sharename, orig_sd);
+ status = set_sharesec(mem_ctx, lp_ctx, session, sharename, orig_sd);
if (!NT_STATUS_IS_OK(status)) {
d_printf("custom set_sharesec failed: %s\n",
nt_errstr(status));
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
return false;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("whoami failed\n");
talloc_free(mem_ctx);
return false;
}
- sd = get_sharesec(mem_ctx, cli->session, torture_setting_string(torture,
- "share", NULL));
+ sd = get_sharesec(mem_ctx, torture->lp_ctx, cli->session,
+ torture_setting_string(torture, "share", NULL));
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, 0, NT_STATUS_ACCESS_DENIED, NT_STATUS_OK);
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, SEC_FILE_READ_DATA, NT_STATUS_OK,
NT_STATUS_MEDIA_WRITE_PROTECTED);
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, SEC_FILE_ALL, NT_STATUS_OK, NT_STATUS_OK);
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\lsarpc",
&ndr_table_lsarpc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
}
static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree,
+ struct smb_iconv_convenience *iconv_convenience,
char **name)
{
struct rap_WserverGetInfo r;
r.in.level = 0;
r.in.bufsize = 0xffff;
- status = smbcli_rap_netservergetinfo(tree, mem_ctx, &r);
+ status = smbcli_rap_netservergetinfo(tree, iconv_convenience, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
memcpy(servername, r.out.info.info0.name, 16);
servername[16] = '\0';
- if (pull_ascii_talloc(mem_ctx, name, servername) < 0) {
+ if (pull_ascii_talloc(mem_ctx, iconv_convenience,
+ name, servername) < 0) {
return NT_STATUS_NO_MEMORY;
}
}
-static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree,
+static NTSTATUS find_printers(TALLOC_CTX *ctx, struct loadparm_context *lp_ctx,
+ struct smbcli_tree *tree,
const char ***printers, int *num_printers)
{
TALLOC_CTX *mem_ctx;
return NT_STATUS_NO_MEMORY;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\srvsvc", &ndr_table_srvsvc,
+ status = pipe_bind_smb(mem_ctx, lp_ctx,
+ tree, "\\srvsvc", &ndr_table_srvsvc,
&p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("could not bind to srvsvc pipe\n");
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
return false;
}
- status = get_servername(mem_ctx, cli->tree, &servername);
+ status = get_servername(mem_ctx, cli->tree, lp_iconv_convenience(torture->lp_ctx), &servername);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "(%s) get_servername returned %s\n",
__location__, nt_errstr(status));
return false;
}
- if (!NT_STATUS_IS_OK(find_printers(mem_ctx, cli->tree,
+ if (!NT_STATUS_IS_OK(find_printers(mem_ctx, torture->lp_ctx, cli->tree,
&printers, &num_printers))) {
talloc_free(mem_ctx);
return false;
return true;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\spoolss",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\spoolss",
&ndr_table_spoolss, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
}
if (!(torture_open_connection_share(
- mem_ctx, &cli, torture_setting_string(torture, "host", NULL),
+ mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
"IPC$", NULL))) {
d_printf("IPC$ connection failed\n");
talloc_free(mem_ctx);
return false;
}
- status = get_servername(mem_ctx, cli->tree, &servername);
+ status = get_servername(mem_ctx, cli->tree, lp_iconv_convenience(torture->lp_ctx), &servername);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "(%s) get_servername returned %s\n",
__location__, nt_errstr(status));
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\wkssvc",
&ndr_table_wkssvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
}
static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_state *cli,
const char *share,
struct srvsvc_NetShareInfo502 **info)
NTSTATUS status;
if (!(p = dcerpc_pipe_init(cli,
- cli->transport->socket->event.ctx))) {
+ cli->transport->socket->event.ctx,
+ lp_iconv_convenience(lp_ctx)))) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
static NTSTATUS get_hklm_handle(TALLOC_CTX *mem_ctx,
struct smbcli_state *cli,
+ struct smb_iconv_convenience *iconv_convenience,
struct dcerpc_pipe **pipe_p,
struct policy_handle **handle)
{
}
if (!(p = dcerpc_pipe_init(result,
- cli->transport->socket->event.ctx))) {
+ cli->transport->socket->event.ctx,
+ iconv_convenience))) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
}
static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
+ struct smb_iconv_convenience *iconv_convenience,
const char *sharename)
{
struct dcerpc_pipe *p;
mem_ctx = talloc_new(cli);
NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
- status = get_hklm_handle(mem_ctx, cli, &p, &hklm);
+ status = get_hklm_handle(mem_ctx, cli, iconv_convenience, &p, &hklm);
if (!NT_STATUS_IS_OK(status)) {
d_printf("get_hklm_handle failed: %s\n", nt_errstr(status));
goto fail;
return status;
}
-static NTSTATUS torture_samba3_deleteshare(struct smbcli_state *cli,
+static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture,
+ struct smbcli_state *cli,
const char *sharename)
{
struct dcerpc_pipe *p;
mem_ctx = talloc_new(cli);
NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
- status = get_hklm_handle(cli, cli, &p, &hklm);
+ status = get_hklm_handle(cli, cli, lp_iconv_convenience(torture->lp_ctx),
+ &p, &hklm);
if (!NT_STATUS_IS_OK(status)) {
d_printf("get_hklm_handle failed: %s\n", nt_errstr(status));
goto fail;
}
static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
const char *sharename,
const char *parameter,
const char *value)
DATA_BLOB val;
NTSTATUS status;
- status = get_hklm_handle(cli, cli, &p, &hklm);
+ status = get_hklm_handle(cli, cli, lp_iconv_convenience(lp_ctx), &p, &hklm);
if (!NT_STATUS_IS_OK(status)) {
d_printf("get_hklm_handle failed: %s\n", nt_errstr(status));
return status;;
bool ret = false;
const char *comment = "Dummer Kommentar";
- if (!(torture_open_connection(&cli, 0))) {
+ if (!(torture_open_connection(&cli, torture, 0))) {
return false;
}
- status = torture_samba3_createshare(cli, "blubber");
+ status = torture_samba3_createshare(cli, lp_iconv_convenience(torture->lp_ctx), "blubber");
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_createshare failed: "
"%s\n", nt_errstr(status));
goto done;
}
- status = torture_samba3_setconfig(cli, "blubber", "comment", comment);
+ status = torture_samba3_setconfig(cli, torture->lp_ctx, "blubber", "comment", comment);
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_setconfig failed: "
"%s\n", nt_errstr(status));
goto done;
}
- status = get_shareinfo(torture, cli, "blubber", &i);
+ status = get_shareinfo(torture, torture->lp_ctx, cli, "blubber", &i);
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "get_shareinfo failed: "
"%s\n", nt_errstr(status));
goto done;
}
- status = torture_samba3_deleteshare(cli, "blubber");
+ status = torture_samba3_deleteshare(torture, cli, "blubber");
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_deleteshare failed: "
"%s\n", nt_errstr(status));