[SCM] Samba Shared Repository - branch v4-9-test updated

Karolin Seeger kseeger at samba.org
Tue Jul 31 13:28:02 UTC 2018


The branch, v4-9-test has been updated
       via  d666a5e ctdb-docs: Update documentation for "ctdb event" command
       via  8932003 ctdb-event: Implement event tool "script list" command
       via  792e170 ctdb-event: Change event-tool script enable/disable to chmod file directly
       via  0c65347 ctdb-common: Use script abstraction in run_event
       via  4cce86e ctdb-common: Factor out basic script abstraction
       via  34aba6f ctdb-event: Fix "ctdb event status" usage message
       via  f24f0f13 ctdb-doc: Provide an example script for migrating old configuration
       via  cb1292d WHATSNEW: Add further CTDB updates for 4.9
       via  d197d11 ctdb-docs: Replace obsolete reference to CTDB_DEBUG_HUNG_SCRIPT option
       via  5c2513d ctdb-protocol: Fix compilation issue with strncpy()
       via  d4e9454 ctdb-common: Fix compilation issue with strncpy()
       via  eb3f8ae ctdb-common: Fix the TCP packet length check
       via  e4aa9b9 ctdb-tests: Strip all spaces from od output
       via  23e4131 ctdb-tests: Fix a typo
       via  0733f13 ctdb-tests: Use errcode to translate ETIMEDOUT
       via  0be07ae ctdb-tests: Replace md5sum with posix cksum
       via  862aedc ctdb-tests: Use portable wc -c instead of stat -c "%s"
       via  55fe4b5 ctdb-scripts: date "+%N" is non-portable
       via  33df4f9 ctdb-tests: Simplify pattern matching for ctime output
       via  18aa6548 ctdb-tests: Do not try to match pstree output in eventd tests
       via  eb1279e ctdb-common: Add fd argument to ctdb_connection_list_read()
       via  ea5643f ctdb-protocol: Avoid fgets in ctdb_connection_list_read
       via  b21efa2 ctdb-common: Add line based I/O
       via  fcae5c6 ctdb-tests: Porting tests should ignore unsupported features
       via  16838f3 ctdb-tests: Use sigcode to match signals
       via  0ec4783 ctdb-tests: Add signal code matching utility
       via  adc4c78 ctdb-tests: Add ps output filter for freebsd
       via  ed50360 ctdb-client: Switch to ETIMEDOUT instead of ETIME
       via  60ef296 ctdb-daemon: Switch to using ETIMEDOUT instead of ETIME
       via  0782860 ctdb-event: Switch to ETIMEDOUT instead of ETIME
       via  43cd4e4 ctdb-common: Switch to ETIMEDOUT from ETIME
       via  d49d03d ctdb-tests: Add required_error() to match on error codes
       via  3f75791 ctdb-tests: Add errno matching utility
       via  f6be661 ctdb-tests: Switch some test stubs to use /bin/sh
       via  58671b0 ctdb-tests: Improve portability by not using mktemp --tmpdir option
       via  ebeecc3 ctdb-tests: Avoid use of non-portable getopt in stubs
       via  04a9667 ctdb-tests: Avoid use of non-portable getopt in run_tests.sh
       via  e4b703e ctdb-tools: Avoid use of non-portable getopt in onnode
       via  7d28f01 ctdb-tests: Improve portability by not using /bin/bash directly
       via  23b5be4 ctdb-tools: Improve portability by not using /bin/bash directly
       via  4c2e666 s3: smbd: Fix AIX sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  a221165 s3: smbd: Fix FreeBSD sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  8b54ad0 s3: smbd: Fix HPUX sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  8652ab1 s3: smbd: Fix Solaris sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  76d3abe s3: smbd: Fix Linux sendfile() for SMB2. Ensure we don't spin on EAGAIN.
       via  a6dab26 dns wildcards: fix BUG 13536
       via  1496392 dns wildcards: tests to confirm BUG 13536
       via  9ad7af6 s3: smbd: fix path check in smbd_smb2_create_durable_lease_check()
       via  3b7a39b s4: torture: run test_durable_v2_open_reopen2_lease() in a subdirectory
       via  c775cda ctdb-tests: Loosen match against pstree output in simple test
       via  5abe6e6 ctdb-tests: Simplify pstree output in eventd unit tests
       via  0b3e00a samba-tool trust: support discovery via netr_GetDcName
       via  a3c26b3 s3:selftest: run rpc.lsa.lookupsids also with explicit [smb1] and [smb2]
       via  e3e6425 s4:librpc: autonegotiate SMB1/2/3
       via  25405ee python/tests: use explicit "client ipc max protocol = NT1" for samba.tests.net_join_no_spnego
       via  373406a tests/auth_log: Permit SMB2 service description if empty binding is used for kerberos authentication
       via  b1753af s4:libcli: add smb_connect_nego_{send,recv}()
       via  3d8c4bf s4:libcli: allow a fallback to NTLMSSP if SPNEGO is not supported locally
       via  02f7b65 s4:libcli: add fallback_to_anonymous to smb2_connect_send()
       via  4d7023f s4:libcli: allow passing an already negotiated connection to smb2_connect_send()
       via  a3a5797 s4:libcli: split out smb2_connect_session_start()
       via  c85c9b5 s4:libcli: add smb2_transport_raw_init()
       via  f9b685e s4:libcli: allow passing an already negotiated connection to smb_composite_connect()
       via  71a1355 s4:libcli: use talloc_zero() for struct smb_composite_connect in fetchfile.c
       via  00e5ea1 s4:libcli: add smbcli_transport_raw_init()
       via  a8cd704 s4:libcli: split out smb_raw_negotiate_fill_transport()
       via  7e96021 librpc: add binding handle support for [smb1]
       via  d85dd18 python/samba/tests: make sure samba.tests can be imported without SamDB
       via  c6a325c s4-dsdb: only build dsdb Python modules for AD DC
       via  bc280e8 s4-dns_server: Only build dns server Python code for AD DC
      from  516a440 s3: vfs: bump to version 39, Samba 4.9 will ship with that

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


- Log -----------------------------------------------------------------
commit d666a5e0b1d8529b88bf7cabbcfdf8cebbce5ff1
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 23 14:07:08 2018 +1000

    ctdb-docs: Update documentation for "ctdb event" command
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Sat Jul 28 20:03:52 CEST 2018 on sn-devel-144
    
    (cherry picked from commit e3ce1a2dfc4cbba4bf22381b91e9a14c8f240f5d)
    
    Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-9-test): Tue Jul 31 15:27:32 CEST 2018 on sn-devel-144

commit 8932003d606bd7bfbac55cc92a72f95db79623d1
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 13:47:51 2018 +1000

    ctdb-event: Implement event tool "script list" command
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 5017325c2ef84b10ccd23328f5d62ac5b246bbb3)

