[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Tue Jun 5 11:29:04 MDT 2012
The branch, master has been updated
via 8693a4f s3:lib: split things into a conn_tdb.h
via 5a12293 s3:libsmb: fix the talloc parent of clistr_pull_talloc() in cli_notify_done()
via 7ef4ae4 s3:libsmb: change cli_sesssetup_blob_* to use uint8_t instead of char for inbuf
via 2b5d4d4 s3:libsmb: use inhdr instead of inbuf in tree connect related functions
via ae627a5 s3:libsmb: use inhdr instead of inbuf in session setup related functions
via a868a51 s3:libsmb: remove unused 'inbuf' variable
via 324c51c s3:libsmb: don't require a pinbuf in cli_smb_recv() to keep the memory
via cd99e61 s4:torture/locktest: fix compiler warning
from 5cc86fd s3: remove dependency on automake for "make everything"
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8693a4fff95f2fa1f9c3b93429101c3b3d22218f
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 15:32:28 2012 +0200
s3:lib: split things into a conn_tdb.h
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Tue Jun 5 19:28:35 CEST 2012 on sn-devel-104
commit 5a122931ede833484d9c47d7a9b5434e85b5c8d7
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 18:30:11 2012 +0200
s3:libsmb: fix the talloc parent of clistr_pull_talloc() in cli_notify_done()
metze
commit 7ef4ae42fee5c672afab5af801705fea9a575051
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 16:40:42 2012 +0200
s3:libsmb: change cli_sesssetup_blob_* to use uint8_t instead of char for inbuf
metze
commit 2b5d4d4267fe00578124c076cd1c7d0038765fa1
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 16:26:27 2012 +0200
s3:libsmb: use inhdr instead of inbuf in tree connect related functions
metze
commit ae627a5da8147d63739bd5645a0657ee00c51c20
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 16:26:27 2012 +0200
s3:libsmb: use inhdr instead of inbuf in session setup related functions
metze
commit a868a51eca659c3002ce23d2ea0708841f1f4772
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 15:59:42 2012 +0200
s3:libsmb: remove unused 'inbuf' variable
metze
commit 324c51c25b064d5a6270274472779d260f913fe6
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 4 15:53:52 2012 +0200
s3:libsmb: don't require a pinbuf in cli_smb_recv() to keep the memory
metze
commit cd99e612022ec8607c7a2e85f0835621eb337b7b
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon May 28 15:25:24 2012 +0200
s4:torture/locktest: fix compiler warning
metze
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 19 ------
source3/include/smb.h | 25 --------
source3/lib/conn_tdb.c | 1 +
source3/lib/conn_tdb.h | 62 +++++++++++++++++++
source3/libsmb/async_smb.c | 5 ++
source3/libsmb/cliconnect.c | 94 +++++++++++++++--------------
source3/libsmb/clientgen.c | 3 +-
source3/libsmb/clifile.c | 20 ++----
source3/libsmb/climessage.c | 3 +-
source3/libsmb/clioplock.c | 3 +-
source3/libsmb/clireadwrite.c | 3 +-
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 1 +
source3/smbd/connection.c | 1 +
source3/smbd/server.c | 1 +
source3/smbd/sesssetup.c | 1 +
source3/utils/net_serverid.c | 1 +
source3/utils/net_status.c | 1 +
source3/utils/status.c | 1 +
source3/web/statuspage.c | 1 +
source4/torture/locktest.c | 2 +-
20 files changed, 136 insertions(+), 112 deletions(-)
create mode 100644 source3/lib/conn_tdb.h
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index b8a2409..b5a66b5 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -87,25 +87,6 @@ size_t align_string(const void *base_ptr, const char *p, int flags);
size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
-/* The following definitions come from lib/conn_tdb.c */
-
-struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
- connection_struct *conn,
- const char *name);
-int connections_traverse(int (*fn)(struct db_record *rec,
- void *private_data),
- void *private_data);
-int connections_forall(int (*fn)(struct db_record *rec,
- const struct connections_key *key,
- const struct connections_data *data,
- void *private_data),
- void *private_data);
-int connections_forall_read(int (*fn)(const struct connections_key *key,
- const struct connections_data *data,
- void *private_data),
- void *private_data);
-bool connections_init(bool rw);
-
/* The following definitions come from lib/dmallocmsg.c */
void register_dmalloc_msgs(struct messaging_context *msg_ctx);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 245ff7b..9a63d82 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -564,31 +564,6 @@ Offset Data length.
#define NT_HASH_LEN 16
#define LM_HASH_LEN 16
-/* key and data in the connections database - used in smbstatus and smbd */
-struct connections_key {
- struct server_id pid;
- int cnum;
- fstring name;
-};
-
-struct connections_data {
- int magic;
- struct server_id pid;
- int cnum;
- uid_t uid;
- gid_t gid;
- char servicename[FSTRING_LEN];
- char addr[24];
- char machine[FSTRING_LEN];
- time_t start;
-
- /*
- * This field used to hold the msg_flags. For compatibility reasons,
- * keep the data structure in the tdb file the same.
- */
- uint32 unused_compatitibility_field;
-};
-
/* offsets into message for common items */
#define smb_com (NBT_HDR_SIZE+HDR_COM)
#define smb_rcls (NBT_HDR_SIZE+HDR_RCLS)
diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c
index 9b0a07a..776f53c 100644
--- a/source3/lib/conn_tdb.c
+++ b/source3/lib/conn_tdb.c
@@ -23,6 +23,7 @@
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_open.h"
#include "messages.h"
+#include "lib/conn_tdb.h"
static struct db_context *connections_db_ctx(bool rw)
{
diff --git a/source3/lib/conn_tdb.h b/source3/lib/conn_tdb.h
new file mode 100644
index 0000000..ee4befe
--- /dev/null
+++ b/source3/lib/conn_tdb.h
@@ -0,0 +1,62 @@
+/*
+ Unix SMB/CIFS implementation.
+ Low-level connections.tdb access functions
+ Copyright (C) Volker Lendecke 2007
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* key and data in the connections database - used in smbstatus and smbd */
+struct connections_key {
+ struct server_id pid;
+ int cnum;
+ fstring name;
+};
+
+struct connections_data {
+ int magic;
+ struct server_id pid;
+ int cnum;
+ uid_t uid;
+ gid_t gid;
+ char servicename[FSTRING_LEN];
+ char addr[24];
+ char machine[FSTRING_LEN];
+ time_t start;
+
+ /*
+ * This field used to hold the msg_flags. For compatibility reasons,
+ * keep the data structure in the tdb file the same.
+ */
+ uint32 unused_compatitibility_field;
+};
+
+/* The following definitions come from lib/conn_tdb.c */
+
+struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
+ connection_struct *conn,
+ const char *name);
+int connections_traverse(int (*fn)(struct db_record *rec,
+ void *private_data),
+ void *private_data);
+int connections_forall(int (*fn)(struct db_record *rec,
+ const struct connections_key *key,
+ const struct connections_data *data,
+ void *private_data),
+ void *private_data);
+int connections_forall_read(int (*fn)(const struct connections_key *key,
+ const struct connections_data *data,
+ void *private_data),
+ void *private_data);
+bool connections_init(bool rw);
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index e30435a..c2986e2 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -275,6 +275,11 @@ NTSTATUS cli_smb_recv(struct tevent_req *req,
} else {
*pinbuf = inbuf;
}
+ } else if (mem_ctx != NULL) {
+ if (talloc_reference_count(inbuf) == 0) {
+ (void)talloc_move(mem_ctx, &inbuf);
+ TALLOC_FREE(recv_iov);
+ }
}
return status;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 0858be9..df8c6fc 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -46,15 +46,15 @@
*******************************************************/
static NTSTATUS smb_bytes_talloc_string(TALLOC_CTX *mem_ctx,
- char *inbuf,
+ const uint8_t *hdr,
char **dest,
uint8_t *src,
size_t srclen,
ssize_t *destlen)
{
*destlen = clistr_pull_talloc(mem_ctx,
- inbuf,
- SVAL(inbuf, smb_flg2),
+ (const char *)hdr,
+ SVAL(hdr, HDR_FLG2),
dest,
(char *)src,
srclen,
@@ -232,7 +232,7 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
struct cli_state *cli = state->cli;
uint32_t num_bytes;
uint8_t *in;
- char *inbuf;
+ uint8_t *inhdr;
uint8_t *bytes;
uint8_t *p;
NTSTATUS status;
@@ -248,14 +248,14 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
return;
}
- inbuf = (char *)in;
+ inhdr = in + NBT_HDR_SIZE;
p = bytes;
- cli_state_set_uid(state->cli, SVAL(inbuf, smb_uid));
+ cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_os,
p,
bytes+num_bytes-p,
@@ -268,7 +268,7 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_type,
p,
bytes+num_bytes-p,
@@ -281,7 +281,7 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_domain,
p,
bytes+num_bytes-p,
@@ -470,7 +470,7 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
struct cli_state *cli = state->cli;
uint32_t num_bytes;
uint8_t *in;
- char *inbuf;
+ uint8_t *inhdr;
uint8_t *bytes;
uint8_t *p;
NTSTATUS status;
@@ -486,14 +486,14 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
return;
}
- inbuf = (char *)in;
+ inhdr = in + NBT_HDR_SIZE;
p = bytes;
- cli_state_set_uid(state->cli, SVAL(inbuf, smb_uid));
+ cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_os,
p,
bytes+num_bytes-p,
@@ -506,7 +506,7 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_type,
p,
bytes+num_bytes-p,
@@ -519,7 +519,7 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_domain,
p,
bytes+num_bytes-p,
@@ -674,7 +674,7 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
struct cli_state *cli = state->cli;
uint32_t num_bytes;
uint8_t *in;
- char *inbuf;
+ uint8_t *inhdr;
uint8_t *bytes;
uint8_t *p;
NTSTATUS status;
@@ -689,14 +689,14 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
return;
}
- inbuf = (char *)in;
+ inhdr = in + NBT_HDR_SIZE;
p = bytes;
- cli_state_set_uid(state->cli, SVAL(inbuf, smb_uid));
+ cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_os,
p,
bytes+num_bytes-p,
@@ -709,7 +709,7 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_type,
p,
bytes+num_bytes-p,
@@ -722,7 +722,7 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_domain,
p,
bytes+num_bytes-p,
@@ -1024,7 +1024,7 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
struct cli_state *cli = state->cli;
uint32_t num_bytes;
uint8_t *in;
- char *inbuf;
+ uint8_t *inhdr;
uint8_t *bytes;
uint8_t *p;
NTSTATUS status;
@@ -1040,14 +1040,14 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
return;
}
- inbuf = (char *)in;
+ inhdr = in + NBT_HDR_SIZE;
p = bytes;
- cli_state_set_uid(state->cli, SVAL(inbuf, smb_uid));
+ cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_os,
p,
bytes+num_bytes-p,
@@ -1059,7 +1059,7 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_type,
p,
bytes+num_bytes-p,
@@ -1071,7 +1071,7 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- inbuf,
+ inhdr,
&cli->server_domain,
p,
bytes+num_bytes-p,
@@ -1159,7 +1159,7 @@ struct cli_sesssetup_blob_state {
struct iovec *recv_iov;
NTSTATUS status;
- char *inbuf;
+ uint8_t *inbuf;
DATA_BLOB ret_blob;
};
@@ -1295,7 +1295,8 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
NTSTATUS status;
uint8_t *p;
uint16_t blob_length;
- uint8_t *inbuf;
+ uint8_t *in;
+ uint8_t *inhdr;
ssize_t ret;
if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
@@ -1303,7 +1304,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
&state->recv_iov,
&state->ret_blob);
} else {
- status = cli_smb_recv(subreq, state, &inbuf, 4, &wct, &vwv,
+ status = cli_smb_recv(subreq, state, &in, 4, &wct, &vwv,
&num_bytes, &bytes);
TALLOC_FREE(state->buf);
}
@@ -1320,8 +1321,9 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
goto next;
}
- state->inbuf = (char *)inbuf;
- cli_state_set_uid(state->cli, SVAL(inbuf, smb_uid));
+ state->inbuf = in;
+ inhdr = in + NBT_HDR_SIZE;
+ cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
blob_length = SVAL(vwv+3, 0);
@@ -1334,7 +1336,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
p = bytes + blob_length;
status = smb_bytes_talloc_string(cli,
- (char *)inbuf,
+ inhdr,
&cli->server_os,
p,
bytes+num_bytes-p,
@@ -1347,7 +1349,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- (char *)inbuf,
+ inhdr,
&cli->server_type,
p,
bytes+num_bytes-p,
@@ -1360,7 +1362,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
p += ret;
status = smb_bytes_talloc_string(cli,
- (char *)inbuf,
+ inhdr,
&cli->server_domain,
p,
bytes+num_bytes-p,
@@ -1390,13 +1392,13 @@ next:
static NTSTATUS cli_sesssetup_blob_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx,
DATA_BLOB *pblob,
- char **pinbuf,
+ uint8_t **pinbuf,
struct iovec **precv_iov)
{
struct cli_sesssetup_blob_state *state = tevent_req_data(
req, struct cli_sesssetup_blob_state);
NTSTATUS status;
- char *inbuf;
+ uint8_t *inbuf;
struct iovec *recv_iov;
if (tevent_req_is_nterror(req, &status)) {
@@ -1503,7 +1505,7 @@ static void cli_session_setup_kerberos_done(struct tevent_req *subreq)
subreq, struct tevent_req);
struct cli_session_setup_kerberos_state *state = tevent_req_data(
req, struct cli_session_setup_kerberos_state);
- char *inbuf = NULL;
+ uint8_t *inbuf = NULL;
struct iovec *recv_iov = NULL;
NTSTATUS status;
@@ -1528,7 +1530,7 @@ static void cli_session_setup_kerberos_done(struct tevent_req *subreq)
} else {
if (smb1cli_conn_activate_signing(state->cli->conn, state->session_key_krb5,
data_blob_null)
- && !smb1cli_conn_check_signing(state->cli->conn, (uint8_t *)inbuf, 1)) {
+ && !smb1cli_conn_check_signing(state->cli->conn, inbuf, 1)) {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
@@ -1685,7 +1687,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
struct cli_session_setup_ntlmssp_state *state = tevent_req_data(
req, struct cli_session_setup_ntlmssp_state);
DATA_BLOB blob_in, msg_in, blob_out;
- char *inbuf = NULL;
+ uint8_t *inbuf = NULL;
struct iovec *recv_iov = NULL;
bool parse_ret;
NTSTATUS status;
@@ -1736,7 +1738,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
if (smb1cli_conn_activate_signing(
state->cli->conn, state->ntlmssp_state->session_key,
data_blob_null)
- && !smb1cli_conn_check_signing(state->cli->conn, (uint8_t *)inbuf, 1)) {
+ && !smb1cli_conn_check_signing(state->cli->conn, inbuf, 1)) {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
@@ -2411,7 +2413,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
req, struct cli_tcon_andx_state);
struct cli_state *cli = state->cli;
uint8_t *in;
- char *inbuf;
+ uint8_t *inhdr;
uint8_t wct;
uint16_t *vwv;
uint32_t num_bytes;
@@ -2426,12 +2428,12 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
return;
}
- inbuf = (char *)in;
+ inhdr = in + NBT_HDR_SIZE;
--
Samba Shared Repository
More information about the samba-cvs
mailing list