The branch, master has been updated
       via  e742661bd25 tstream: Add tstream_npa_existing_stream()
       via  1b47dd65a38 tstream_npa: Allow NULL output parameters
       via  bbfdf2708e8 tstream_npa: Return named_pipe_auth_req_info4 from 
accept_existing
       via  3a03c0a1ad7 tstream_npa: Keep "named_pipe_auth_req" around in 
tstream_npa_accept_existing_send()/recv()
       via  0736a9f5c39 wbinfo: Allow SID for -R
       via  4e174b5a0f4 dynconfig: Introduce and expose SAMBA_LIBEXECDIR
       via  206c99f6e5e srv_winreg: Align integer types
       via  6a6676488ea printing: Align integer types
       via  23056f537c6 smbd: Factor out a bool expr into a descriptive variable
       via  6f4e6fc631a test: Add a test for background_job_send crash
       via  cabd67d69f7 lib: Fix rundown of jobs sent with background_job_send()
       via  74720bd9acd lib: Add required includes to source3/lib/background.h
      from  97e657b89b6 asn1: Remove unused function asn1_check_enumerated()

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


- Log -----------------------------------------------------------------
commit e742661bd2507d39dfa47e40531dc1dca636cbbe
Author: Volker Lendecke <[email protected]>
Date:   Tue Feb 16 17:22:40 2021 +0100

    tstream: Add tstream_npa_existing_stream()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Thu Apr  1 20:36:19 UTC 2021 on sn-devel-184

commit 1b47dd65a3815e38537af335792353fca6c40f03
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 18 21:28:30 2021 +0100

    tstream_npa: Allow NULL output parameters
    
    When reading the info4, the substructs might not be interesting for
    you.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit bbfdf2708e8e85cee56aeff43c9216d2003ed310
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 18 17:30:42 2021 +0100

    tstream_npa: Return named_pipe_auth_req_info4 from accept_existing
    
    Callers might want the full picture. We need to make
    named_pipe_auth_req_info4 public for that.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 3a03c0a1ad7ea81d9dcae88016c42a1f9e000b47
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 18 16:54:07 2021 +0100

    tstream_npa: Keep "named_pipe_auth_req" around in 
tstream_npa_accept_existing_send()/recv()
    
    This will make it simpler to return a copy of the struct
    named_pipe_auth_req_info4 in the next commit.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 0736a9f5c39b93e06a9172a74b766eb9a029f1f0
Author: Volker Lendecke <[email protected]>
Date:   Tue Feb 23 16:04:02 2021 +0100

    wbinfo: Allow SID for -R
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 4e174b5a0f42b042f363640d6b02ef6ba4e9883a
Author: Volker Lendecke <[email protected]>
Date:   Tue Feb 2 16:50:48 2021 +0100

    dynconfig: Introduce and expose SAMBA_LIBEXECDIR
    
    Right now the smbspool_krb5_wrapper lives there, but we'll have more
    in the future.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 206c99f6e5e0720eff4e3240d61a51ba151204f7
Author: Volker Lendecke <[email protected]>
Date:   Sat Mar 27 16:42:29 2021 +0100

    srv_winreg: Align integer types
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 6a6676488ea4849b8ed1e6d851fa3363b6a72d6d
Author: Volker Lendecke <[email protected]>
Date:   Sat Mar 27 16:42:52 2021 +0100

    printing: Align integer types
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 23056f537c6c12e656fbccac86643088db7f14da
Author: Volker Lendecke <[email protected]>
Date:   Fri Mar 26 18:50:00 2021 +0100

    smbd: Factor out a bool expr into a descriptive variable
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 6f4e6fc631a4f43d22fe65cd53daf635b4324d53
Author: Volker Lendecke <[email protected]>
Date:   Wed Mar 31 11:22:16 2021 +0000

    test: Add a test for background_job_send crash
    
    I haven't figured out how to properly add a crashing test to
    "knownfail", so this is added after the fix.
    
    Signed-off-by: Volker Lendecke <[email protected]>

