[SCM] Samba Shared Repository - branch v4-7-stable updated

Karolin Seeger kseeger at samba.org
Thu Nov 2 11:48:22 UTC 2017


The branch, v4-7-stable has been updated
       via  b174cb5 VERSION: Disable GIT_SNAPSHOTS for the Samba 4.7.1 release.
       via  e36b55c WHATSNEW: Add release notes for Samba 4.7.1.
       via  3c45cc8 s4:pyparam: Fix resource leaks on error
       via  81047d0 s3:modules: Check correct variable for NULL in posixacl_xattr
       via  bdbbc80 s3:passdb: Make sure the salt is fully initialized before passing
       via  e4a4a43 s3:secrets: Do not leak memory of pw and old_pw
       via  bd6e153 s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()
       via  8bb2f28 s4:scripting: Fix ntstatus_gen.h generation on 32bit
       via  8875241 ctdb-tests: Process-exists unit tests should wait until PID is registered
       via  020afdc ctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't
       via  418c5c5 ctdb-tests: Skip starting fake_ctdbd when current node is disconnected
       via  4dc2604 ctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't
       via  a3b2963 ctdb-tests: Allow wait_until() to be used in unit tests
       via  ab7d073 replmd: check for duplicate values in MOD_REPLACE case
       via  1167d46 linked attribute tests: test against duplicates in replace
       via  3379b70 s3: smbclient: Test we can rename with a name containing.
       via  5e86ee4 s3: smbclient: Ensure we call client_clean_name() before all operations on remote pathnames.
       via  f3f306c s3: client: Add new utility function client_clean_name().
       via  5e1abab vfs_glusterfs: Fix exporting subdirs with shadow_copy2
       via  9a5761b replace: Link to -lbsd when building replace.c by hand
       via  62e9e06 vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR
       via  7963780 selftest: Also run smbtorture smb2.compound with aio enabled
       via  d9723a2 torture: Add testcase for compound CREATE-WRITE-CLOSE request
       via  f66d6cc smbd/aio: Do not go async for SMB2 compound requests
       via  c1dbeb2 smbd: Move check for SMB2 compound request to new function
       via  eec0b43 vfs_catia: Fix a potential memleak
       via  d179770 vfs_catia: Fix a memory leak
       via  43088b1 smb.conf.5: sort parameters alphabetically
       via  38d6051 krb5_wrap: ADDRTYPE_INET6 is available in all supported MIT versions
       via  64db83b krb5_wrap: KRB5_ADDRESS_INET6 is not a define in Heimdal
       via  779a5a9 s4/torture: vfs_fruit: test xattr unpacking
       via  4942194 s4/torture: vfs_fruit: replace AppleDouble data blob with xattr data
       via  76bd6dc vfs_fruit: on-access conversion of AppleDouble xattr data
       via  3a6ee04 vfs_fruit: static string fruit_catia_maps
       via  d076049 vfs_fruit: pass smb_fname to ad_convert
       via  266a416 vfs_fruit: unpack AppleDouble xattr header if present
       via  0a62033 vfs_fruit: allocate ad_data buffer up to AD_XATTR_MAX_HDR_SIZE bytes
       via  a0acb0f vfs_fruit: add AppleDouble xattr structure definitions
       via  9245b3f vfs_fruit: fix ftruncating resource fork
       via  e433622 vfs_catia: factor out mapping functions
       via  cc2f7d6 ctdb-tests: Add tests for event scripts with multiple '.'s
       via  fbac803 ctdb-common: Ignore event scripts with multiple '.'s
       via  7d36ecb s3: VFS: Protect errno if sys_getwd() fails across free() call.
       via  6b1971f s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.
       via  e507bcd s3: VFS: Ensure default SMB_VFS_GETWD() call can't return a partially completed struct smb_filename.
       via  7070cfb net: groupmap cleanup should not delete BUILTIN mappings
       via  61dcee4 ctdb-common: Do not queue a packet if queue does not have valid fd
       via  433132e ctdb-tests: Send broadcast to connected nodes, not configured nodes
       via  6676099 ctdb-daemon: Send broadcast to connected nodes, not configured nodes
       via  7689bdd vfs_solarisacl: fix build for samba 4.7 and up
       via  7015e55 lib: gpo: Put enforced GPOs at the end of the list.
       via  953d05b lib: gpo: Fixes issue with GPOPTIONS_BLOCK_INHERITANCE.
       via  3e7a1d1 lib: gpo: Changes order to match GPO application order.
       via  9501b00 lib: Use CTDB_CONTROL_CHECK_PID_SRVID
       via  660a4cc lib: Add "unique_id" to ctdbd_process_exists
       via  f1da343 ctdb-tests: Add tests for client with multiple connections
       via  8455844 ctdb-tests: Add support for multiple ctdb connections in dummy_client
       via  f007f3c ctdb-tests: Check all connections from a process in CHECK_PID_SRVID control
       via  3893a71 ctdb-daemon: Check all connections from a process in CHECK_PID_SRVID control
       via  4c833aa ctdb-tests: Add tests for PID with srvid
       via  c3b6860 ctdb-tests: Implement control CHECK_PID_SRVID in fake daemon
       via  a93d844 ctdb-tests: Reimplement message handlers using srvid abstraction
       via  00fafb1 ctdb-tool: Update process-exists command to pass optional srvid
       via  ac799fb ctdb-client: Add client code for control CHECK_PID_SRVID
       via  be97d96 ctdb-daemon: Add implementation of control CHECK_PID_SRVID
       via  655c67f ctdb-protocol: Add marshalling for control CHECK_PID_SRVID
       via  cce9800 ctdb-protocol: Add marshalling for struct ctdb_pid_srvid
       via  ef9db44 ctdb-protocol: Add new control CTDB_CONTROL_CHECK_PID_SRVID
       via  29fae09 ctdb-common: Extend srvid_exists() check to support optional private_data
       via  0a99c01 s3: smbd: Currently if getwd() fails after a chdir(), we panic.
       via  df225fe s3/smbd: use correct access in get_file_handle_for_metadata
       via  12f19c3 s3/smbd: fix access checks in set_ea_dos_attribute()
       via  7fff450 s3/smbd: README.Coding fixes in set_ea_dos_attribute
       via  08e6e69 s3: spoolss: Fix GUID string format on GetPrinter info
       via  3d23c0c s3/mdssvc: missing assignment in sl_pack_float
       via  7f7b132 s4:rpc_server:backupkey: Move variable into scope
       via  925aa83 s4-dnsserver: Check for too many DNS results
       via  6ed5472 s4-dnsserver: Always encode user-supplied names when looking up DNS records
       via  e0d79ab samba-tool dns query: Allow '*' in names
       via  443b85c samba-tool dns: Test support of DNS wild card in names
       via  bf9ad97 dnsserver: Add support for dns wildcards
       via  086b68c dnsserver: Tighten DNS name checking
       via  d603ff0 dnsserver: Tests for dns wildcard entries
       via  8aa3ae4 s4/torture: add a test for rename change notification with inotify enabled
       via  70809cf selftest: run smb2.notify-inotify testsuite against fileserver
       via  f85dcf3 selftest: enable kernel change notifications in the fileserver environment
       via  9663cab messaging: Remove messaging_handler_send
       via  32cbcbe notifyd: Remove notifyd_handler_done
       via  a4e5da1 notifyd: Use messaging_register for MSG_SMB_NOTIFY_DB
       via  dea5b99 notifyd: Use messaging_register for MSG_SMB_NOTIFY_GET_DB
       via  0af027d notifyd: Use messaging_register for MSG_SMB_NOTIFY_TRIGGER
       via  3aecf03 notifyd: Use messaging_register for MSG_SMB_NOTIFY_REC_CHANGE
       via  6fbbb26 messaging: make messaging_rec_create public
       via  a958c33 notifyd: Avoid an if-expression
       via  6b0de3c notifyd: Consolidate two #ifdef CLUSTER into one
       via  9870d0e notifyd: Only ask for messaging_ctdb_conn when clustering
       via  967ce09 man pages: properly ident lists
       via  a1bec76 selftest: prevent interpretation of escape sequences in test_give_owner.sh
       via  959643e selftest: add some debugging to test_give_owner.sh
       via  01e6208 vfs_fake_acls: deny give-ownership
       via  bfc1b6a vfs_acl_common: fix take ownership vs give ownership
       via  16d82b0 vfs_acl_common: factor out a variable declaration
       via  a3cb2ec s3/smbd/posix_acls: return correct status in try_chown
       via  3d8578c selftest: tests for change ownership on a file
       via  431ba57 selftest: fix samba3.blackbox.inherit_owner.default test script test_inherit_owner.sh
       via  d44a3ea selftest: fix acl_xattr test script test_acl_xattr.sh
       via  39ac1dc selftest: fix acl_xattr test: sn-devel unreliable gid
       via  8ddf781 selftest: fix acl_xattr test: grep ouput before munging
       via  099ca92 selftest: fix acl_xattr test: group, not user
       via  784071f selftest: fix acl_xattr test: changing owner
       via  fd3e3a5 vfs/nfs4_acls: move special handling of SMB_ACE4_SYNCHRONIZE to vfs_zfsacl
       via  241b8dc s3/vfs: move ACE4_ADD_FILE/ACE4_DELETE_CHILD mapping from NFSv4 framework to vfs_zfsacl
       via  b4fdb8a vfs_zfsacl: ensure zfs_get_nt_acl_common() has access to stat info
       via  a3b6a75 vfs_zfsacl: pass smb_fname to zfs_get_nt_acl_common
       via  6a67866 lib/util/run_cmd: use a cleanup function instead of a destructor
       via  31eefb6 lib/util/run_cmd: remove a printf
       via  c7f33ca lib/util/run_cmd: ensure fd_stdin gets set to -1 in the destructor
       via  634514a lib/util/run_cmd: prevent zombies in samba_runcmd_send on timeout
       via  3711ec4 selftest: Check re-opening sam.ldb corrects the @ATTRIBUTES and @INDEXLIST
       via  16594ab VERSION: Bump version up to 4.7.1...
      from  d1e6984 VERSION: Disable GIT_SNAPSHOTS for the 4.7.0 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       | 111 ++++++
 ctdb/client/client_control_sync.c                  |  29 ++
 ctdb/client/client_sync.h                          |   5 +
 ctdb/common/ctdb_io.c                              |   5 +
 ctdb/common/run_event.c                            |   6 +
 ctdb/common/srvid.c                                |  13 +-
 ctdb/common/srvid.h                                |   8 +-
 ctdb/config/events.d/README                        |   4 +-
 ctdb/doc/ctdb.1.xml                                |   8 +-
 ctdb/include/ctdb_private.h                        |   2 +
 ctdb/protocol/protocol.h                           |   7 +
 ctdb/protocol/protocol_api.h                       |   5 +
 ctdb/protocol/protocol_client.c                    |  28 ++
 ctdb/protocol/protocol_control.c                   |  22 ++
 ctdb/protocol/protocol_debug.c                     |   1 +
 ctdb/protocol/protocol_private.h                   |   5 +
 ctdb/protocol/protocol_types.c                     |  47 +++
 ctdb/server/ctdb_control.c                         |   4 +
 ctdb/server/ctdb_daemon.c                          |  28 +-
 ctdb/server/ctdb_ltdb_server.c                     |   5 +-
 ctdb/tests/cunit/protocol_test_002.sh              |   2 +-
 ctdb/tests/cunit/run_event_001.sh                  |  21 ++
 ctdb/tests/eventd/scripts/local.sh                 |   7 +-
 ctdb/tests/scripts/common.sh                       |  44 +++
 ctdb/tests/scripts/integration.bash                |  44 ---
 ctdb/tests/simple/07_ctdb_process_exists.sh        |  20 +-
 ctdb/tests/src/cluster_wait.c                      |   2 +-
 ctdb/tests/src/dummy_client.c                      |  32 +-
 ctdb/tests/src/fake_ctdbd.c                        | 108 ++++--
 ctdb/tests/src/protocol_client_test.c              |  15 +-
 ctdb/tests/src/protocol_types_test.c               |  15 +
 ctdb/tests/src/srvid_test.c                        |  12 +-
 ctdb/tests/tool/ctdb.getcapabilities.003.sh        |  13 +-
 ctdb/tests/tool/ctdb.lvs.008.sh                    |  13 +-
 ctdb/tests/tool/ctdb.process-exists.001.sh         |   2 +
 ctdb/tests/tool/ctdb.process-exists.002.sh         |  28 ++
 ctdb/tests/tool/ctdb.process-exists.003.sh         |  28 ++
 ctdb/tests/tool/scripts/local.sh                   |   6 +-
 ctdb/tools/ctdb.c                                  |  32 +-
 docs-xml/wscript_build                             |   9 +-
 docs-xml/xslt/man.xsl                              |   1 +
 lib/krb5_wrap/krb5_samba.c                         |   4 +-
 lib/replace/wscript                                |  12 +-
 lib/util/util_runcmd.c                             |  19 +-
 libgpo/gpo_ldap.c                                  | 221 +++++++-----
 librpc/idl/dns.idl                                 |   3 +
 python/samba/netcmd/dns.py                         |   3 +-
 python/samba/tests/dns_wildcard.py                 | 288 ++++++++++++++++
 python/samba/tests/dsdb_schema_attributes.py       |  53 +++
 python/samba/tests/samba_tool/dnscmd.py            |  67 ++++
 selftest/knownfail                                 |   1 +
 selftest/target/Samba3.pm                          |   2 +
 source3/client/client.c                            | 230 ++++++++++++-
 source3/client/client_proto.h                      |   1 +
 source3/client/clitar.c                            |  31 ++
 source3/include/ctdbd_conn.h                       |   2 +-
 source3/include/messages.h                         |  13 +-
 source3/lib/ctdb_dummy.c                           |   3 +-
 source3/lib/ctdbd_conn.c                           |  24 +-
 source3/lib/messages.c                             |  83 +----
 source3/lib/serverid.c                             |   2 +-
 source3/lib/system.c                               |  11 +-
 source3/modules/nfs4_acls.c                        |  11 -
 source3/modules/posixacl_xattr.c                   |   2 +-
 source3/modules/string_replace.c                   | 178 ++++++++++
 .../passwd_proto.h => modules/string_replace.h}    |  26 +-
 source3/modules/vfs_acl_common.c                   |  18 +-
 source3/modules/vfs_catia.c                        | 170 ++-------
 source3/modules/vfs_default.c                      |   4 +
 source3/modules/vfs_fake_acls.c                    |  18 +
 source3/modules/vfs_fruit.c                        | 383 +++++++++++++++++++--
 source3/modules/vfs_glusterfs.c                    |  13 +-
 source3/modules/vfs_solarisacl.c                   |   2 +-
 source3/modules/vfs_solarisacl.h                   |   2 +-
 source3/modules/vfs_zfsacl.c                       |  54 ++-
 source3/modules/wscript_build                      |   7 +-
 source3/passdb/machine_account_secrets.c           |  18 +-
 source3/rpc_server/mdssvc/marshalling.c            |   2 +
 source3/rpc_server/spoolss/srv_spoolss_nt.c        |  16 +-
 source3/script/tests/test_acl_xattr.sh             |  15 +-
 source3/script/tests/test_give_owner.sh            | 141 ++++++++
 source3/script/tests/test_inherit_owner.sh         |  17 +-
 source3/script/tests/test_smbclient_s3.sh          |  48 +++
 source3/selftest/tests.py                          |  21 +-
 source3/smbd/aio.c                                 |   8 +
 source3/smbd/dosmode.c                             |  35 +-
 source3/smbd/globals.h                             |   1 +
 source3/smbd/notifyd/notifyd.c                     | 244 +++++++------
 source3/smbd/posix_acls.c                          |   2 +-
 source3/smbd/server.c                              |   8 +-
 source3/smbd/smb2_read.c                           |   2 +-
 source3/smbd/smb2_server.c                         |   5 +
 source3/smbd/vfs.c                                 |  81 ++++-
 source3/utils/net_groupmap.c                       |   4 +-
 source4/dns_server/dlz_bind9.c                     |   4 +-
 source4/dns_server/dns_query.c                     |   5 +-
 source4/dns_server/dns_server.h                    |   5 +
 source4/dns_server/dns_utils.c                     |  18 +
 source4/dns_server/dnsserver_common.c              | 383 ++++++++++++++++++++-
 source4/dns_server/dnsserver_common.h              |   5 +
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    |  37 ++
 source4/dsdb/tests/python/linked_attributes.py     |  10 +
 source4/param/pyparam.c                            |   6 +
 source4/rpc_server/backupkey/dcesrv_backupkey.c    |   4 +-
 source4/rpc_server/dnsserver/dcerpc_dnsserver.c    |  15 +-
 source4/rpc_server/dnsserver/dnsdb.c               |  18 +-
 source4/scripting/bin/gen_ntstatus.py              |   2 +-
 source4/selftest/tests.py                          |   2 +-
 source4/torture/smb2/compound.c                    |  73 ++++
 source4/torture/smb2/notify.c                      | 158 +++++++++
 source4/torture/smb2/smb2.c                        |   1 +
 source4/torture/vfs/fruit.c                        | 171 +++++++--
 113 files changed, 3574 insertions(+), 771 deletions(-)
 create mode 100755 ctdb/tests/tool/ctdb.process-exists.002.sh
 create mode 100755 ctdb/tests/tool/ctdb.process-exists.003.sh
 create mode 100644 python/samba/tests/dns_wildcard.py
 create mode 100644 source3/modules/string_replace.c
 copy source3/{utils/passwd_proto.h => modules/string_replace.h} (54%)
 create mode 100755 source3/script/tests/test_give_owner.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index d91963a..c8a4837 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=7
