[SCM] SAMBA-CTDB repository - branch v3-4-ctdb updated - 3.4.7-ctdb-9-130-g79020f9

Michael Adam obnox at samba.org
Tue Jun 28 09:28:47 MDT 2011


The branch, v3-4-ctdb has been updated
       via  79020f98f9d50c576bfc753c3b601bc1046fa7fb (commit)
       via  c5d80e9c6c0e597fa4824d8d8e9d4b37d276606f (commit)
       via  bda7d3134ecc547b9c174a04fd2d02813b06f038 (commit)
       via  a04c47b10758b6aa8035107e816dc7efac871646 (commit)
       via  c7655450f4c9784b700218628568c39e3528e9df (commit)
       via  1c81fe53f0ef6e8a9a2f578b809e71d42a82e7eb (commit)
       via  b83a21ed8a1468af62cc6c976f036fb8fc85fa68 (commit)
       via  f3e8ac7e1c01b3ebc49a8db697c47bb01c69e49d (commit)
       via  2aeaed1c8d86df07bb5fc972648e3954c8c38e53 (commit)
       via  217e75e1520acfac863a8626a4ddb82288421ba0 (commit)
       via  fb5552e0aadc537b527673a7b6da59974e34253a (commit)
       via  11c2092e1df134b72d7c417eda7e1cfa0c739033 (commit)
       via  149d0f50830652a3f5116989a7266e8f623c8d74 (commit)
       via  d94b5e95d394f180aaa296310b57a2932e3f8e2a (commit)
       via  b0f596b9e5e4327bfd99d035a34e3b571daa571b (commit)
       via  5b3b8ce8797e001b866c582d45ab8d7380a5758d (commit)
       via  33dcb69eaae058933f7cf9cc7e353af0786a7bb1 (commit)
       via  dd720bd847b8c658aea5cf86ce336093974d672f (commit)
       via  3cd762b6fe36917ee70de694d02f4f03a9d65a7a (commit)
       via  054411303b8b930078e3a117a90402a7c1a4fc86 (commit)
       via  765afa9ac37bc61d11443afb0b879752ba3df803 (commit)
       via  50b786834863c2b3e48b4edcf40ebf1a6909715d (commit)
       via  e5b8a37d2480bbdbe502ea377d35b2480e91ff53 (commit)
       via  5ba1965a981338f00d8cf93151a162534eebbff0 (commit)
       via  3c11dd6514b441daef43ad168be2fba6ba220c96 (commit)
       via  8d344d0b94de53d5370a82f7768b26499ed36f65 (commit)
       via  2ab1db01a72775fd82191a9c5bafc62ecccacff0 (commit)
       via  e2aeafa07c52e2e167f1ef932e54df5a5efddffe (commit)
       via  c4f92fff3af0d8763c6e5b5d4e84a782aa00dd18 (commit)
       via  ae09ace7f69a32e202dbe6542704a922997f1a9a (commit)
       via  6edb49f16f47536e1bfdc2145d5d61897718f415 (commit)
       via  a3c2342b0086461dfa6bc1b0ec4d75f267a163d4 (commit)
       via  6c1881536a818fe65166a789cdf8d4b6a9440c81 (commit)
       via  6773e6e833c9d35cbdfdfd02c3f84db1ecd4a86f (commit)
       via  af630812f690bdb60f62b677d3221be9c8e70d7f (commit)
       via  c75ecafda5567d40564372eecd8395e7741cbffe (commit)
       via  c8befe75669c827419397d874c7e0c06fbcf4f13 (commit)
       via  f970d084dd46b4c1a380d2c8cd0879d39081e745 (commit)
       via  24bb4c4369d107e1cf7069682f6270782a401190 (commit)
       via  ff215e7b1e8b5958914935736b7458817f44ce1f (commit)
       via  9d7dccf2a362b89d0ad207e60693fc3b0cc5637b (commit)
       via  2fc3e7f2ed11b1beee8dab35f05baaa4f2d19ecd (commit)
       via  c7a25de572693318b90d9ff578c2e8d95c3f7ade (commit)
       via  8d155ca22205b3278b6976392f72e947a82e8048 (commit)
       via  dc4bd1d1ca15464108bb1411a600dd2aef0f6b2e (commit)
       via  afb73570d42d598b54d232b6b0504591413cdec1 (commit)
       via  e7aa5fa89984e772318b7a6c27543080a3e88f88 (commit)
       via  6e62dcca878a3e2ead6c85b2ccc57c9a19ae818e (commit)
       via  ec14e807bc8ffda796bb6a95194802b8e87f9823 (commit)
       via  1dcb4ccc658bffb3dfa7a31506b92f338b4c945b (commit)
       via  936cfb0c62233d2a8b2d3097454b6e7208f3f68c (commit)
       via  eb2345d0b1866af48d4bed08ca9702ee7c19c116 (commit)
       via  8e7604d69e44877f453fa198d1e707e5747bc76b (commit)
       via  d9adfddb1972daf8b1f4d9cfef52037fc5badac4 (commit)
       via  ee76cf0087de00bfaab4026a0881e23340b3121c (commit)
       via  d530521fc00027f2438acacf5618a4d38afeba8b (commit)
       via  d8b6144c976168adc42bc91a4735e508d02bdef9 (commit)
       via  5883405cfe448583f86bbbc1299bce2ffef45a4e (commit)
       via  183e9336568f1fcf9360ea84270c580e23528ea6 (commit)
       via  83159c0032d958ebdebecf75629feae888e00a6b (commit)
       via  7b20f28eb51c144df72542ad56c023e0868a9875 (commit)
       via  93a19121634bab7f51cee5c5c4e576668b171275 (commit)
       via  95d329e1b97e918b8111a7173c145fe6926dc3c0 (commit)
       via  1f728435c63b198e345cf59de69cab987da4e0e4 (commit)
       via  be860a0ed6e3c9de614c599e600807ae97c2e826 (commit)
       via  3939300e372503b396c138abd568ea9ce24a0aaa (commit)
       via  c6576ed2a1b772856f6da3d9cfd9a58e31fbb0a1 (commit)
       via  ea3b0febab5dc24619de48e5c858775f660e9b1e (commit)
       via  36656e1420427926080cc4dfe64e401697d4dcb1 (commit)
       via  29ab853e0750499b0fb9625d32fd67d9695b7007 (commit)
       via  b0a1fadb2eeb053e90dd5ff7162e3cb4c2d843c6 (commit)
       via  ef11e3d3f0182a1b1cc1dc852b86b00ed617ebaa (commit)
       via  099e8fa30f30367596cee2d57a75cac73efa4d5a (commit)
       via  5f546bc640bbf12610cb671a9244c8b0e4867695 (commit)
       via  61957a1523a8192fc284243765f82a3cf03ac296 (commit)
       via  dde6693b1d53aca790cfbcec505e62649df3a456 (commit)
       via  c4789521d5e724e45c5881f74d55daf7ac59eb40 (commit)
       via  59ca550f2fd6b0fcab57ccdfc638c24eb44ff3a8 (commit)
       via  dfebc94185e5ca1fc6e7971f8c71cd377c5a4f32 (commit)
       via  92a2f80e19abdbcbc83bf8f55eae9c7cdfa538e2 (commit)
       via  e3aa5a62f28dd9ff4ace599ef9764ba76f12a65e (commit)
      from  e97b5b7e2a48cb21e7118b15a34e70c623eebbc8 (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-4-ctdb


- Log -----------------------------------------------------------------
commit 79020f98f9d50c576bfc753c3b601bc1046fa7fb
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 7 08:29:41 2011 -0700

    v3-4-ctdb: Bump ctdb vendor patch level to 25

commit c5d80e9c6c0e597fa4824d8d8e9d4b37d276606f
Author: Michael Adam <obnox at samba.org>
Date:   Tue Mar 8 16:49:46 2011 +0100

    s3:dbwrap_ctdb: send the SCHEDULE_FOR_DELETION control with the NOREPLY flag.
    
    We don't need to wait for an answer, this is fire and forget.

commit bda7d3134ecc547b9c174a04fd2d02813b06f038
Author: Michael Adam <obnox at samba.org>
Date:   Tue Mar 8 16:26:34 2011 +0100

    s3:ctdb: pass the ctdb control flags to the ctdb daemon when sending the control
    
    The only flag that is currently used is the NOREPLY flag to indicate that
    the client expects no reply packet. This needs to get passed down to the
    ctdb daemon so that it really does not send a reply.

commit a04c47b10758b6aa8035107e816dc7efac871646
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 23 16:46:24 2010 +0100

    s3:ctdb: samba can now handle the NOREPLY flag
    
    Revert "samba3 can't handle NOREPLY yet"
    
    This reverts commit 9bf211db6d7d6ef6e59508de69d6d8dfe5bae059.

commit c7655450f4c9784b700218628568c39e3528e9df
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 23 16:43:55 2010 +0100

    s3:ctdb: correctly handle cstatus if CTDB_CTRL_FLAG_NOREPLY is set.

commit 1c81fe53f0ef6e8a9a2f578b809e71d42a82e7eb
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 22 14:16:07 2010 +0100

    s3:dbwrap_ctdb: in ctdb_delete, send a SCHEDULE_FOR_DELETION control to local ctdbd
    
    This way, the record will be scheduled for fast vacuuming.

commit b83a21ed8a1468af62cc6c976f036fb8fc85fa68
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 7 08:29:41 2011 -0700

    v3-4-ctdb: Bump ctdb vendor patch level to 24

commit f3e8ac7e1c01b3ebc49a8db697c47bb01c69e49d
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 8 15:03:36 2010 +0100

    s3: Fix ENODATA for getacl on .snapshot dirs
    
    The best we can do is to allow everything to the world.

commit 2aeaed1c8d86df07bb5fc972648e3954c8c38e53
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 29 06:07:59 2010 -0700

    v3-4-ctdb: Deal with mmsnapdir -a

commit 217e75e1520acfac863a8626a4ddb82288421ba0
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Tue Feb 22 15:45:44 2011 +0100

    s3:libsmb only log a dead connection if it was not closed
    
    in case the cli was closed before (e.g. via a dropped ip message)
    it can be expected that the read here returns with an error and so
    we should not log that a connection is dead when it was closed before

commit fb5552e0aadc537b527673a7b6da59974e34253a
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 24 02:50:46 2011 -0700

    s3: GPFS can't deal with mangled names
    
    In getrealfilename, avoid calling the GPFS function

commit 11c2092e1df134b72d7c417eda7e1cfa0c739033
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 28 08:24:17 2011 -0700

    v3-4-ctdb: Bump ctdb vendor patch level to 23

commit 149d0f50830652a3f5116989a7266e8f623c8d74
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Wed Feb 23 11:10:15 2011 +0100

    s3: Survive an idle child that was killed
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Mon Feb 28 14:53:20 CET 2011 on sn-devel-104
    (cherry picked from commit 3854413c246a3a69d100af6e827ce8f217bf408e)

commit d94b5e95d394f180aaa296310b57a2932e3f8e2a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 2 17:47:19 2011 -0800

    Fix value overflow (one too many 'f's ).
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Thu Feb  3 03:35:32 CET 2011 on sn-devel-104

commit b0f596b9e5e4327bfd99d035a34e3b571daa571b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 15 02:22:31 2011 -0700

    v3-4-ctdb: Bump ctdb vendor patch level to 22

commit 5b3b8ce8797e001b866c582d45ab8d7380a5758d
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Thu Feb 10 15:55:50 2011 +0100

    nsswitch: fix a segfault in the krb5 locator plugin
    
    after the number of retries was exceeded, the loop did not
    bail out correctly with an error and went on using a null pointer

commit 33dcb69eaae058933f7cf9cc7e353af0786a7bb1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 9 11:00:00 2011 +0100

    s3: Cope with 192.168.1.1/24 in smbcontrol ip-dropped

commit dd720bd847b8c658aea5cf86ce336093974d672f
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 11 08:44:36 2011 +0100

    s3: Add more checks and better fallback to addrchange
    
    From http://netsplit.com/2011/02/09/the-proc-connector-and-socket-filters/ I
    learned a bit more about netlink...
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri Feb 11 10:47:09 CET 2011 on sn-devel-104

commit 3cd762b6fe36917ee70de694d02f4f03a9d65a7a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 7 02:48:07 2011 -0700

    v3-4-ctdb: Bump ctdb vendor patch level to 21

commit 054411303b8b930078e3a117a90402a7c1a4fc86
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 4 12:54:36 2011 +0100

    s3:lib/addrchange: set ctx->sock to -1 after close
    
    The makes the code more consistent with similar destructors.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Fri Feb  4 15:52:55 CET 2011 on sn-devel-104

commit 765afa9ac37bc61d11443afb0b879752ba3df803
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 4 12:53:38 2011 +0100

    s3:lib/addrchange: remove unused pointer
    
    metze

commit 50b786834863c2b3e48b4edcf40ebf1a6909715d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 4 12:32:41 2011 +0100

    s3:lib/addrchange: let addrchange_done() retry and ignore unknown message types
    
    Messages like RTM_NEWLINK should be just ignored.
    
    metze

commit e5b8a37d2480bbdbe502ea377d35b2480e91ff53
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 4 12:29:42 2011 +0100

    s3:winbindd: fix segfaults on addrchange errors and make DEBUG() statements more usefull
    
    metze

commit 5ba1965a981338f00d8cf93151a162534eebbff0
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 2 05:08:40 2011 -0700

    v3-4-ctdb: Work around the 1024-fd limit in select
    
    This is an extremely dirty hack that just postpones the problem that select
    only allows 1024 file descriptors to be queried by increasing the limit
    to 16384.

commit 3c11dd6514b441daef43ad168be2fba6ba220c96
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 1 05:23:06 2011 -0700

    v3-4-ctdb: Bump ctdb vendor patch level to 20

commit 8d344d0b94de53d5370a82f7768b26499ed36f65
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 31 17:25:55 2011 +0100

    s3: Send a dropped_ip message if we lose an IP

commit 2ab1db01a72775fd82191a9c5bafc62ecccacff0
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 27 16:56:13 2011 +0100

    s3: test addrchange

commit e2aeafa07c52e2e167f1ef932e54df5a5efddffe
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 27 12:58:22 2011 +0100

    s3: Add support for AF_NETLINK addr notifications
    
    Via an AF_NETLINK socket, the Linux kernel can inform us when IP addresses are
    added or dropped.
    
    This will first be used in winbind, it was triggered by clustering with ctdb.
    When winbind is connected to a domain controller and ctdb decides to move away
    the IP address that winbind used locally for the connection to the DC, the next
    request will run into a timeout. winbind sends out its request, but the
    response will never arrive: The IP is gone.
    
    It will also be interesting for more reliable online/offline detection, but
    this is something for future winbind refactoring.

commit c4f92fff3af0d8763c6e5b5d4e84a782aa00dd18
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 1 03:39:45 2011 -0700

    v3-4-ctdb: Add recfrom_send/recv

commit ae09ace7f69a32e202dbe6542704a922997f1a9a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 31 11:58:45 2011 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 19

commit 6edb49f16f47536e1bfdc2145d5d61897718f415
Author: Michael Adam <obnox at samba.org>
Date:   Sun Jan 30 13:49:14 2011 +0100

    s3:net registry: ignore WERR_BADFILE when --force is given in deletekey[_recursive]

commit a3c2342b0086461dfa6bc1b0ec4d75f267a163d4
Author: Michael Adam <obnox at samba.org>
Date:   Sun Jan 30 13:44:31 2011 +0100

    s3:registry: in deletekey_recursive, fix return code upon error.
    
    correctly keep the werr from inside the transaction when the opearation
    inside the transaction fails.
    
    What is the correct behaviour if the cancel operation fails?

commit 6c1881536a818fe65166a789cdf8d4b6a9440c81
Author: Michael Adam <obnox at samba.org>
Date:   Wed Sep 22 06:21:38 2010 +0200

    s3:registry: remove unneeded TALLOC_CTX argument from reg_deletekey_recursive

commit 6773e6e833c9d35cbdfdfd02c3f84db1ecd4a86f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Sep 22 06:27:49 2010 +0200

    s3:net: add subcommand net registry deletekey_recursive
    
    to delete a key including subkeys

commit af630812f690bdb60f62b677d3221be9c8e70d7f
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Thu Jan 27 19:31:45 2011 +0100

    s3: fix empty ACL dialog for file in snapshot
    
    Explorer failed to display the ACL of a file when it was
    located in a snapshot.
    Originally, this was already fixed with 30b5a1d2290fb09d362
    in samba-ctdb v3.2.
    The patch was ported to master, but there is no fget_nt_acl
    operation any more so that part was ommited.
    Afterwards, it was ported from there to 3.4 missing
    the fget_nt_acl part now.
    
    Re-adding now the lost part

commit c75ecafda5567d40564372eecd8395e7741cbffe
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Mon Jan 17 14:56:52 2011 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 18

commit c8befe75669c827419397d874c7e0c06fbcf4f13
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 14 05:14:22 2011 -0700

    s3: Make sure we call wbcAuthenticateUserEx correctly
    
    There are cases where we fill in params.password.response.lm_data with non-NULL
    where params.password.response.lm_length is 0. wbcAuthenticateUserEx does not
    like that.

commit f970d084dd46b4c1a380d2c8cd0879d39081e745
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 10 17:25:00 2011 +0100

    s3: Add wbinfo --dc-info

commit 24bb4c4369d107e1cf7069682f6270782a401190
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Thu Jan 13 16:04:36 2011 +0100

    s3:vfs aio_fork children do not go away
    
    on RHEL 5.5, recvmsg() does not return when it is reading
    from the socket and the process on the other side closes
    its connection. This left aio children around that should
    have gone already and were just wasting system resources.
    
    This patch makes the child go away by writing invalid
    data to it so that the child exits.
    
    Pair-Programmed-With: Volker Lendecke <vl at samba.org>

commit ff215e7b1e8b5958914935736b7458817f44ce1f
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Thu Jan 13 15:59:18 2011 +0100

    s3:vfs fix children cleanup in aio_fork
    
    the cleanup loop in aio_fork always stopped operation
    on the first inactive child it found. In case lots of
    children need to be reaped, it will take multiple runs
    before all children are gone

commit 9d7dccf2a362b89d0ad207e60693fc3b0cc5637b
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Mon Jan 17 14:06:15 2011 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 17

commit 2fc3e7f2ed11b1beee8dab35f05baaa4f2d19ecd
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 21 21:55:01 2010 +0100

    s3: Use smbsock_any_connect in winbind

commit c7a25de572693318b90d9ff578c2e8d95c3f7ade
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 21 18:52:53 2010 +0100

    s3: Retry *SMBSERVER in nb_connect

commit 8d155ca22205b3278b6976392f72e947a82e8048
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 13 17:17:51 2010 +0100

    s3: Add smbsock_any_connect

commit dc4bd1d1ca15464108bb1411a600dd2aef0f6b2e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 12 18:55:06 2010 +0100

    s3: Add an async smbsock_connect
    
    This connects to 445 and after 5 milliseconds also to 139. It treats a netbios
    session setup failure as equivalent as a TCP connect failure. So if 139 is
    faster but fails the nb session setup, the 445 still has the chance to succeed.

commit afb73570d42d598b54d232b6b0504591413cdec1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 22 15:21:27 2010 +0100

    v3-4-test: Pull in tevent_req_poll_ntstatus from master

commit e7aa5fa89984e772318b7a6c27543080a3e88f88
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 12 18:54:31 2010 +0100

    s3: Add async cli_session_request
    
    This does not do the redirects, but I think that might be obsolete anyway

commit 6e62dcca878a3e2ead6c85b2ccc57c9a19ae818e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 22 15:15:47 2010 +0100

    v3-4-test: Pull in read_smb_send from master

commit ec14e807bc8ffda796bb6a95194802b8e87f9823
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 12 18:53:49 2010 +0100

    s3: Add some const to name_mangle()

commit 1dcb4ccc658bffb3dfa7a31506b92f338b4c945b
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 16 04:26:02 2010 -0700

    s3: Fix shadow-copy module for drag&drop from a snapshot
    
    We have to return NT_STATUS_NOT_SAME_DEVICE to trigger the Windows client to
    start a copy itself. Unbeknownst to us via the ACLs snapshots are read-only, so
    a rename would trigger a EACCES. Unfortunately the MacOS/X finder does not do
    the smart NOT_SAME_DEVICE fallback that Windows does.

commit 936cfb0c62233d2a8b2d3097454b6e7208f3f68c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 13 13:42:30 2010 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 16

commit eb2345d0b1866af48d4bed08ca9702ee7c19c116
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 10 08:48:19 2010 -0700

    s3: Reply correctly to FSCTL_IS_VOLUME_DIRTY

commit 8e7604d69e44877f453fa198d1e707e5747bc76b
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 29 18:09:49 2010 +0100

    s3: Add shadow copy info to smbclient allinfo
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Tue Nov 30 12:23:50 CET 2010 on sn-devel-104

commit d9adfddb1972daf8b1f4d9cfef52037fc5badac4
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 29 17:39:43 2010 +0100

    s3: Add cli_shadow_copy_data

commit ee76cf0087de00bfaab4026a0881e23340b3121c
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Thu Dec 9 11:25:17 2010 +0100

    s3:registry correct a debug level
    
    this is not a level 0 message, move it to 10

commit d530521fc00027f2438acacf5618a4d38afeba8b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 3 01:34:02 2010 -0700

    s3: Fix serverid_exists
    
    In the cluster case it can happen that a node just died and we did not yet have
    the time to clean up serverid.tdb. If the corresponding serverid.tdb record
    that represented a process was migrated away from the dead record, it
    represents existence of a process where it is already dead.

commit d8b6144c976168adc42bc91a4735e508d02bdef9
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 3 02:13:46 2010 -0700

    v3-4-ctdb: Fix debuginfo builds

commit 5883405cfe448583f86bbbc1299bce2ffef45a4e
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Wed Nov 24 11:57:59 2010 +0100

    s3:winbind correct a copy&paste error
    
    negative results of sid->gid lookups should be stored with
    idmap_cache_set_sid2gid instead of idmap_cache_set_sid2uid
    
    This seems to be a copy&paste error when similar logic from the
    sid2uid path was copied here in 84b88f4b.

commit 183e9336568f1fcf9360ea84270c580e23528ea6
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 23 14:49:12 2010 +0100

    v3-4-test: Protect against invalid winbindd_cache entries

commit 83159c0032d958ebdebecf75629feae888e00a6b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 23 14:28:45 2010 +0100

    v3-4-test: Correctly calculate the wbinfo -s result

commit 7b20f28eb51c144df72542ad56c023e0868a9875
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 2 17:18:31 2010 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 15

commit 93a19121634bab7f51cee5c5c4e576668b171275
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Wed Nov 10 18:37:02 2010 +0100

    s3:winbind killed winbind child logs back trace
    
    change the signal that the winbind parent sends to a children
    that timed out answering a request from SIGTERM to SIGXCPU
    
    By adding this differentation, it is possible to dump
    a backtrace of the child only in this case, not when winbind
    is shutting down
    The backtrace is meant as a debug aid to determine what
    a child was waiting for when it timed out

commit 95d329e1b97e918b8111a7173c145fe6926dc3c0
Author: Christian Ambach <christian.ambach at de.ibm.com>
Date:   Wed Nov 10 18:35:19 2010 +0100

    s3:util add log_stack_trace_with_level
    
    add a new function log_stack_trace_with_level to specify
    the debug level with which backtraces will be written to the log

commit 1f728435c63b198e345cf59de69cab987da4e0e4
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 17 08:56:28 2010 -0700

    s3: Make winbind recover from a signing error
    
    When winbind sees a signing error on the smb connection to a DC (for whatever
    reason, our bug, network glitch, etc) it should recover properly. The "old"
    code in clientgen.c just closed the socket in this case. This is the right
    thing to do, this connection is spoiled anyway. The new, async code did not do
    this so far, which led to the code in winbindd_cm.c not detect that we need to
    reconnect.

commit be860a0ed6e3c9de614c599e600807ae97c2e826
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 2 17:18:31 2010 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 14

commit 3939300e372503b396c138abd568ea9ce24a0aaa
Author: Michael Adam <obnox at samba.org>
Date:   Wed Oct 13 16:57:26 2010 +0200

    v3-4-ctdb: Bump ctdb vendor patch level to 13

commit c6576ed2a1b772856f6da3d9cfd9a58e31fbb0a1
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Oct 25 11:07:36 2010 +0200

    s3: Pass tdb_flags to ctdbd when attaching to a db
    
    This is required to make ctdb create databases with INCOMPATIBLE_HASH

commit ea3b0febab5dc24619de48e5c858775f660e9b1e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Oct 21 12:37:51 2010 +0200

    s3: use TDB_INCOMPATIBLE_HASH (the jenkins hash) on all TDB_CLEAR_IF_FIRST tdb's.
    
    In the backport we only use TDB_INCOMPATIBLE_HASH if CLEAR_IF_FIRST
    was also set, that should make downgrades easier to handle.
    
    (similar to commit f98d217514433cd06887f8c0217a7835392f0375)
    
    metze

commit 36656e1420427926080cc4dfe64e401697d4dcb1
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Oct 21 12:09:15 2010 +0200

    tdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.
    
    This flag to tdb_open/tdb_open_ex effects creation of a new database:
    1) Uses the Jenkins lookup3 hash instead of the old gdbm hash if none is
       specified,
    2) Places a non-zero field in header->rwlocks, so older versions of TDB will
       refuse to open it.
    
    This means that the caller (ie Samba) can set this flag to safely
    change the hash function.  Versions of TDB from this one on will either
    use the correct hash or refuse to open (if a different hash is specified).
    Older TDB versions will see the nonzero rwlocks field and refuse to open
    it under any conditions.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    (cherry picked (modified) from commit 2dcf76c9247ff02a1779000dbbecdc418473ca41)
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 29ab853e0750499b0fb9625d32fd67d9695b7007
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Fri Sep 24 15:39:43 2010 +0930

    tdb: automatically identify Jenkins hash tdbs
    
    If the caller to tdb_open_ex() doesn't specify a hash, and tdb_old_hash
    doesn't match, try tdb_jenkins_hash.
    
    This was Metze's idea: it makes life simpler, especially with the upcoming
    TDB_INCOMPATIBLE_HASH flag.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    (cherry picked from commit ccac258d14dda7d8a994a7b80474ce6d85478a6d)
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit b0a1fadb2eeb053e90dd5ff7162e3cb4c2d843c6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Oct 21 14:10:36 2010 +0200

    s3:configure: build common/hash.o from lib/tdb
    
    metze

