[SCM] Samba Shared Repository - branch v3-2-stable updated - release-3-2-4-37-gecc6700

Karolin Seeger kseeger at samba.org
Mon Oct 6 14:53:01 GMT 2008


The branch, v3-2-stable has been updated
       via  ecc67001315111493738e893917c4550be7828a1 (commit)
       via  7cb9d82244a8e93261d12a3800334d8152a2431e (commit)
       via  4ac937db865d9fc56cb49838a361dd697d06efc7 (commit)
       via  829e29c95ad6c1b5744dcffb4586ff7c875e3831 (commit)
       via  2e65d8bce755ddfa35bae5ad4c5107db7e18515a (commit)
       via  a0ee34c3c55a64ac2b73fdbaa32233d01ee131c6 (commit)
       via  2ed66bc2b6e22aeb0dcc1aba68bac3791ee0647f (commit)
       via  589fe1c879ef23ee9e45f5f877f2696142d57e70 (commit)
       via  28fa519a80bfcd30737a51ad157d134322c1fed9 (commit)
       via  d2242f9776cfed2dfff44db180dbf34fbbba2e5e (commit)
       via  35130846b4595cc3a937e10a113d2805a5b2c096 (commit)
       via  47161923108222c41db4572b5f44cdb2b6d84a51 (commit)
       via  a937de4a626a8084e852bf7d345441bab15963cd (commit)
       via  a2f298883f21c3e9afe686ee393410f2bcb28370 (commit)
       via  8443b4859f64aa5459976ce37ca96a90daae889a (commit)
       via  63603373628901fcb6a816d9ac9b5340dd8d8662 (commit)
       via  747f7a5647851290f6a3968477a8749e1134777c (commit)
       via  1bf75ac9781c60be5a7b5899bc42aa1d198091d9 (commit)
       via  ac2046979cacf96f8d4df7c5ece06e55d51758c8 (commit)
       via  37d4e792bfd72e4b12811e0fbdb75cec2eda8f2a (commit)
       via  8b41be0c7080edaf9fb33e583c66f2ef50a91643 (commit)
       via  a48d591ef5d839159f600a8c7e2966211450c00b (commit)
       via  7c9a7cb8682156ffb39382a44e3abf40408bff63 (commit)
       via  1394827cfda4eeff5b4239b6ed5c93fcaaed0e2e (commit)
       via  e73c090b5ff624f71ce827c494cd71ca73144ba9 (commit)
       via  7292c322ca70e9df82e020f45f1510e9ca02efbc (commit)
       via  aa9a74f33f1a1862836569565d64861706de5429 (commit)
       via  caa0f1131872f82c1a346f701830544b372e4317 (commit)
       via  f64bcae4ff2bb1a9db603c1f38e1e4fa2e5148bc (commit)
       via  aeabc475d8abf9a820b4846a30cf92cc253bc939 (commit)
       via  24348e2e028f8f63c7acad33f2f9a362a3d3fdc0 (commit)
       via  9a38a8454cfbd0011d804b3ab88c16e5d4f1c4bd (commit)
       via  fc9247572e0ace4956845e279c63c9d00fa667bd (commit)
      from  cfc8dc236dda869dbe4141bef80f6965ce76188d (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable


- Log -----------------------------------------------------------------
commit ecc67001315111493738e893917c4550be7828a1
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Sep 21 20:39:17 2008 +0200

    Attempt to fix bug 5778
    
    Jeff, Steve, please check!
    (cherry picked from commit 110756cc7bcaed5a9d6aa58f3b3fe4481f8d1f31)
    (cherry picked from commit 46b050e525b339fbac68329f668e47ebd11b3e08)

commit 7cb9d82244a8e93261d12a3800334d8152a2431e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 5 14:34:58 2008 -0700

    Remove an unused variable
    (cherry picked from commit 41aed9f2f3c6d53e1b8b6d72467bc5d5a0689dce)

commit 4ac937db865d9fc56cb49838a361dd697d06efc7
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 5 14:34:01 2008 -0700

    Fix some missing error handlings
    (cherry picked from commit 1709a099c82e9b06771b3aa562c5488a71f10c62)

commit 829e29c95ad6c1b5744dcffb4586ff7c875e3831
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 5 14:29:50 2008 -0700

    OS/X does not have rl_done in readline.h
    (cherry picked from commit af055bb8d89a14ed572f76b5f8fe492e0ed98e12)

commit 2e65d8bce755ddfa35bae5ad4c5107db7e18515a
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 5 14:28:33 2008 -0700

    Fix an uninitialized variable warning
    
    Not sure if we can ever not get domain and dns_domain, but gcc complained
    (cherry picked from commit e56b0b947a5c357c4e84b330c38d7a7f569be201)

commit a0ee34c3c55a64ac2b73fdbaa32233d01ee131c6
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 4 19:39:39 2008 -0700

    Fix an unlikely memleak found by the IBM checker
    (cherry picked from commit 52365077e74e80959a42aa82cf9a6c959e2fcda5)

commit 2ed66bc2b6e22aeb0dcc1aba68bac3791ee0647f
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 4 19:38:42 2008 -0700

    Fix an uninitialized variable found by the IBM Checker
    (cherry picked from commit 65169e4b5f182f1614e102bb0e09326a26bd5b5d)

commit 589fe1c879ef23ee9e45f5f877f2696142d57e70
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 4 19:38:04 2008 -0700

    Fix a potential NULL deref in line 258 found by the IBM checker
    (cherry picked from commit de581efedbc53a783a680ff366d37aeccd14ee23)

commit 28fa519a80bfcd30737a51ad157d134322c1fed9
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 3 14:56:30 2008 -0700

    Correctly fix smbclient to terminate on eof from server.
    Jeremy.
    (cherry picked from commit 4dc2eb7f42bad6812d21bf4577e2901b04a5ca83)

commit d2242f9776cfed2dfff44db180dbf34fbbba2e5e
Author: Gerald (Jerry) Carter <jerry at samba.org>
Date:   Fri Oct 3 10:51:54 2008 -0500

    net_dns: Make "lwinet ads dns register" honor the "interfaces" parameter.
    
    This is helpful on multihomed hosts that only require a subset
    of IP addresses be registered with DNS.
    (cherry picked from commit 17c9f8810598d8117befc896d12a597a52b0ac3b)
    (cherry picked from commit 2fb742e127f725b56f308538852d7b10b86f29c1)

commit 35130846b4595cc3a937e10a113d2805a5b2c096
Author: Gerald (Jerry) Carter <jerry at samba.org>
Date:   Fri Oct 3 10:51:21 2008 -0500

    libaddns: Use the same prerequisite for DDNS update as Windows XP.
    
       Hostname, TYPE: CNAME, CLASS: NONE
    
    This has to have been broken for ages.  I cannot see
    how it would have worked in any environment.
    (cherry picked from commit 6b6402bce318a48b0890ed6fc23ed5b30440927b)
    (cherry picked from commit adde53eddb85e9af391c3f77425a3376c5c60dbf)

commit 47161923108222c41db4572b5f44cdb2b6d84a51
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 2 14:02:20 2008 -0700

    Fix bug #5080. Access to cups-printers via samba broken with cups 1.3.4, Unsupported character set.
    Cups 1.3.4 expects utf8 to be used in all messages to/from the server. We may be using a
    different character set so we need to use talloc utf8 push/pull functions in all communication.
    Contains the !server fix already applied to 3.3.
    Jeremy.
    (cherry picked from commit a1323951a3264f81be07276f021201bee0d8d0f5)

commit a937de4a626a8084e852bf7d345441bab15963cd
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Thu Oct 2 09:17:49 2008 -0400

    Fix bug 5805: don't close stdout
    
    - When calling setup_logging multiple times, the code was closing the debug
      file descriptor before opening or assigning the new one.  We don't, however,
      want to close the debug file descriptor if it is stdout.
    
    Derrell
    (cherry picked from commit 7142872d2c6e0be42307671afa31016f6940007d)

commit a2f298883f21c3e9afe686ee393410f2bcb28370
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 1 15:00:35 2008 -0700

    Whitespace cleanup.
    Jeremy.
    (cherry picked from commit d596f78517f33f5a4c4849be3162d4f3031f045f)

commit 8443b4859f64aa5459976ce37ca96a90daae889a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 1 13:22:02 2008 -0700

    Fix use of DLIST_REMOVE as spotted by Constantine Vetoshev <gepardcv at gmail.com>.
    This API is unusual in that if used to remove a non-list head it nulls out
    the next and prev pointers. This is what you want for debugging (don't want
    an entry removed from the list to be still virtually linked into it) but
    means there is no consistent idiom for use as the next and prev pointers
    get trashed on removal from the list, meaning you must save them yourself.
    You can use it one way when deleting everything via the head pointer, as
    this preserves the next pointer, but you *must* use it another way when not
    deleting everything via the head pointer. Fix all known uses of this (the main
    one is in conn_free_internal() and would not free all the private data entries
    for vfs modules. The other changes in web/statuspage.c and winbindd_util.c
    are not strictly neccessary, as the head pointer is being used, but I've done
    them for consistency. Long term we must revisit this as this API is too hard
    to use correctly.
    Jeremy.
    (cherry picked from commit 347fc4ed725083f2c520afc39f7c81db0dd60324)

commit 63603373628901fcb6a816d9ac9b5340dd8d8662
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 1 12:30:12 2008 -0700

    Turn the socket connections into a refcounted list - in the common case there'll now only be one socket per smbd.
    Changed the format of the wire data to (a) include a version number (V1) as the first element. (b) removed the
    ";)" at the end an replaced it with a "\n". Receiver can change back if needed, and now receiver can just log
    "as-is" to a text file (making testing easier). Added my (C). Sorry Holger, but I've changed quite a bit now.
    Jeremy.
    (cherry picked from commit 7ea95c19305a2fb6efc95acc4e96f083e31f6c6f)

commit 747f7a5647851290f6a3968477a8749e1134777c
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 30 16:20:29 2008 -0700

    Convert to allocated strings. Use write_data(), not send as this doesn't correctly
    deal with EINTR. Jim and Holger please check this still works.
    Jeremy.
    (cherry picked from commit dc1ff1a9c07edf7e3e649b256667704ad59aafbd)

commit 1bf75ac9781c60be5a7b5899bc42aa1d198091d9
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 30 15:09:49 2008 -0700

    Restructure the module so it connects to the remote data sink
    on connect, and closes the socket on client disconnect. This should
    make it much more efficient. Store the remote fd in a private data
    pointer off the handle. Finally we need to remove the fstrings and
    convert to allocated buffer storage.
    Jeremy.
    (cherry picked from commit 2f7884babcefcb04d1f9a877dde41e11b0f7b825)

commit ac2046979cacf96f8d4df7c5ece06e55d51758c8
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 30 13:21:27 2008 -0700

    Fix the make test problem Karolin reported. Now rename_open_files actually works correctly we must emit the change notify before we change the name, not before.
    Jeremy.
    (cherry picked from commit 10ae99d86c0c90bee9a0538854f6f96fc7cbbc23)

commit 37d4e792bfd72e4b12811e0fbdb75cec2eda8f2a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 29 16:04:23 2008 -0700

    re-added "winbind:ignore domains" patch
    
    This option really is essential, as we discover again and again at
    customer sites. Due to bugs in winbind some domains are toxic. When
    you are installing at a site and a particular domain in a complex
    setup causes winbind to segfault or hang then you need a way to
    disable that domain and continue.
    
    In an ideal world winbind could handle arbitrarily complex ADS
    domains, but we are nowhere near that yet. If we ever get to that
    stage then we won't need this option.
    (cherry picked from commit 41898a42c1ad7d382088799a6e3f712583808d20)

commit 8b41be0c7080edaf9fb33e583c66f2ef50a91643
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 29 11:24:00 2008 -0700

    fixed segv on startup with trusted domains
    
    With some setups, idmap_tdb2_allocate_id can be called before the
    allocate backend is initialised, leading to a segv. This change
    ensures that the db is opened in all paths that use it
    (cherry picked from commit 3a2a70996919a7ee08fea40b8e5f1cf2e3bd7caf)

commit a48d591ef5d839159f600a8c7e2966211450c00b
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Sep 29 10:57:32 2008 -0700

    Ensure we null out fsp after a close in all paths.
    Jeremy.
    (cherry picked from commit 3cba8305bd32c7a83fd9c39eaea953b8a0199b22)

commit 7c9a7cb8682156ffb39382a44e3abf40408bff63
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Sep 29 10:53:36 2008 -0700

    Avoid freeing fsp twice when opening new_file fails. (Debian #431696)
    If opening new_file fails, fsp would still be set to the files_struct of
    old_file.
    (cherry picked from commit f75b53f85cbccc4b37db4c9adc0df81a06898d38)

commit 1394827cfda4eeff5b4239b6ed5c93fcaaed0e2e
Author: Holger Hetterich <hhetter at novell.com>
Date:   Mon Sep 29 14:34:36 2008 +0200

    Add an initial version of a manpage for the vfs_smb_traffic_analyzer module.
    (cherry picked from commit 503d1c0226fb38c21b14fe1deac11b0ec461b4d0)

commit e73c090b5ff624f71ce827c494cd71ca73144ba9
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Sep 26 18:37:33 2008 -0700

    Second part of the fix for bug #5790 - samba returns STATUS_OBJECT_NAME_NOT_FOUND on set file disposition call.
    This was my fault. I use a singleton cache (positive and negative) to speed up pathname based qfileinfo/setfileinfo lookups for alternate fsp's open on the same path. I only invalidated the negative cache on adding a new file fsp, as I incorrectly imagined the new fsp was put at the *end* of the open files list. DLIST_ADD puts it at the start, meaning any subsequent open wasn't seen once the cache was set. Doh !
    Jeremy.
    (cherry picked from commit a7fd59a26bfc4a98b6936dc3ac8e67e1a7cb3733)

commit 7292c322ca70e9df82e020f45f1510e9ca02efbc
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Sep 26 15:18:18 2008 -0700

    Fix bug #5797 - Moving readonly files fails. Reported by infomail at lordb.de.
    We don't need to deny a DELETE open on a readonly file (I'm also adding a s4
    torture test for this), the set_file_disposition call will return
    NT_STATUS_CANNOT_DELETE if the delete-on-close bit is set
    on a readonly file (and we already do this).
    Jeremy.
    (cherry picked from commit dd43302066b2d3f5270d3ee25a1e2c85d8ce2b85)

commit aa9a74f33f1a1862836569565d64861706de5429
Author: Günther Deschner <gd at samba.org>
Date:   Fri Sep 26 01:32:16 2008 +0200

    s3-srvsvc: fix _srvsvc_NetShareAdd segfault.
    
    parm_err is not a ref pointer.
    
    Guenther
    (cherry picked from commit 29942b7043c1a31ad4fb76d01ab19fd3dbf26f0a)
    (cherry picked from commit 6debf35c1575a25f98f927726742a7f34b3a55a9)

commit caa0f1131872f82c1a346f701830544b372e4317
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Sep 25 11:56:10 2008 -0700

    Use IPv4/v6 independent calls. Change safe_strcpy/cat to strlcpy/cat (this
    needs changing to talloc_sprintf) and fix file descriptor resource leaks
    in error paths. Jim and Holger please check !
    Jeremy.
    (cherry picked from commit d55becbe492cf3c95ef45ebb2c123067a9297b4f)

commit f64bcae4ff2bb1a9db603c1f38e1e4fa2e5148bc
Author: Jim McDonough <jmcd at samba.org>
Date:   Wed Sep 24 20:47:03 2008 -0400

    Fix the new vfs_smb_traffic_analyzer build for static links
    (cherry picked from commit d36039acd8f1722ba76b5999d7fea4f046735817)

commit aeabc475d8abf9a820b4846a30cf92cc253bc939
Author: Holger Hetterich <hhetter at novell.com>
Date:   Wed Sep 24 19:01:00 2008 -0400

    SMB traffic analyzer vfs module from Holger Hetterich <hhetter at novell.com>
    
    Used to gather data to feed to a database for live and historical
    analysis of usage per user, per share, etc.
    
    Helper apps to read the data still to come.  This one still needs to be
    made ipv6 enabled (connection is made to the helper app).
    (cherry picked from commit baf49e5fcabd3682927fe19974c97bbae4be7379)

commit 24348e2e028f8f63c7acad33f2f9a362a3d3fdc0
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 24 14:26:06 2008 -0700

    Fix bug #5790 samba returns STATUS_OBJECT_NAME_NOT_FOUND on set file disposition.
    We were checking that fd != -1 in file_find_di_XXX calls which is no longer
    needed due to a change in internal semantics.
    Jeremy.
    (cherry picked from commit bd7acd6344022e87495edc124e262eb50ba5ebd8)

commit 9a38a8454cfbd0011d804b3ab88c16e5d4f1c4bd
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 23 16:38:04 2008 -0700

    Fix winbindd crash in an unusual failure mode. Bug #5737. Based on original patch from shargagan at novell.com
    Jeremy.
    (cherry picked from commit 0a0426650e596453b4b8aa6536f4fe8b1d890451)

commit fc9247572e0ace4956845e279c63c9d00fa667bd
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 23 15:04:18 2008 -0700

    Fix bug #5783 FindFirst fails where search pattern == mangled filename.
    That was an old and subtle bug.
    Jeremy.
    (cherry picked from commit c412888f916563c44c4c753884df23c1951f6e27)

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

Summary of changes:
 docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml |  157 ++++++++
 source/Makefile.in                                 |    4 +
 source/client/client.c                             |   13 +-
 source/client/mount.cifs.c                         |   10 +
 source/configure.in                                |    3 +-
 source/lib/debug.c                                 |    4 +-
 source/lib/netapi/getdc.c                          |    5 +
 source/lib/readline.c                              |   21 +-
 source/libaddns/dnsmarshall.c                      |    1 +
 source/libaddns/dnsrecord.c                        |    4 +-
 source/libads/ldap.c                               |    1 +
 source/libads/util.c                               |    2 +
 source/libsmb/dsgetdcname.c                        |    2 +
 source/modules/vfs_smb_traffic_analyzer.c          |  405 ++++++++++++++++++++
 source/printing/nt_printing.c                      |    2 +
 source/printing/print_cups.c                       |  316 +++++++++++-----
 source/rpc_server/srv_srvsvc_nt.c                  |    4 +-
 source/smbd/conn.c                                 |    2 +-
 source/smbd/filename.c                             |    3 +-
 source/smbd/files.c                                |   16 +-
 source/smbd/open.c                                 |    4 +-
 source/smbd/reply.c                                |    4 +-
 source/smbd/trans2.c                               |   13 +-
 source/utils/net_dns.c                             |   26 +-
 source/web/statuspage.c                            |    5 +-
 source/winbindd/idmap_tdb2.c                       |   22 +-
 source/winbindd/winbindd_dual.c                    |   14 +-
 source/winbindd/winbindd_util.c                    |   27 +-
 28 files changed, 937 insertions(+), 153 deletions(-)
 create mode 100644 docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
 create mode 100644 source/modules/vfs_smb_traffic_analyzer.c


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml b/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
new file mode 100644
index 0000000..c0b1ef8
--- /dev/null
+++ b/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="vfs_smb_traffic_analyzer.8">
+
+<refmeta>
+	<refentrytitle>smb_traffic_analyzer</refentrytitle>
+	<manvolnum>8</manvolnum>
+	<refmiscinfo class="source">Samba</refmiscinfo>
+	<refmiscinfo class="manual">System Administration tools</refmiscinfo>
+	<refmiscinfo class="version">3.2</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+	<refname>vfs_smb_traffic_analyzer</refname>
+	<refpurpose>log Samba VFS read and write operations through a socket
+	to a helper application</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>vfs objects = smb_traffic_analyzer</command>
+	</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+	<title>DESCRIPTION</title>
+
+	<para>This VFS module is part of the
+	<citerefentry><refentrytitle>samba</refentrytitle>
+	<manvolnum>7</manvolnum></citerefentry> suite.</para>
+
+	<para>The <command>vfs_smb_traffic_analyzer</command> VFS module logs
+	client write and read operations on a Samba server and sends this data
+	over a socket to a helper program, which feeds a SQL database. More
+	information on the helper programs can be obtained from the
+	homepage of the project at:
+	http://holger123.wordpress.com/smb-traffic-analyzer/
+	</para>
+	<para><command>vfs_smb_traffic_analyzer</command> currently is aware
+	of the following VFS operations:</para>
+
+	<simplelist>
+        <member>write</member>
+        <member>pwrite</member>
+	<member>read</member>
+	<member>pread</member>
+	</simplelist>
+
+	<para><command>vfs_smb_traffic_analyzer</command> sends the following data
+	in a fixed format seperated by a comma through either an internet or a
+	unix domain socket:</para>
+	<programlisting>
+	BYTES|USER|DOMAIN|READ/WRITE|SHARE|FILENAME|TIMESTAMP
+	</programlisting>
+
+	<para>Description of the records:
+
+	<itemizedlist>
+	<listitem><para><command>BYTES</command> - the length in bytes of the VFS operation</para></listitem>
+	<listitem><para><command>USER</command> - the user who initiated the operation</para></listitem>
+	<listitem><para><command>DOMAIN</command> - the domain of the user</para></listitem>
+	<listitem><para><command>READ/WRITE</command> - either "W" for a write operation or "R" for read</para></listitem>
+	<listitem><para><command>SHARE</command> - the name of the share on which the VFS operation occured</para></listitem>
+	<listitem><para><command>FILENAME</command> - the name of the file that was used by the VFS operation</para></listitem>
+	<listitem><para><command>TIMESTAMP</command> - a timestamp, formatted as "yyyy-mm-dd hh-mm-ss.ms" indicating when the VFS operation occured</para></listitem>
+	</itemizedlist>
+
+	</para>
+
+	<para>This module is stackable.</para>
+
+</refsect1>
+
+
+<refsect1>
+	<title>OPTIONS</title>
+
+	<variablelist>
+
+		<varlistentry>
+                <term>smb_traffic_analyzer:mode = STRING</term>
+                <listitem>
+                <para>If STRING matches to "unix_domain_socket", the module will
+		use a unix domain socket located at /var/tmp/stadsocket, if
+		STRING contains an different string or is not defined, the module will
+		use an internet domain socket for data transfer.</para>
+
+                </listitem>
+                </varlistentry>
+
+
+		<varlistentry>
+		<term>smb_traffic_analyzer:host = STRING</term>
+		<listitem>
+		<para>The module will send the data to the system named with
+		the hostname STRING.</para>
+
+		</listitem>
+		</varlistentry>
+
+		<varlistentry>
+		<term>smb_traffic_analyzer:port = STRING</term>
+		<listitem>
+		<para>The module will send the data using the TCP port given
+		in STRING
+		</para>
+
+		</listitem>
+		</varlistentry>
+
+
+	</variablelist>
+</refsect1>
+
+<refsect1>
+	<title>EXAMPLES</title>
+
+	<para>The module running on share "example_share", using a unix domain socket</para>
+	<programlisting>
+	<smbconfsection name="[example_share]"/>
+	<smbconfoption name="path">/data/example</smbconfoption>
+	<smbconfoption name="vfs objects">smb_traffic_analyzer</smbconfoption>
+	<smbconfoption name="smb_traffic_analyzer:mode">unix_domain_socket</smbconfoption>
+	</programlisting>
+
+	<para>The module running on share "example_share", using an internet domain socket,
+	connecting to host "examplehost" on port 3491.</para>
+	<programlisting>
+	<smbconfsection name="[example_share]"/>
+	<smbconfoption name="path">/data/example</smbconfoption>
+	<smbconfoption name="vfs objects">smb_traffic_analyzer</smbconfoption>
+	<smbconfoption name="smb_traffic_analyzer:host">examplehost</smbconfoption>
+	<smbconfoption name="smb_traffic_analyzer:port">3490</smbconfoption>
+	</programlisting>
+
+</refsect1>
+
+<refsect1>
+	<title>VERSION</title>
+	<para>This man page is correct for version 3.2.0 of the Samba suite.
+	</para>
+</refsect1>
+
+<refsect1>
+	<title>AUTHOR</title>
+
+	<para>The original Samba software and related utilities
+	were created by Andrew Tridgell. Samba is now developed
+	by the Samba Team as an Open Source project similar
+	to the way the Linux kernel is developed.</para>
+
+	<para>The original version of the VFS module and the
+	helper tools were created by Holger Hetterich.</para>
+</refsect1>
+
+</refentry>
diff --git a/source/Makefile.in b/source/Makefile.in
index cf405fe..3573ead 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -601,6 +601,7 @@ VFS_TSMSM_OBJ = modules/vfs_tsmsm.o
 VFS_FILEID_OBJ = modules/vfs_fileid.o
 VFS_AIO_FORK_OBJ = modules/vfs_aio_fork.o
 VFS_SYNCOPS_OBJ = modules/vfs_syncops.o
+VFS_SMB_TRAFFIC_ANALYZER_OBJ = modules/vfs_smb_traffic_analyzer.o
 
 PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
 
@@ -2345,6 +2346,9 @@ bin/aio_fork. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_AIO_FORK_OBJ)
 	@echo "Building plugin $@"
 	@$(SHLD_MODULE) $(VFS_AIO_FORK_OBJ)
 
+bin/smb_traffic_analyzer. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SMB_TRAFFIC_ANALYZER_OBJ)
+	@echo "Building plugin $@"
+	@$(SHLD_MODULE) $(VFS_SMB_TRAFFIC_ANALYZER_OBJ)
 #########################################################
 ## IdMap NSS plugins
 
