[SCM] Samba Shared Repository - branch v3-2-stable updated -
initial-v3-2-test-2687-g4170259
Karolin Seeger
ks at sernet.de
Mon Mar 3 10:42:23 GMT 2008
The branch, v3-2-stable has been updated
via 4170259e5f83c281966a80916e4ece6937e08988 (commit)
via 575b829b390f7f07138305adc2988918eda95ce1 (commit)
via 8beead9c936038365f28467e527b2c066e3a5440 (commit)
via 7821066d4ff4a8503a596ab342a2a84ed9a9f8b9 (commit)
via 1bfc4404e7f7314111f979bd09321e39be76bf15 (commit)
via 851b53895807835fc9e6a4a1b3a2b4739ca7c63f (commit)
from f2712698241dc7a0c75378fb8fd747b923d3248f (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable
- Log -----------------------------------------------------------------
commit 4170259e5f83c281966a80916e4ece6937e08988
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 29 22:38:10 2008 +0100
Restore 3.0 behaviour with empty /etc/hosts
Jeremy, in 3.0 we allowed get_mydnsdomname and get_mydnsfullname to fail
without filling in anything useful. Worked fine. Without this patch and a empty
/etc/hosts and no DNS configured, session setup would return
NT_STATUS_BAD_NETWORK_NAME. This is confusing at best, BAD_NETWORK_NAME afaik
is only ever returned from tcon normally.
This restores the 3.0 behaviour.
Comments?
Volker
commit 575b829b390f7f07138305adc2988918eda95ce1
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 1 09:26:43 2008 +0100
Revert "Add basic infrastructure for general async requests"
This reverts commit ae254cb61f4b9331755848c47ebc34e90dd80390.
(cherry picked from commit 030bef7f22f7a73466204b7860f397dbca9f2ab0)
commit 8beead9c936038365f28467e527b2c066e3a5440
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 1 09:26:27 2008 +0100
Revert "Add infrastructure to support async SMB requests"
This reverts commit f5356825698a02df2d400b51dd95d1f857c83e81.
(cherry picked from commit 5f53a62be8a21b8d92ac44b18d202882500356e8)
commit 7821066d4ff4a8503a596ab342a2a84ed9a9f8b9
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 1 09:26:18 2008 +0100
Revert "Add async cli_pull support"
This reverts commit 844a163458c7585e4306a21ffdae5d08e03d6e4d.
(cherry picked from commit 5ab1cfda500de07ff3c712442ab2fc74eecc8886)
commit 1bfc4404e7f7314111f979bd09321e39be76bf15
Author: Volker Lendecke <vl at samba.org>
Date: Sat Mar 1 09:26:06 2008 +0100
Revert "Convert cli_read to use cli_pull"
This reverts commit 719527f55e88f0c5fdceda5c807475aba299c79f.
(cherry picked from commit ac301fada257e2d3b50148109a3d44fa1421b0b4)
commit 851b53895807835fc9e6a4a1b3a2b4739ca7c63f
Author: Günther Deschner <gd at samba.org>
Date: Sat Mar 1 16:13:25 2008 +0100
Make sure we are still able to join Windows 2008.
Guenther
(cherry picked from commit aa9c0f587718f4d647e87b9662acbedba042b9cb)
-----------------------------------------------------------------------
Summary of changes:
source/Makefile.in | 4 +-
source/client/client.c | 42 +++--
source/include/async_req.h | 89 -------
source/include/async_smb.h | 62 -----
source/include/client.h | 30 ---
source/include/includes.h | 2 -
source/lib/async_req.c | 68 ------
source/libnet/libnet_join.c | 3 +-
source/libsmb/async_smb.c | 483 ---------------------------------------
source/libsmb/clireadwrite.c | 519 ++++++++++--------------------------------
source/libsmb/ntlmssp.c | 9 +-
11 files changed, 157 insertions(+), 1154 deletions(-)
delete mode 100644 source/include/async_req.h
delete mode 100644 source/include/async_smb.h
delete mode 100644 source/lib/async_req.c
delete mode 100644 source/libsmb/async_smb.c
Changeset truncated at 500 lines:
diff --git a/source/Makefile.in b/source/Makefile.in
index 35a4480..c91f544 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -323,7 +323,7 @@ LIB_WITHOUT_PROTO_OBJ = $(LIBSAMBAUTIL_OBJ) \
lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \
lib/interfaces.o lib/rbtree.o lib/memcache.o \
- lib/util_transfer_file.o lib/async_req.o
+ lib/util_transfer_file.o
LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
lib/interface.o lib/md4.o \
@@ -408,7 +408,7 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
libsmb/clistr.o libsmb/cliquota.o libsmb/clifsinfo.o libsmb/clidfs.o \
libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o \
libsmb/clioplock.o $(ERRORMAP_OBJ) libsmb/clirap2.o \
- libsmb/smb_seal.o $(DOSERR_OBJ) libsmb/async_smb.o \
+ libsmb/smb_seal.o $(DOSERR_OBJ) \
$(RPC_PARSE_OBJ1) $(LIBSAMBA_OBJ) $(LIBNMB_OBJ)
RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o
diff --git a/source/client/client.c b/source/client/client.c
index 1410fc2..f7ed33a 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -964,20 +964,12 @@ static int cmd_echo(void)
Get a file from rname to lname
****************************************************************************/
-static NTSTATUS writefile_sink(char *buf, size_t n, void *priv)
-{
- int *pfd = (int *)priv;
- if (writefile(*pfd, buf, n) == -1) {
- return map_nt_error_from_unix(errno);
- }
- return NT_STATUS_OK;
-}
-
static int do_get(const char *rname, const char *lname_in, bool reget)
{
TALLOC_CTX *ctx = talloc_tos();
int handle = 0, fnum;
bool newhandle = false;
+ char *data = NULL;
struct timeval tp_start;
int read_size = io_bufsize;
uint16 attr;
@@ -988,7 +980,6 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
struct cli_state *targetcli = NULL;
char *targetname = NULL;
char *lname = NULL;
- NTSTATUS status;
lname = talloc_strdup(ctx, lname_in);
if (!lname) {
@@ -1047,15 +1038,36 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
DEBUG(1,("getting file %s of size %.0f as %s ",
rname, (double)size, lname));
- status = cli_pull(targetcli, fnum, start, size, 1024*1024,
- writefile_sink, (void *)&handle, &nread);
- if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "parallel_read returned %s\n",
- nt_errstr(status));
+ if(!(data = (char *)SMB_MALLOC(read_size))) {
+ d_printf("malloc fail for size %d\n", read_size);
cli_close(targetcli, fnum);
return 1;
}
+ while (1) {
+ int n = cli_read(targetcli, fnum, data, nread + start, read_size);
+
+ if (n <= 0)
+ break;
+
+ if (writefile(handle,data, n) != n) {
+ d_printf("Error writing local file\n");
+ rc = 1;
+ break;
+ }
+
+ nread += n;
+ }
+
+ if (nread + start < size) {
+ DEBUG (0, ("Short read when getting file %s. Only got %ld bytes.\n",
+ rname, (long)nread));
+
+ rc = 1;
+ }
+
+ SAFE_FREE(data);
+
if (!cli_close(targetcli, fnum)) {
d_printf("Error %s closing remote file\n",cli_errstr(cli));
rc = 1;
diff --git a/source/include/async_req.h b/source/include/async_req.h
deleted file mode 100644
index 6df5360..0000000
--- a/source/include/async_req.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Infrastructure for async requests
- Copyright (C) Volker Lendecke 2008
-
- 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/>.
-*/
-
-#ifndef __ASYNC_REQ_H__
-#define __ASYNC_REQ_H__
-
-#include "includes.h"
-
-/*
- * An async request moves between the following 4 states.
- */
-enum async_req_state {
- ASYNC_REQ_INIT, /* we are creating the request */
- ASYNC_REQ_IN_PROGRESS, /* we are waiting the request to complete */
- ASYNC_REQ_DONE, /* the request is finished */
- ASYNC_REQ_ERROR }; /* an error has occured */
-
-struct async_req {
- /* the external state - will be queried by the caller */
- enum async_req_state state;
-
- /* a private pointer for use by the async function implementation */
- void *private_data;
-
- /* print yourself, for debugging purposes */
- char *(*print)(TALLOC_CTX *mem_ctx, struct async_req *);
-
- /* status code when finished */
- NTSTATUS status;
-
- /* the event context we are using */
- struct event_context *event_ctx;
-
- /* information on what to do on completion */
- struct {
- void (*fn)(struct async_req *);
- void *priv;
- } async;
-};
-
-/*
- * Print an async_req structure for debugging purposes
- */
-char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req);
-
-/*
- * Create an async request
- */
-struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev);
-
-/*
- * An async request has successfully finished, invoke the callback
- */
-void async_req_done(struct async_req *req);
-
-/*
- * An async request has seen an error, invoke the callback
- */
-void async_req_error(struct async_req *req, NTSTATUS status);
-
-/*
- * Convenience helper to easily check alloc failure within a callback.
- *
- * Call pattern would be
- * p = talloc(mem_ctx, bla);
- * if (async_req_nomem(p, req)) {
- * return;
- * }
- *
- */
-bool async_req_nomem(const void *p, struct async_req *req);
-
-#endif
diff --git a/source/include/async_smb.h b/source/include/async_smb.h
deleted file mode 100644
index 19408be..0000000
--- a/source/include/async_smb.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Infrastructure for async SMB client requests
- Copyright (C) Volker Lendecke 2008
-
- 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/>.
-*/
-
-#include "includes.h"
-
-/*
- * Create a fresh async smb request
- */
-
-struct async_req *cli_request_new(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- struct cli_state *cli,
- uint8_t num_words, size_t num_bytes,
- struct cli_request **preq);
-
-/*
- * Convenience function to get the SMB part out of an async_req
- */
-
-struct cli_request *cli_request_get(struct async_req *req);
-
-/*
- * Fetch an error out of a NBT packet
- */
-
-NTSTATUS cli_pull_error(char *buf);
-
-/*
- * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
- */
-
-void cli_set_error(struct cli_state *cli, NTSTATUS status);
-
-/*
- * Create a temporary event context for use in the sync helper functions
- */
-
-struct cli_tmp_event *cli_tmp_event_ctx(TALLOC_CTX *mem_ctx,
- struct cli_state *cli);
-
-/*
- * Attach an event context permanently to a cli_struct
- */
-
-NTSTATUS cli_add_event_ctx(struct cli_state *cli,
- struct event_context *event_ctx);
diff --git a/source/include/client.h b/source/include/client.h
index 52dc513..d29a2e7 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -192,36 +192,6 @@ struct cli_state {
bool force_dos_errors;
bool case_sensitive; /* False by default. */
-
- struct event_context *event_ctx;
- struct fd_event *fd_event;
- char *evt_inbuf;
-
- struct cli_request *outstanding_requests;
-};
-
-struct cli_request {
- struct cli_request *prev, *next;
- struct async_req *async;
-
- struct cli_state *cli;
-
- struct smb_trans_enc_state *enc_state;
-
- uint16_t mid;
-
- char *outbuf;
- size_t sent;
- char *inbuf;
-
- union {
- struct {
- off_t ofs;
- size_t size;
- ssize_t received;
- uint8_t *rcvbuf;
- } read;
- } data;
};
typedef struct file_info {
diff --git a/source/include/includes.h b/source/include/includes.h
index 269baa5..a2c3a0c 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -723,8 +723,6 @@ typedef char fstring[FSTRING_LEN];
#include "ctdbd_conn.h"
#include "talloc_stack.h"
#include "memcache.h"
-#include "async_req.h"
-#include "async_smb.h"
/* used in net.c */
struct functable {
diff --git a/source/lib/async_req.c b/source/lib/async_req.c
deleted file mode 100644
index 01154ca..0000000
--- a/source/lib/async_req.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Infrastructure for async requests
- Copyright (C) Volker Lendecke 2008
-
- 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/>.
-*/
-
-#include "includes.h"
-
-char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req)
-{
- return talloc_asprintf(mem_ctx, "async_req: state=%d, status=%s, "
- "priv=%s", req->state, nt_errstr(req->status),
- talloc_get_name(req->private_data));
-}
-
-struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev)
-{
- struct async_req *result;
-
- result = TALLOC_ZERO_P(mem_ctx, struct async_req);
- if (result == NULL) {
- return NULL;
- }
- result->state = ASYNC_REQ_IN_PROGRESS;
- result->event_ctx = ev;
- result->print = async_req_print;
- return result;
-}
-
-void async_req_done(struct async_req *req)
-{
- req->status = NT_STATUS_OK;
- req->state = ASYNC_REQ_DONE;
- if (req->async.fn != NULL) {
- req->async.fn(req);
- }
-}
-
-void async_req_error(struct async_req *req, NTSTATUS status)
-{
- req->status = status;
- req->state = ASYNC_REQ_ERROR;
- if (req->async.fn != NULL) {
- req->async.fn(req);
- }
-}
-
-bool async_req_nomem(const void *p, struct async_req *req)
-{
- if (p != NULL) {
- return false;
- }
- async_req_error(req, NT_STATUS_NO_MEMORY);
- return true;
-}
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index 1a8486f..866d1c0 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -928,9 +928,8 @@ NTSTATUS libnet_join_ok(const char *netbios_domain_name,
const char *machine_name,
const char *dc_name)
{
- uint32_t neg_flags = NETLOGON_NEG_AUTH2_FLAGS |
+ uint32_t neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS |
NETLOGON_NEG_SCHANNEL;
- /* FIXME: NETLOGON_NEG_SELECT_AUTH2_FLAGS */
struct cli_state *cli = NULL;
struct rpc_pipe_client *pipe_hnd = NULL;
struct rpc_pipe_client *netlogon_pipe = NULL;
diff --git a/source/libsmb/async_smb.c b/source/libsmb/async_smb.c
deleted file mode 100644
index 21bcd5b..0000000
--- a/source/libsmb/async_smb.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Infrastructure for async SMB client requests
- Copyright (C) Volker Lendecke 2008
-
- 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/>.
-*/
-
-#include "includes.h"
-
-/*
- * Fetch an error out of a NBT packet
- */
-
-NTSTATUS cli_pull_error(char *buf)
-{
- uint32_t flags2 = SVAL(buf, smb_flg2);
-
- if (flags2 & FLAGS2_32_BIT_ERROR_CODES) {
- return NT_STATUS(IVAL(buf, smb_rcls));
- }
-
- return NT_STATUS_DOS(CVAL(buf, smb_rcls), SVAL(buf,smb_err));
-}
-
-/*
- * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
- */
-
-void cli_set_error(struct cli_state *cli, NTSTATUS status)
-{
- uint32_t flags2 = SVAL(cli->inbuf, smb_flg2);
-
- if (NT_STATUS_IS_DOS(status)) {
- SSVAL(cli->inbuf, smb_flg2,
- flags2 & ~FLAGS2_32_BIT_ERROR_CODES);
- SCVAL(cli->inbuf, smb_rcls, NT_STATUS_DOS_CLASS(status));
- SSVAL(cli->inbuf, smb_err, NT_STATUS_DOS_CODE(status));
- return;
- }
-
- SSVAL(cli->inbuf, smb_flg2, flags2 | FLAGS2_32_BIT_ERROR_CODES);
- SIVAL(cli->inbuf, smb_rcls, NT_STATUS_V(status));
- return;
-}
-
-/*
- * Allocate a new mid
- */
-
-static uint16_t cli_new_mid(struct cli_state *cli)
-{
- uint16_t result;
- struct cli_request *req;
-
- while (true) {
- result = cli->mid++;
- if (result == 0) {
- continue;
- }
-
- for (req = cli->outstanding_requests; req; req = req->next) {
- if (result == req->mid) {
- break;
- }
- }
-
- if (req == NULL) {
- return result;
- }
- }
-}
-
-static char *cli_request_print(TALLOC_CTX *mem_ctx, struct async_req *req)
-{
- char *result = async_req_print(mem_ctx, req);
- struct cli_request *cli_req = cli_request_get(req);
-
- if (result == NULL) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list