commit cabd67d69f7fa24a132b6e7850b9678aac269ec5
Author: Volker Lendecke <[email protected]>
Date:   Tue Mar 30 17:18:10 2021 +0200

    lib: Fix rundown of jobs sent with background_job_send()
    
    When using this with a trigger message in smbd it will crash at
    rundown in messaging_deregister because the global messaging context
    can be TALLOC_FREE'ed before the background job is freed.
    
    Using messaging_filtered_send already takes care of this situation
    properly.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 74720bd9acd4951dd03f562748cae4dbe26092a0
Author: Volker Lendecke <[email protected]>
Date:   Wed Mar 31 11:21:52 2021 +0000

    lib: Add required includes to source3/lib/background.h
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 dynconfig/dynconfig.c                      |   1 +
 dynconfig/dynconfig.h                      |   1 +
 dynconfig/wscript                          |   7 ++
 lib/printer_driver/printer_driver.c        |  21 ++--
 libcli/named_pipe_auth/npa_tstream.c       | 153 +++++++++++++++++++++--------
 libcli/named_pipe_auth/npa_tstream.h       |  34 +++++--
 librpc/idl/named_pipe_auth.idl             |   2 +-
 nsswitch/wbinfo.c                          |  25 +++--
 selftest/tests.py                          |   6 ++
 source3/lib/background.c                   |  36 +++----
 source3/lib/background.h                   |   6 ++
 source3/rpc_server/rpc_server.c            |   1 +
 source3/rpc_server/winreg/srv_winreg_nt.c  |   2 +-
 source3/smbd/server.c                      |  10 +-
 source4/samba/service_named_pipe.c         |   1 +
 testsuite/unittests/test_background_send.c |  82 ++++++++++++++++
 testsuite/unittests/wscript                |   7 ++
 17 files changed, 298 insertions(+), 97 deletions(-)
 create mode 100644 testsuite/unittests/test_background_send.c


Changeset truncated at 500 lines:

diff --git a/dynconfig/dynconfig.c b/dynconfig/dynconfig.c
index dd4de16e1d4..415ccc53c52 100644
--- a/dynconfig/dynconfig.c
+++ b/dynconfig/dynconfig.c
@@ -87,6 +87,7 @@ DEFINE_DYN_CONFIG_PARAM(LMHOSTSFILE) /** Statically 
configured LanMan hosts. **/
 DEFINE_DYN_CONFIG_PARAM(CODEPAGEDIR)
 DEFINE_DYN_CONFIG_PARAM(LIBDIR)
 DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
+DEFINE_DYN_CONFIG_PARAM(SAMBA_LIBEXECDIR)
 DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
 DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
 DEFINE_DYN_CONFIG_PARAM(STATEDIR) /** Persistent state files. Default LOCKDIR 
*/
diff --git a/dynconfig/dynconfig.h b/dynconfig/dynconfig.h
index 156e63e38ac..72028a8c2e1 100644
--- a/dynconfig/dynconfig.h
+++ b/dynconfig/dynconfig.h
@@ -38,6 +38,7 @@ DEFINE_DYN_CONFIG_PROTO(LMHOSTSFILE) /** Statically 
configured LanMan hosts. **/
 DEFINE_DYN_CONFIG_PROTO(CODEPAGEDIR)
 DEFINE_DYN_CONFIG_PROTO(LIBDIR)
 DEFINE_DYN_CONFIG_PROTO(MODULESDIR)
