Do an old lanman2 style session setup.
****************************************************************************/
-static BOOL cli_session_setup_lanman2(struct cli_state *cli, char *user,
- char *pass, int passlen, const char *workgroup)
+static BOOL cli_session_setup_lanman2(struct cli_state *cli, const char *user,
+ const char *pass, int passlen, const char *workgroup)
{
fstring pword;
char *p;
if (cli->capabilities & CAP_UNICODE)
capabilities |= CAP_UNICODE;
+ if (cli->capabilities & CAP_LARGE_FILES)
+ capabilities |= CAP_LARGE_FILES;
+
return capabilities;
}
Do a NT1 plaintext session setup.
****************************************************************************/
-static BOOL cli_session_setup_plaintext(struct cli_state *cli, char *user,
- char *pass, char *workgroup)
+static BOOL cli_session_setup_plaintext(struct cli_state *cli, const char *user,
+ const char *pass, const char *workgroup)
{
uint32 capabilities = cli_session_setup_capabilities(cli);
char *p;
- int push_flags = STR_TERMINATE;
-
- if (capabilities & CAP_UNICODE)
- push_flags |= STR_UNICODE;
- else
- push_flags |= STR_ASCII;
set_message(cli->outbuf,13,0,True);
SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
SSVAL(cli->outbuf,smb_vwv8,0);
SIVAL(cli->outbuf,smb_vwv11,capabilities);
p = smb_buf(cli->outbuf);
- p += clistr_push(cli, p, pass, -1, push_flags); /* password */
+ p += clistr_push(cli, p, pass, -1, STR_TERMINATE); /* password */
SSVAL(cli->outbuf,smb_vwv7,PTR_DIFF(p, smb_buf(cli->outbuf)));
p += clistr_push(cli, p, user, -1, STR_TERMINATE); /* username */
p += clistr_push(cli, p, workgroup, -1, STR_TERMINATE); /* workgroup */
return True;
}
-static void set_signing_on_cli (struct cli_state *cli, char* pass, uint8 response[24])
+static void set_signing_on_cli (struct cli_state *cli, const char* pass, uint8 response[24])
{
uint8 zero_sig[8];
ZERO_STRUCT(zero_sig);
@param workgroup The user's domain.
****************************************************************************/
-static BOOL cli_session_setup_nt1(struct cli_state *cli, char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *workgroup)
+static BOOL cli_session_setup_nt1(struct cli_state *cli, const char *user,
+ const char *pass, int passlen,
+ const char *ntpass, int ntpasslen,
+ const char *workgroup)
{
uint32 capabilities = cli_session_setup_capabilities(cli);
uchar pword[24];
/* Have plaintext orginal */
set_signing_on_cli(cli, pass, ntpword);
}
-
+
return True;
}
Do a spnego/kerberos encrypted session setup.
****************************************************************************/
-static BOOL cli_session_setup_kerberos(struct cli_state *cli, char *principal, char *workgroup)
+static BOOL cli_session_setup_kerberos(struct cli_state *cli, const char *principal, const char *workgroup)
{
DATA_BLOB blob2, negTokenTarg;
Do a spnego/NTLMSSP encrypted session setup.
****************************************************************************/
-static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, char *user,
- char *pass, char *workgroup)
+static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, const char *user,
+ const char *pass, const char *workgroup)
{
DATA_BLOB msg1, struct_blob;
DATA_BLOB blob, chal1, chal2, auth, challenge_blob;
neg_flags = NTLMSSP_NEGOTIATE_UNICODE |
NTLMSSP_NEGOTIATE_128 |
- NTLMSSP_NEGOTIATE_NTLM;
+ NTLMSSP_NEGOTIATE_NTLM |
+ NTLMSSP_REQUEST_TARGET;
memset(sess_key, 0, 16);
"NTLMSSP",
NTLMSSP_NEGOTIATE,
neg_flags,
- workgroup, strlen(workgroup),
- cli->calling.name, strlen(cli->calling.name) + 1);
+ workgroup,
+ cli->calling.name);
DEBUG(10, ("neg_flags: %0X, workgroup: %s, calling name %s\n",
neg_flags, workgroup, cli->calling.name));
/* and wrap it in a SPNEGO wrapper */
Do a spnego encrypted session setup.
****************************************************************************/
-static BOOL cli_session_setup_spnego(struct cli_state *cli, char *user,
- char *pass, char *workgroup)
+static BOOL cli_session_setup_spnego(struct cli_state *cli, const char *user,
+ const char *pass, const char *workgroup)
{
char *principal;
char *OIDs[ASN1_MAX_OIDS];
****************************************************************************/
BOOL cli_session_setup(struct cli_state *cli,
- char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *workgroup)
+ const char *user,
+ const char *pass, int passlen,
+ const char *ntpass, int ntpasslen,
+ const char *workgroup)
{
char *p;
fstring user2;
Initialise client credentials for authenticated pipe access.
****************************************************************************/
-static void init_creds(struct ntuser_creds *creds, char* username,
- char* domain, char* password)
+static void init_creds(struct ntuser_creds *creds, const char* username,
+ const char* domain, const char* password)
{
ZERO_STRUCTP(creds);
@param user Username, unix string
@param domain User's domain
@param password User's password, unencrypted unix string.
+ @param retry BOOL. Did this connection fail with a retryable error ?
*/
NTSTATUS cli_full_connection(struct cli_state **output_cli,
const char *my_name,
const char *dest_host,
struct in_addr *dest_ip, int port,
- char *service, char *service_type,
- char *user, char *domain,
- char *password, int flags)
+ const char *service, const char *service_type,
+ const char *user, const char *domain,
+ const char *password, int flags,
+ BOOL *retry)
{
struct ntuser_creds creds;
NTSTATUS nt_status;
struct nmb_name called;
struct cli_state *cli;
struct in_addr ip;
- extern pstring global_myname;
+
+ if (retry)
+ *retry = False;
if (!my_name)
- my_name = global_myname;
+ my_name = global_myname();
if (!(cli = cli_initialise(NULL)))
return NT_STATUS_NO_MEMORY;
return NT_STATUS_UNSUCCESSFUL;
}
+ cli_set_timeout(cli, 10000); /* 10 seconds. */
+
if (dest_ip)
ip = *dest_ip;
else
return NT_STATUS_UNSUCCESSFUL;
}
+ if (retry)
+ *retry = True;
+
if (!cli_session_request(cli, &calling, &called)) {
char *p;
DEBUG(1,("session request to %s failed (%s)\n",
if (service) {
if (!cli_send_tconX(cli, service, service_type,
- (char*)password, strlen(password)+1)) {
- DEBUG(1,("failed tcon_X with %s\n", nt_errstr(nt_status)));
+ password, strlen(password)+1)) {
nt_status = cli_nt_error(cli);
+ DEBUG(1,("failed tcon_X with %s\n", nt_errstr(nt_status)));
cli_shutdown(cli);
if (NT_STATUS_IS_OK(nt_status)) {
nt_status = NT_STATUS_UNSUCCESSFUL;
Attempt a NetBIOS session request, falling back to *SMBSERVER if needed.
****************************************************************************/
-BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
+BOOL attempt_netbios_session_request(struct cli_state *cli, const char *srchost, const char *desthost,
struct in_addr *pdest_ip)
{
struct nmb_name calling, called;