-SAMBA_VERSION_RELEASE=0
+SAMBA_VERSION_RELEASE=1
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 09c7be6..6de5de8 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,115 @@
                    =============================
+                   Release Notes for Samba 4.7.1
+                         November 02, 2017
+                   =============================
+
+
+This is the latest stable release of the Samba 4.7 release series.
+
+
+Changes since 4.7.0:
+--------------------
+
+o  Michael Adam <obnox at samba.org>
+   * BUG 13091: vfs_glusterfs: Fix exporting subdirs with shadow_copy2.
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 13027: s3: smbd: Currently if getwd() fails after a chdir(), we panic.
+   * BUG 13068: s3: VFS: Ensure default SMB_VFS_GETWD() call can't return a
+     partially completed struct smb_filename.
+   * BUG 13069: sys_getwd() can leak memory or possibly return the wrong errno
+     on older systems.
+   * BUG 13093: 'smbclient' doesn't correctly canonicalize all local names
+     before use.
+
+o  Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
+   * BUG 13095: Fix broken linked attribute handling.
+
+o  Andrew Bartlett <abartlet at samba.org>
+   * BUG 12994: Missing LDAP query escapes in DNS rpc server.
+   * BUG 13087: replace: Link to -lbsd when building replace.c by hand.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 6133: Cannot delete non-ACL files on Solaris/ZFS/NFSv4 ACL filesystem.
+   * BUG 7909: Map SYNCHRONIZE acl permission statically in zfs_acl vfs module.
+   * BUG 7933: Samba fails to honor SEC_STD_WRITE_OWNER bit with the
+     acl_xattr module.
+   * BUG 12991: s3/mdssvc: Missing assignment in sl_pack_float.
+   * BUG 12995: Wrong Samba access checks when changing DOS attributes.
+   * BUG 13062: samba_runcmd_send() leaves zombie processes on timeout
+   * BUG 13065: net: groupmap cleanup should not delete BUILTIN mappings.
+   * BUG 13076: Enabling vfs_fruit results in loss of Finder tags and other
+     xattrs.
+
+o  Alexander Bokovoy <ab at samba.org>
+   * BUG 9613: man pages: Properly ident lists.
+   * BUG 13081: smb.conf.5: Sort parameters alphabetically.
+
+o  Samuel Cabrero <scabrero at suse.de>
+   * BUG 12993: s3: spoolss: Fix GUID string format on GetPrinter info.
+
+o  Amitay Isaacs <amitay at gmail.com>
+   * BUG 13042: Remote serverid check doesn't check for the unique id.
+   * BUG 13056: CTDB starts consuming memory if there are dead nodes in the
+     cluster.
+   * BUG 13070: ctdb-common: Ignore event scripts with multiple '.'s.
+
+o  Lutz Justen <ljusten at google.com>
+   * BUG 13046: libgpo doesn't sort the GPOs in the correct order.
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 13042: Remote serverid check doesn't check for the unique id.
+   * BUG 13090: vfs_catia: Fix a potential memleak.
+   * BUG 12903: Fix file change notification for renames.
+
+o  Gary Lockyer <gary at catalyst.net.nz>
+   * BUG 12952: Samba DNS server does not honour wildcards.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 13079:  Can't change password in samba from a Windows client if Samba
+     runs on IPv6 only interface.
+
+o  Anoop C S <anoopcs at redhat.com>
+   * BUG 13086: vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR.
+
+o  Christof Schmitt <cs at samba.org>
+   * BUG 13047: Apple client can't cope with SMB2 async replies when creating
+     symlinks.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 12959: s4:rpc_server:backupkey: Move variable into scope.
+   * BUG 13099: s4:scripting: Fix ntstatus_gen.h generation on 32bit.
+   * BUG 13100: s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd().
+   * BUG 13101: Fix resouce leaks and pointer issues.
+
+o  Jorge Schrauwen
+   * BUG 13049: vfs_solarisacl: Fix build for samba 4.7 and up.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the "Samba 4.1 and newer" product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   =============================
                    Release Notes for Samba 4.7.0
                         September 20, 2017
                    =============================
