return old_state;
}
-/****************************************************************************
- Initialize Domain, user or password.
-****************************************************************************/
-
-NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain)
-{
- TALLOC_FREE(cli->domain);
- cli->domain = talloc_strdup(cli, domain ? domain : "");
- if (cli->domain == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- return NT_STATUS_OK;
-}
-
-NTSTATUS cli_set_username(struct cli_state *cli, const char *username)
-{
- TALLOC_FREE(cli->user_name);
- cli->user_name = talloc_strdup(cli, username ? username : "");
- if (cli->user_name == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- return NT_STATUS_OK;
-}
-
-NTSTATUS cli_set_password(struct cli_state *cli, const char *password)
-{
- TALLOC_FREE(cli->password);
-
- /* Password can be NULL. */
- if (password) {
- cli->password = talloc_strdup(cli, password);
- if (cli->password == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- } else {
- /* Use zero NTLMSSP hashes and session key. */
- cli->password = NULL;
- }
-
- return NT_STATUS_OK;
-}
-
-/****************************************************************************
- Initialise credentials of a client structure.
-****************************************************************************/
-
-NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password)
-{
- NTSTATUS status = cli_set_username(cli, username);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- status = cli_set_domain(cli, domain);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- DEBUG(10,("cli_init_creds: user %s domain %s\n", cli->user_name, cli->domain));
-
- return cli_set_password(cli, password);
-}
-
/****************************************************************************
Initialise a client structure. Always returns a talloc'ed struct.
Set the signing state (used from the command line).
****************************************************************************/
+struct GUID cli_state_client_guid;
+
struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
int fd,
const char *remote_name,
bool use_level_II_oplocks = false;
uint32_t smb1_capabilities = 0;
uint32_t smb2_capabilities = 0;
- struct GUID client_guid = GUID_random();
+ struct GUID client_guid;
+
+ if (!GUID_all_zero(&cli_state_client_guid)) {
+ client_guid = cli_state_client_guid;
+ } else {
+ client_guid = GUID_random();
+ }
/* Check the effective uid - make sure we are not setuid */
if (is_setuid_root()) {
cli->raw_status = NT_STATUS_INTERNAL_ERROR;
cli->map_dos_errors = true; /* remove this */
cli->timeout = CLIENT_TIMEOUT;
- cli->case_sensitive = false;
/* Set the CLI_FORCE_DOSERR environment variable to test
client routines using DOS errors instead of STATUS32
Set the PID to use for smb messages. Return the old pid.
****************************************************************************/
-uint16 cli_setpid(struct cli_state *cli, uint16 pid)
+uint16_t cli_setpid(struct cli_state *cli, uint16_t pid)
{
uint16_t ret = cli->smb1.pid;
cli->smb1.pid = pid;
bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive)
{
- bool ret = cli->case_sensitive;
+ bool ret;
uint32_t fs_attrs;
struct smbXcli_tcon *tcon;
}
fs_attrs = smbXcli_tcon_get_fs_attributes(tcon);
+ if (fs_attrs & FILE_CASE_SENSITIVE_SEARCH) {
+ ret = true;
+ } else {
+ ret = false;
+ }
if (case_sensitive) {
fs_attrs |= FILE_CASE_SENSITIVE_SEARCH;
} else {
}
smbXcli_tcon_set_fs_attributes(tcon, fs_attrs);
- cli->case_sensitive = case_sensitive;
return ret;
}