commit ef11e3d3f0182a1b1cc1dc852b86b00ed617ebaa
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Oct 21 12:11:00 2010 +0200

    tdb: fix non-WAF build, commit 1.2.6 ABI file.
    
    Sorry Jeremy.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    (cherry picked (modified) from commit b7cd6af5b45840a3588ad0cd50b4414f32f8b792)
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 099e8fa30f30367596cee2d57a75cac73efa4d5a
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Oct 21 12:02:01 2010 +0200

    tdb: add Bob Jenkins lookup3 hash as helper hash.
    
    This is a better hash than the default: shipping it with tdb makes it easy
    for callers to use it as the hash by passing it to tdb_open_ex().
    
    This version taken from CCAN and modified, which took it from
    http://www.burtleburtle.net/bob/c/lookup3.c.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    (cherry picked (modified) from commit 3258cf3f11bf7c68a2e69e1808c4551cc899725a)
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 5f546bc640bbf12610cb671a9244c8b0e4867695
Author: Günther Deschner <gd at samba.org>
Date:   Mon Sep 20 16:01:51 2010 -0700

    lib/tdb: fix c++ build warning in tdb_header_hash().
    
    Guenther
    (cherry picked from commit 1585c4df68a66569524a41def95488666dd827dd)
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 61957a1523a8192fc284243765f82a3cf03ac296
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Oct 21 11:55:19 2010 +0200

    tdb: put example hashes into header, so we notice incorrect hash_fn.
    
    This is Stefan Metzmacher <metze at samba.org>'s patch with minor changes:
    1) Use the TDB_MAGIC constant so both hashes aren't of strings.
    2) Check the hash in tdb_check (paranoia, really).
    3) Additional check in the (unlikely!) case where both examples hash to 0.
    4) Cosmetic changes to var names and complaint message.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
    (cherry picked (modified for v3-4) from commit 786b7263000dedcb97e7369402e2e9dc967e36c4)
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit dde6693b1d53aca790cfbcec505e62649df3a456
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 19 08:59:14 2010 +0200

    s3: Add some DEBUG