commit 792e170278134f030996cdab5607a88e53a52b00
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 13:27:16 2018 +1000

    ctdb-event: Change event-tool script enable/disable to chmod file directly
    
    They no longer go over the socket to eventd to enable and disable
    scripts.  Use the event script abstraction to chmod them directly.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 295826f1b83b6e59d24e4da43b290242c17f44af)

commit 0c65347e949b27d2532361e9395ac8ab9d3394ef
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 13:26:27 2018 +1000

    ctdb-common: Use script abstraction in run_event
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 82e62488027302e541739628210292c2d95717e1)

commit 4cce86e872b10f387988dbf6c06303c55bfb6018
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 13:20:55 2018 +1000

    ctdb-common: Factor out basic script abstraction
    
    Provides for listing of scripts and chmod enable/disable.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit a7a4ee439dc1cf262b4da9fbcb38a2f69c62744c)

commit 34aba6f9ef373b1e654e13f0bbe802087c1a4ec6
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 10:44:20 2018 +1000

    ctdb-event: Fix "ctdb event status" usage message
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 56e248de6072063308786ea83282aaecc8d7e62a)

commit f24f0f13005ae2ad6c40500b830ae8b383870427
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 20:10:35 2018 +1000

    ctdb-doc: Provide an example script for migrating old configuration
    
    Include an example ctdbd.conf-style file for testing.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13550
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Mon Jul 30 14:30:06 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 4fcbaae57b129deaacfab0a226cefca99aa78256)

commit cb1292d6aac633e3f94832f194d48b5f2d7723d4
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 31 13:06:15 2018 +1000

    WHATSNEW: Add further CTDB updates for 4.9
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Karolin Seeger <kseeger at samba.org>

commit d197d11a6ce9c15c576f4980f54d38f5c1d25c63
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 12 17:38:38 2018 +1000

    ctdb-docs: Replace obsolete reference to CTDB_DEBUG_HUNG_SCRIPT option
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13546
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Sat Jul 28 07:26:24 CEST 2018 on sn-devel-144
    
    (cherry picked from commit a44e6987b1e469ae202777cd575fd81c19e1ac6c)

commit 5c2513d82c4555e2a970b4a65bd4f2616735e040
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 26 11:01:30 2018 +1000

    ctdb-protocol: Fix compilation issue with strncpy()
    
    When configured with --picky-developer and using -O3 with gcc 8.1:
    
    ../protocol/protocol_util.c: In function ‘ctdb_sock_addr_from_string’:
    ../protocol/protocol_util.c:282:2: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
      strncpy(s, str, len+1);
      ^~~~~~~~~~~~~~~~~~~~~~
    ../protocol/protocol_util.c:277:8: note: length computed here
      len = strlen(str);
            ^~~~~~~~~~~
    
    Use strlcpy() instead and check the result.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13545
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 3b56f2002a35b55b46958178c79aee519f0c5880)

commit d4e9454f107df8ea0c1c132bb91d37586b3429cf
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 26 11:00:28 2018 +1000

    ctdb-common: Fix compilation issue with strncpy()
    
    When configured with --picky-developer and using -O3 with gcc 8.1:
    
    ../common/system_socket.c: In function ‘parse_ip_mask’:
    ../common/system_socket.c:229:2: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
      strncpy(s, str, len+1);
      ^~~~~~~~~~~~~~~~~~~~~~
    ../common/system_socket.c:223:8: note: length computed here
      len = strlen(str);
            ^~~~~~~~~~~
    
    Use strlcpy() instead and check the result.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13545
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 5dd84bf5d73e4afab094834bc317da7884b9b9b3)

commit eb3f8ae42e8bbf7e37529a97e0111dd5d173d32a
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 26 14:51:44 2018 +1000

    ctdb-common: Fix the TCP packet length check
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit be43e08072ebce937ed0a02cd8d9d1c6072b178d)

commit e4aa9b98d7543d116f7fc5a1697e6f38717fa6bc
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 17:41:55 2018 +1000

    ctdb-tests: Strip all spaces from od output
    
    On freebsd, there are trailing spaces in od output.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 3047202ce733d1a767fbc83c7021cb83bb83e0e1)

commit 23e41315192a3cb99eb8f3b783b5b9f24e942c2f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 17:41:07 2018 +1000

    ctdb-tests: Fix a typo
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 6f5ed2b8b829e01fc675537e47095868ff8b5aa2)

commit 0733f13398b976ff8117b270b677341aa5d01a5e
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 17:40:40 2018 +1000

    ctdb-tests: Use errcode to translate ETIMEDOUT
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 65cc36f24d8a92c749dbc3700802e1d83a9ceb9f)

commit 0be07aec5b4524673948f34f621a2d78fb9c2a06
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 16:10:15 2018 +1000

    ctdb-tests: Replace md5sum with posix cksum
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 22c3078c8b10c88f8aff22caa7c92a06f387f17d)

commit 862aedcd302ec31ba8c3d108eb7672f78c08a8d1
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 15:27:51 2018 +1000

    ctdb-tests: Use portable wc -c instead of stat -c "%s"
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 07844c2ec9583362594241e607d81aaead8f1a99)

commit 55fe4b5641bf91edefb5b42f5d9f9603d68ea9ca
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 14:43:09 2018 +1000

    ctdb-scripts: date "+%N" is non-portable
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 96d5c7de82f795e33e9998e0fe94ddcb50e7421d)

commit 33df4f987f2f2ff18a9ab0fbbd18296e03baecde
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 12:08:20 2018 +1000

    ctdb-tests: Simplify pattern matching for ctime output
    
    On freebsd, sed does not accept multiple pattern strings.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 68542dbb5ab7b9d17b476937d1c84fe19d893255)

commit 18aa65484ba7c5f8c1ac4c43d0504c1d1563f041
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 19 14:30:17 2018 +1000

    ctdb-tests: Do not try to match pstree output in eventd tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 4152e98c0e95a938e17f95c543c2114bbf54b136)

commit eb1279e6dfcd02222ff9643dc2fa165d98e115d0
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Jul 18 19:00:42 2018 +1000

    ctdb-common: Add fd argument to ctdb_connection_list_read()
    
    This makes testing easier.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 3bf753e830c20183ef4f3278880d3be362e53bef)

commit ea5643fe165b958545cdc31de9aeab53309182c6
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Jul 11 18:35:46 2018 +1000

    ctdb-protocol: Avoid fgets in ctdb_connection_list_read
    
    C library buffering API can behave in unexpected fashion if underlying
    fd for stdin, stdout or stderr is closed and re-opened.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit c9b42d27e6cf9e6ae36f44970f0a388edc737a7a)