diff --git a/source/client/client.c b/source/client/client.c
index d794f8f..dc5e0f5 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -4342,6 +4342,8 @@ cleanup:
 	}
 }
 
+static bool finished;
+
 /****************************************************************************
  Make sure we swallow keepalives during idle time.
 ****************************************************************************/
@@ -4388,6 +4390,8 @@ static void readline_callback(void)
 			DEBUG(0, ("Read from server failed, maybe it closed "
 				  "the connection\n"));
 
+			finished = true;
+			smb_readline_done();
 			if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
 				set_smb_read_error(&cli->smb_rw_error,
 						   SMB_READ_EOF);
@@ -4416,7 +4420,12 @@ static void readline_callback(void)
 	{
 		unsigned char garbage[16];
 		memset(garbage, 0xf0, sizeof(garbage));
-		cli_echo(cli, 1, garbage, sizeof(garbage));
+		if (!cli_echo(cli, 1, garbage, sizeof(garbage))) {
+			DEBUG(0, ("SMBecho failed. Maybe server has closed "
+				  "the connection\n"));
+			smb_readline_done();
+			finished = true;
+		}
 	}
 }
 
@@ -4428,7 +4437,7 @@ static int process_stdin(void)
 {
 	int rc = 0;
 
-	while (1) {
+	while (!finished) {
 		TALLOC_CTX *frame = talloc_stackframe();
 		char *tok = NULL;
 		char *the_prompt = NULL;
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 8fb652b..56778dd 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -56,6 +56,10 @@
  #endif /* _SAMBA_BUILD_ */
 #endif /* MOUNT_CIFS_VENDOR_SUFFIX */
 
+#ifdef _SAMBA_BUILD_
+#include "include/config.h"
+#endif
+
 #ifndef MS_MOVE 
 #define MS_MOVE 8192 
 #endif 
@@ -94,6 +98,8 @@ char * prefixpath = NULL;
 
 /* like strncpy but does not 0 fill the buffer and always null
  *    terminates. bufsize is the size of the destination buffer */
+
+#ifndef HAVE_STRLCPY
 static size_t strlcpy(char *d, const char *s, size_t bufsize)
 {
 	size_t len = strlen(s);
@@ -104,10 +110,13 @@ static size_t strlcpy(char *d, const char *s, size_t bufsize)
 	d[len] = 0;
 	return ret;
 }
+#endif
 
 /* like strncat but does not 0 fill the buffer and always null
  *    terminates. bufsize is the length of the buffer, which should
  *       be one more than the maximum resulting string length */
+
+#ifndef HAVE_STRLCAT
 static size_t strlcat(char *d, const char *s, size_t bufsize)
 {
 	size_t len1 = strlen(d);
@@ -126,6 +135,7 @@ static size_t strlcat(char *d, const char *s, size_t bufsize)
 	}
 	return ret;
 }
+#endif
 
 /* BB finish BB
 
diff --git a/source/configure.in b/source/configure.in
index d56d628..f28da35 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -404,7 +404,7 @@ dnl These have to be built static:
 default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl2 rpc_ntsvcs2 rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template"
 
 dnl These are preferably build shared, and static if dlopen() is not available
-default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr"
+default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_smb_traffic_analyzer"
 
 if test "x$developer" = xyes; then
    default_static_modules="$default_static_modules rpc_rpcecho"
@@ -6077,6 +6077,7 @@ SMB_MODULE(vfs_aio_fork, \$(VFS_AIO_FORK_OBJ), "bin/aio_fork.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
 
 
 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
diff --git a/source/lib/debug.c b/source/lib/debug.c
index d835ea7..d91b55d 100644
--- a/source/lib/debug.c
+++ b/source/lib/debug.c
@@ -578,7 +578,9 @@ void setup_logging(const char *pname, bool interactive)
 	stdout_logging = False;
 	if (dbf) {
 		x_fflush(dbf);
-		(void) x_fclose(dbf);
+                if (dbf != x_stdout) {
+                        (void) x_fclose(dbf);
+                }
 	}
 
 	dbf = NULL;
diff --git a/source/lib/netapi/getdc.c b/source/lib/netapi/getdc.c
index c1d021b..e03660c 100644
--- a/source/lib/netapi/getdc.c
+++ b/source/lib/netapi/getdc.c
@@ -60,6 +60,11 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
 				       r->in.domain_name,
 				       (const char **)r->out.buffer,
 				       &werr);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		werr = ntstatus_to_werror(status);
+	}
+
  done:
 
 	return werr;
diff --git a/source/lib/readline.c b/source/lib/readline.c
index 254f55c..cf7809b 100644
--- a/source/lib/readline.c
+++ b/source/lib/readline.c
@@ -45,6 +45,24 @@
 #  define RL_COMPLETION_CAST
 #endif /* HAVE_NEW_LIBREADLINE */
 
+static bool smb_rl_done;
+
+#if HAVE_LIBREADLINE
+/*
+ *  * MacOS/X does not have rl_done in readline.h, but
+ *   * readline.so has it
+ *    */
+extern int rl_done;
+#endif
+
+void smb_readline_done(void)
+{
+	smb_rl_done = true;
+#if HAVE_LIBREADLINE
+	rl_done = 1;
+#endif
+}
+
 /****************************************************************************
  Display the prompt and wait for input. Call callback() regularly
 ****************************************************************************/
@@ -69,7 +87,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
 		return NULL;
 	}
 
-	while (1) {
+	while (!smb_rl_done) {
 		timeout.tv_sec = 5;
 		timeout.tv_usec = 0;
 
@@ -87,6 +105,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
 			callback();
 		}
 	}
+	return NULL;
 }
 
 /****************************************************************************
diff --git a/source/libaddns/dnsmarshall.c b/source/libaddns/dnsmarshall.c
index 8c3389e..5530290 100644
--- a/source/libaddns/dnsmarshall.c
+++ b/source/libaddns/dnsmarshall.c
@@ -252,6 +252,7 @@ void dns_unmarshall_domain_name(TALLOC_CTX *mem_ctx,
 
 	if (!(name = talloc(mem_ctx, struct dns_domain_name))) {
 		buf->error = ERROR_DNS_NO_MEMORY;
+		return;
 	}
 
 	dns_unmarshall_label(name, 0, buf, &name->pLabelList);
diff --git a/source/libaddns/dnsrecord.c b/source/libaddns/dnsrecord.c
index 500cbd6..559c264 100644
--- a/source/libaddns/dnsrecord.c
+++ b/source/libaddns/dnsrecord.c
@@ -378,10 +378,10 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
 	if (!ERR_DNS_IS_OK(err)) return err;
 
 	/*
-	 * The zone must be used at all
+	 * Use the same prereq as WinXP -- No CNAME records for this host.
 	 */
 
