[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Oct 25 11:31:05 MDT 2011


The branch, master has been updated
       via  414df4b s3:smb2cli_base: make use of [_]smb_[set]len_tcp()
       via  fc69057 s3:smb2cli_base: make use of map_nt_error_from_unix_common()
       via  fd261fe s3:lib/errmap_unix: map EPIPE to NT_STATUS_CONNECTION_DISCONNECTED
       via  e947aca s3:libsmb: s/event_context/tevent_context/ in async_smb.[ch]
       via  dd9d40a s3:lib/addrchange.h: include libreplace headers before others
       via  254601d build: always include tevent with <tevent.h>
       via  2d05cb9 build: always include talloc with <talloc.h>
       via  50e7a87 torture: Remove unused smbiconv
      from  ef87630 s3-libsmbclient: make some functions static in testsuite code.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 414df4b9c4595e90aa65425817f49b47718528fb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Oct 25 15:47:10 2011 +0200

    s3:smb2cli_base: make use of [_]smb_[set]len_tcp()
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Tue Oct 25 19:30:43 CEST 2011 on sn-devel-104

commit fc69057b8b8136db5532a84197413d2a69a3242f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Oct 25 14:56:38 2011 +0200

    s3:smb2cli_base: make use of map_nt_error_from_unix_common()
    
    metze

commit fd261fea74dedefe68b9b37fdaf86e633ffb3c75
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Oct 25 15:12:05 2011 +0200

    s3:lib/errmap_unix: map EPIPE to NT_STATUS_CONNECTION_DISCONNECTED
    
    This lets map_nt_error_from_unix() return the same value as
    map_nt_error_from_unix_common().
    
    There are no callers relying on NT_STATUS_PIPE_BROKEN.
    
    metze

commit e947acaa8a36f574a8245c174da28d3ad7fab452
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Oct 25 14:26:17 2011 +0200

    s3:libsmb: s/event_context/tevent_context/ in async_smb.[ch]
    
    metze

commit dd9d40a0e6a908ea6ea50161352cf166dc11b9ff
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Oct 25 15:53:41 2011 +0200

    s3:lib/addrchange.h: include libreplace headers before others
    
    Also we typically don't use an explicit "lib/replace/" prefix.
    
    metze

commit 254601df4da05471e2ba82b266e22dd2d2f7edfa
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Oct 25 11:26:52 2011 +1100

    build: always include tevent with <tevent.h>
    
    This ensures we do the right thing if we are built against the system
    tevent.
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 2d05cb909633761da2503b4c875d3712a2e197e6
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Oct 25 11:23:54 2011 +1100

    build: always include talloc with <talloc.h>
    
    This ensures we do the right thing if we are built against the system
    talloc.
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 50e7a8767fabd24d7ca5490dc326ea24459ec282
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Oct 24 10:05:19 2011 +1100

    torture: Remove unused smbiconv
    
    smbiconv is not used in any test script, and has only had changes
    since being introduced by Jelmer to keep it building.
    
    It is also not installed on the system. I have also checked with
    Jelmer, who approved the removal.
    
    Andrew Bartlett
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/Makefile.in           |   10 +--
 source3/include/async_smb.h   |    4 +-
 source3/lib/addrchange.h      |    8 +-
 source3/lib/errmap_unix.c     |    2 +-
 source3/libsmb/async_smb.c    |    4 +-
 source3/libsmb/smb2cli_base.c |   10 +-
 source3/torture/smbiconv.c    |  246 -----------------------------------------
 source3/wscript_build         |    7 -
 source4/torture/smbiconv.c    |  236 ---------------------------------------
 9 files changed, 16 insertions(+), 511 deletions(-)
 delete mode 100644 source3/torture/smbiconv.c
 delete mode 100644 source4/torture/smbiconv.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index c303fe9..502dab7 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -231,7 +231,7 @@ BIN_PROGS = @EXTRA_BIN_PROGS@ \
 EVERYTHING_PROGS = bin/debug2html at EXEEXT@ bin/smbfilter at EXEEXT@ \
 	$(TALLOCTORT) bin/replacetort at EXEEXT@ \
 	bin/log2pcap at EXEEXT@ \
-	bin/vlp at EXEEXT@ bin/smbiconv at EXEEXT@ \
+	bin/vlp at EXEEXT@ \
 	bin/dbwrap_tool at EXEEXT@ \
 	bin/dbwrap_torture at EXEEXT@
 
@@ -1299,8 +1299,6 @@ PDBTEST_OBJ = torture/pdbtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
 
 VFSTEST_OBJ = torture/cmd_vfs.o torture/vfstest.o $(SMBD_OBJ_BASE) $(READLINE_OBJ)
 
-SMBICONV_OBJ = $(PARAM_OBJ) torture/smbiconv.o $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) $(LIBSMB_ERR_OBJ)
-
 LOG2PCAP_OBJ = utils/log2pcaphex.o
 
 LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