commit b21efa24ac0b798a19a02df0a63c9a107cdc43d9
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Jul 18 18:42:10 2018 +1000

    ctdb-common: Add line based I/O
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit c7041b0faf490661818244dd032ad413ce906e5c)

commit fcae5c60af1197ad4a26607f56b681dfbec7c5d8
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Jul 11 17:23:43 2018 +1000

    ctdb-tests: Porting tests should ignore unsupported features
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 0273171c30a5bcfdfc0b3f74c1d5a89dbaa5b204)

commit 16838f3cf312ff7b1f5f90586c948c2054339c94
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 19:11:18 2018 +1000

    ctdb-tests: Use sigcode to match signals
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 23952c9165bbdcae8f34b7dfefdbb4a499a55362)

commit 0ec4783c32f3ed3947a70efb1a5e5c684c769af5
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 19:09:00 2018 +1000

    ctdb-tests: Add signal code matching utility
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit b0028dd5bf2d5466a50dfd12a82a23f30e9ccf48)

commit adc4c784f03f974176cc01fd8664883360e949f1
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 18:54:11 2018 +1000

    ctdb-tests: Add ps output filter for freebsd
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit b7dbe9f306fda0d8f1dcc8dd81864539f6ff2632)

commit ed503603df6f2618e1bdc1f7cc66e2815af05f67
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 18:48:53 2018 +1000

    ctdb-client: Switch to ETIMEDOUT instead of ETIME
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit e1236a855ffc493efb5e9cb7b295034376e56d3a)

commit 60ef296034e517de4343d54030d47319c7a200cc
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 18:18:33 2018 +1000

    ctdb-daemon: Switch to using ETIMEDOUT instead of ETIME
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit b886a95eca306d0062240e5710ae0ed4505b1068)

commit 0782860bb5013928469bf56056679d2323c92a55
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 18:34:13 2018 +1000

    ctdb-event: Switch to ETIMEDOUT instead of ETIME
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit c8756ec17be11e40bc7e75aac7afdb323acb42e2)

commit 43cd4e47ae92f0f71f94790a31588cd170e2348c
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 18:19:09 2018 +1000

    ctdb-common: Switch to ETIMEDOUT from ETIME
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit a42a7232990fa163d046fb07be351ea3e0467046)

commit d49d03db06cf80e331c935abc95f36e361ac8c41
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 18:47:27 2018 +1000

    ctdb-tests: Add required_error() to match on error codes
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit e8a1b3db7abfa9e4a53e98a0aa21dfc268a21c92)

commit 3f757916bc61e833cfa1b406de38fb27c076bba4
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jul 10 17:38:42 2018 +1000

    ctdb-tests: Add errno matching utility
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit af8c31ead80d6c74b0e9d057cb47dff6552178a9)

commit f6be6615c0b3153b9dda8e7a424bac7ae514d301
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 1 13:39:57 2018 +1000

    ctdb-tests: Switch some test stubs to use /bin/sh
    
    They don't use any bash features.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit f13824b291fca9cdaa936c238d7e9bcb73927da7)

commit 58671b0079f1d754111015efd91e45599d5da3b6
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 1 13:28:40 2018 +1000

    ctdb-tests: Improve portability by not using mktemp --tmpdir option
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 2f2c35a1cb4afe38e869882e8f18a62d4daac981)

commit ebeecc34318d4046ca28573da76a933e9a54a840
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 1 19:58:02 2018 +1000

    ctdb-tests: Avoid use of non-portable getopt in stubs
    
    getopt is being used with non-portable options.  In most cases use
    simpler, POSIX-compliant getopts instead.
    
    In the case of the ctdb test stub command, options can appear after
    other arguments, so this requires an additional nested loop.
    
    In the case of smnotify, there are no short options, so handle the
    long options manually.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 896c77df1ce2645c6dd7898b59ea802e204dc7d9)

commit 04a9667fc8b0624ea1138bbf881879f3e48f5d4e
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 8 21:54:40 2018 +1000

    ctdb-tests: Avoid use of non-portable getopt in run_tests.sh
    
    getopt is being used with non-portable options.  Use simpler,
    POSIX-compliant getopts instead.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 56ffca3e79923a028ff96fbd50706d808b9dd215)

commit e4b703ede52c9b3345ff875230c57461a4db20dc
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 1 18:43:06 2018 +1000

    ctdb-tools: Avoid use of non-portable getopt in onnode
    
    getopt is being used with non-portable options.  Use simpler,
    POSIX-compliant getopts instead.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 4a39bc4aaad541f1e89c0eb3e98d4104bcc25025)

commit 7d28f016441dfbb3371beb58e0b722c3742097bd
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 1 13:30:06 2018 +1000

    ctdb-tests: Improve portability by not using /bin/bash directly
    
    FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash"
    for better flexibility.
    
    There are still many integration tests that use /bin/bash but this at
    least lets FreeBSD start running tests.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit dd9d8a20aa6948a5d1e7fb532842b7ff5bc0f550)

commit 23b5be4f9947f257b7cfa8d60491fb0a3fd23b72
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jul 1 19:47:37 2018 +1000

    ctdb-tools: Improve portability by not using /bin/bash directly
    
    FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash"
    for better flexibility.
    
    There are still many integration tests that use /bin/bash but this at
    least lets FreeBSD start running tests.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 73298ac8a9a87dcf3b3699dfdd39a8e865291620)

commit 4c2e666af7a882f6884e29beec39a328d224608a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 18 15:49:29 2018 -0700

    s3: smbd: Fix AIX sendfile() for SMB2. Ensure we don't spin on EAGAIN.
    
    For SMB2 the socket is set non-blocking. Ensure sendfile()
    calls complete if they return EAGAIN by saving the socket state,
    setting it blocking, doing the sendfile until completion and then
    restoring the socket state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Fri Jul 20 15:14:24 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 582ce5d6b599516d6d8d619529a2aa809139a175)

commit a221165ede44d8bdc1c52dc2d931ea3b857c0530
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 18 15:44:34 2018 -0700

    s3: smbd: Fix FreeBSD sendfile() for SMB2. Ensure we don't spin on EAGAIN.
    
    For SMB2 the socket is set non-blocking. Ensure sendfile()
    calls complete if they return EAGAIN by saving the socket state,
    setting it blocking, doing the sendfile until completion and then
    restoring the socket state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 456e520a3be7e4b54f1f144324c3671b8f6e35ea)

commit 8b54ad07aad4840aba6379d5e6b655929c828c97
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 18 15:36:47 2018 -0700

    s3: smbd: Fix HPUX sendfile() for SMB2. Ensure we don't spin on EAGAIN.
    
    For SMB2 the socket is set non-blocking. Ensure sendfile()
    calls complete if they return EAGAIN by saving the socket state,
    setting it blocking, doing the sendfile until completion and then
    restoring the socket state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit d222caa449d9c00bb2dd9da6c79ea509960d47c6)