diff --git a/ctdb/client/client_control_sync.c b/ctdb/client/client_control_sync.c
index 43a941d..6b64c75 100644
--- a/ctdb/client/client_control_sync.c
+++ b/ctdb/client/client_control_sync.c
@@ -2758,3 +2758,32 @@ int ctdb_ctrl_db_attach_replicated(TALLOC_CTX *mem_ctx,
 
 	return 0;
 }
+
+int ctdb_ctrl_check_pid_srvid(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+			      struct ctdb_client_context *client,
+			      int destnode, struct timeval timeout,
+			      struct ctdb_pid_srvid *pid_srvid, int *status)
+{
+	struct ctdb_req_control request;
+	struct ctdb_reply_control *reply;
+	int ret;
+
+	ctdb_req_control_check_pid_srvid(&request, pid_srvid);
+	ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
+				  &request, &reply);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control CHECK_PID_SRVID failed to node %u, ret=%d\n",
+		       destnode, ret));
+		return ret;
+	}
+
+	ret = ctdb_reply_control_check_pid_srvid(reply, status);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control CHECK_PID_SRVID failed, ret=%d\n", ret));
+		return ret;
+	}
+
+	return 0;
+}
diff --git a/ctdb/client/client_sync.h b/ctdb/client/client_sync.h
index a4b5c49..c0a7b25 100644
--- a/ctdb/client/client_sync.h
+++ b/ctdb/client/client_sync.h
@@ -494,6 +494,11 @@ int ctdb_ctrl_db_attach_replicated(TALLOC_CTX *mem_ctx,
 				   int destnode, struct timeval timeout,
 				   const char *db_name, uint32_t *db_id);
 
