There're no callers which tried to pass raw {lm,nt}_response any more.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
}
nt_status = cli_session_setup(cli, l_username,
- l_password, strlen(l_password),
- l_password, strlen(l_password),
+ l_password,
lp_workgroup());
if (!NT_STATUS_IS_OK(nt_status)) {
d_printf("session setup failed: %s\n", nt_errstr(nt_status));
}
nt_status = cli_session_setup(cli, username,
- password, strlen(password) + 1,
- password, strlen(password) + 1,
+ password,
workgroup);
if (!NT_STATUS_IS_OK(nt_status)) {
fprintf(stderr, "ERROR: Session setup failed: %s\n", nt_errstr(nt_status));
struct tevent_context *ev,
struct cli_state *cli,
const char *user,
- const char *pass, int passlen,
- const char *ntpass, int ntpasslen,
+ const char *pass,
const char *workgroup)
{
struct tevent_req *req, *subreq;
char *p;
char *user2;
uint16_t sec_mode = smb1cli_conn_server_security_mode(cli->conn);
+ int passlen = 0;
+
+ if (pass != NULL) {
+ passlen = strlen(pass);
+ if (passlen > 0) {
+ /*
+ * If we have a realm password
+ * we include the terminating '\0'
+ */
+ passlen += 1;
+ }
+ }
req = tevent_req_create(mem_ctx, &state,
struct cli_session_setup_state);
}
subreq = cli_session_setup_nt1_send(
- state, ev, cli, user, pass, passlen, ntpass, ntpasslen,
+ state, ev, cli, user, pass, passlen, pass, passlen,
workgroup);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
NTSTATUS cli_session_setup(struct cli_state *cli,
const char *user,
- const char *pass, int passlen,
- const char *ntpass, int ntpasslen,
+ const char *pass,
const char *workgroup)
{
struct tevent_context *ev;
if (ev == NULL) {
goto fail;
}
- req = cli_session_setup_send(ev, ev, cli, user, pass, passlen,
- ntpass, ntpasslen, workgroup);
+ req = cli_session_setup_send(ev, ev, cli, user, pass, workgroup);
if (req == NULL) {
goto fail;
}
}
subreq = cli_session_setup_send(
state, state->ev, state->cli, state->user,
- state->password, state->pw_len, state->password, state->pw_len,
- state->domain);
+ state->password, state->domain);
if (tevent_req_nomem(subreq, req)) {
return;
}
state->flags &= ~CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK;
subreq = cli_session_setup_send(
- state, state->ev, state->cli, "", "", 0, "", 0,
+ state, state->ev, state->cli, "", "",
state->domain);
if (tevent_req_nomem(subreq, req)) {
return;
}
status = cli_session_setup(c, username,
- password, strlen(password),
- password, strlen(password),
+ password,
domain);
if (!NT_STATUS_IS_OK(status)) {
/* If a password was not supplied then
* try again with a null username. */
if (password[0] || !username[0] ||
get_cmdline_auth_info_use_kerberos(auth_info) ||
- !NT_STATUS_IS_OK(status = cli_session_setup(c, "",
- "", 0,
- "", 0,
+ !NT_STATUS_IS_OK(status = cli_session_setup(c, "", "",
lp_workgroup()))) {
d_printf("session setup failed: %s\n",
nt_errstr(status));
const char *server_n = server;
int is_ipc = (share != NULL && strcmp(share, "IPC$") == 0);
uint32_t fs_attrs = 0;
- const char *username_used;
+ const char *username_used = NULL;
+ const char *password_used = NULL;
NTSTATUS status;
char *newserver, *newshare;
int flags = 0;
smb2cli_conn_set_max_credits(c->conn, DEFAULT_SMB2_MAX_CREDITS);
}
- username_used = *pp_username;
+ username_used = *pp_username;
+ password_used = *pp_password;
if (!NT_STATUS_IS_OK(cli_session_setup(c, username_used,
- *pp_password,
- strlen(*pp_password),
- *pp_password,
- strlen(*pp_password),
+ password_used,
*pp_workgroup))) {
/* Failed. Try an anonymous login, if allowed by flags. */
- username_used = "";
+ username_used = "";
+ password_used = "";
if (smbc_getOptionNoAutoAnonymousLogin(context) ||
- !NT_STATUS_IS_OK(cli_session_setup(c, username_used,
- *pp_password, 1,
- *pp_password, 0,
+ !NT_STATUS_IS_OK(cli_session_setup(c, username_used,
+ password_used,
*pp_workgroup))) {
cli_shutdown(c);
/* Attempt UNIX smb encryption. */
if (!NT_STATUS_IS_OK(cli_force_encryption(c,
username_used,
- *pp_password,
+ password_used,
*pp_workgroup))) {
/*
/* Given things like SMB signing, restrict anonymous and the like,
try an authenticated connection first */
result = cli_session_setup(cli, user_name,
- old_passwd, strlen(old_passwd)+1,
- old_passwd, strlen(old_passwd)+1, "");
+ old_passwd, "");
if (!NT_STATUS_IS_OK(result)) {
* Thanks to <Nicholas.S.Jenkins@cdc.com> for this fix.
*/
- result = cli_session_setup(cli, "", "", 0, "", 0, "");
+ result = cli_session_setup(cli, "", "", "");
if (!NT_STATUS_IS_OK(result)) {
if (asprintf(err_str, "machine %s rejected the session "
struct tevent_context *ev,
struct cli_state *cli,
const char *user,
- const char *pass, int passlen,
- const char *ntpass, int ntpasslen,
+ const char *pass,
const char *workgroup);
NTSTATUS cli_session_setup_recv(struct tevent_req *req);
NTSTATUS cli_session_setup(struct cli_state *cli,
const char *user,
- const char *pass, int passlen,
- const char *ntpass, int ntpasslen,
+ const char *pass,
const char *workgroup);
struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
return;
}
- if (!NT_STATUS_IS_OK(cli_session_setup(cli, "", "", 1, "", 0,
+ if (!NT_STATUS_IS_OK(cli_session_setup(cli, "", "",
workgroup))) {
cli_shutdown(cli);
return;
}
status = cli_session_setup(c, username,
- password, strlen(password),
- password, strlen(password),
+ password,
lp_workgroup());
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("session setup failed: %s\n", nt_errstr(status)));
}
status = cli_session_setup(cli, username,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_session_setup returned %s\n", nt_errstr(status));
}
status = cli_session_setup(cli1, username,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_session_setup returned %s\n", nt_errstr(status));
}
status = cli_session_setup(cli, username,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("cli_session_setup returned %s\n", nt_errstr(status));
}
status = cli_session_setup(cli1, username,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_sesssetup returned %s\n", nt_errstr(status));
}
status = cli_session_setup(cli, username,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_sesssetup returned %s\n", nt_errstr(status));
bool torture_cli_session_setup2(struct cli_state *cli, uint16_t *new_vuid)
{
uint16_t old_vuid = cli_state_get_uid(cli);
- size_t passlen = strlen(password);
NTSTATUS status;
bool ret;
cli_state_set_uid(cli, 0);
status = cli_session_setup(cli, username,
- password, passlen,
- password, passlen,
+ password,
workgroup);
ret = NT_STATUS_IS_OK(status);
*new_vuid = cli_state_get_uid(cli);
return False;
}
- status = cli_session_setup(c_nt, "", "", 0, "", 0, workgroup);
+ status = cli_session_setup(c_nt, "", "", workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("%s rejected the NT-error initial session setup (%s)\n",host, nt_errstr(status));
return False;
return False;
}
- status = cli_session_setup(c_dos, "", "", 0, "", 0, workgroup);
+ status = cli_session_setup(c_dos, "", "", workgroup);
if (!NT_STATUS_IS_OK(status)) {
printf("%s rejected the DOS-error initial session setup (%s)\n",
host, nt_errstr(status));
fstr_sprintf(user, "%X", error);
status = cli_session_setup(c_nt, user,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (NT_STATUS_IS_OK(status)) {
printf("/** Session setup succeeded. This shouldn't happen...*/\n");
}
status = cli_session_setup(c_dos, user,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (NT_STATUS_IS_OK(status)) {
printf("/** Session setup succeeded. This shouldn't happen...*/\n");
for (i=0; i<torture_numops; i++) {
status = cli_session_setup(
c, username,
- password, strlen(password),
- password, strlen(password),
+ password,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) cli_session_setup failed: %s\n",
status = cli_session_setup(cli2,
username,
password,
- strlen(password)+1,
- password,
- strlen(password)+1,
workgroup);
if (!NT_STATUS_IS_OK(status)) {
goto out;
result = cli_session_setup(*cli,
machine_krb5_principal,
machine_password,
- strlen(machine_password)+1,
- machine_password,
- strlen(machine_password)+1,
machine_domain);
if (NT_STATUS_IS_OK(result)) {
result = cli_session_setup(*cli,
machine_account,
machine_password,
- strlen(machine_password)+1,
- machine_password,
- strlen(machine_password)+1,
machine_domain);
}
result = cli_session_setup(*cli,
machine_account,
machine_password,
- strlen(machine_password)+1,
- machine_password,
- strlen(machine_password)+1,
machine_domain);
if (NT_STATUS_IS_OK(result)) {
(*cli)->use_kerberos = False;
- result = cli_session_setup(*cli, "", "", 0, "", 0, "");
+ result = cli_session_setup(*cli, "", "", "");
if (NT_STATUS_IS_OK(result)) {
DEBUG(5, ("Connected anonymously\n"));
goto session_setup_done;