commit 8652ab1be380faa2e1a08c64eb723f6aa1a4bbe9
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 18 15:29:37 2018 -0700

    s3: smbd: Fix Solaris sendfile() for SMB2. Ensure we don't spin on EAGAIN.
    
    For SMB2 the socket is set non-blocking. Ensure sendfile()
    calls complete if they return EAGAIN by saving the socket state,
    setting it blocking, doing the sendfile until completion and then
    restoring the socket state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 16a587075c8c62c1160869358ca56a133e90247a)

commit 76d3abeecaecaf33ace0db9149dcebc7bdefe6d5
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 18 13:32:49 2018 -0700

    s3: smbd: Fix Linux sendfile() for SMB2. Ensure we don't spin on EAGAIN.
    
    For SMB2 the socket is set non-blocking. Ensure sendfile()
    calls complete if they return EAGAIN by saving the socket state,
    setting it blocking, doing the sendfile until completion and then
    restoring the socket state.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 809967b3eab7a1b48c186517701538ca93536246)

commit a6dab26aa852a17198688ce4966ce9969d8590af
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Wed Jul 18 15:33:26 2018 +1200

    dns wildcards: fix BUG 13536
    
    The current position in the dns name was not advanced past the '.'
    character
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Jul 20 04:40:31 CEST 2018 on sn-devel-144
    
    (cherry picked from commit cef1b31cd1f33074e8ab6de52aa0fb74e9b57a9f)

commit 14963928ffb908ff49e0261915c7d651ba9b7b97
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Wed Jul 18 15:29:21 2018 +1200

    dns wildcards: tests to confirm BUG 13536
    
    DNS wildcard matching failing if more than one label to the left of the
    wildcard. This commits adds tests to confirm the bug.
    
    Wildcard entry: *.example.org
    bar.example.com matches
    foo.bar.example.com does not, but it it should.
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 0d3aec18679a2637430263a55de5e210a9201e21)

commit 9ad7af6899c2fd7b9498a0f0db8189a6c2f59015
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 17 15:40:04 2018 +0200

    s3: smbd: fix path check in smbd_smb2_create_durable_lease_check()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13535
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e60e9368cb3cb512e2506620d814187a692108e0)

commit 3b7a39bd5668b77be29b812cdb0bb9ab6e2c84e6
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 17 15:56:05 2018 +0200

    s4: torture: run test_durable_v2_open_reopen2_lease() in a subdirectory
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13535
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 725319743f1f2de934cbde477ca84430f5b2b4b4)

commit c775cda689c31d57292ef299979787b58a83cc19
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jul 18 15:24:05 2018 +1000

    ctdb-tests: Loosen match against pstree output in simple test
    
    As per previous commit, pstree can truncate output if it gets too
    wide.  Instead of matching against the script's full path and
    arguments, just match against the script name.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13531
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Wed Jul 18 14:53:39 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 359e52187fbc9b5f94570ff8d12607b4fc42e4f2)

commit 5abe6e6713161a44c37f8c98191e9c7c6fc31dc8
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jul 18 12:01:27 2018 +1000

    ctdb-tests: Simplify pstree output in eventd unit tests
    
    pstree truncates output when it exceeds a maximum width - the default
    is 132 columns.  A couple of recent
    commits (12fd8d7a5c5d14d403aac6cd9e318afcd0a8e159,
    b23f3f996038626f618c5b5aa552686c1b852f44) lengthened the command
    string in the output so that it is more likely to exceed this limit
    and be truncated, as below:
    
    ==================================================
    Running "cat /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/debug_script.log"
    --------------------------------------------------
    Output (Exit status: 0):
    --------------------------------------------------
    02.enabled.scri,PID /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/events/random/02.enabled.script ...
      `-sleep,PID 99
    01.disabled          DISABLED
    02.enabled           TIMEDOUT   DATETIME
      OUTPUT: Sleeping for 99 seconds
    --------------------------------------------------
    Required output (Exit status: 0):
    --------------------------------------------------
    02.enabled.scri,PID /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/events/random/02.enabled.script verbosetimeout
      `-sleep,PID 99
    01.disabled          DISABLED
    02.enabled           TIMEDOUT   DATETIME
      OUTPUT: Sleeping for 99 seconds
    
    FAILED
    
    It isn't clear that the above example exceeds 132 characters, given
    that the PID has been filtered into a fixed string, but it certainly
    goes close.  Whether or not it is truncated probably depends on the
    width of the PID in the unfiltered output.  This would explain why the
    test flaps.
    
    Avoid the output truncation by dropping the -a and -p options to
    simplify the pstree output.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13531
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (cherry picked from commit da115efd2b89e10767e9bec7343dce65ffd3c68b)

commit 0b3e00a622ce5af3acf9cba936b6993123955002
Author: Alexander Bokovoy <ab at samba.org>
Date:   Sat Feb 24 14:34:44 2018 +0200

    samba-tool trust: support discovery via netr_GetDcName
    
    In case a remote DC does not support netr_DsRGetDCNameEx2(),
    use netr_GetDcName() instead.
    
    This should help with FreeIPA where embedded smbd runs as a domain
    controller but does not implement full Active Directory compatibility.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13538
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
    Autobuild-Date(master): Tue Jul 24 09:55:23 CEST 2018 on sn-devel-144
    
    (cherry picked from commit c390728819e73cefbf02e0d52d22805930f4c45b)

commit a3c26b35d6839d6aabcc8c862200270b11d2b22c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 19 07:34:11 2018 +0200

    s3:selftest: run rpc.lsa.lookupsids also with explicit [smb1] and [smb2]
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 6800077c5c57c257326573537d1f2bb7a8066149)

commit e3e64256a15ab05dfd69f2b3b6d8fe32ea794f04
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 16:55:33 2018 +0200

    s4:librpc: autonegotiate SMB1/2/3
    
    Windows Server 1709 defaults to SMB2 and does not have SMB1 enabled.
    When establishing trust, samba-tool does not specify SMB protocol
    version and fail by default.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 4422f7382aad3090cb959ade030a02bf4fef81ac)

commit 25405ee6c1c4f422e91e051c8638aca41b29769d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jul 23 00:17:35 2018 +0200

    python/tests: use explicit "client ipc max protocol = NT1" for samba.tests.net_join_no_spnego
    
    The tests rely on SMB1.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 802e43bf742e756896fa73fcd139feca9ae293dd)