+int ctdb_ctrl_check_pid_srvid(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+			      struct ctdb_client_context *client,
+			      int destnode, struct timeval timeout,
+			      struct ctdb_pid_srvid *pid_srvid, int *status);
+
 /* from client/client_message_sync.c */
 
 int ctdb_message_recd_update_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index 152d535..3e732e8 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -300,6 +300,11 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
 	struct ctdb_queue_pkt *pkt;
 	uint32_t length2, full_length;
 
+	/* If the queue does not have valid fd, no point queueing a packet */
+	if (queue->fd == -1) {
+		return 0;
+	}
+
 	if (queue->alignment) {
 		/* enforce the length and alignment rules from the tcp packet allocator */
 		length2 = (length+(queue->alignment-1)) & ~(queue->alignment-1);
diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c
index e5d562c..0961d65 100644
--- a/ctdb/common/run_event.c
+++ b/ctdb/common/run_event.c
@@ -60,6 +60,12 @@ static int script_filter(const struct dirent *de)
 		return 0;
 	}
 
+	/* Ignore filenames with multiple '.'s */
+	ptr = index(&de->d_name[3], '.');
+	if (ptr != NULL) {
+		return 0;
+	}
+
 	return 1;
 }
 
diff --git a/ctdb/common/srvid.c b/ctdb/common/srvid.c
index f9cd49b..3304994 100644
--- a/ctdb/common/srvid.c
+++ b/ctdb/common/srvid.c
@@ -221,9 +221,10 @@ int srvid_deregister(struct srvid_context *srv, uint64_t srvid,
 /*
  * Check if a message handler exists
  */
-int srvid_exists(struct srvid_context *srv, uint64_t srvid)
+int srvid_exists(struct srvid_context *srv, uint64_t srvid, void *private_data)
 {
 	struct srvid_handler_list *list;
+	struct srvid_handler *h;
 	int ret;
 
 	ret = srvid_fetch(srv, srvid, &list);
@@ -234,6 +235,16 @@ int srvid_exists(struct srvid_context *srv, uint64_t srvid)
 		return ENOENT;
 	}
 
+	if (private_data != NULL) {
+		for (h = list->h; h != NULL; h = h->next) {
+			if (h->private_data == private_data) {
+				return 0;
+			}
+		}
+
+		return ENOENT;
+	}
+
 	return 0;
 }
 