-	err = dns_create_rrec(req, domainname, QTYPE_ANY, DNS_CLASS_ANY,
+	err = dns_create_rrec(req, hostname, QTYPE_CNAME, DNS_CLASS_NONE,
 			      0, 0, NULL, &rec);
 	if (!ERR_DNS_IS_OK(err)) goto error;
 
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 063645f..842e4fd 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -2639,6 +2639,7 @@ ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val)
 		if ( (ads_s = ads_init( ads->server.realm, ads->server.workgroup, 
 			ads->server.ldap_server )) == NULL )
 		{
+			status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
 			goto done;
 		}
 		ads_s->auth.flags = ADS_AUTH_ANON_BIND;
diff --git a/source/libads/util.c b/source/libads/util.c
index 72f5dee..d23c36f 100644
--- a/source/libads/util.c
+++ b/source/libads/util.c
@@ -86,6 +86,8 @@ ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
 		server_realm = SMB_STRDUP(ads->config.realm);
 
 		if (!server || !server_realm) {
+			SAFE_FREE(server);
+			SAFE_FREE(server_realm);
 			return ADS_ERROR(LDAP_NO_MEMORY);
 		}
 
diff --git a/source/libsmb/dsgetdcname.c b/source/libsmb/dsgetdcname.c
index 8d75593..2b8f76a 100644
--- a/source/libsmb/dsgetdcname.c
+++ b/source/libsmb/dsgetdcname.c
@@ -356,6 +356,8 @@ static NTSTATUS store_cldap_reply(TALLOC_CTX *mem_ctx,
 		}
 	}
 