commit 373406a18ef7bc02953b68a96eda7090713c8029
Author: Alexander Bokovoy <ab at samba.org>
Date:   Thu Jul 19 14:07:39 2018 +0300

    tests/auth_log: Permit SMB2 service description if empty binding is used for kerberos authentication
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 70a9cf9ccfc4075cc08209191db1bce2c9b432fc)

commit b1753afa311fe0c97fd1208cb39de9575a3f2ceb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 14:52:43 2018 +0200

    s4:libcli: add smb_connect_nego_{send,recv}()
    
    This can be used to create a connection up to a negotiated
    smbXcli_conn.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit e4910f35eab008a41cfcac3d97b3647c721ac679)

commit 3d8c4bf85ee41f4c01b8b752c81eb2f0b645c45b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 19 23:04:33 2018 +0200

    s4:libcli: allow a fallback to NTLMSSP if SPNEGO is not supported locally
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 5188454bdce80f6e2bfc45deca18bd1b7289a7a6)

commit 02f7b65279f1d7b8a57cec498901bd96f22c2206
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 23:52:30 2018 +0200

    s4:libcli: add fallback_to_anonymous to smb2_connect_send()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit ca000d8901e6acb8a7c59d26d4f75c9d92bafece)

commit 4d7023f8ab70d00f1321d99d64c87665fdf4cab1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 16:44:16 2018 +0200

    s4:libcli: allow passing an already negotiated connection to smb2_connect_send()
    
    It will just do the session setup and tree connect steps.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit f20e607c15b4c8ae56ade5d7e68d832542a2cd5e)

commit a3a5797e2874eb14e918961e7e46f2d288930d5f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 16:43:32 2018 +0200

    s4:libcli: split out smb2_connect_session_start()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 5ad5b81b6ef601596583b4ad7d6a14241fa99a71)

commit c85c9b58e7188a44da2662b3caa7cedb071c09ad
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 16:43:04 2018 +0200

    s4:libcli: add smb2_transport_raw_init()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit ce2248c4b5aad2d00155a2e77b3e6340ce824979)

commit f9b685e9a5dfdb58be692c653ff41184415ea622
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 15:34:55 2018 +0200

    s4:libcli: allow passing an already negotiated connection to smb_composite_connect()
    
    It will just do the session setup and tree connect steps.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 2b68f9b8b0dd944fa89b9e0037886ddd4fb4e5f9)

commit 71a1355172bd568bc83db3cbf41920f34115cd77
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 15:01:50 2018 +0200

    s4:libcli: use talloc_zero() for struct smb_composite_connect in fetchfile.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 87d73397f9a9dee8fa0055a2ff08244b2c85e120)

commit 00e5ea1fac691e1bd20be313ad4ba3a0c39bb55b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 15:36:52 2018 +0200

    s4:libcli: add smbcli_transport_raw_init()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit b7e99c2571e31971a6d7f1898e7458c16dc1031e)

commit a8cd7046efa19f535c076b997f145306c85d2fd3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 18 15:36:31 2018 +0200

    s4:libcli: split out smb_raw_negotiate_fill_transport()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 17b12a9b9a9dfd859679de77aa0c7ffbc782f1bc)

commit 7e9602100ec06ff38e2dc45137e42881ef802598
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 19 07:32:08 2018 +0200

    librpc: add binding handle support for [smb1]
    
    This will be used to force smb1.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13308
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 062b518cabd9fb5f72f96cdf400c978c0b844619)

commit d85dd18592a4d1609b186bbaeaec0b43cf1372fd
Author: Alexander Bokovoy <ab at samba.org>
Date:   Sat Jul 21 12:05:15 2018 +0300

    python/samba/tests: make sure samba.tests can be imported without SamDB
    
    We are using samba.tests Python module __init__.py file as a catch-all
    for all types of helpers. Some of these helpers are only usable with
    Samba AD DC targets.
    
    When SamDB is not available in a non-Samba AD DC target, provide a
    dummy replacement that simply returns None. This allows to complete
    initialization for non-Samba AD DC target tests which do not use
    connect_samdb() helper.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit c6a325c97c82c867df2b17f48e565b73f9045c44
Author: Alexander Bokovoy <ab at samba.org>
Date:   Fri Jul 20 12:32:20 2018 +0300

    s4-dsdb: only build dsdb Python modules for AD DC
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit bc280e8afc2187cbcf60facda8b9a3cfcd3c2d4f
Author: Alexander Bokovoy <ab at samba.org>
Date:   Fri Jul 20 12:31:20 2018 +0300

    s4-dns_server: Only build dns server Python code for AD DC
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542
    
    Signed-off-by: Alexander Bokovoy <ab at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

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