diff --git a/ctdb/common/srvid.h b/ctdb/common/srvid.h
index f048b5c..702724f 100644
--- a/ctdb/common/srvid.h
+++ b/ctdb/common/srvid.h
@@ -91,11 +91,17 @@ int srvid_deregister(struct srvid_context *srv, uint64_t srvid,
 /**
  * @brief Check if any message handler is registered for srvid
  *
+ * If private_data is NULL, then check if there is any registration
+ * for * specified srvid.  If private_data is not NULL, then check for
+ * registration that matches the specified private data.
+ *
  * @param[in] srv The srvid message handler database context
  * @param[in] srvid The srvid
+ * @param[in] private_data Private data
  * @return 0 on success, errno on failure
  */
-int srvid_exists(struct srvid_context *srv, uint64_t srvid);
+int srvid_exists(struct srvid_context *srv, uint64_t srvid,
+		 void *private_data);
 
 /**
  * @brief Call message handlers for given srvid
diff --git a/ctdb/config/events.d/README b/ctdb/config/events.d/README
index 11da702..69f5904 100644
--- a/ctdb/config/events.d/README
+++ b/ctdb/config/events.d/README
@@ -11,7 +11,9 @@ alphanumeric sort order.
 
 As a special case, any eventscript that ends with a '~' character will be
 ignored since this is a common postfix that some editors will append to
-older versions of a file.
+older versions of a file.  Similarly, any eventscript with multiple '.'s
+will be ignored as package managers can create copies with additional
+suffix starting with '.' (e.g. .rpmnew, .dpkg-dist).
 
 Only executable event scripts are run by CTDB.  Any event script that
 does not have execute permission is ignored.
diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index 3aceb73..471d825 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -1681,9 +1681,13 @@ RUNNING
     </refsect2>
 
     <refsect2>
-      <title>process-exists <parameter>PID</parameter></title>
+      <title>process-exists <parameter>PID</parameter> <parameter>[SRVID]</parameter></title>
       <para>
-	This command checks if a specific process exists on the CTDB host. This is mainly used by Samba to check if remote instances of samba are still running or not.
+	This command checks if a specific process exists on the CTDB
+	host. This is mainly used by Samba to check if remote instances
+	of samba are still running or not.  When the optional SRVID
+	argument is specified, the command check if a specific process
+	exists on the CTDB host and has registered for specified SRVID.
       </para>
     </refsect2>
 
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 043149e..da3760d 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -584,6 +584,8 @@ struct ctdb_client *ctdb_find_client_by_pid(struct ctdb_context *ctdb,
 					    pid_t pid);
 
 int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid);
+int32_t ctdb_control_check_pid_srvid(struct ctdb_context *ctdb,
+				     TDB_DATA indata);
 
 int ctdb_control_getnodesfile(struct ctdb_context *ctdb, uint32_t opcode,
 			      TDB_DATA indata, TDB_DATA *outdata);
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index ee409f7..e116b3a 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -369,6 +369,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
 		    CTDB_CONTROL_DB_PUSH_CONFIRM         = 148,
 		    CTDB_CONTROL_DB_OPEN_FLAGS           = 149,
 		    CTDB_CONTROL_DB_ATTACH_REPLICATED    = 150,
+		    CTDB_CONTROL_CHECK_PID_SRVID         = 151,
 };
 
 #define CTDB_MONITORING_ENABLED		0
@@ -842,6 +843,11 @@ enum ctdb_runstate {
 	CTDB_RUNSTATE_SHUTDOWN,
 };
 
+struct ctdb_pid_srvid {
+	pid_t pid;
+	uint64_t srvid;
+};
+
 struct ctdb_req_control_data {
 	uint32_t opcode;
 	union {
@@ -879,6 +885,7 @@ struct ctdb_req_control_data {
 		struct ctdb_uint64_array *u64_array;
 		struct ctdb_traverse_start_ext *traverse_start_ext;
 		struct ctdb_traverse_all_ext *traverse_all_ext;
+		struct ctdb_pid_srvid *pid_srvid;
 	} data;
 };
 
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index a887544..5961527 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -606,6 +606,11 @@ void ctdb_req_control_db_attach_replicated(struct ctdb_req_control *request,
 int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
 					    uint32_t *db_id);
 
+void ctdb_req_control_check_pid_srvid(struct ctdb_req_control *request,
+				      struct ctdb_pid_srvid *pid_srvid);
+int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control *reply,
+				       int *status);
+
 /* From protocol/protocol_debug.c */
 
 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c
index daa70cc..70bf1f5 100644
--- a/ctdb/protocol/protocol_client.c
+++ b/ctdb/protocol/protocol_client.c
@@ -2386,3 +2386,31 @@ int ctdb_reply_control_db_attach_replicated(struct ctdb_reply_control *reply,
 	}
 	return reply->status;
 }