commit c4789521d5e724e45c5881f74d55daf7ac59eb40
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 19 08:53:21 2010 +0200

    s3: Cope with EINTR in smbd_[un]lock_socket

commit 59ca550f2fd6b0fcab57ccdfc638c24eb44ff3a8
Author: Michael Adam <obnox at samba.org>
Date:   Wed Oct 13 16:57:26 2010 +0200

    v3-4-ctdb: Bump ctdb vendor patch level to 12

commit dfebc94185e5ca1fc6e7971f8c71cd377c5a4f32
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 6 18:24:13 2010 +0200

    s3: Fix the async echo responder for netbios keepalives
    
    This fixes a crash in the echo responder when the client started to send the
    NetBIOS-Level 0x85-style keepalive packets. We did not correctly check the
    packet length, so the code writing the signing seqnum overwrote memory after
    the malloc'ed area for the 4 byte keepalive packet.

commit 92a2f80e19abdbcbc83bf8f55eae9c7cdfa538e2
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 2 17:07:00 2010 +0200

    s3: Stop using the write cache after an oplock break
    
    This fixes samba-bug 7715: If "write cache size" is set (a typical tuning knob
    that might be applied in critical customer situations by performance experts),
    smbd can corrupt data. This fixes it.

commit e3aa5a62f28dd9ff4ace599ef9764ba76f12a65e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 6 15:05:59 2010 +0200

    s3: Make the write end of the echo responder pipe non-blocking
    
    Without this, we can get a writable pipe end, but the writev call on the pipe
    will block.

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

