From 1c77c7f3d5b6cb29fac4606299c237c0e299f836 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Fri, 16 Jan 2009 16:41:36 -0500 Subject: Treat file names in POSIX-like case-sensitive fashion by default *** THIS COMMIT CAUSES A CHANGE OF DEFAULT BEHAVIOR IN libsmbclient!!! *** - libsmbclient now calls cli_set_case_sensitive() for a new CLI. By default, it requests case-sensitive, but the old behavior of case-insensitive can be requested with smbc_setOptionCaseSensitive(context, False); The change of behavior is considered a bug fix, as it was previously possible to accidentally overwrite a file that had the same case-insensitive name but a different case-sensitive name as a previously-existing file, while creating a new file. Derrell --- source3/include/libsmb_internal.h | 5 +++++ source3/include/libsmbclient.h | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'source3/include') diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index b488116939..8b410b4f7f 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -176,6 +176,11 @@ struct SMBC_internal_data { */ smbc_smb_encrypt_level smb_encryption_level; + /* + * Should we request case sensitivity of file names? + */ + bool case_sensitive; + struct smbc_server_cache * server_cache; /* POSIX emulation functions */ diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index a8b27b709e..4a8accbf4e 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -550,6 +550,15 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c); + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); + + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes a -- cgit From c6b4f3526a262b22d5a97a3152f378778a497a26 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Fri, 16 Jan 2009 20:26:46 -0500 Subject: [Bug 6022] smbc_urlencode and smbc_urldecode were not exported - Since the revamp of libsmbclient, there has still been an external declaration for smbc_urlencode and smbc_urldecode in libsmbclient.h, yet those functions were renamed and made private. The two choices were to remove the function names from libsmbclient.h or to make them public again. The reported requested that they be public. This commit makes it so. Derrell --- source3/include/libsmb_internal.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source3/include') diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 8b410b4f7f..67add074bf 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -401,16 +401,6 @@ SMBC_errno(SMBCCTX *context, /* Functions in libsmb_path.c */ -int -SMBC_urldecode(char *dest, - char *src, - size_t max_dest_len); - -int -SMBC_urlencode(char *dest, - char *src, - int max_dest_len); - int SMBC_parse_path(TALLOC_CTX *ctx, SMBCCTX *context, -- cgit From 6d300399b52e0921ce205ef2f053b722b21edeeb Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sat, 17 Jan 2009 13:33:25 -0500 Subject: Determine case sensitivity based on file system attributes. - Most of the time, we can determine from the file system we're connecting to whether it supports case sensitivity. In those cases, we now set the internal case sensitivity flag automatically. For those cases where the request to retrieve file system attributes fails, we'll use the user-specified option value. Derrell --- source3/include/libsmbclient.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 4a8accbf4e..b2d9483a0b 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -550,11 +550,23 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); -/** Get whether to treat file names as case-sensitive. */ +/** + * Get whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ smbc_bool smbc_getOptionCaseSensitive(SMBCCTX *c); -/** Set whether to treat file names as case-sensitive. */ +/** + * Set whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ void smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); -- cgit From 5e6f3eaae9435b1ab7b36726e7b898d4994fcebf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 17 Jan 2009 12:18:29 +0100 Subject: Move initialization of the reply prs_struct to rpc_api_pipe --- source3/include/proto.h | 2 +- source3/include/rpc_client.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index d644b09a6a..9210a5cfe2 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5197,7 +5197,7 @@ NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli, /* The following definitions come from rpc_client/cli_pipe.c */ -NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli, +NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, uint8 op_num, prs_struct *in_data, prs_struct *out_data); diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 684044b871..61b861c3b4 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -49,9 +49,8 @@ if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ return WERR_NOMEM;\ }\ - prs_init_empty( &r_ps, ctx, UNMARSHALL );\ if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ - NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ + NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(ctx, pcli, opnum, &q_ps, &r_ps); \ if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ prs_mem_free( &q_ps );\ prs_mem_free( &r_ps );\ -- cgit From 396ed3b36359367e1efd49395cd9e6dc6f7c98fc Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 17 Jan 2009 17:52:35 +0100 Subject: Add async rpc_api_pipe_req --- source3/include/proto.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 9210a5cfe2..72b95d44c3 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5197,6 +5197,13 @@ NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli, /* The following definitions come from rpc_client/cli_pipe.c */ +struct async_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct rpc_pipe_client *cli, + uint8_t op_num, + prs_struct *req_data); +NTSTATUS rpc_api_pipe_req_recv(struct async_req *req, TALLOC_CTX *mem_ctx, + prs_struct *reply_pdu); NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, uint8 op_num, prs_struct *in_data, -- cgit From 28c35b4c0456ce62bf1a492ad9c1b223e2f31816 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 18 Jan 2009 12:12:15 +0100 Subject: Make rpc_pipe_bind async --- source3/include/proto.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 72b95d44c3..71ad259085 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5208,6 +5208,11 @@ NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, uint8 op_num, prs_struct *in_data, prs_struct *out_data); +struct async_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct rpc_pipe_client *cli, + struct cli_pipe_auth_data *auth); +NTSTATUS rpc_pipe_bind_recv(struct async_req *req); NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, struct cli_pipe_auth_data *auth); unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli, -- cgit