+
+/* CTDB_CONTROL_CHECK_PID_SRVID */
+
+void ctdb_req_control_check_pid_srvid(struct ctdb_req_control *request,
+				      struct ctdb_pid_srvid *pid_srvid)
+{
+	request->opcode = CTDB_CONTROL_CHECK_PID_SRVID;
+	request->pad = 0;
+	request->srvid = 0;
+	request->client_id = 0;
+	request->flags = 0;
+
+	request->rdata.opcode = CTDB_CONTROL_CHECK_PID_SRVID;
+	request->rdata.data.pid_srvid = pid_srvid;
+}
+
+int ctdb_reply_control_check_pid_srvid(struct ctdb_reply_control *reply,
+				       int *status)
+{
+	if (reply->rdata.opcode != CTDB_CONTROL_CHECK_PID_SRVID) {
+		return EPROTO;
+	}
+
+	*status = reply->status;
+	reply->status = 0;
+
+	return reply->status;
+}
diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c
index 3c5c7ce..a98c8ea 100644
--- a/ctdb/protocol/protocol_control.c
+++ b/ctdb/protocol/protocol_control.c
@@ -434,6 +434,10 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
 	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
 		len = ctdb_string_len(cd->data.db_name);
 		break;
+
+	case CTDB_CONTROL_CHECK_PID_SRVID:
+		len = ctdb_pid_srvid_len(cd->data.pid_srvid);
+		break;
 	}
 
 	return len;
