[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-214-g37da26a
Volker Lendecke
vlendec at samba.org
Thu Jan 29 20:39:03 GMT 2009
The branch, master has been updated
via 37da26a06ee0a51f2e6c7b93e2fefc2342613c84 (commit)
via 89caa0e86be9e20702a24fea4f94a11e6e02cc93 (commit)
via 1a87568d99e35c7d028d742c59a3f811a67731e3 (commit)
from 29ab9ed933ff12d593414d13b5ce584e008f158c (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 37da26a06ee0a51f2e6c7b93e2fefc2342613c84
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jan 26 20:45:09 2009 +0100
Add the strlen to push to smb_bytes_push_str, return the converted size
The pushed strlen replaces the STR_TERMINATE flag which I personally always
find very confusing.
commit 89caa0e86be9e20702a24fea4f94a11e6e02cc93
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 25 21:55:05 2009 +0100
cli_ucs2
commit 1a87568d99e35c7d028d742c59a3f811a67731e3
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jan 29 20:07:58 2009 +0100
Fix the build on "opi"
It did not like to include "includes.h" twice
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 4 +++-
source3/lib/tdb_validate.c | 2 +-
source3/lib/tdb_validate.h | 3 ++-
source3/libsmb/cliconnect.c | 5 ++++-
source3/libsmb/clientgen.c | 10 ++++++++++
source3/libsmb/clifile.c | 19 +++++++++++--------
source3/libsmb/clitrans.c | 6 +++---
7 files changed, 34 insertions(+), 15 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f8a9dbc..e00d644 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2462,6 +2462,7 @@ struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
DATA_BLOB data);
NTSTATUS cli_echo_recv(struct async_req *req);
NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
+bool cli_ucs2(struct cli_state *cli);
/* The following definitions come from libsmb/clierror.c */
@@ -2500,7 +2501,8 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname,
uint32 CreateDisposition, uint32 CreateOptions,
uint8 SecuityFlags);
int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess);
-uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str);
+uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
+ size_t strlen, size_t *pconverted_size);
struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
struct cli_state *cli,
const char *fname, int flags, int share_mode);
diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c
index 948201a..1f5dfe4 100644
--- a/source3/lib/tdb_validate.c
+++ b/source3/lib/tdb_validate.c
@@ -19,8 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "includes.h"
#include "tdb_validate.h"
+#include "includes.h"
/*
* internal validation function, executed by the child.
diff --git a/source3/lib/tdb_validate.h b/source3/lib/tdb_validate.h
index 1a207fa..9eda79d 100644
--- a/source3/lib/tdb_validate.h
+++ b/source3/lib/tdb_validate.h
@@ -22,7 +22,8 @@
#ifndef __TDB_VALIDATE_H__
#define __TDB_VALIDATE_H__
-#include "includes.h"
+#include "lib/replace/replace.h"
+#include "tdb.h"
/**
* Flag field for keeping track of the status of a validation.
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index bc690f2..5778e7f 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1294,7 +1294,10 @@ struct async_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
if (bytes == NULL) {
return NULL;
}
- bytes = smb_bytes_push_str(bytes, false, prots[numprots].name);
+ bytes = smb_bytes_push_str(bytes, false,
+ prots[numprots].name,
+ strlen(prots[numprots].name)+1,
+ NULL);
if (bytes == NULL) {
return NULL;
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 0bec242..d841bcf 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -56,6 +56,16 @@ void cli_set_port(struct cli_state *cli, int port)
}
/****************************************************************************
+ convenience routine to find if we negotiated ucs2
+****************************************************************************/
+
+bool cli_ucs2(struct cli_state *cli)
+{
+ return ((cli->capabilities & CAP_UNICODE) != 0);
+}
+
+
+/****************************************************************************
Read an smb from a fd ignoring all keepalive packets.
The timeout is in milliseconds
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 02cd210..3b6585b 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -781,7 +781,9 @@ int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0);
}
-uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str)
+uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2,
+ const char *str, size_t str_len,
+ size_t *pconverted_size)
{
size_t buflen;
char *converted;
@@ -806,7 +808,7 @@ uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str)
if (!convert_string_allocate(talloc_tos(), CH_UNIX,
ucs2 ? CH_UTF16LE : CH_DOS,
- str, strlen(str)+1, &converted,
+ str, str_len, &converted,
&converted_size, true)) {
return NULL;
}
@@ -821,6 +823,11 @@ uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str)
memcpy(buf + buflen, converted, converted_size);
TALLOC_FREE(converted);
+
+ if (pconverted_size) {
+ *pconverted_size = converted_size;
+ }
+
return buf;
}
@@ -890,12 +897,8 @@ struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
}
bytes = talloc_array(talloc_tos(), uint8_t, 0);
- if (bytes == NULL) {
- return NULL;
- }
-
- bytes = smb_bytes_push_str(
- bytes, (cli->capabilities & CAP_UNICODE) != 0, fname);
+ bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), fname,
+ strlen(fname)+1, NULL);
if (bytes == NULL) {
return NULL;
}
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index baa73ae..4a0fc5f 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -765,9 +765,9 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx,
if (bytes == NULL) {
goto fail;
}
- bytes = smb_bytes_push_str(
- bytes, (state->cli->capabilities & CAP_UNICODE) != 0,
- state->pipe_name);
+ bytes = smb_bytes_push_str(bytes, cli_ucs2(state->cli),
+ state->pipe_name,
+ strlen(state->pipe_name)+1, NULL);
if (bytes == NULL) {
goto fail;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list