Summary of changes:
 WHATSNEW.txt                                       |  18 +-
 ctdb/client/client.h                               |   2 +-
 ctdb/client/client_connect.c                       |   2 +-
 ctdb/common/event_script.c                         | 246 ++++++++
 ctdb/common/event_script.h                         |  72 +++
 ctdb/common/line.c                                 | 145 +++++
 ctdb/common/line.h                                 |  62 ++
 ctdb/common/run_event.c                            | 221 ++-----
 ctdb/common/run_proc.c                             |   2 +-
 ctdb/common/system_socket.c                        |   6 +-
 ctdb/config/events/legacy/00.ctdb.script           |   2 +-
 ctdb/config/functions                              |   9 +-
 ctdb/doc/ctdb-script.options.5.xml                 |   5 +-
 ctdb/doc/ctdb.1.xml                                |  95 +--
 ctdb/doc/examples/config_migrate.sh                | 688 +++++++++++++++++++++
 ctdb/doc/examples/config_migrate.test_input        |  45 ++
 ctdb/event/event_cmd.c                             |   4 +-
 ctdb/event/event_tool.c                            | 232 +++++--
 ctdb/protocol/protocol_util.c                      |  92 +--
 ctdb/protocol/protocol_util.h                      |   4 +-
 ctdb/server/ctdb_client.c                          |   2 +-
 ctdb/server/ctdb_monitor.c                         |   2 +-
 ctdb/server/ctdb_recover.c                         |   2 +-
 ctdb/server/ctdb_takeover.c                        |   8 +-
 ctdb/server/eventscript.c                          |   4 +-
 ctdb/tests/cunit/event_script_test_001.sh          | 125 ++++
 ctdb/tests/cunit/line_test_001.sh                  |  90 +++
 ctdb/tests/cunit/pidfile_test_001.sh               |   2 +-
 ctdb/tests/cunit/porting_tests_001.sh              |  13 +-
 ctdb/tests/cunit/run_event_001.sh                  |   8 +-
 ctdb/tests/cunit/run_proc_001.sh                   |  19 +-
 ctdb/tests/cunit/sock_daemon_test_001.sh           |  26 +-
 ctdb/tests/eventd/etc-ctdb/debug-script.sh         |   2 +-
 .../01.disabled.script => data/03.notalink.script} |   1 -
 .../data/{01.dummy.script => 02.disabled.script}   |   0
 .../etc-ctdb/{ => share}/events/empty/README       |   0
 .../{ => share}/events/random/01.disabled.script   |   0
 .../{ => share}/events/random/02.enabled.script    |   0
 .../{ => share}/events/random/README.script        |   0
 .../etc-ctdb/{ => share}/events/random/a.script    |   0
 ctdb/tests/eventd/eventd_001.sh                    |  11 +-
 ctdb/tests/eventd/eventd_002.sh                    |  10 +-
 ctdb/tests/eventd/eventd_003.sh                    |  20 +-
 ctdb/tests/eventd/eventd_004.sh                    |   2 +-
 ctdb/tests/eventd/eventd_006.sh                    |   2 +-
 ctdb/tests/eventd/eventd_007.sh                    |   4 +-
 ctdb/tests/eventd/eventd_009.sh                    | 116 ++++
 ctdb/tests/eventd/eventd_011.sh                    |   4 +-
 ctdb/tests/eventd/eventd_012.sh                    |   4 +-
 ctdb/tests/eventd/eventd_013.sh                    |   4 +-
 ctdb/tests/eventd/eventd_021.sh                    |   2 +-
 ctdb/tests/eventd/eventd_022.sh                    |   4 +-
 ctdb/tests/eventd/eventd_023.sh                    |   2 +-
 ctdb/tests/eventd/eventd_024.sh                    |   4 +-
 ctdb/tests/eventd/eventd_032.sh                    |   6 +-
 ctdb/tests/eventd/eventd_033.sh                    |  12 +-
 ctdb/tests/eventd/eventd_042.sh                    |   2 +-
 ctdb/tests/eventd/eventd_043.sh                    |   4 +-
 ctdb/tests/eventd/eventd_052.sh                    |   4 +-
 ctdb/tests/eventd/scripts/local.sh                 |   6 +-
 ctdb/tests/eventscripts/00.ctdb.init.009.sh        |   1 +
 ctdb/tests/eventscripts/13.per_ip_routing.024.sh   |   2 +-
 ctdb/tests/eventscripts/scripts/00.ctdb.sh         |   3 +-
 ctdb/tests/eventscripts/scripts/11.natgw.sh        |   8 +-
 ctdb/tests/eventscripts/stubs/ctdb                 |  38 +-
 ctdb/tests/eventscripts/stubs/ip                   |   2 +-
 ctdb/tests/eventscripts/stubs/rpcinfo              |  34 +-
 ctdb/tests/eventscripts/stubs/smnotify             |  17 +-
 ctdb/tests/eventscripts/stubs/ss                   |  28 +-
 ctdb/tests/run_tests.sh                            |  48 +-
 ctdb/tests/scripts/integration.bash                |   2 +-
 ctdb/tests/scripts/unit.sh                         |   7 +
 ctdb/tests/simple/90_debug_hung_script.sh          |   2 +-
 ctdb/tests/src/dummy_client.c                      |   2 +-
 ctdb/tests/src/errcode.c                           | 189 ++++++
 ctdb/tests/src/event_script_test.c                 | 119 ++++
 ctdb/tests/src/line_test.c                         | 102 +++
 ctdb/tests/src/porting_tests.c                     |  10 +-
 ctdb/tests/src/protocol_util_test.c                |  18 +-
 ctdb/tests/src/run_event_test.c                    |   1 +
 ctdb/tests/src/sigcode.c                           | 120 ++++
 ctdb/tests/takeover_helper/210.sh                  |   6 +-
 ctdb/tests/takeover_helper/211.sh                  |   6 +-
 ctdb/tests/takeover_helper/220.sh                  |   6 +-
 ctdb/tests/takeover_helper/230.sh                  |   8 +-
 ctdb/tests/takeover_helper/240.sh                  |   6 +-
 ctdb/tests/takeover_helper/250.sh                  |   6 +-
 ctdb/tests/takeover_helper/260.sh                  |   6 +-
 ctdb/tests/takeover_helper/scripts/local.sh        |   4 +-
 ctdb/tools/ctdb.c                                  |   6 +-
 ctdb/tools/ctdb_killtcp.c                          |   2 +-
 ctdb/tools/onnode                                  |  55 +-
 ctdb/wscript                                       |  21 +-
 librpc/rpc/binding.c                               |   1 +
 librpc/rpc/rpc_common.h                            |   2 +
 python/samba/netcmd/domain.py                      |  26 +-
 python/samba/tests/__init__.py                     |   5 +-
 python/samba/tests/auth_log.py                     |  26 +-
 python/samba/tests/dns_wildcard.py                 |  48 ++
 python/samba/tests/net_join_no_spnego.py           |   2 +
 source3/lib/sendfile.c                             | 293 ++++++++-
 source3/selftest/tests.py                          |   2 +-
 source3/smbd/smb2_create.c                         |  16 +-
 source4/dns_server/dnsserver_common.c              |   1 +
 source4/dns_server/wscript_build                   |   8 +-
 source4/dsdb/wscript_build                         |  11 +-
 source4/libcli/raw/clitransport.c                  |  44 ++
 source4/libcli/raw/clitree.c                       |   1 +
 source4/libcli/raw/rawnegotiate.c                  |  74 ++-
 source4/libcli/smb2/connect.c                      |  69 ++-
 source4/libcli/smb2/session.c                      |  35 +-
 source4/libcli/smb2/transport.c                    |  35 ++
 source4/libcli/smb_composite/connect.c             |  48 +-
 source4/libcli/smb_composite/connect_nego.c        | 209 +++++++
 source4/libcli/smb_composite/fetchfile.c           |   2 +-
 source4/libcli/smb_composite/smb_composite.h       |  23 +
 source4/libcli/wscript_build                       |  20 +-
 source4/librpc/rpc/dcerpc_connect.c                | 257 ++++----
 source4/ntvfs/cifs/vfs_cifs.c                      |   1 +
 source4/torture/smb2/durable_v2_open.c             |  11 +-
 120 files changed, 3818 insertions(+), 816 deletions(-)
 create mode 100644 ctdb/common/event_script.c
 create mode 100644 ctdb/common/event_script.h
 create mode 100644 ctdb/common/line.c
 create mode 100644 ctdb/common/line.h
 create mode 100755 ctdb/doc/examples/config_migrate.sh
 create mode 100644 ctdb/doc/examples/config_migrate.test_input
 create mode 100755 ctdb/tests/cunit/event_script_test_001.sh
 create mode 100755 ctdb/tests/cunit/line_test_001.sh
 copy ctdb/tests/eventd/etc-ctdb/events/{random/01.disabled.script => data/03.notalink.script} (94%)
 copy ctdb/tests/eventd/etc-ctdb/share/events/data/{01.dummy.script => 02.disabled.script} (100%)
 copy ctdb/tests/eventd/etc-ctdb/{ => share}/events/empty/README (100%)
 copy ctdb/tests/eventd/etc-ctdb/{ => share}/events/random/01.disabled.script (100%)
 copy ctdb/tests/eventd/etc-ctdb/{ => share}/events/random/02.enabled.script (100%)
 copy ctdb/tests/eventd/etc-ctdb/{ => share}/events/random/README.script (100%)
 copy ctdb/tests/eventd/etc-ctdb/{ => share}/events/random/a.script (100%)
 create mode 100644 ctdb/tests/src/errcode.c
 create mode 100644 ctdb/tests/src/event_script_test.c
 create mode 100644 ctdb/tests/src/line_test.c
 create mode 100644 ctdb/tests/src/sigcode.c
 create mode 100644 source4/libcli/smb_composite/connect_nego.c


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 6de49f2..f45251b 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -286,8 +286,8 @@ There are many changes to CTDB in this release.
     CTDB_SET_TunableVariable=<value> in the main configuration file is
     no longer supported.  See ctdb-tunables(7) for details.
 