@@ -705,6 +709,10 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
 	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
 		ctdb_string_push(cd->data.db_name, buf);
 		break;
+
+	case CTDB_CONTROL_CHECK_PID_SRVID:
+		ctdb_pid_srvid_push(cd->data.pid_srvid, buf);
+		break;
 	}
 }
 
@@ -1045,6 +1053,11 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
 		ret = ctdb_string_pull(buf, buflen, mem_ctx,
 				       &cd->data.db_name);
 		break;
+
+	case CTDB_CONTROL_CHECK_PID_SRVID:
+		ret = ctdb_pid_srvid_pull(buf, buflen, mem_ctx,
+					  &cd->data.pid_srvid);
+		break;
 	}
 
 	return ret;
@@ -1414,6 +1427,9 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
 	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
 		len = ctdb_uint32_len(cd->data.db_id);
 		break;
+
+	case CTDB_CONTROL_CHECK_PID_SRVID:
+		break;
 	}
 
 	return len;
@@ -1574,6 +1590,9 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd,
 	case CTDB_CONTROL_DB_ATTACH_REPLICATED:
 		ctdb_uint32_push(cd->data.db_id, buf);
 		break;
+
+	case CTDB_CONTROL_CHECK_PID_SRVID:
+		break;
 	}
 }
 