Summary of changes:
 lib/async_req/async_sock.c                         |   82 +++
 lib/async_req/async_sock.h                         |    7 +
 lib/replace/replace.h                              |    7 +
 lib/tdb/common/hash.c                              |  380 +++++++++++++
 lib/tdb/common/open.c                              |   91 +++-
 lib/tdb/common/tdb_private.h                       |   11 +-
 lib/tdb/include/tdb.h                              |    7 +
 lib/tdb/libtdb.m4                                  |    2 +-
 nsswitch/libwbclient/wbc_util.c                    |   88 +++
 nsswitch/libwbclient/wbclient.h                    |   15 +-
 nsswitch/wbinfo.c                                  |   33 ++
 nsswitch/winbind_krb5_locator.c                    |    2 +-
 nsswitch/winbind_struct_protocol.h                 |    4 +-
 packaging/RHEL-CTDB/makerpms.sh                    |   11 +
 source3/Makefile.in                                |    3 +
 source3/VERSION                                    |    2 +-
 source3/auth/auth_winbind.c                        |   14 +-
 source3/client/client.c                            |   46 ++
 source3/configure.in                               |   11 +-
 source3/include/async_smb.h                        |    7 +
 source3/include/ntioctl.h                          |    1 +
 source3/include/proto.h                            |   45 ++-
 source3/lib/addrchange.c                           |  294 ++++++++++
 .../net_registry_util.h => lib/addrchange.h}       |   40 +-
 source3/lib/conn_tdb.c                             |    4 +-
 source3/lib/ctdbd_conn.c                           |    9 +-
 source3/lib/dbwrap_ctdb.c                          |   43 ++-
 source3/lib/g_lock.c                               |    2 +-
 source3/lib/gencache.c                             |    2 +-
 source3/lib/messages_local.c                       |    4 +-
 source3/lib/serverid.c                             |    8 +-
 source3/lib/smbconf/smbconf_reg.c                  |    5 +-
 source3/lib/util.c                                 |   36 +-
 source3/libgpo/gpext/scripts.c                     |    2 +-
 source3/libgpo/gpo_reg.c                           |    4 +-
 source3/libsmb/async_smb.c                         |  214 ++++++++
 source3/libsmb/clientgen.c                         |   19 +-
 source3/libsmb/clifile.c                           |  156 ++++++
 source3/libsmb/nmblib.c                            |    2 +-
 source3/libsmb/smb_share_modes.c                   |    2 +-
 source3/libsmb/smbsock_connect.c                   |  573 ++++++++++++++++++++
 source3/libsmb/unexpected.c                        |    2 +-
 source3/locking/brlock.c                           |    2 +-
 source3/locking/locking.c                          |    2 +-
 source3/modules/vfs_aio_fork.c                     |   22 +-
 source3/modules/vfs_gpfs.c                         |   26 +-
 source3/modules/vfs_shadow_copy2.c                 |   50 ++
 source3/nmbd/nmbd_winsserver.c                     |    3 +-
 source3/registry/reg_api.c                         |   43 +-
 source3/registry/reg_parse.c                       |    2 +-
 source3/rpc_client/cli_lsarpc.c                    |   34 +-
 source3/smbd/notify_internal.c                     |    8 +-
 source3/smbd/nttrans.c                             |    9 +
 source3/smbd/oplock.c                              |    1 +
 source3/smbd/process.c                             |   48 ++-
 source3/smbd/session.c                             |    2 +-
 source3/torture/proto.h                            |    6 +
 source3/torture/test_addrchange.c                  |   93 ++++
 source3/torture/torture.c                          |    1 +
 source3/utils/dbwrap_torture.c                     |    2 +-
 source3/utils/net_registry.c                       |   37 ++-
 source3/utils/net_serverid.c                       |    2 +-
 source3/utils/net_status.c                         |    4 +-
 source3/utils/status.c                             |    4 +-
 source3/winbindd/idmap_util.c                      |    6 +-
 source3/winbindd/winbindd.c                        |  105 ++++
 source3/winbindd/winbindd_cache.c                  |   13 +-
 source3/winbindd/winbindd_cm.c                     |  187 +++++--
 source3/winbindd/winbindd_dual.c                   |    2 +-
 source3/winbindd/winbindd_misc.c                   |   53 ++
 source3/winbindd/winbindd_proto.h                  |    4 +
 71 files changed, 2849 insertions(+), 212 deletions(-)
 create mode 100644 lib/tdb/common/hash.c
 create mode 100644 source3/lib/addrchange.c
 copy source3/{utils/net_registry_util.h => lib/addrchange.h} (50%)
 create mode 100644 source3/libsmb/smbsock_connect.c
 create mode 100644 source3/torture/test_addrchange.c