@@ -2031,12 +2029,6 @@ bin/vfstest at EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ $(LIBTALLOC)
 		@SMBD_LIBS@ $(NSCD_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
 		$(LIBWBCLIENT_LIBS) $(ZLIB_LIBS)
 
-bin/smbiconv at EXEEXT@: $(BINARY_PREREQS) $(SMBICONV_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB)
-	@echo Linking $@
-	@$(CC) -o $@ $(SMBICONV_OBJ) $(LDFLAGS) $(TERMLDFLAGS) \
-		$(TERMLIBS) $(DYNEXP) $(LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
-		$(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
-
 bin/log2pcap at EXEEXT@: $(BINARY_PREREQS) $(LOG2PCAP_OBJ) @BUILD_POPT@ $(LIBTALLOC)
 	@echo Linking $@
 	@$(CC) -o $@ $(LOG2PCAP_OBJ) $(LDFLAGS) $(DYNEXP) \
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index 482c7eb..30c71a2 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -23,7 +23,7 @@
 struct cli_state;
 
 struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
-				      struct event_context *ev,
+				      struct tevent_context *ev,
 				      struct cli_state *cli,
 				      uint8_t smb_command,
 				      uint8_t additional_flags,
@@ -40,7 +40,7 @@ uint16_t cli_smb_req_mid(struct tevent_req *req);
 void cli_smb_req_set_mid(struct tevent_req *req, uint16_t mid);
 uint32_t cli_smb_req_seqnum(struct tevent_req *req);
 void cli_smb_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
-struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
+struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 				struct cli_state *cli,
 				uint8_t smb_command, uint8_t additional_flags,
 				uint8_t wct, uint16_t *vwv,
diff --git a/source3/lib/addrchange.h b/source3/lib/addrchange.h
index 9587be7..1106380 100644
--- a/source3/lib/addrchange.h
+++ b/source3/lib/addrchange.h
@@ -19,11 +19,11 @@
 #ifndef __ADDRCHANGE_H__
 #define __ADDRCHANGE_H__
 
-#include "lib/talloc/talloc.h"
-#include "lib/tevent/tevent.h"
+#include "replace.h"
+#include "system/network.h"
+#include <talloc.h>
+#include <tevent.h>
 #include "libcli/util/ntstatus.h"
-#include "lib/replace/replace.h"
-#include "lib/replace/system/network.h"
 
 struct addrchange_context;
 
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index ea19547..28f527e 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -50,7 +50,7 @@ static const struct {
 	{ ENOMEM,       NT_STATUS_NO_MEMORY },
 	{ EISDIR,       NT_STATUS_FILE_IS_A_DIRECTORY},
 #ifdef EPIPE
-	{ EPIPE,        NT_STATUS_PIPE_BROKEN},
+	{ EPIPE,        NT_STATUS_CONNECTION_DISCONNECTED},
 #endif
 	{ EMLINK,       NT_STATUS_TOO_MANY_LINKS },
 	{ ENOSYS,       NT_STATUS_NOT_SUPPORTED },
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 933b7e8..79194f5 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -373,7 +373,7 @@ static uint8_t *iov_concat(TALLOC_CTX *mem_ctx, const struct iovec *iov,
 }
 
 struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
-				      struct event_context *ev,
+				      struct tevent_context *ev,
 				      struct cli_state *cli,
 				      uint8_t smb_command,
 				      uint8_t additional_flags,
@@ -554,7 +554,7 @@ NTSTATUS cli_smb_req_send(struct tevent_req *req)
 }
 
 struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx,
-				struct event_context *ev,
+				struct tevent_context *ev,
 				struct cli_state *cli,
 				uint8_t smb_command,
 				uint8_t additional_flags,
diff --git a/source3/libsmb/smb2cli_base.c b/source3/libsmb/smb2cli_base.c
index 3563af1..de4a06b 100644
--- a/source3/libsmb/smb2cli_base.c
+++ b/source3/libsmb/smb2cli_base.c
@@ -324,7 +324,7 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
 	 */
 
 	state = tevent_req_data(reqs[0], struct smb2cli_req_state);
-	_smb_setlen_large(state->nbt, nbt_len);
+	_smb_setlen_tcp(state->nbt, nbt_len);
 	iov[0].iov_base = state->nbt;
 	iov[0].iov_len  = sizeof(state->nbt);
 
@@ -388,7 +388,8 @@ static void smb2cli_writev_done(struct tevent_req *subreq)
 	TALLOC_FREE(subreq);
 	if (nwritten == -1) {
 		/* here, we need to notify all pending requests */
-		smb2cli_notify_pending(state->cli, map_nt_error_from_unix(err));
+		NTSTATUS status = map_nt_error_from_unix_common(err);
+		smb2cli_notify_pending(state->cli, status);
 		return;
 	}
 }
@@ -410,7 +411,7 @@ static NTSTATUS smb2cli_inbuf_parse_compound(uint8_t *buf, TALLOC_CTX *mem_ctx,
 	iov[0].iov_base = buf;
 	iov[0].iov_len = 4;
 
-	buflen = smb_len_large(buf) + 4;
+	buflen = smb_len_tcp(buf) + 4;
 	taken = 4;
 
 	while (taken < buflen) {
@@ -536,7 +537,8 @@ static void smb2cli_inbuf_received(struct tevent_req *subreq)
 		 * We need to close the connection and notify
 		 * all pending requests.
 		 */
-		smb2cli_notify_pending(cli, map_nt_error_from_unix(err));
+		status = map_nt_error_from_unix_common(err);
+		smb2cli_notify_pending(cli, status);
 		TALLOC_FREE(frame);
 		return;
 	}
diff --git a/source3/torture/smbiconv.c b/source3/torture/smbiconv.c
deleted file mode 100644
index 88ad6fe..0000000
--- a/source3/torture/smbiconv.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Charset module tester
-
-   Copyright (C) Jelmer Vernooij 2003
-   Based on iconv/icon_prog.c from the GNU C Library, 
-      Contributed by Ulrich Drepper <drepper at cygnus.com>, 1998.
-
-   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"
-#include "system/filesys.h"
-#include "popt_common.h"
-#undef realloc
-
-static int
-process_block (smb_iconv_t cd, const char *addr, size_t len, FILE *output)
-{
-#define OUTBUF_SIZE	32768
-  const char *start = addr;
-  char outbuf[OUTBUF_SIZE];
-  char *outptr;
-  size_t outlen;
-  size_t n;
-
-  while (len > 0)
-    {
-      outptr = outbuf;
-      outlen = OUTBUF_SIZE;
-      n = smb_iconv (cd,  &addr, &len, &outptr, &outlen);
-
-      if (outptr != outbuf)
-	{
-	  /* We have something to write out.  */
-	  int errno_save = errno;
-
-	  if (fwrite (outbuf, 1, outptr - outbuf, output)
-	      < (size_t) (outptr - outbuf)
-	      || ferror (output))
-	    {
-	      /* Error occurred while printing the result.  */
-	      DEBUG (0, ("conversion stopped due to problem in writing the output"));
-	      return -1;
-	    }
-
-	  errno = errno_save;
-	}
-
-      if (errno != E2BIG)
-	{
-	  /* iconv() ran into a problem.  */
-	  switch (errno)
-	    {
-	    case EILSEQ:
-	      DEBUG(0,("illegal input sequence at position %ld", 
-		     (long) (addr - start)));
-	      break;
-	    case EINVAL:
-	      DEBUG(0, ("\
-incomplete character or shift sequence at end of buffer"));
-	      break;
-	    case EBADF:
-	      DEBUG(0, ("internal error (illegal descriptor)"));
-	      break;
-	    default:
-	      DEBUG(0, ("unknown iconv() error %d", errno));
-	      break;
-	    }
-
-	  return -1;
-	}
-    }
-
-  return 0;
-}
-
-
-static int
-process_fd (smb_iconv_t cd, int fd, FILE *output)
-{
-  /* we have a problem with reading from a descriptor since we must not
-     provide the iconv() function an incomplete character or shift
-     sequence at the end of the buffer.  Since we have to deal with
-     arbitrary encodings we must read the whole text in a buffer and
-     process it in one step.  */
-  static char *inbuf = NULL;
-  static size_t maxlen = 0;
-  char *inptr = NULL;
-  size_t actlen = 0;
-
-  while (actlen < maxlen)
-    {
-      ssize_t n = read (fd, inptr, maxlen - actlen);
-
-      if (n == 0)
-	/* No more text to read.  */
-	break;
-
-      if (n == -1)
-	{
-	  /* Error while reading.  */
-	  DEBUG(0, ("error while reading the input"));
-	  return -1;
-	}
-
-      inptr += n;
-      actlen += n;
-    }
-
-  if (actlen == maxlen)
-    while (1)
-      {
-	ssize_t n;
-	char *new_inbuf;
-
-	/* Increase the buffer.  */
-	new_inbuf = (char *) realloc (inbuf, maxlen + 32768);
-	if (new_inbuf == NULL)
-	  {
-	    DEBUG(0, ("unable to allocate buffer for input"));
-	    return -1;
-	  }
-	inbuf = new_inbuf;
-	maxlen += 32768;
-	inptr = inbuf + actlen;
-
-	do
-	  {
-	    n = read (fd, inptr, maxlen - actlen);
-
-	    if (n == 0)
-	      /* No more text to read.  */
-	      break;
-
-	    if (n == -1)
-	      {
-		/* Error while reading.  */
-		DEBUG(0, ("error while reading the input"));
-		return -1;
-	      }
-
-	    inptr += n;
-	    actlen += n;
-	  }
-	while (actlen < maxlen);
-
-	if (n == 0)
-	  /* Break again so we leave both loops.  */
-	  break;
-      }
-
-  /* Now we have all the input in the buffer.  Process it in one run.  */
-  return process_block (cd, inbuf, actlen, output);
-}
-
-/* Main function */
-
-int main(int argc, char *argv[])
-{
-	const char *file = NULL;
-	const char *from = "";
-	const char *to = "";
-	char *output = NULL;
-	const char *preload_modules[] = {NULL, NULL};
-	FILE *out = stdout;
-	int fd;
-	smb_iconv_t cd;
-
-	/* make sure the vars that get altered (4th field) are in
-	   a fixed location or certain compilers complain */
-	poptContext pc;
-	struct poptOption long_options[] = {
-		POPT_AUTOHELP
-		{ "from-code", 'f', POPT_ARG_STRING, &from, 0, "Encoding of original text" },
-		{ "to-code", 't', POPT_ARG_STRING, &to, 0, "Encoding for output" },
-		{ "output", 'o', POPT_ARG_STRING, &output, 0, "Write output to this file" },
-		{ "preload-modules", 'p', POPT_ARG_STRING, &preload_modules[0], 0, "Modules to load" },
-		POPT_COMMON_SAMBA
-		POPT_TABLEEND
-	};
-
-	setlinebuf(stdout);
-
-	pc = poptGetContext("smbiconv", argc, (const char **) argv,
-			    long_options, 0);
-
-	poptSetOtherOptionHelp(pc, "[FILE] ...");
-	
-	while(poptGetNextOpt(pc) != -1);
-
-	/* the following functions are part of the Samba debugging
-	   facilities.  See lib/debug.c */
-	setup_logging("smbiconv", DEBUG_STDOUT);
-
-	if (preload_modules[0]) smb_load_modules(preload_modules);
-
-	if(output) {
-		out = fopen(output, "w");
-
-		if(!out) {
-			DEBUG(0, ("Can't open output file '%s': %s, exiting...\n", output, strerror(errno)));
-			return 1;
-		}
-	}
-
-	cd = smb_iconv_open(to, from);
-	if (cd == (smb_iconv_t)-1) {
-		DEBUG(0,("unable to find from or to encoding, exiting...\n"));
-		if (out != stdout) fclose(out);
-		return 1;
-	}
-
-	while((file = poptGetArg(pc))) {
-		if(strcmp(file, "-") == 0) fd = 0;
-		else {
-			fd = open(file, O_RDONLY);
-			
-			if(!fd) {
-				DEBUG(0, ("Can't open input file '%s': %s, ignoring...\n", file, strerror(errno)));
-				continue;
-			}
-		}
-
-		/* Loop thru all arguments */
-		process_fd(cd, fd, out);
-
-		close(fd);
-	}
-	poptFreeContext(pc);
-
-	fclose(out);
-
-	return 0;
-}
diff --git a/source3/wscript_build b/source3/wscript_build
index f2c4148..7430d20 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -584,8 +584,6 @@ PDBTEST_SRC = '''torture/pdbtest.c'''
 
 VFSTEST_SRC = '''torture/cmd_vfs.c torture/vfstest.c'''
 
-SMBICONV_SRC = '''torture/smbiconv.c'''
-
 LOG2PCAP_SRC = '''utils/log2pcaphex.c'''
 
 LOCKTEST2_SRC = '''torture/locktest2.c'''
@@ -1314,11 +1312,6 @@ bld.SAMBA3_BINARY('vfstest',
                  deps='smbd_base SMBREADLINE',
                  vars=locals())
 
-bld.SAMBA3_BINARY('smbiconv',
-                 source=SMBICONV_SRC,
-                 deps='''talloc tdb_compat tevent cap param smbd_shim popt_samba3 LIBSMB_ERR''',
-                 vars=locals())
-
 bld.SAMBA3_BINARY('log2pcap',
                  source=LOG2PCAP_SRC,
                  deps='''talloc popt''',
diff --git a/source4/torture/smbiconv.c b/source4/torture/smbiconv.c
deleted file mode 100644
index 4516608..0000000
--- a/source4/torture/smbiconv.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Charset module tester
-
-   Copyright (C) Jelmer Vernooij 2003
-   Based on iconv/icon_prog.c from the GNU C Library, 
-      Contributed by Ulrich Drepper <drepper at cygnus.com>, 1998.
-
-   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"
-
-static int process_block (smb_iconv_t cd, const char *addr, size_t len, FILE *output)
-{
-#define OUTBUF_SIZE	32768
-  const char *start = addr;
-  char outbuf[OUTBUF_SIZE];
-  char *outptr;
-  size_t outlen;
-  size_t n;
-
-  while (len > 0)
-    {
-      outptr = outbuf;
-      outlen = OUTBUF_SIZE;
-      n = smb_iconv (cd,  &addr, &len, &outptr, &outlen);
-
-      if (outptr != outbuf)
-	{
-	  /* We have something to write out.  */
-	  int errno_save = errno;
-
-	  if (fwrite (outbuf, 1, outptr - outbuf, output)
-	      < (size_t) (outptr - outbuf)
-	      || ferror (output))
-	    {
-	      /* Error occurred while printing the result.  */
-	      DEBUG (0, ("conversion stopped due to problem in writing the output"));
-	      return -1;
-	    }
-
-	  errno = errno_save;
-	}
-
-      if (errno != E2BIG)
-	{
-	  /* iconv() ran into a problem.  */
-	  switch (errno)
-	    {
-	    case EILSEQ:
-	      DEBUG(0,("illegal input sequence at position %ld", 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list