@@ -1771,6 +1790,9 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen,
 		ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
 				       &cd->data.db_id);
 		break;
+
+	case CTDB_CONTROL_CHECK_PID_SRVID:
+		break;
 	}
 
 	return ret;
diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c
index 574f903..7c6d862 100644
--- a/ctdb/protocol/protocol_debug.c
+++ b/ctdb/protocol/protocol_debug.c
@@ -239,6 +239,7 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp)
 		{ CTDB_CONTROL_DB_PUSH_CONFIRM, "DB_PUSH_CONFIRM" },
 		{ CTDB_CONTROL_DB_OPEN_FLAGS, "DB_OPEN_FLAGS" },
 		{ CTDB_CONTROL_DB_ATTACH_REPLICATED, "DB_ATTACH_REPLICATED" },
+		{ CTDB_CONTROL_CHECK_PID_SRVID, "CHECK_PID_SRVID" },
 		{ MAP_END, "" },
 	};
 
diff --git a/ctdb/protocol/protocol_private.h b/ctdb/protocol/protocol_private.h
index f887ce5..ecbd627 100644
--- a/ctdb/protocol/protocol_private.h
+++ b/ctdb/protocol/protocol_private.h
@@ -240,6 +240,11 @@ void ctdb_db_statistics_push(struct ctdb_db_statistics *dbstats, void *buf);
 int ctdb_db_statistics_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
 			    struct ctdb_db_statistics **out);
 
+size_t ctdb_pid_srvid_len(struct ctdb_pid_srvid *in);
+void ctdb_pid_srvid_push(struct ctdb_pid_srvid *in, uint8_t *buf);
+int ctdb_pid_srvid_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
+			struct ctdb_pid_srvid **out);
+


-- 
Samba Shared Repository



More information about the samba-cvs mailing list