Changeset truncated at 500 lines:

diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index 09ab7d0..f4777ca 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -611,3 +611,85 @@ ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 	*pbuf = talloc_move(mem_ctx, &state->buf);
 	return talloc_get_size(*pbuf);
 }
+
+struct recvfrom_state {
+	int fd;
+	void *buf;
+	size_t len;
+	int flags;
+	struct sockaddr_storage *addr;
+	socklen_t *addr_len;
+	ssize_t received;
+};
+
+static void recvfrom_handler(struct tevent_context *ev,
+			       struct tevent_fd *fde,
+			       uint16_t flags, void *private_data);
+
+struct tevent_req *recvfrom_send(TALLOC_CTX *mem_ctx,
+				 struct tevent_context *ev,
+				 int fd, void *buf, size_t len, int flags,
+				 struct sockaddr_storage *addr,
+				 socklen_t *addr_len)
+{
+	struct tevent_req *result;
+	struct recvfrom_state *state;
+	struct tevent_fd *fde;
+
+	result = tevent_req_create(mem_ctx, &state, struct recvfrom_state);
+	if (result == NULL) {
+		return result;
+	}
+	state->fd = fd;
+	state->buf = buf;
+	state->len = len;
+	state->flags = flags;
+	state->addr = addr;
+	state->addr_len = addr_len;
+
+	fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ, recvfrom_handler,
+			    result);
+	if (fde == NULL) {
+		TALLOC_FREE(result);
+		return NULL;
+	}
+	return result;
+}
+
+static void recvfrom_handler(struct tevent_context *ev,
+			       struct tevent_fd *fde,
+			       uint16_t flags, void *private_data)
+{
+	struct tevent_req *req = talloc_get_type_abort(
+		private_data, struct tevent_req);
+	struct recvfrom_state *state =
+		tevent_req_data(req, struct recvfrom_state);
+
+	state->received = recvfrom(state->fd, state->buf, state->len,
+				   state->flags, (struct sockaddr *)state->addr,
+				   state->addr_len);
+	if ((state->received == -1) && (errno == EINTR)) {
+		/* retry */
+		return;
+	}
+	if (state->received == 0) {
+		tevent_req_error(req, EPIPE);
+		return;
+	}
+	if (state->received == -1) {
+		tevent_req_error(req, errno);
+		return;
+	}
+	tevent_req_done(req);
+}
+
+ssize_t recvfrom_recv(struct tevent_req *req, int *perrno)
+{
+	struct recvfrom_state *state =
+		tevent_req_data(req, struct recvfrom_state);
+
+	if (tevent_req_is_unix_error(req, perrno)) {
+		return -1;
+	}
+	return state->received;
+}
diff --git a/lib/async_req/async_sock.h b/lib/async_req/async_sock.h
index c5d9400..2139f19 100644
--- a/lib/async_req/async_sock.h
+++ b/lib/async_req/async_sock.h
@@ -57,4 +57,11 @@ struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
 ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 			 uint8_t **pbuf, int *perrno);
 