-  A script to convert an old-style configuration to a new one will be
-  available for release but is not yet available.
+  A example script to migrate an old-style configuration to the new
+  style is available in ctdb/doc/examples/config_migrate.sh.
 
 * The following configuration variables and corresponding ctdbd
   command-line options have been removed and not replaced with
@@ -324,6 +324,20 @@ There are many changes to CTDB in this release.
 
   Event scripts must now end with a ".script" suffix.
 
+* The "ctdb event" command has changed in 2 ways:
+
+  - A component is now required for all commands
+
+    In this release the only valid component is "legacy".
+
+  - There is no longer a default event when running "ctdb event status"
+
+    Listing the status of the "monitor" event is now done via:
+
+      ctdb event status legacy monitor
+
+   See ctdb(1) for details.
+
 * The following service-related event script options have been
   removed:
 
diff --git a/ctdb/client/client.h b/ctdb/client/client.h
index 2eec3ea..d4d1450 100644
--- a/ctdb/client/client.h
+++ b/ctdb/client/client.h
@@ -184,7 +184,7 @@ void ctdb_client_wait(struct tevent_context *ev, bool *done);
  * @param[in] ev Tevent context
  * @param[in] done Boolean flag to indicate when to stop waiting
  * @param[in] timeout How long to wait
- * @return 0 on succes, ETIME on timeout, and errno on failure
+ * @return 0 on succes, ETIMEDOUT on timeout, and errno on failure
  */
 int ctdb_client_wait_timeout(struct tevent_context *ev, bool *done,
 			     struct timeval timeout);