+	status = NT_STATUS_OK;
+
  done:
 	data_blob_free(&blob);
 
diff --git a/source/modules/vfs_smb_traffic_analyzer.c b/source/modules/vfs_smb_traffic_analyzer.c
new file mode 100644
index 0000000..714df02
--- /dev/null
+++ b/source/modules/vfs_smb_traffic_analyzer.c
@@ -0,0 +1,405 @@
+/*
+ * traffic-analyzer VFS module. Measure the smb traffic users create
+ * on the net.
+ *
+ * Copyright (C) Holger Hetterich, 2008
+ * Copyright (C) Jeremy Allison, 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"
+
+/* abstraction for the send_over_network function */
+enum sock_type {INTERNET_SOCKET = 0, UNIX_DOMAIN_SOCKET};
+
+#define LOCAL_PATHNAME "/var/tmp/stadsocket"
+
+extern userdom_struct current_user_info;
+
+static int vfs_smb_traffic_analyzer_debug_level = DBGC_VFS;
+
+static enum sock_type smb_traffic_analyzer_connMode(vfs_handle_struct *handle)
+{
+	connection_struct *conn = handle->conn;
+        const char *Mode;
+        Mode=lp_parm_const_string(SNUM(conn), "smb_traffic_analyzer","mode", \
+			"internet_socket");
+	if (strstr(Mode,"unix_domain_socket")) {
+		return UNIX_DOMAIN_SOCKET;
+	} else {
+		return INTERNET_SOCKET;
+	}
+}
+
+/* Connect to an internet socket */
+
+static int smb_traffic_analyzer_connect_inet_socket(vfs_handle_struct *handle,
+					const char *name, uint16_t port)
+{
+	/* Create a streaming Socket */
+	int sockfd = -1;
+	struct addrinfo hints;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list