+DEFINE_DYN_CONFIG_PROTO(SAMBA_LIBEXECDIR)
 DEFINE_DYN_CONFIG_PROTO(SHLIBEXT)
 DEFINE_DYN_CONFIG_PROTO(LOCKDIR)
 DEFINE_DYN_CONFIG_PROTO(STATEDIR) /** Persistent state files. Default LOCKDIR 
*/
diff --git a/dynconfig/wscript b/dynconfig/wscript
index f455699f062..c62afa25399 100644
--- a/dynconfig/wscript
+++ b/dynconfig/wscript
@@ -95,6 +95,11 @@ dynconfig = {
          'FHS-PATH':  '${LIBEXECDIR}',
          'OVERWRITE': True,
     },
+    'SAMBA_LIBEXECDIR' : {
+         'STD-PATH':  '${LIBEXECDIR}/samba',
+         'FHS-PATH':  '${LIBEXECDIR}/samba',
+         'OVERWRITE': True,
+    },
     'DATADIR' : {
          'STD-PATH':  '${DATADIR}',
          'FHS-PATH':  '${DATADIR}',
@@ -373,6 +378,8 @@ def get_override(bld):
                  'PYTHONARCHDIR' : 'bin/python',
                  'BINDIR'        : 'bin',
                  'SBINDIR'       : 'bin',
+                 'LIBEXECDIR'    : 'bin',
+                 'SAMBA_LIBEXECDIR' : 'bin',
                  'CODEPAGEDIR'   : 'codepages',
                  'SCRIPTSBINDIR' : 'source4/scripting/bin',
                  'SETUPDIR'      : 'source4/setup'
diff --git a/lib/printer_driver/printer_driver.c 
b/lib/printer_driver/printer_driver.c
index 2176d4ae948..35260c29075 100644
--- a/lib/printer_driver/printer_driver.c
+++ b/lib/printer_driver/printer_driver.c
@@ -330,11 +330,10 @@ static NTSTATUS enum_devices_in_toc(struct 
gp_inifile_context *ctx,
                                    const char ***pdevice_values)
 {
        NTSTATUS status;
-       size_t num_manufacturers = 0;
+       size_t i, num_manufacturers = 0;
        const char **manufacturers = NULL;
        const char **values = NULL;
        char *p;
-       int i;
        bool ok;
 
        status = gp_inifile_enum_section(ctx, "Manufacturer", 
&num_manufacturers, &manufacturers, &values);
@@ -370,10 +369,9 @@ static NTSTATUS enum_devices_in_toc(struct 
gp_inifile_context *ctx,
                         */
 
                        const char *decorated_models_section_name;
-                       size_t num_devices = 0;
+                       size_t d, num_devices = 0;
                        const char **devices = NULL;
                        const char **device_values = NULL;
-                       int d;
                        size_t c = 0;
 
                        decorated_models_section_name = 
talloc_asprintf(mem_ctx, "%s.%s",
@@ -430,10 +428,9 @@ static NTSTATUS find_device_in_toc(struct 
gp_inifile_context *ctx,
                                   const char **value)
 {
        NTSTATUS status;
-       size_t num_devices = 0;
+       size_t d, num_devices = 0;
        const char **devices = NULL;
        const char **device_values = NULL;
-       int d;
 
        if (device_description == NULL) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -477,11 +474,10 @@ static NTSTATUS process_driver_section_copyfiles(struct 
gp_inifile_context *ctx,
                                                 struct spoolss_AddDriverInfo8 
*r)
 {
        NTSTATUS status;
-       size_t num_keys = 0;
+       size_t i, num_keys = 0;
        char *p, *key;
        const char **keys = NULL;
        const char **values = NULL;
-       int i;
        char *str;
        const char *s;
 
@@ -643,10 +639,9 @@ static NTSTATUS process_one_core_driver_section(struct 
gp_inifile_context *core_
                                                struct spoolss_AddDriverInfo8 
*r)
 {
        NTSTATUS status;
-       size_t num_keys = 0;
+       size_t i, num_keys = 0;
        const char **keys = NULL;
        const char **values = NULL;
-       int i;
 
        DEBUG(10,("CoreDriverSection is: %s\n", driver_section));
 
@@ -924,10 +919,9 @@ static NTSTATUS process_source_disk_name(struct 
gp_inifile_context *ctx,
        NTSTATUS status;
        bool ok;
        const char *key;
-       size_t num_keys = 0;
+       size_t i, num_keys = 0;
        const char **keys = NULL;
        const char **values = NULL;
-       int i;
 
        key = talloc_asprintf(mem_ctx, "SourceDisksNames.%s", 
short_environment);
        if (key == NULL) {
@@ -1207,11 +1201,10 @@ NTSTATUS driver_inf_list(TALLOC_CTX *mem_ctx,
 {
        NTSTATUS status;
        const char *short_environment;
-       size_t num_devices = 0;
+       size_t d, num_devices = 0;
        const char **devices = NULL;
        const char **device_values = NULL;
        struct inf_context *inf_ctx;
-       int d;
 
        if (!filename || !environment) {
                return NT_STATUS_INVALID_PARAMETER;
diff --git a/libcli/named_pipe_auth/npa_tstream.c 
b/libcli/named_pipe_auth/npa_tstream.c
index 8c07f2e76f9..a6fa0211d20 100644
--- a/libcli/named_pipe_auth/npa_tstream.c
+++ b/libcli/named_pipe_auth/npa_tstream.c
@@ -949,15 +949,14 @@ static const struct tstream_context_ops tstream_npa_ops = 
{
        .disconnect_recv        = tstream_npa_disconnect_recv,
 };
 
-int _tstream_npa_existing_socket(TALLOC_CTX *mem_ctx,
-                                int fd,
+int _tstream_npa_existing_stream(TALLOC_CTX *mem_ctx,
+                                struct tstream_context **transport,
                                 uint16_t file_type,
                                 struct tstream_context **_stream,
                                 const char *location)
 {
        struct tstream_context *stream;
        struct tstream_npa *npas;
-       int ret;
 
        switch (file_type) {
        case FILE_TYPE_BYTE_MODE_PIPE:
@@ -977,23 +976,33 @@ int _tstream_npa_existing_socket(TALLOC_CTX *mem_ctx,
        if (!stream) {
                return -1;
        }
-       ZERO_STRUCTP(npas);
 
-       npas->file_type = file_type;
-
-       ret = tstream_bsd_existing_socket(stream, fd,
-                                         &npas->unix_stream);
-       if (ret == -1) {
-               int saved_errno = errno;
-               talloc_free(stream);
-               errno = saved_errno;
-               return -1;
-       }
+       *npas = (struct tstream_npa) {
+               .file_type = file_type,
+               .unix_stream = talloc_move(npas, transport),
+       };
 
        *_stream = stream;
        return 0;
 }
 
+int _tstream_npa_existing_socket(TALLOC_CTX *mem_ctx,
+                                int fd,
+                                uint16_t file_type,
+                                struct tstream_context **_stream,
+                                const char *location)
+{
+       struct tstream_context *transport = NULL;
+       int ret;
+
+       ret = _tstream_bsd_existing_socket(
+               mem_ctx, fd, &transport, location);
+       if (ret == -1) {
+               return -1;
+       }
+       return _tstream_npa_existing_stream(
+               mem_ctx, &transport, file_type, _stream, location);
+}
 
 struct tstream_npa_accept_state {
        struct tevent_context *ev;
@@ -1002,16 +1011,15 @@ struct tstream_npa_accept_state {
        uint16_t device_state;
        uint64_t alloc_size;
 
+       struct named_pipe_auth_req *pipe_request;
+
        DATA_BLOB npa_blob;
        struct iovec out_iov;
 
        /* results */
        NTSTATUS accept_status;
        struct tsocket_address *remote_client_addr;
-       char *remote_client_name;
        struct tsocket_address *local_server_addr;
-       char *local_server_name;
-       struct auth_session_info_transport *session_info;
 };
 
 static void tstream_npa_accept_existing_reply(struct tevent_req *subreq);
@@ -1116,6 +1124,7 @@ static void tstream_npa_accept_existing_reply(struct 
tevent_req *subreq)
                DEBUG(0, ("Out of memory!\n"));
                goto reply;
        }
+       state->pipe_request = pipe_request;
 
        /* parse the passed credentials */
        ndr_err = ndr_pull_struct_blob_all(
@@ -1161,9 +1170,6 @@ static void tstream_npa_accept_existing_reply(struct 
tevent_req *subreq)
                goto reply;
        }
 
-       state->local_server_name = discard_const_p(char,
-                                                  talloc_move(state,
-                                                              
&i4.local_server_name));
        ret = tsocket_address_inet_from_strings(state, "ip",
                                                i4.local_server_addr,
                                                i4.local_server_port,
@@ -1176,9 +1182,6 @@ static void tstream_npa_accept_existing_reply(struct 
tevent_req *subreq)
                goto reply;
        }
 
-       state->remote_client_name = discard_const_p(char,
-                                                   talloc_move(state,
-                                                               
&i4.remote_client_name));
        ret = tsocket_address_inet_from_strings(state, "ip",
                                                i4.remote_client_addr,
                                                i4.remote_client_port,
@@ -1191,7 +1194,6 @@ static void tstream_npa_accept_existing_reply(struct 
tevent_req *subreq)
                goto reply;
        }
 
-       state->session_info = talloc_move(state, &i4.session_info);
 reply:
        /* create the output */
        ndr_err = ndr_push_struct_blob(&out, state, &pipe_reply,
@@ -1243,19 +1245,62 @@ static void tstream_npa_accept_existing_done(struct 
tevent_req *subreq)
        tevent_req_done(req);
 }
 
-int _tstream_npa_accept_existing_recv(struct tevent_req *req,
-                                     int *perrno,
-                                     TALLOC_CTX *mem_ctx,
-                                     struct tstream_context **stream,
-                                     struct tsocket_address 
**remote_client_addr,
-                                     char **_remote_client_name,
-                                     struct tsocket_address 
**local_server_addr,
-                                     char **local_server_name,
-                                     struct auth_session_info_transport 
**session_info,
-                                     const char *location)
+static struct named_pipe_auth_req_info4 *copy_npa_info4(
+       TALLOC_CTX *mem_ctx, const struct named_pipe_auth_req_info4 *src)
+{
+       struct named_pipe_auth_req_info4 *dst = NULL;
+       DATA_BLOB blob;
+       enum ndr_err_code ndr_err;
+
+       dst = talloc_zero(mem_ctx, struct named_pipe_auth_req_info4);
+       if (dst == NULL) {
+               return NULL;
+       }
+
+       ndr_err = ndr_push_struct_blob(
+               &blob,
+               dst,
+               src,
+               (ndr_push_flags_fn_t)ndr_push_named_pipe_auth_req_info4);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DBG_WARNING("ndr_push_named_pipe_auth_req_info4 failed: %s\n",
+                           ndr_errstr(ndr_err));
+               TALLOC_FREE(dst);
+               return NULL;
+       }
+
+       ndr_err = ndr_pull_struct_blob_all(
+               &blob,
+               dst,
+               dst,
+               (ndr_pull_flags_fn_t)ndr_pull_named_pipe_auth_req_info4);
+       TALLOC_FREE(blob.data);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DBG_WARNING("ndr_push_named_pipe_auth_req_info4 failed: %s\n",
+                           ndr_errstr(ndr_err));
+               TALLOC_FREE(dst);
+               return NULL;
+       }
+
+       return dst;
+}
+
+int _tstream_npa_accept_existing_recv(
+       struct tevent_req *req,
+       int *perrno,
+       TALLOC_CTX *mem_ctx,
+       struct tstream_context **stream,
+       struct named_pipe_auth_req_info4 **info4,
+       struct tsocket_address **remote_client_addr,
+       char **_remote_client_name,
+       struct tsocket_address **local_server_addr,
+       char **local_server_name,
+       struct auth_session_info_transport **session_info,
+       const char *location)
 {
        struct tstream_npa_accept_state *state =
                        tevent_req_data(req, struct tstream_npa_accept_state);
+       struct named_pipe_auth_req_info4 *i4 = &state->pipe_request->info.info4;
        struct tstream_npa *npas;
        int ret;
 
@@ -1296,11 +1341,41 @@ int _tstream_npa_accept_existing_recv(struct tevent_req 
*req,
        npas->unix_stream = state->plain;
        npas->file_type = state->file_type;
 
-       *remote_client_addr = talloc_move(mem_ctx, &state->remote_client_addr);
-       *_remote_client_name = talloc_move(mem_ctx, &state->remote_client_name);
-       *local_server_addr = talloc_move(mem_ctx, &state->local_server_addr);
-       *local_server_name = talloc_move(mem_ctx, &state->local_server_name);
-       *session_info = talloc_move(mem_ctx, &state->session_info);
+       if (info4 != NULL) {
+               /*
+                * Make a full copy of "info4" because further down we
+                * talloc_move() away substructures from
+                * state->pipe_request.
+                */
+               struct named_pipe_auth_req_info4 *dst = copy_npa_info4(
+                       mem_ctx, i4);
+               if (dst == NULL) {
+                       *perrno = ENOMEM;
+                       tevent_req_received(req);
+                       return -1;
+               }
+               *info4 = dst;
+       }
+
+       if (remote_client_addr != NULL) {
+               *remote_client_addr = talloc_move(
+                       mem_ctx, &state->remote_client_addr);
+       }
+       if (_remote_client_name != NULL) {
+               *_remote_client_name = discard_const_p(
+                       char, talloc_move(mem_ctx, &i4->remote_client_name));
+       }
+       if (local_server_addr != NULL) {
+               *local_server_addr = talloc_move(
+                       mem_ctx, &state->local_server_addr);
+       }
+       if (local_server_name != NULL) {
+               *local_server_name = discard_const_p(
+                       char, talloc_move(mem_ctx, &i4->local_server_name));
+       }
+       if (session_info != NULL) {
+               *session_info = talloc_move(mem_ctx, &i4->session_info);
+       }
 
        tevent_req_received(req);
        return 0;
diff --git a/libcli/named_pipe_auth/npa_tstream.h 
b/libcli/named_pipe_auth/npa_tstream.h
index b7d11dea6d3..27e4d9c5a21 100644
--- a/libcli/named_pipe_auth/npa_tstream.h
+++ b/libcli/named_pipe_auth/npa_tstream.h
@@ -24,6 +24,7 @@ struct tevent_req;
 struct tevent_context;
 struct auth_session_info_transport;
 struct tsocket_address;
+struct named_pipe_auth_req_info4;
 
 struct tevent_req *tstream_npa_connect_send(TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
@@ -46,6 +47,15 @@ int _tstream_npa_connect_recv(struct tevent_req *req,
        _tstream_npa_connect_recv(req, perrno, mem_ctx, stream, f, d, a, \
                                  __location__)
 
+int _tstream_npa_existing_stream(TALLOC_CTX *mem_ctx,
+                                struct tstream_context **transport,
+                                uint16_t file_type,
+                                struct tstream_context **_stream,
+                                const char *location);
+#define tstream_npa_existing_stream(mem_ctx, transport, ft, stream) \
+       _tstream_npa_existing_stream(mem_ctx, transport, ft, stream, \
+                                    __location__)
+
 int _tstream_npa_existing_socket(TALLOC_CTX *mem_ctx,
                                 int fd,
                                 uint16_t file_type,
@@ -95,18 +105,21 @@ struct tevent_req 
*tstream_npa_accept_existing_send(TALLOC_CTX *mem_ctx,
  *
  * @return  0 if successful, -1 on failure with *perror filled.
  */
-int _tstream_npa_accept_existing_recv(struct tevent_req *req,
-                                     int *perrno,
-                                     TALLOC_CTX *mem_ctx,
-                                     struct tstream_context **stream,
-                                     struct tsocket_address 
**remote_client_addr,
-                                     char **_remote_client_name,
-                                     struct tsocket_address 
**local_server_addr,
-                                     char **local_server_name,
-                                     struct auth_session_info_transport 
**session_info,
-                                     const char *location);
+int _tstream_npa_accept_existing_recv(
+       struct tevent_req *req,
+       int *perrno,
+       TALLOC_CTX *mem_ctx,
+       struct tstream_context **stream,
+       struct named_pipe_auth_req_info4 **info4,
+       struct tsocket_address **remote_client_addr,
+       char **_remote_client_name,
+       struct tsocket_address **local_server_addr,
+       char **local_server_name,
+       struct auth_session_info_transport **session_info,
+       const char *location);
 #define tstream_npa_accept_existing_recv(req, perrno, \
                                         mem_ctx, stream, \
+                                        info4, \
                                         remote_client_addr, \
                                         remote_client_name,  \
                                         local_server_addr, \
@@ -114,6 +127,7 @@ int _tstream_npa_accept_existing_recv(struct tevent_req 
*req,
                                         session_info) \
        _tstream_npa_accept_existing_recv(req, perrno, \
                                          mem_ctx, stream, \
+                                         info4, \
                                          remote_client_addr, \
                                          remote_client_name,  \
                                          local_server_addr, \
diff --git a/librpc/idl/named_pipe_auth.idl b/librpc/idl/named_pipe_auth.idl
index e5f0b1833a0..27e4dd799a2 100644
--- a/librpc/idl/named_pipe_auth.idl
+++ b/librpc/idl/named_pipe_auth.idl
@@ -12,7 +12,7 @@ interface named_pipe_auth
 {
        const char *NAMED_PIPE_AUTH_MAGIC = "NPAM";
 
-       typedef struct {
+       typedef [public] struct {
                [charset(UTF8),string] uint8 *remote_client_name;
                [charset(DOS),string] uint8 *remote_client_addr;
                uint16 remote_client_port;
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 7860632bad1..c8006f85d6e 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1381,7 +1381,7 @@ static bool wbinfo_lookupsid_fullname(const char *sid_str)
 static bool wbinfo_lookuprids(const char *domain, const char *arg)
 {
        wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
-       struct wbcDomainInfo *dinfo = NULL;
+       struct wbcDomainSid dsid;
        char *domain_name = NULL;
        const char **names = NULL;
        enum wbcSidType *types = NULL;
@@ -1396,13 +1396,19 @@ static bool wbinfo_lookuprids(const char *domain, const 
char *arg)
                domain = get_winbind_domain();
        }
 
-       /* Send request */
-
-       wbc_status = wbcDomainInfo(domain, &dinfo);
+       wbc_status = wbcStringToSid(domain, &dsid);
        if (!WBC_ERROR_IS_OK(wbc_status)) {
-               d_printf("wbcDomainInfo(%s) failed: %s\n", domain,
-                        wbcErrorString(wbc_status));
-               goto done;
+               struct wbcDomainInfo *dinfo = NULL;
+
+               wbc_status = wbcDomainInfo(domain, &dinfo);
+               if (!WBC_ERROR_IS_OK(wbc_status)) {
+                       d_printf("wbcDomainInfo(%s) failed: %s\n", domain,
+                                wbcErrorString(wbc_status));
+                       goto done;
+               }
+
+               dsid = dinfo->sid;
+               wbcFreeMemory(dinfo);
        }


-- 
Samba Shared Repository

Reply via email to