+struct tevent_req *recvfrom_send(TALLOC_CTX *mem_ctx,
+				 struct tevent_context *ev,
+				 int fd, void *buf, size_t len, int flags,
+				 struct sockaddr_storage *addr,
+				 socklen_t *addr_len);
+ssize_t recvfrom_recv(struct tevent_req *req, int *perrno);
+
 #endif
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index c5b8676..c16964e 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -32,6 +32,13 @@
 #include "config.h"
 #endif
 
+#include <features.h>
+#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+# include <bits/types.h>
+# undef __FD_SETSIZE
+# define __FD_SETSIZE 16384
+#endif
+
 #ifdef HAVE_STANDARDS_H
 #include <standards.h>
 #endif
diff --git a/lib/tdb/common/hash.c b/lib/tdb/common/hash.c
new file mode 100644
index 0000000..c07297e
--- /dev/null
+++ b/lib/tdb/common/hash.c
@@ -0,0 +1,380 @@
+ /*
+   Unix SMB/CIFS implementation.
+
+   trivial database library
+
+   Copyright (C) Rusty Russell		   2010
+
+     ** NOTE! The following LGPL license applies to the tdb
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#include "tdb_private.h"
+
+/* This is based on the hash algorithm from gdbm */
+unsigned int tdb_old_hash(TDB_DATA *key)
+{
+	uint32_t value;	/* Used to compute the hash value.  */
+	uint32_t   i;	/* Used to cycle through random values. */
+
+	/* Set the initial value from the key size. */
+	for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++)
+		value = (value + (key->dptr[i] << (i*5 % 24)));
+
+	return (1103515243 * value + 12345);
+}
+
+#ifndef WORDS_BIGENDIAN
+# define HASH_LITTLE_ENDIAN 1
+# define HASH_BIG_ENDIAN 0
+#else
+# define HASH_LITTLE_ENDIAN 0
+# define HASH_BIG_ENDIAN 1
+#endif
+
+/*
+-------------------------------------------------------------------------------
+lookup3.c, by Bob Jenkins, May 2006, Public Domain.
+
+These are functions for producing 32-bit hashes for hash table lookup.
+hash_word(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
+are externally useful functions.  Routines to test the hash are included
+if SELF_TEST is defined.  You can use this free for any purpose.  It's in
+the public domain.  It has no warranty.
+
+You probably want to use hashlittle().  hashlittle() and hashbig()
+hash byte arrays.  hashlittle() is is faster than hashbig() on
+little-endian machines.  Intel and AMD are little-endian machines.
+On second thought, you probably want hashlittle2(), which is identical to
+hashlittle() except it returns two 32-bit hashes for the price of one.
+You could implement hashbig2() if you wanted but I haven't bothered here.
+
+If you want to find a hash of, say, exactly 7 integers, do
+  a = i1;  b = i2;  c = i3;
+  mix(a,b,c);
+  a += i4; b += i5; c += i6;
+  mix(a,b,c);
+  a += i7;
+  final(a,b,c);
+then use c as the hash value.  If you have a variable length array of
+4-byte integers to hash, use hash_word().  If you have a byte array (like
+a character string), use hashlittle().  If you have several byte arrays, or
+a mix of things, see the comments above hashlittle().
+
+Why is this so big?  I read 12 bytes at a time into 3 4-byte integers,
+then mix those integers.  This is fast (you can do a lot more thorough
+mixing with 12*3 instructions on 3 integers than you can with 3 instructions
+on 1 byte), but shoehorning those bytes into integers efficiently is messy.
+*/
+
+#define hashsize(n) ((uint32_t)1<<(n))
+#define hashmask(n) (hashsize(n)-1)
+#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
+
+/*
+-------------------------------------------------------------------------------
+mix -- mix 3 32-bit values reversibly.
+
+This is reversible, so any information in (a,b,c) before mix() is
+still in (a,b,c) after mix().
+
+If four pairs of (a,b,c) inputs are run through mix(), or through
+mix() in reverse, there are at least 32 bits of the output that
+are sometimes the same for one pair and different for another pair.
+This was tested for:
+* pairs that differed by one bit, by two bits, in any combination
+  of top bits of (a,b,c), or in any combination of bottom bits of
+  (a,b,c).
+* "differ" is defined as +, -, ^, or ~^.  For + and -, I transformed
+  the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
+  is commonly produced by subtraction) look like a single 1-bit
+  difference.
+* the base values were pseudorandom, all zero but one bit set, or
+  all zero plus a counter that starts at zero.
+
+Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
+satisfy this are
+    4  6  8 16 19  4
+    9 15  3 18 27 15
+   14  9  3  7 17  3
+Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
+for "differ" defined as + with a one-bit base and a two-bit delta.  I
+used http://burtleburtle.net/bob/hash/avalanche.html to choose
+the operations, constants, and arrangements of the variables.
+
+This does not achieve avalanche.  There are input bits of (a,b,c)
+that fail to affect some output bits of (a,b,c), especially of a.  The
+most thoroughly mixed value is c, but it doesn't really even achieve
+avalanche in c.
+
+This allows some parallelism.  Read-after-writes are good at doubling
+the number of bits affected, so the goal of mixing pulls in the opposite
+direction as the goal of parallelism.  I did what I could.  Rotates
+seem to cost as much as shifts on every machine I could lay my hands
+on, and rotates are much kinder to the top and bottom bits, so I used
+rotates.
+-------------------------------------------------------------------------------
+*/
+#define mix(a,b,c) \
+{ \
+  a -= c;  a ^= rot(c, 4);  c += b; \
+  b -= a;  b ^= rot(a, 6);  a += c; \
+  c -= b;  c ^= rot(b, 8);  b += a; \
+  a -= c;  a ^= rot(c,16);  c += b; \
+  b -= a;  b ^= rot(a,19);  a += c; \
+  c -= b;  c ^= rot(b, 4);  b += a; \
+}
+
+/*
+-------------------------------------------------------------------------------
+final -- final mixing of 3 32-bit values (a,b,c) into c
+
+Pairs of (a,b,c) values differing in only a few bits will usually
+produce values of c that look totally different.  This was tested for
+* pairs that differed by one bit, by two bits, in any combination
+  of top bits of (a,b,c), or in any combination of bottom bits of
+  (a,b,c).
+* "differ" is defined as +, -, ^, or ~^.  For + and -, I transformed
+  the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
+  is commonly produced by subtraction) look like a single 1-bit
+  difference.
+* the base values were pseudorandom, all zero but one bit set, or
+  all zero plus a counter that starts at zero.
+
+These constants passed:
+ 14 11 25 16 4 14 24
+ 12 14 25 16 4 14 24
+and these came close:
+  4  8 15 26 3 22 24
+ 10  8 15 26 3 22 24
+ 11  8 15 26 3 22 24
+-------------------------------------------------------------------------------
+*/
+#define final(a,b,c) \
+{ \
+  c ^= b; c -= rot(b,14); \
+  a ^= c; a -= rot(c,11); \
+  b ^= a; b -= rot(a,25); \
+  c ^= b; c -= rot(b,16); \
+  a ^= c; a -= rot(c,4);  \
+  b ^= a; b -= rot(a,14); \
+  c ^= b; c -= rot(b,24); \
+}
+
+
+/*
+-------------------------------------------------------------------------------
+hashlittle() -- hash a variable-length key into a 32-bit value
+  k       : the key (the unaligned variable-length array of bytes)
+  length  : the length of the key, counting by bytes
+  val2    : IN: can be any 4-byte value OUT: second 32 bit hash.
+Returns a 32-bit value.  Every bit of the key affects every bit of
+the return value.  Two keys differing by one or two bits will have
+totally different hash values.  Note that the return value is better
+mixed than val2, so use that first.
+
+The best hash table sizes are powers of 2.  There is no need to do
+mod a prime (mod is sooo slow!).  If you need less than 32 bits,
+use a bitmask.  For example, if you need only 10 bits, do
+  h = (h & hashmask(10));
+In which case, the hash table should have hashsize(10) elements.
+
+If you are hashing n strings (uint8_t **)k, do it like this:
+  for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
+
+By Bob Jenkins, 2006.  bob_jenkins at burtleburtle.net.  You may use this
+code any way you wish, private, educational, or commercial.  It's free.
+
+Use for hash table lookup, or anything where one collision in 2^^32 is
+acceptable.  Do NOT use for cryptographic purposes.
+-------------------------------------------------------------------------------
+*/
+
+static uint32_t hashlittle( const void *key, size_t length )
+{
+  uint32_t a,b,c;                                          /* internal state */
+  union { const void *ptr; size_t i; } u;     /* needed for Mac Powerbook G4 */
+
+  /* Set up the internal state */
+  a = b = c = 0xdeadbeef + ((uint32_t)length);
+
+  u.ptr = key;
+  if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
+    const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
+#ifdef VALGRIND
+    const uint8_t  *k8;
+#endif
+
+    /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
+    while (length > 12)
+    {
+      a += k[0];
+      b += k[1];
+      c += k[2];
+      mix(a,b,c);
+      length -= 12;
+      k += 3;
+    }
+
+    /*----------------------------- handle the last (probably partial) block */
+    /*
+     * "k[2]&0xffffff" actually reads beyond the end of the string, but
+     * then masks off the part it's not allowed to read.  Because the
+     * string is aligned, the masked-off tail is in the same word as the
+     * rest of the string.  Every machine with memory protection I've seen
+     * does it on word boundaries, so is OK with this.  But VALGRIND will
+     * still catch it and complain.  The masking trick does make the hash
+     * noticably faster for short strings (like English words).
+     */
+#ifndef VALGRIND
+
+    switch(length)
+    {
+    case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
+    case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break;
+    case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break;
+    case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break;
+    case 8 : b+=k[1]; a+=k[0]; break;
+    case 7 : b+=k[1]&0xffffff; a+=k[0]; break;
+    case 6 : b+=k[1]&0xffff; a+=k[0]; break;
+    case 5 : b+=k[1]&0xff; a+=k[0]; break;
+    case 4 : a+=k[0]; break;
+    case 3 : a+=k[0]&0xffffff; break;
+    case 2 : a+=k[0]&0xffff; break;
+    case 1 : a+=k[0]&0xff; break;
+    case 0 : return c;              /* zero length strings require no mixing */
+    }
+
+#else /* make valgrind happy */
+
+    k8 = (const uint8_t *)k;
+    switch(length)
+    {
+    case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
+    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
+    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
+    case 9 : c+=k8[8];                   /* fall through */
+    case 8 : b+=k[1]; a+=k[0]; break;
+    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
+    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
+    case 5 : b+=k8[4];                   /* fall through */
+    case 4 : a+=k[0]; break;
+    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
+    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
+    case 1 : a+=k8[0]; break;
+    case 0 : return c;
+    }
+
+#endif /* !valgrind */
+
+  } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
+    const uint16_t *k = (const uint16_t *)key;         /* read 16-bit chunks */
+    const uint8_t  *k8;
+
+    /*--------------- all but last block: aligned reads and different mixing */
+    while (length > 12)
+    {
+      a += k[0] + (((uint32_t)k[1])<<16);
+      b += k[2] + (((uint32_t)k[3])<<16);
+      c += k[4] + (((uint32_t)k[5])<<16);
+      mix(a,b,c);
+      length -= 12;
+      k += 6;
+    }
+
+    /*----------------------------- handle the last (probably partial) block */
+    k8 = (const uint8_t *)k;
+    switch(length)
+    {
+    case 12: c+=k[4]+(((uint32_t)k[5])<<16);
+             b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
+             break;
+    case 11: c+=((uint32_t)k8[10])<<16;     /* fall through */
+    case 10: c+=k[4];
+             b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
+             break;
+    case 9 : c+=k8[8];                      /* fall through */
+    case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
+             break;
+    case 7 : b+=((uint32_t)k8[6])<<16;      /* fall through */
+    case 6 : b+=k[2];
+             a+=k[0]+(((uint32_t)k[1])<<16);
+             break;
+    case 5 : b+=k8[4];                      /* fall through */
+    case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
+             break;
+    case 3 : a+=((uint32_t)k8[2])<<16;      /* fall through */
+    case 2 : a+=k[0];
+             break;
+    case 1 : a+=k8[0];
+             break;
+    case 0 : return c;                     /* zero length requires no mixing */
+    }
+
+  } else {                        /* need to read the key one byte at a time */
+    const uint8_t *k = (const uint8_t *)key;
+
+    /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
+    while (length > 12)
+    {
+      a += k[0];
+      a += ((uint32_t)k[1])<<8;
+      a += ((uint32_t)k[2])<<16;
+      a += ((uint32_t)k[3])<<24;
+      b += k[4];
+      b += ((uint32_t)k[5])<<8;
+      b += ((uint32_t)k[6])<<16;
+      b += ((uint32_t)k[7])<<24;
+      c += k[8];
+      c += ((uint32_t)k[9])<<8;
+      c += ((uint32_t)k[10])<<16;
+      c += ((uint32_t)k[11])<<24;
+      mix(a,b,c);
+      length -= 12;
+      k += 12;
+    }
+
+    /*-------------------------------- last block: affect all 32 bits of (c) */
+    switch(length)                   /* all the case statements fall through */
+    {
+    case 12: c+=((uint32_t)k[11])<<24;
+    case 11: c+=((uint32_t)k[10])<<16;
+    case 10: c+=((uint32_t)k[9])<<8;
+    case 9 : c+=k[8];
+    case 8 : b+=((uint32_t)k[7])<<24;
+    case 7 : b+=((uint32_t)k[6])<<16;
+    case 6 : b+=((uint32_t)k[5])<<8;
+    case 5 : b+=k[4];
+    case 4 : a+=((uint32_t)k[3])<<24;
+    case 3 : a+=((uint32_t)k[2])<<16;
+    case 2 : a+=((uint32_t)k[1])<<8;
+    case 1 : a+=k[0];
+             break;
+    case 0 : return c;
+    }


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list