diff --git a/ctdb/client/client_connect.c b/ctdb/client/client_connect.c
index 1e4157e..0977d71 100644
--- a/ctdb/client/client_connect.c
+++ b/ctdb/client/client_connect.c
@@ -363,7 +363,7 @@ int ctdb_client_wait_timeout(struct tevent_context *ev, bool *done,
 	talloc_free(mem_ctx);
 
 	if (timed_out) {
-		return ETIME;
+		return ETIMEDOUT;
 	}
 
 	return 0;
diff --git a/ctdb/common/event_script.c b/ctdb/common/event_script.c
new file mode 100644
index 0000000..8978d14
--- /dev/null
+++ b/ctdb/common/event_script.c
@@ -0,0 +1,246 @@
+/*
+   Low level event script handling
+
+   Copyright (C) Amitay Isaacs  2017
+   Copyright (C) Martin Schwenke  2018
+
+   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 "replace.h"
+#include "system/filesys.h"
+#include "system/dir.h"
+#include "system/glob.h"
+
+#include <talloc.h>
+
+#include "common/event_script.h"
+
+static int script_filter(const struct dirent *de)
+{
+	int ret;
+
+	/* Match a script pattern */
+	ret = fnmatch("[0-9][0-9].*.script", de->d_name, 0);
+	if (ret == 0) {
+		return 1;
+	}
+
+	return 0;
+}
+
+int event_script_get_list(TALLOC_CTX *mem_ctx,
+			  const char *script_dir,
+			  struct event_script_list **out)
+{
+	struct dirent **namelist = NULL;
+	struct event_script_list *script_list = NULL;
+	size_t ds_len;
+	int count, ret;
+	int i;
+
+	count = scandir(script_dir, &namelist, script_filter, alphasort);
+	if (count == -1) {
+		ret = errno;
+		goto done;
+	}
+
+	script_list = talloc_zero(mem_ctx, struct event_script_list);
+	if (script_list == NULL) {
+		goto nomem;
+	}
+
+	if (count == 0) {
+		ret = 0;
+		*out = script_list;
+		goto done;
+	}
+
+	script_list->num_scripts = count;
+	script_list->script = talloc_zero_array(script_list,
+						struct event_script *,
+						count);
+	if (script_list->script == NULL) {
+		goto nomem;
+	}
+
+	ds_len = strlen(".script");
+	for (i = 0; i < count; i++) {
+		struct event_script *s;
+		struct stat statbuf;
+
+		s = talloc_zero(script_list->script, struct event_script);
+		if (s == NULL) {
+			goto nomem;
+		}
+
+		script_list->script[i] = s;
+
+		s->name = talloc_strndup(script_list->script,
+					 namelist[i]->d_name,
+					 strlen(namelist[i]->d_name) - ds_len);
+		if (s->name == NULL) {
+			goto nomem;
+		}
+
+		s->path = talloc_asprintf(script_list->script,
+					  "%s/%s",
+					  script_dir,
+					  namelist[i]->d_name);
+		if (s->path == NULL) {
+			goto nomem;
+		}
+
+		ret = stat(s->path, &statbuf);
+		if (ret == 0) {
+			/*
+			 * If ret != 0 this is either a dangling
+			 * symlink or it has just disappeared.  Either
+			 * way, it isn't executable.  See the note
+			 * below about things that have disappeared.
+			 */
+			if (statbuf.st_mode & S_IXUSR) {
+				s->enabled = true;
+			}
+		}
+	}
+
+	*out = script_list;
+	return 0;
+
+nomem:
+	ret = ENOMEM;
+	talloc_free(script_list);
+
+done:
+	if (namelist != NULL && count != -1) {
+		for (i=0; i<count; i++) {
+			free(namelist[i]);
+		}
+		free(namelist);
+	}
+
+	return ret;
+}
+
+int event_script_chmod(const char *script_dir,
+		       const char *script_name,
+		       bool enable)
+{
+	const char *dot_script = ".script";
+	size_t ds_len = strlen(dot_script);
+	size_t sn_len = strlen(script_name);
+	DIR *dirp;
+	struct dirent *de;
+	char buf[PATH_MAX];
+	const char *script_file;
+	int ret, new_mode;
+	char filename[PATH_MAX];
+	struct stat st;
+	bool found;
+	ino_t found_inode;
+	int fd = -1;
+
+	/* Allow script_name to already have ".script" suffix */
+	if (sn_len > ds_len &&
+	    strcmp(&script_name[sn_len - ds_len], dot_script) == 0) {
+		script_file = script_name;
+	} else {
+		ret = snprintf(buf, sizeof(buf), "%s.script", script_name);
+		if (ret >= sizeof(buf)) {
+			return ENAMETOOLONG;
+		}
+		script_file = buf;
+	}
+
+	dirp = opendir(script_dir);
+	if (dirp == NULL) {
+		return errno;
+	}
+
+	found = false;
+	while ((de = readdir(dirp)) != NULL) {
+		if (strcmp(de->d_name, script_file) == 0) {
+			/* check for valid script names */
+			ret = script_filter(de);
+			if (ret == 0) {
+				closedir(dirp);
+				return EINVAL;
+			}
+
+			found = true;
+			found_inode = de->d_ino;
+			break;
+		}
+	}
+	closedir(dirp);
+
+	if (! found) {
+		return ENOENT;
+	}
+
+	ret = snprintf(filename,
+		       sizeof(filename),
+		       "%s/%s",
+		       script_dir,
+		       script_file);
+	if (ret >= sizeof(filename)) {
+		return ENAMETOOLONG;
+	}
+
+	fd = open(filename, O_RDWR);
+	if (fd == -1) {
+		ret = errno;
+		goto done;
+	}
+
+	ret = fstat(fd, &st);
+	if (ret != 0) {
+		ret = errno;
+		goto done;
+	}
+
+	/*
+	 * If the directory entry inode number doesn't match the one
+	 * returned by fstat() then this is probably a symlink, so the
+	 * caller should not be calling this function.  Note that this
+	 * is a cheap sanity check to catch most programming errors.
+	 * This doesn't cost any extra system calls but can still miss
+	 * the unlikely case where the symlink is to a file on a
+	 * different filesystem with the same inode number as the
+	 * symlink.
+	 */
+	if (found && found_inode != st.st_ino) {
+		ret = EINVAL;
+		goto done;
+	}
+
+	if (enable) {
+		new_mode = st.st_mode | (S_IXUSR | S_IXGRP | S_IXOTH);
+	} else {
+		new_mode = st.st_mode & ~(S_IXUSR | S_IXGRP | S_IXOTH);
+	}
+
+	ret = fchmod(fd, new_mode);
+	if (ret != 0) {
+		ret = errno;
+		goto done;
+	}
+
+done:
+	if (fd != -1) {
+		close(fd);
+	}
+	return ret;
+}
diff --git a/ctdb/common/event_script.h b/ctdb/common/event_script.h
new file mode 100644
index 0000000..bf5a8fd
--- /dev/null
+++ b/ctdb/common/event_script.h
@@ -0,0 +1,72 @@
+/*
+   Low level event script handling
+
+   Copyright (C) Amitay Isaacs  2017
+   Copyright (C) Martin Schwenke  2018
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CTDB_SCRIPT_H__
+#define __CTDB_SCRIPT_H__
+
+#include "replace.h"
+#include "system/filesys.h"
+
+#include <talloc.h>
+
+/**
+ * @file script.h
+ *
+ * @brief Script listing and manipulation
+ */
+
+
+struct event_script {
+	char *name;
+	char *path;
+	bool enabled;
+};
+
+struct event_script_list {
+	unsigned int num_scripts;
+	struct event_script **script;
+};
+
+
+/**
+ * @brief Retrieve a list of scripts
+ *
+ * @param[in] mem_ctx Talloc memory context
+ * @param[in] script_dir Directory containing scripts
+ * @param[out] out List of scripts
+ * @return 0 on success, errno on failure
+ */
+int event_script_get_list(TALLOC_CTX *mem_ctx,
+			  const char *script_dir,
+			  struct event_script_list **out);
+
+/**
+ * @brief Make a script executable or not executable
+ *
+ * @param[in] script_dir Directory containing script
+ * @param[in] script_name Name of the script to enable
+ * @param[in] executable True if script should be made executable
+ * @return 0 on success, errno on failure
+ */
+int event_script_chmod(const char *script_dir,
+		       const char *script_name,
+		       bool executable);
+
+#endif /* __CTDB_SCRIPT_H__ */
diff --git a/ctdb/common/line.c b/ctdb/common/line.c
new file mode 100644
index 0000000..c4c6726
--- /dev/null
+++ b/ctdb/common/line.c
@@ -0,0 +1,145 @@
+/*
+   Line based I/O over fds
+
+   Copyright (C) Amitay Isaacs  2018
+
+   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 "replace.h"
+
+#include <talloc.h>
+
+#include "lib/util/sys_rw.h"
+
+#include "common/line.h"
+
+struct line_read_state {
+	line_process_fn_t callback;
+	void *private_data;
+	char *buf;
+	size_t hint, len, offset;
+	int num_lines;
+};
+
+static bool line_read_one(char *buf, size_t start, size_t len, size_t *pos)
+{
+	size_t i;
+
+	for (i=start; i<len; i++) {
+		if (buf[i] == '\n' || buf[i] == '\0') {
+			*pos = i;
+			return true;
+		}
+	}
+
+	return false;
+}
+
+static int line_read_process(struct line_read_state *state)
+{
+	size_t start = 0;
+	size_t pos = 0;
+
+	while (1) {
+		int ret;
+		bool ok;
+
+		ok = line_read_one(state->buf, start, state->offset, &pos);
+		if (! ok) {
+			break;
+		}
+
+		state->buf[pos] = '\0';
+		state->num_lines += 1;
+
+		ret = state->callback(state->buf + start, state->private_data);
+		if (ret != 0) {
+			return ret;
+		}
+
+		start = pos+1;
+	}
+
+	if (pos > 0) {
+		if (pos+1 < state->offset) {
+			memmove(state->buf,
+				state->buf + pos+1,
+				state->offset - (pos+1));
+		}
+		state->offset -= (pos+1);
+	}
+
+	return 0;
+}
+
+int line_read(int fd,
+	      size_t length,
+	      TALLOC_CTX *mem_ctx,
+	      line_process_fn_t callback,
+	      void *private_data,
+	      int *num_lines)
+{
+	struct line_read_state state;
+
+	if (length < 32) {
+		length = 32;
+	}
+
+	state = (struct line_read_state) {
+		.callback = callback,
+		.private_data = private_data,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list