[SCM] Samba Shared Repository - branch master updated

Samuel Cabrero scabrero at samba.org
Fri Mar 20 17:12:02 UTC 2020


The branch, master has been updated
       via  9496e0523ea s3:rpc_server: Remove dead code
       via  93224d4184d s3:rpc_server: Remove unused RPC module init and shutdown callbacks
       via  e8e4ecfb8b9 s3:rpc_server: Do not generate and build s3 RPC server code
       via  4c09839ec99 s3:rpc_server: Do not include s3 autogenerated headers
       via  f6d41e5b44f s3:rpc_server: Remove api_struct
       via  d891c2d389b s3:rpc_server: Remove dead code and unused struct members
       via  04172e966b8 s3:rpc_server: Remove s3 rpc server loop
       via  c647c13a548 s3:rpc_server: Remove call to s3 rpc services shutdown code
       via  9bdf3ccde65 s3:rpc_server: Switch to core dcerpc server loop
       via  0c326e9688d s3:rpc_server: Update winspool generated server stub
       via  97ee59fd4ea s3:winbindd: Dispatch RPC calls through interface local handler
       via  60fa8e25525 s3:rpc_server: Dispatch local calls through interfaces local handler
       via  42a7e7bcad6 pidl:NDR/ServerCompat: Generate local dispatching function
       via  73e32f5f42b pidl:NDR/ServerCompat: Initialize and allocate out vars
       via  bebd55784a1 pidl:NDR/ServerCompat: Add dispatch, reply, pull and push functions to header
       via  d1afa40c3ca pidl:NDR/ServerCompat: Retrieve and setup pipes struct before dispatch
       via  d4e6764b225 s3:rpc_server: Store dcesrv context and endpoint in ncacn_conn
       via  06a913a2699 s3:rpc_server: Retrieve dcesrv_context from parent context to open NP
       via  0d37a00be74 s3:rpc_server: Set a dcerpc_ncacn_conn termination function
       via  7fef249d7a2 s3:rpc_server: Retrieve the dcesrv_endpoint from prefork listen data
       via  82020a3f62d s3:rpc_server: Drop dcerpc_binding_vector usage in the server side
       via  53ca9ad2a70 s3:rpc_server: Remove unused members from dcerpc_ncacn_listen_state
       via  9a6a5a50f14 s3:rpc_server: Create ncacn_np sockets through endpoint initialization
       via  64a70a96100 s3:rpc_server: Setup ncacn_np sockets through endpoint initialization
       via  c0ff6da277b s3:rpc_server: Listen in different socket for ncalrpc when role is AD DC
       via  f8eb0e3569b s3:rpc_server: Create ncalrpc socket through endpoint initialization
       via  1d970fa83da s3:rpc_server: Setup ncalrpc sockets through endpoint initialization
       via  a6b718b6ec3 s3:rpc_server: Create ncacn_ip_tcp sockets through enpoint init
       via  a18163a147b s3:rpc_server: Setup ncacn_ip_tcp sockets through endpoint init
       via  5e7dc9fbeac s3:rpc_server: Initialize spoolssd connection endpoints
       via  fd099ae16a7 s3:rpc_server: Initialize mdssd connection endpoints
       via  04d3053663d s3:rpc_server: Initialize fssd connection endpoints
       via  d0a2b0c7692 s3:rpc_server: Initialize lsasd connection endpoints
       via  0e6d138c8e1 s3:rpc_server: Initialize epmd connection endpoints
       via  2d2c4881215 s3:rpc_server: Initialize the embedded services endpoints
       via  228f8b2c533 s3:rpc_server: Add a function to create the endpoints sockets
       via  c97a77297d2 s3:rpc_server: Add a function to setup the endpoints
       via  4e7670ed128 s3:rpc_server: Implement association group find callback
       via  b9e5740a85b s3:rpc_server: Setup dcesrv_context callbacks
       via  eeacac2ed63 s3:winbindd: Initialize dcesrv_context and ep servers in winbindd daemon
       via  5174e469ae0 s3:rpc_server: Init registered ep servers in external mdssd daemon
       via  99b5b9a9fb6 s3:rpc_server: Init registered ep servers in external fssd daemon
       via  a450f10374d s3:rpc_server: Init registered ep servers in external lsasd daemon
       via  887a8b37b5a s3:rpc_server: Init registered ep servers in external spoolssd daemon
       via  0e2839f9bcb s3:rpc_server: Init registered ep servers in external epmd daemon
       via  36c2abbc16b s3:rpc_server: Init registered endpoint servers for embedded services
       via  7eab9f88509 pidl:NDR/ServerCompat: Register and unregister legacy api_struct cmds
       via  f89ae36306c s3:rpc_server: Reinitialize dcesrv_context in external spoolssd daemon
       via  3b52f1543c8 s3:rpc_server: Reinitialize dcesrv_context in external lsasd daemon
       via  80c57f238df s3:rpc_server: Reinitialize dcesrv_context in external mdssd daemon
       via  eeb6888f422 s3:rpc_server: Reinitialize dcesrv_context in external fssd daemon
       via  f1eec15c371 s3:rpc_server: Reinitialize dcesrv_context in external epmd daemon
       via  1f87794d124 s3:rpc_server: Shutdown registered enpoint servers on server exit
       via  3719de01070 s3:rpc_server: Initialize global dcesrv_context for embedded services
       via  20542bcfa9b s3:rpc_server: Add global dcesrv_context init and shutdown functions
       via  ed02614edb4 s3:winbindd: Register endpoint servers in winbindd daemon
       via  eea1c425a66 s3:rpc_server: Register endpoint servers in external mdssd daemon
       via  3692290e3b0 s3:rpc_server: Register endpoint servers in external spoolssd daemon
       via  612c7fa341b s3:rpc_server: Register endpoint servers in external fssd daemon
       via  909cf570d46 s3:rpc_server: Register endpoint servers in external lsasd daemon
       via  da5aabde57f s3:rpc_server: Register endpoint servers in external epmd daemon
       via  d77a4e553da s3:rpc_server: Register endpoint servers for embedded services
       via  06f1bad0518 s3:rpc_server: Provide LSA ncacn_np secondary endpoint and LSA over Netlogon
       via  9331772e4ce selftests: Tests only appropiate RPC interfaces are available in smb pipes
       via  3bcbad0c573 selftests: Test lsa over netlogon in nt4 dc environment
       via  dc1d34d388f s3:rpc_server: Include generated boilerplate code
       via  1903467014a pidl:NDR/ServerCompat: Compat server PIDL parser
       via  d809da3acef selftest: Run python.samba.tests.dcerpc.raw_protocol against S3 ad_member
      from  bce99f59332 gitlab-ci: Add Fedora 32 (Beta)

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


- Log -----------------------------------------------------------------
commit 9496e0523ea156b5705b1d3866f0d887a6fc4d2d
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 17:15:19 2019 +0200

    s3:rpc_server: Remove dead code
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Samuel Cabrero <scabrero at samba.org>
    Autobuild-Date(master): Fri Mar 20 17:11:28 UTC 2020 on sn-devel-184

commit 93224d4184dfbc369667d6a56c08ff217d839d93
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 16:54:52 2019 +0200

    s3:rpc_server: Remove unused RPC module init and shutdown callbacks
    
    The setup function registers the endpoint server and RPC core routines
    initialize and shutdown it.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e8e4ecfb8b92b99b6d566ea79a4268738e486f6a
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 17:01:36 2019 +0200

    s3:rpc_server: Do not generate and build s3 RPC server code
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4c09839ec9991bd7c1019242d5691fce123a0ec3
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 16:12:51 2019 +0200

    s3:rpc_server: Do not include s3 autogenerated headers
    
    Prototype is generated by the server compat parser.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f6d41e5b44fd68c6f47828930bdd9f1a621a5c02
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 16:32:39 2019 +0200

    s3:rpc_server: Remove api_struct
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d891c2d389b39d1535c30ab759f1a0dd48787ec0
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Mar 7 11:37:48 2019 +0100

    s3:rpc_server: Remove dead code and unused struct members
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 04172e966b899763d6b982a688ff6564f3deaa28
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Feb 28 14:04:08 2019 +0100

    s3:rpc_server: Remove s3 rpc server loop
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c647c13a5487512ee198e1564a543d8156869196
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Mon Sep 9 18:22:43 2019 +0200

    s3:rpc_server: Remove call to s3 rpc services shutdown code
    
    The rpc_<service>_shutdown function unregisters the legacy api_struct
    from the local dispatch table, which is not longer used as local
    dispatching is done through dcesrv_interface and will be removed in
    following commits.
    
    The dcesrv_shutdown_registered_ep_servers will unregister endpoint servers.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9bdf3ccde6550093daf7e5bdf4dc25cbd2c9a41d
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Thu Dec 5 11:45:54 2019 +0100

    s3:rpc_server: Switch to core dcerpc server loop
    
    This commit finally switches the RPC server implementation.
    
    At the same we have to do other related changes to keep code compiling
    and test environments running.
    
    First avoid moving the session_info into the allocated pipes_struct memory
    context as it is owned now by the core RPC server, and the s3compat pidl
    compiler will update the pipes_struct session_info before dispatching
    the call with dcesrv_call->auth_state->session_info.
    
    Also, fix a segfault in the endpoint mapper daemon when it tries to delete
    the endpoints previously registered over a NCALRPC connection.
    
    If we have:
    
    rpc_server : epmapper = external
    rpc_server : lsarpc = external
    rpc_daemon : epmd = fork
    rpc_daemon : lsasd = fork
    
    The sequence is:
    
    * The endpoint mapper starts (start_epmd in source3/smbd/server.c)
    * The lsarpc daemon starts (start_lsasd in source3/smbd/server.c)
      * The lsarpc daemon creates the sockets and registers its endpoints
        (rpc_ep_register in source3/rpc_server/lsasd.c)
      * The endpoint registration code opens a NCALRPC connection to the
        endpoint mapper daemon (ep_register in source3/librpc/rpc/dcerpc_ep.c)
        and keeps it open to re-register if the endpoint mapper daemon dies
        (rpc_ep_register_loop in source3/rpc_server/rpc_ep_register.c)
    * When the endpoint mapper daemon accepts a NCALRPC connection it sets a
      termination function (srv_epmapper_delete_endpoints)
    * Suppose the lsarpc daemon exits. The NCALRPC connection termination
      function is called.
    * The termination function tries to delete all endpoints registered by that
      connection by calling _epm_Delete
    * _epm_Delete calls is_privileged_pipe which access to
      pipes_struct->session_info.
    
    As the call to _epm_Delete occurs outside of the PIDL generated code,
    the pipes_stuct->session_info is NULL. This commit also sets
    pipes_struct->session_info from the dcerpc_connection before calling
    _epm_Delete. As the core rpc server supports security context multiplexing we
    need to pass the dcesrv_connection to the termination function and let the
    implementation pick a auth context. In the case of the endpoint mapper
    the termination function has to pick one of type NCALRPC_AS_SYSTEM to
    check if the connection is privileged and delete the endpoints
    registered by the connection being closed.
    
    Finally, the samba.tests.dcerpc.raw_protocol testsuite passes against
    the ad_member environment.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0c326e9688d09c73e14e1913420bc734ad702d48
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Feb 28 13:04:02 2019 +0100

    s3:rpc_server: Update winspool generated server stub
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 97ee59fd4eae318d2de83a8c26688e6d2f4b9d3a
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Tue Oct 22 18:28:44 2019 +0200

    s3:winbindd: Dispatch RPC calls through interface local handler
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 60fa8e255254d38e9443bf96f2c0f31430be6ab8
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 12:05:45 2019 +0200

    s3:rpc_server: Dispatch local calls through interfaces local handler
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 42a7e7bcad6959156bd0b8014f4cf619b2e5d14f
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue May 28 12:02:09 2019 +0200

    pidl:NDR/ServerCompat: Generate local dispatching function
    
    To be used in rpcint_binding_handle, prepare to remove legacy api_struct
    and S3 pidl generated code.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 73e32f5f42b13ef65aff79a203a99e6f2a99763d
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Mon Mar 11 14:10:28 2019 +0100

    pidl:NDR/ServerCompat: Initialize and allocate out vars
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bebd55784a1b85b4033e8fef8114b0d67025b223
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Feb 28 13:03:33 2019 +0100

    pidl:NDR/ServerCompat: Add dispatch, reply, pull and push functions to header
    
    Will be used by winspool to forward selected opnums to spoolss.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d1afa40c3cae7969b99f2d0a0cc78902138c0f15
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 23:28:25 2019 +0100

    pidl:NDR/ServerCompat: Retrieve and setup pipes struct before dispatch
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d4e6764b225f4fcf95b812c64e6539c2f414f8fa
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 23:44:16 2019 +0100

    s3:rpc_server: Store dcesrv context and endpoint in ncacn_conn
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 06a913a2699627bda45acab7225da1e4dc849d84
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 21:36:22 2019 +0100

    s3:rpc_server: Retrieve dcesrv_context from parent context to open NP
    
    Get the dcesrv_context from parent context and use it to search the
    endpoint serving the named pipe. Once we have the endpoint pass it to
    the make_internal_rpc_pipe_socketpair function.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0d37a00be74e912d1680d19437ebf303ae4dd912
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 21:03:30 2019 +0100

    s3:rpc_server: Set a dcerpc_ncacn_conn termination function
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7fef249d7a27684abfd09ac5f7b408a373346fe9
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 20:21:44 2019 +0100

    s3:rpc_server: Retrieve the dcesrv_endpoint from prefork listen data
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 82020a3f62de17db41b839d53e63f89b80605e88
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 19:32:26 2019 +0100

    s3:rpc_server: Drop dcerpc_binding_vector usage in the server side
    
    The endpoint mapper entry is built using the dcesrv_endpoint and the
    interfaces registered into it instead of using the
    dcerpc_binding_vector.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 53ca9ad2a70856069083428cbefa5ad4d7fea6e7
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 20:49:56 2019 +0100

    s3:rpc_server: Remove unused members from dcerpc_ncacn_listen_state
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9a6a5a50f14318b508bd029de4f13d157a237c0e
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 19:13:57 2019 +0100

    s3:rpc_server: Create ncacn_np sockets through endpoint initialization
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 64a70a96100d244ad0f266768ef5e5452a2771af
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 18:58:15 2019 +0100

    s3:rpc_server: Setup ncacn_np sockets through endpoint initialization
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c0ff6da277b16015cf3aaa6f44c10e7cf0979994
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Mon Nov 18 12:46:04 2019 +0100

    s3:rpc_server: Listen in different socket for ncalrpc when role is AD DC
    
    If smbd and samba processes use DEFAULT as socket name they will race to
    accept the NCALRPC connections.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f8eb0e3569b7372763ce40ff43c9152ece4ecc6e
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 18:32:45 2019 +0100

    s3:rpc_server: Create ncalrpc socket through endpoint initialization
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1d970fa83da200a8962c8acd579607b15166c5dc
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 18:20:11 2019 +0100

    s3:rpc_server: Setup ncalrpc sockets through endpoint initialization
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a6b718b6ec3824c1c49eef92f3b5cf915494bce0
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 18:05:08 2019 +0100

    s3:rpc_server: Create ncacn_ip_tcp sockets through enpoint init
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a18163a147bcbda2868e556e0a88b1f46fe31e1d
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 17:52:21 2019 +0100

    s3:rpc_server: Setup ncacn_ip_tcp sockets through endpoint init
    
    The listener is created in the endpoint memory context. If the endpoint
    is freed, the listener will be freed too and the socket closed.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5e7dc9fbeac82258269d146766c9f9eb56f08db8
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 16:28:28 2019 +0100

    s3:rpc_server: Initialize spoolssd connection endpoints
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fd099ae16a73ab9a6287968b15ba596b7cf89ee0
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 16:06:44 2019 +0100

    s3:rpc_server: Initialize mdssd connection endpoints
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 04d3053663db61d18c5c612858acddd79cd39877
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 15:49:01 2019 +0100

    s3:rpc_server: Initialize fssd connection endpoints
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d0a2b0c76921dde0dde681fd71440ea40e7c8a0f
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 15:45:52 2019 +0100

    s3:rpc_server: Initialize lsasd connection endpoints
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0e6d138c8e1d56e74cf465394d8f089ff4e85849
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 14:42:07 2019 +0100

    s3:rpc_server: Initialize epmd connection endpoints
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2d2c48812158ef5cb73da89f6968d36dacbb4966
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 14:36:30 2019 +0100

    s3:rpc_server: Initialize the embedded services endpoints
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 228f8b2c53334805bc5064b15a73aced84f5f80c
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 14:21:01 2019 +0100

    s3:rpc_server: Add a function to create the endpoints sockets
    
    The pidl-generated initialization function for each endpoint server will
    register the RPC interface in all endpoints defined in the idl file.
    
    The interface registration code will create the endpoint if it does not
    exists (as an endpoint can serve multiple interfaces) and will add it to
    the endpoint list exiting in the dcesrv_context.
    
    This commit adds a generic dcesrv_create_endpoint_sockets function which
    will be preforking external daemons to create the sockets regardless the
    endpoint transport. This function will only create the sockets, the
    external preforking daemon is who will start listening.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c97a77297d266fa56f15f71d6978a945758d2699
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Feb 27 14:01:11 2019 +0100

    s3:rpc_server: Add a function to setup the endpoints
    
    The pidl-generated initialization function for each endpoint server will
    register the RPC interface in all endpoints defined in the idl file.
    
    The interface registration code will create the endpoint if it does not
    exists (as an endpoint can serve multiple interfaces) and will add it to
    the endpoint list exiting in the dcesrv_context.
    
    This commit adds a generic dcesrv_setup_endpoint_sockets function which
    will be used by embedded services and non-preforking external daemons to
    setup the sockets regardless the transport.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4e7670ed12886ee6536372ff90c0fd060533e445
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Fri Oct 4 14:05:53 2019 +0200

    s3:rpc_server: Implement association group find callback
    
    Keep the s3 server behaviour for now and return always the same
    association group ID, 0x53F0.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b9e5740a85bee76dbf8b813a18afbe2104557041
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Fri Jan 25 09:50:15 2019 +0100

    s3:rpc_server: Setup dcesrv_context callbacks
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit eeacac2ed63fba1795ea7cac59374c5cd9b6fea7
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Feb 28 13:36:09 2019 +0100

    s3:winbindd: Initialize dcesrv_context and ep servers in winbindd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5174e469ae06b29754252477925109d251615784
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 18:00:55 2019 +0100

    s3:rpc_server: Init registered ep servers in external mdssd daemon
    
    Initialize and shutdown the endpoint servers registed by the mdssd
    daemon. The pidl-generated init function will register the
    api_struct for backward compatibility until completely removed.
    
    The common server exit routine will shutdown all registered endpoint
    servers, and the pidl-generated shutdown function will unregister the
    api_struct.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 99b5b9a9fb6d7f0871d19cf33d8bc86794ca015e
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 17:59:38 2019 +0100

    s3:rpc_server: Init registered ep servers in external fssd daemon
    
    Initialize and shutdown the endpoint servers registed by the fssd
    daemon. The pidl-generated init function will register the
    api_struct for backward compatibility until completely removed.
    
    The common server exit routine will shutdown all registered endpoint
    servers, and the pidl-generated shutdown function will unregister the
    api_struct.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a450f10374d145e1f26e26de60fe78608398e6dc
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 17:57:58 2019 +0100

    s3:rpc_server: Init registered ep servers in external lsasd daemon
    
    Initialize and shutdown the endpoint servers registed by the lsasd
    daemon. The pidl-generated init function will register the
    api_struct for backward compatibility until completely removed.
    
    The common server exit routine will shutdown all registered endpoint
    servers, and the pidl-generated shutdown function will unregister the
    api_struct.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 887a8b37b5adbf77c410ff9f402a8d5beee1e057
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 17:55:07 2019 +0100

    s3:rpc_server: Init registered ep servers in external spoolssd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0e2839f9bcb7f6746760d056a684b35bd3911fd3
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 17:15:37 2019 +0100

    s3:rpc_server: Init registered ep servers in external epmd daemon
    
    Initialize and shutdown the endpoint servers registed by the endpoint
    mapper daemon. The pidl-generated init function will register the
    api_struct for backward compatibility until completely removed.
    
    The common server exit routine will shutdown all registered endpoint
    servers, and the pidl-generated shutdown function will unregister the
    api_struct.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 36c2abbc16bcf19a4139c0877ecefec000545908
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 17:53:18 2019 +0100

    s3:rpc_server: Init registered endpoint servers for embedded services
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7eab9f88509c4bb49a9c9c149491536190d1d979
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 17:37:52 2019 +0100

    pidl:NDR/ServerCompat: Register and unregister legacy api_struct cmds
    
    Next commits will initialize the registered enpoint servers in S3 RPC
    server, removing the rpc_{interface}_init calls. The legacy api_struct
    registration will be registered by the enpoint server initialization
    code generated by PIDL.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f89ae36306cfb4dd0e205d27b6e2a4121d4761c8
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 16:58:10 2019 +0100

    s3:rpc_server: Reinitialize dcesrv_context in external spoolssd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3b52f1543c89d79840dffb49d3f0d1c72160a5fc
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 16:56:42 2019 +0100

    s3:rpc_server: Reinitialize dcesrv_context in external lsasd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 80c57f238dfd6aca73a181f4e2e5c6761e39cefb
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 15:52:43 2019 +0100

    s3:rpc_server: Reinitialize dcesrv_context in external mdssd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit eeb6888f4223426f0d68640be822d9370bd4f998
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 15:47:06 2019 +0100

    s3:rpc_server: Reinitialize dcesrv_context in external fssd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f1eec15c371e21a7f83e5630390ab45d664dd63b
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 14:18:34 2019 +0100

    s3:rpc_server: Reinitialize dcesrv_context in external epmd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1f87794d124494d19c559b118124268245175d8c
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Thu Mar 19 13:00:52 2020 +0100

    s3:rpc_server: Shutdown registered enpoint servers on server exit
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3719de010703ff6deb16b76cd968cee8b6ac1811
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 13:58:43 2019 +0100

    s3:rpc_server: Initialize global dcesrv_context for embedded services
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 20542bcfa9ba7b722e569a8ffbd4bfb41963349e
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Wed Oct 30 17:00:05 2019 +0100

    s3:rpc_server: Add global dcesrv_context init and shutdown functions
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ed02614edb46359d74adb8bfd144216f877610ff
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Feb 28 13:32:53 2019 +0100

    s3:winbindd: Register endpoint servers in winbindd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit eea1c425a66a504476be1c33b7f320454fae8606
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 13:52:39 2019 +0100

    s3:rpc_server: Register endpoint servers in external mdssd daemon
    
    The parent calls the setup function to register the endpoint server, as
    it has to be registered to initialize the endpoints (create the sockets).
    
    Delete the setup call from forker childs as it is already registered by
    the parent.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3692290e3b0fb694a697fbb77de7603ba6195047
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 13:51:23 2019 +0100

    s3:rpc_server: Register endpoint servers in external spoolssd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 612c7fa341b5b3405d5b0ed14112c4f86f1d1932
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 13:50:37 2019 +0100

    s3:rpc_server: Register endpoint servers in external fssd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 909cf570d46d9ffef415803b2736f4f062291b56
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 13:48:33 2019 +0100

    s3:rpc_server: Register endpoint servers in external lsasd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit da5aabde57fd6665eecd31eea88115485ddb5e60
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Feb 26 13:40:44 2019 +0100

    s3:rpc_server: Register endpoint servers in external epmd daemon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d77a4e553dae0322fe5fc1c891b3dea5b4497dbe
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Fri Nov 15 14:26:28 2019 +0100

    s3:rpc_server: Register endpoint servers for embedded services
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 06f1bad0518520544726c2803512d97870940dc4
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Thu Feb 14 14:21:25 2019 +0100

    s3:rpc_server: Provide LSA ncacn_np secondary endpoint and LSA over Netlogon
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9331772e4ce4beba10090a99d2fb6e8915ef52c2
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Tue Nov 26 14:16:14 2019 +0100

    selftests: Tests only appropiate RPC interfaces are available in smb pipes
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3bcbad0c573f6f0505b8cd87f5515689d847aa07
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Fri Nov 15 14:24:31 2019 +0100

    selftests: Test lsa over netlogon in nt4 dc environment
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit dc1d34d388fd1e221c913b3301bf9cb5bb10f8f6
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Fri Feb 22 18:30:45 2019 +0100

    s3:rpc_server: Include generated boilerplate code
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1903467014a3f1eb8b0b15c82d8c5f25fc2ea808
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Tue Jan 15 17:55:07 2019 +0100

    pidl:NDR/ServerCompat: Compat server PIDL parser
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d809da3acefde4a365aea52ea60649967e561633
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Thu Oct 3 14:18:17 2019 +0200

    selftest: Run python.samba.tests.dcerpc.raw_protocol against S3 ad_member
    
    The goal is to pass the raw protocol testsuite against s3 RPC server.
    To do so we need to enable epmd and lsasd daemons, as the testsuite
    connects to the endpoint mapper and lsa endpoints using NCACN_IP_TCP
    and NCACN_NP transports.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 buildtools/wafsamba/samba_pidl.py                  |    1 +
 librpc/idl/wscript_build                           |   10 +-
 librpc/rpc/dcesrv_core.h                           |    4 +
 librpc/wscript_build                               |    5 -
 pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm           |    1 +
 pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm     |  865 ++++
 pidl/pidl                                          |   16 +
 selftest/knownfail                                 |    7 +-
 selftest/target/Samba3.pm                          |   12 +
 source3/include/ntdomain.h                         |    2 -
 source3/librpc/rpc/dcerpc.h                        |    2 -
 source3/librpc/rpc/dcerpc_ep.c                     |  381 +-
 source3/librpc/rpc/dcerpc_ep.h                     |  102 +-
 source3/printing/queue_process.c                   |    3 +-
 source3/printing/queue_process.h                   |    3 +
 source3/printing/spoolssd.c                        |  230 +-
 source3/printing/spoolssd.h                        |    5 +-
 source3/rpc_server/dcesrv_auth_generic.c           |  145 -
 source3/rpc_server/dcesrv_auth_generic.h           |   42 -
 source3/rpc_server/dfs/srv_dfs_nt.c                |    6 +-
 source3/rpc_server/dssetup/srv_dssetup_nt.c        |    6 +-
 source3/rpc_server/echo/srv_echo_nt.c              |    6 +-
 source3/rpc_server/epmapper/srv_epmapper.c         |   45 +-
 source3/rpc_server/epmapper/srv_epmapper.h         |    5 +-
 source3/rpc_server/epmd.c                          |   90 +-
 source3/rpc_server/epmd.h                          |    5 +-
 source3/rpc_server/eventlog/srv_eventlog_nt.c      |   35 +-
 source3/rpc_server/fss/srv_fss_agent.c             |   46 +-
 source3/rpc_server/fssd.c                          |   86 +-
 source3/rpc_server/fssd.h                          |    5 +-
 .../rpc_server/initshutdown/srv_initshutdown_nt.c  |    9 +-
 source3/rpc_server/lsa/srv_lsa_nt.c                |   49 +-
 source3/rpc_server/lsasd.c                         |  483 +-
 source3/rpc_server/lsasd.h                         |    5 +-
 source3/rpc_server/mdssd.c                         |  260 +-
 source3/rpc_server/mdssd.h                         |    5 +-
 source3/rpc_server/mdssvc/srv_mdssvc_nt.c          |   97 +-
 source3/rpc_server/netlogon/srv_netlog_nt.c        |   10 +-
 source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c          |    6 +-
 source3/rpc_server/rpc_config.c                    |   49 +
 source3/rpc_server/rpc_config.h                    |    4 +
 source3/rpc_server/rpc_ep_register.c               |   31 +-
 source3/rpc_server/rpc_ep_register.h               |    7 +-
 source3/rpc_server/rpc_handles.c                   |    1 -
 source3/rpc_server/rpc_modules.c                   |   39 -
 source3/rpc_server/rpc_modules.h                   |   12 +-
 source3/rpc_server/rpc_ncacn_np.c                  |  130 +-
 source3/rpc_server/rpc_ncacn_np.h                  |    6 +-
 source3/rpc_server/rpc_pipes.h                     |   78 -
 source3/rpc_server/rpc_server.c                    |  754 +--
 source3/rpc_server/rpc_server.h                    |   57 +-
 source3/rpc_server/rpc_service_setup.c             |  661 ++-
 source3/rpc_server/rpc_service_setup.h             |   29 +-
 source3/rpc_server/rpc_sock_helper.c               |  159 +-
 source3/rpc_server/rpc_sock_helper.h               |   20 +-
 source3/rpc_server/samr/srv_samr_nt.c              |    6 +-
 source3/rpc_server/spoolss/srv_iremotewinspool.c   | 4846 +++++++++++++++++---
 .../rpc_server/spoolss/srv_iremotewinspool_nt.c    |    3 +-
 source3/rpc_server/spoolss/srv_spoolss_nt.c        |   52 +-
 source3/rpc_server/srv_pipe.c                      | 1840 +-------
 source3/rpc_server/srv_pipe.h                      |   12 +-
 source3/rpc_server/srv_pipe_hnd.c                  |    9 +-
 source3/rpc_server/srv_pipe_hnd.h                  |    1 +
 source3/rpc_server/srv_pipe_internal.h             |   42 -
 source3/rpc_server/srv_pipe_register.c             |  243 -
 source3/rpc_server/srv_pipe_register.h             |   39 -
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c          |    6 +-
 source3/rpc_server/svcctl/srv_svcctl_nt.c          |   53 +-
 source3/rpc_server/winreg/srv_winreg_nt.c          |    6 +-
 source3/rpc_server/wkssvc/srv_wkssvc_nt.c          |    6 +-
 source3/rpc_server/wscript_build                   |   60 +-
 source3/selftest/tests.py                          |    6 +
 source3/smbd/globals.h                             |    2 +
 source3/smbd/pipes.c                               |    1 +
 source3/smbd/process.c                             |    2 +
 source3/smbd/proto.h                               |    2 +
 source3/smbd/server.c                              |   48 +-
 source3/smbd/server_exit.c                         |   43 +-
 source3/winbindd/winbindd.c                        |   64 +-
 source3/winbindd/winbindd_dual_ndr.c               |   69 +-
 source3/winbindd/winbindd_dual_srv.c               |    5 +-
 source3/winbindd/wscript_build                     |    1 -
 source4/selftest/tests.py                          |    8 +-
 source4/torture/rpc/samba3rpc.c                    |  146 +
 testsuite/unittests/test_sambafs_srv_pipe.c        |   73 +-
 85 files changed, 7693 insertions(+), 5133 deletions(-)
 create mode 100644 pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm
 delete mode 100644 source3/rpc_server/dcesrv_auth_generic.c
 delete mode 100644 source3/rpc_server/dcesrv_auth_generic.h
 delete mode 100644 source3/rpc_server/srv_pipe_internal.h
 delete mode 100644 source3/rpc_server/srv_pipe_register.c
 delete mode 100644 source3/rpc_server/srv_pipe_register.h


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index d7e1247aa20..0ce860ca6ae 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -28,6 +28,7 @@ def SAMBA_PIDL(bld, pname, source,
                     '--samba3-ndr-server' : 'srv_%s.c srv_%s.h',
                     '--samba3-ndr-client' : 'cli_%s.c cli_%s.h',
                     '--server'            : 'ndr_%s_s.c',
+                    '--server-compat'     : 'ndr_%s_scompat.c ndr_%s_scompat.h',
                     '--client'            : 'ndr_%s_c.c ndr_%s_c.h',
                     '--python'            : 'py_%s.c',
                     '--tdr-parser'        : 'tdr_%s.c tdr_%s.h',
diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build
index b66f27be901..928f54abde0 100644
--- a/librpc/idl/wscript_build
+++ b/librpc/idl/wscript_build
@@ -11,7 +11,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                        svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl
                        witness.idl clusapi.idl
                        mdssvc.idl''',
-                    options='--header --ndr-parser --samba3-ndr-server --server --client --python',
+                    options='--header --ndr-parser --server-compat --server --client --python',
                     output_dir='../gen_ndr')
 
 # The interface names here are not the same as the IDL name, so the
@@ -21,7 +21,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                        fsrvp.idl
                        lsa.idl
                        winspool.idl''',
-                    options='--header --ndr-parser --samba3-ndr-server --server --client --python',
+                    options='--header --ndr-parser --server-compat --server --client --python',
                     output_dir='../gen_ndr',
                     generate_fuzzers=False)
 
@@ -34,14 +34,14 @@ bld.SAMBA_PIDL_LIST('PIDL',
 # Services that we only have a server in the source3 style
 bld.SAMBA_PIDL_LIST('PIDL',
                     '''initshutdown.idl ntsvcs.idl''',
-                    options='--header --ndr-parser --client --python --samba3-ndr-server',
+                    options='--header --ndr-parser --client --python --server-compat',
                     output_dir='../gen_ndr')
 
 # The interface names here are not the same as the IDL name, so the
 # auto-genration of the fuzzer fails to link
 bld.SAMBA_PIDL_LIST('PIDL',
                     '''dfs.idl''',
-                    options='--header --ndr-parser --client --python --samba3-ndr-server',
+                    options='--header --ndr-parser --client --python --server-compat',
                     output_dir='../gen_ndr',
                     generate_fuzzers=False)
 
@@ -170,6 +170,6 @@ bld.SAMBA_PIDL_LIST('PIDL',
 
 bld.SAMBA_PIDL_LIST('PIDL',
                     'winbind.idl',
-                    options='--header --ndr-parser --samba3-ndr-server --client --python',
+                    options='--header --ndr-parser --server-compat --client --python',
                     output_dir='../gen_ndr')
 
diff --git a/librpc/rpc/dcesrv_core.h b/librpc/rpc/dcesrv_core.h
index 74ce956032e..161ed1a9691 100644
--- a/librpc/rpc/dcesrv_core.h
+++ b/librpc/rpc/dcesrv_core.h
@@ -67,6 +67,10 @@ struct dcesrv_interface {
 	 */
 	NTSTATUS (*ndr_push)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_push *, const void *);
 
+	/* the local dispatch function for the chosen interface.
+	 */
+	NTSTATUS (*local)(void *p, int opnum, TALLOC_CTX *, const DATA_BLOB *in, DATA_BLOB *out);
+
 	/* for any private use by the interface code */
 	const void *private_data;
 
diff --git a/librpc/wscript_build b/librpc/wscript_build
index f0bf7f7785e..928c96dbae4 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -678,11 +678,6 @@ bld.SAMBA_SUBSYSTEM('RPC_NDR_WINBIND',
 	public_deps='dcerpc NDR_WINBIND'
 	)
 
-bld.SAMBA3_SUBSYSTEM('SRV_NDR_WINBIND',
-	source='gen_ndr/srv_winbind.c',
-	public_deps='NDR_WINBIND'
-	)
-
 bld.SAMBA_SUBSYSTEM('NDR_FSRVP_STATE',
     source='gen_ndr/ndr_fsrvp_state.c',
     public_deps='ndr'
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
index eed7d799c0e..73359987f93 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
@@ -193,6 +193,7 @@ static const struct dcesrv_interface dcesrv\_$name\_interface = {
 	.dispatch	    = $name\__op_dispatch,
 	.reply		    = $name\__op_reply,
 	.ndr_push	    = $name\__op_ndr_push,
+	.local		    = NULL,
 #ifdef DCESRV_INTERFACE_$uname\_FLAGS
 	.flags              = DCESRV_INTERFACE_$uname\_FLAGS
 #else
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm
new file mode 100644
index 00000000000..a1729d86d77
--- /dev/null
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm
@@ -0,0 +1,865 @@
+###################################################
+# server boilerplate generator
+# Copyright tridge at samba.org 2003
+# Copyright metze at samba.org 2004
+# Copyright scabrero at samba.org 2019
+# released under the GNU GPL
+
+package Parse::Pidl::Samba4::NDR::ServerCompat;
+
+use Exporter;
+ at ISA = qw(Exporter);
+ at EXPORT_OK = qw(Parse);
+
+use Parse::Pidl::Util qw(print_uuid has_property ParseExpr);
+use Parse::Pidl::Typelist qw(mapTypeName);
+use Parse::Pidl qw(error fatal);
+use Parse::Pidl::NDR qw(ContainsPipe GetNextLevel);
+use Parse::Pidl::Samba4 qw(ElementStars);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionOutEnv);
+
+use vars qw($VERSION);
+$VERSION = '1.0';
+
+use strict;
+
+sub indent($) { my ($self) = @_; $self->{tabs}.="\t"; }
+sub deindent($) { my ($self) = @_; $self->{tabs} = substr($self->{tabs}, 1); }
+sub pidl($$) { my ($self,$txt) = @_; $self->{res} .= $txt ? "$self->{tabs}$txt\n" : "\n"; }
+sub pidlnoindent($$) { my ($self,$txt) = @_; $self->{res} .= $txt ? "$txt\n" : "\n"; }
+sub pidl_hdr($$) { my ($self, $txt) = @_; $self->{res_hdr} .= "$txt\n"; }
+sub pidl_both($$) { my ($self, $txt) = @_; $self->{hdr} .= "$txt\n"; $self->{res_hdr} .= "$txt\n"; }
+
+sub new($)
+{
+	my ($class) = shift;
+	my $self = { res => "", res_hdr => "", tabs => "" };
+	bless($self, $class);
+}
+
+sub decl_level($$)
+{
+	my ($self, $e, $l) = @_;
+	my $res = "";
+
+	if (has_property($e, "charset")) {
+		$res .= "const char";
+	} else {
+		$res .= mapTypeName($e->{TYPE});
+	}
+
+	my $stars = ElementStars($e, $l);
+
+	$res .= " ".$stars unless ($stars eq "");
+
+	return $res;
+}
+
+sub alloc_out_var($$$$$)
+{
+	my ($self, $e, $mem_ctx, $name, $env, $alloc_error_block) = @_;
+
+	my $l = $e->{LEVELS}[0];
+
+	# we skip pointer to arrays
+	if ($l->{TYPE} eq "POINTER") {
+		my $nl = GetNextLevel($e, $l);
+		$l = $nl if ($nl->{TYPE} eq "ARRAY");
+	} elsif
+
+	# we don't support multi-dimentional arrays yet
+	($l->{TYPE} eq "ARRAY") {
+		my $nl = GetNextLevel($e, $l);
+		if ($nl->{TYPE} eq "ARRAY") {
+			fatal($e->{ORIGINAL},"multi-dimentional [out] arrays are not supported!");
+		}
+	} else {
+		# neither pointer nor array, no need to alloc something.
+		return;
+	}
+
+	if ($l->{TYPE} eq "ARRAY") {
+		unless(defined($l->{SIZE_IS})) {
+			error($e->{ORIGINAL}, "No size known for array `$e->{NAME}'");
+			$self->pidl("#error No size known for array `$e->{NAME}'");
+		} else {
+			my $size = ParseExpr($l->{SIZE_IS}, $env, $e);
+			$self->pidl("$name = talloc_zero_array($mem_ctx, " . $self->decl_level($e, 1) . ", $size);");
+		}
+	} else {
+		$self->pidl("$name = talloc_zero($mem_ctx, " . $self->decl_level($e, 1) . ");");
+	}
+
+	$self->pidl("if ($name == NULL) {");
+	$self->indent();
+	foreach (@{$alloc_error_block}) {
+		$self->pidl($_);
+	}
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("");
+}
+
+sub gen_fn_out($$)
+{
+	my ($self, $fn, $alloc_error_block) = @_;
+
+	my $hasout = 0;
+	foreach (@{$fn->{ELEMENTS}}) {
+		if (grep(/out/, @{$_->{DIRECTION}})) {
+			$hasout = 1;
+		}
+	}
+
+	if ($hasout) {
+		$self->pidl("NDR_ZERO_STRUCT(r2->out);");
+	}
+
+	foreach (@{$fn->{ELEMENTS}}) {
+		my @dir = @{$_->{DIRECTION}};
+		if (grep(/in/, @dir) and grep(/out/, @dir)) {
+			$self->pidl("r2->out.$_->{NAME} = r2->in.$_->{NAME};");
+		}
+	}
+
+	foreach (@{$fn->{ELEMENTS}}) {
+		next if ContainsPipe($_, $_->{LEVELS}[0]);
+
+		my @dir = @{$_->{DIRECTION}};
+
+		if (grep(/in/, @dir) and grep(/out/, @dir)) {
+			# noop
+		} elsif (grep(/out/, @dir) and not has_property($_, "represent_as")) {
+			my $env = GenerateFunctionOutEnv($fn, "r2->");
+			$self->alloc_out_var($_, "r2", "r2->out.$_->{NAME}", $env, $alloc_error_block);
+		}
+
+	}
+}
+
+#####################################################
+# generate the switch statement for function dispatch
+sub gen_dispatch_switch($)
+{
+	my ($self, $interface) = @_;
+
+	my @alloc_error_block = ("status = NT_STATUS_NO_MEMORY;",
+				 "p->fault_state = DCERPC_FAULT_CANT_PERFORM;",
+				 "goto fail;");
+	foreach my $fn (@{$interface->{FUNCTIONS}}) {
+		next if not defined($fn->{OPNUM});
+
+		my $fname = $fn->{NAME};
+		my $ufname = uc($fname);
+
+		$self->pidl("case $fn->{OPNUM}: { /* $fn->{NAME} */");
+		$self->indent();
+		$self->pidl("struct $fname *r2 = (struct $fname *)r;");
+		$self->pidl("if (DEBUGLEVEL >= 10) {");
+		$self->indent();
+		$self->pidl("NDR_PRINT_FUNCTION_DEBUG($fname, NDR_IN, r2);");
+		$self->deindent();
+		$self->pidl("}");
+
+		$self->gen_fn_out($fn, \@alloc_error_block);
+
+		$self->pidl_hdr("struct $fname;");
+
+		if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
+			$self->pidl_hdr(mapTypeName($fn->{RETURN_TYPE}) . " _$fname(struct pipes_struct *p, struct $fname *r);");
+			$self->pidl("r2->out.result = _$fname(p, r2);");
+		} else {
+			$self->pidl_hdr("void _$fname(struct pipes_struct *p, struct $fname *r);");
+			$self->pidl("_$fname(p, r2);");
+		}
+
+		$self->pidl("break;");
+		$self->deindent();
+		$self->pidl("}");
+	}
+}
+
+#####################################################
+# generate the switch statement for function reply
+sub gen_reply_switch($)
+{
+	my ($self, $interface) = @_;
+
+	foreach my $fn (@{$interface->{FUNCTIONS}}) {
+		next if not defined($fn->{OPNUM});
+
+		$self->pidl("case $fn->{OPNUM}: { /* $fn->{NAME} */");
+		$self->indent();
+		$self->pidl("struct $fn->{NAME} *r2 = (struct $fn->{NAME} *)r;");
+		$self->pidl("if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {");
+		$self->indent();
+		$self->pidl("DEBUG(5,(\"function $fn->{NAME} replied async\\n\"));");
+		$self->deindent();
+		$self->pidl("}");
+		$self->pidl("if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {");
+		$self->indent();
+		$self->pidl("NDR_PRINT_FUNCTION_DEBUG($fn->{NAME}, NDR_OUT | NDR_SET_VALUES, r2);");
+		$self->deindent();
+		$self->pidl("}");
+		$self->pidl("if (dce_call->fault_code != 0) {");
+		$self->indent();
+		$self->pidl("DBG_WARNING(\"dcerpc_fault %s in $fn->{NAME}\\n\", dcerpc_errstr(mem_ctx, dce_call->fault_code));");
+		$self->deindent();
+		$self->pidl("}");
+		$self->pidl("break;");
+		$self->deindent();
+		$self->pidl("}");
+	}
+}
+
+# generate the switch statement for local function dispatch
+sub gen_local_dispatch_switch($)
+{
+	my ($self, $interface) = @_;
+
+	my @alloc_error_block = ("p->fault_state = DCERPC_FAULT_CANT_PERFORM;",
+				 "return NT_STATUS_NO_MEMORY;");
+
+	foreach my $fn (@{$interface->{FUNCTIONS}}) {
+		next if not defined($fn->{OPNUM});
+
+		$self->pidl("case $fn->{OPNUM}: { /* $fn->{NAME} */");
+		$self->indent();
+		$self->pidl("struct $fn->{NAME} *r2 = (struct $fn->{NAME} *)r;");
+		$self->pidl("if (DEBUGLEVEL >= 10) {\n");
+		$self->indent();
+		$self->pidl("NDR_PRINT_FUNCTION_DEBUG($fn->{NAME}, NDR_IN, r2);");
+		$self->deindent();
+		$self->pidl("}");
+
+		$self->gen_fn_out($fn, \@alloc_error_block);
+
+		if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
+			$self->pidl("r2->out.result = _$fn->{NAME}(p, r2);");
+		} else {
+			$self->pidl("_$fn->{NAME}(p, r2);");
+		}
+		$self->pidl("break;");
+		$self->deindent();
+		$self->pidl("}");
+	}
+}
+
+#####################################################
+# generate the switch statement for local function reply
+sub gen_local_reply_switch($)
+{
+	my ($self, $interface) = @_;
+
+	foreach my $fn (@{$interface->{FUNCTIONS}}) {
+		next if not defined($fn->{OPNUM});
+
+		$self->pidl("case $fn->{OPNUM}: { /* $fn->{NAME} */");
+		$self->indent();
+		$self->pidl("struct $fn->{NAME} *r2 = (struct $fn->{NAME} *)r;");
+		$self->pidl("if (DEBUGLEVEL >= 10 && p->fault_state == 0) {");
+		$self->indent();
+		$self->pidl("NDR_PRINT_FUNCTION_DEBUG($fn->{NAME}, NDR_OUT | NDR_SET_VALUES, r2);");
+		$self->deindent();
+		$self->pidl("}");
+		$self->pidl("if (p->fault_state != 0) {\n");
+		$self->indent();
+		$self->pidl("DBG_WARNING(\"dcerpc_fault %s in $fn->{NAME}\\n\", dcerpc_errstr(mem_ctx, p->fault_state));");
+		$self->deindent();
+		$self->pidl("}");
+		$self->pidl("break;");
+		$self->deindent();
+		$self->pidl("}");
+	}
+}
+
+#####################################################################
+# produce boilerplate code for a interface
+sub boilerplate_iface($)
+{
+	my ($self, $interface) = @_;
+
+	my $name = $interface->{NAME};
+	my $uname = uc $name;
+	my $uuid = lc($interface->{UUID});
+	my $if_version = $interface->{VERSION};
+
+	$self->pidl("static NTSTATUS $name\__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)");
+	$self->pidl("{");
+	$self->indent();
+	$self->pidl("struct pipes_struct *p = NULL;");
+	$self->pidl("struct pipe_rpc_fns *context_fns = NULL;");
+	$self->pidl("bool ok = false;");
+	$self->pidl("");
+	$self->pidl("/* Retrieve pipes struct */");
+	$self->pidl("p = dcesrv_get_pipes_struct(context->conn);");
+	$self->pidl("/* Init pipe handles */");
+	$self->pidl("ok = init_pipe_handles(p, &iface->syntax_id);");
+	$self->pidl("if (!ok) {");
+	$self->indent();
+	$self->pidl("DBG_ERR(\"Failed to init pipe handles\\n\");");
+	$self->pidl("return NT_STATUS_UNSUCCESSFUL;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("");
+
+	$self->pidl("/* TODO check loop */");
+
+	$self->pidl("/* Init pipe context */");
+	$self->pidl("p->pipe_bound = true;");
+	$self->pidl("for (context_fns = p->contexts; context_fns != NULL; context_fns = context_fns->next) {");
+	$self->indent();
+	$self->pidl("if (context_fns->context_id != context->context_id) {");
+	$self->indent();
+	$self->pidl("continue;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("ok = ndr_syntax_id_equal(&context_fns->syntax, &iface->syntax_id);");
+	$self->pidl("if (ok) {");
+	$self->indent();
+	$self->pidl("break;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("return NT_STATUS_UNSUCCESSFUL;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("if (context_fns == NULL) {");
+	$self->indent();
+	$self->pidl("context_fns = talloc_zero(p, struct pipe_rpc_fns);");
+	$self->pidl("if (context_fns == NULL) {");
+	$self->indent();
+	$self->pidl("return NT_STATUS_NO_MEMORY;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("");
+	$self->pidl("context_fns->next = context_fns->prev = NULL;");
+	$self->pidl("context_fns->context_id = context->context_id;");
+	$self->pidl("context_fns->syntax = iface->syntax_id;");
+	$self->pidl("DLIST_ADD( p->contexts, context_fns);");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidlnoindent("#ifdef DCESRV_INTERFACE_$uname\_BIND");
+	$self->pidl("return DCESRV_INTERFACE_$uname\_BIND(context,iface);");
+	$self->pidlnoindent("#else");
+	$self->pidl("return NT_STATUS_OK;");
+	$self->deindent();
+	$self->pidl("#endif");
+	$self->pidl("}");
+	$self->pidl("");
+
+	$self->pidl("static void $name\__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)");
+	$self->pidl("{");
+	$self->pidlnoindent("#ifdef DCESRV_INTERFACE_$uname\_UNBIND");
+	$self->indent();
+	$self->pidl("DCESRV_INTERFACE_$uname\_UNBIND(context, iface);");
+	$self->pidlnoindent("#else");
+	$self->pidl("return;");
+	$self->pidlnoindent("#endif");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("");
+
+	$self->pidl_hdr("NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r);");
+	$self->pidl("NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)");
+	$self->pidl("{");
+	$self->indent();
+	$self->pidl("enum ndr_err_code ndr_err;");
+	$self->pidl("uint16_t opnum = dce_call->pkt.u.request.opnum;");
+	$self->pidl("");
+	$self->pidl("dce_call->fault_code = 0;");
+	$self->pidl("");
+	$self->pidl("if (opnum >= ndr_table_$name.num_calls) {");
+	$self->indent();
+	$self->pidl("dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;");
+	$self->pidl("return NT_STATUS_NET_WRITE_FAULT;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("");
+	$self->pidl("*r = talloc_named(mem_ctx, ndr_table_$name.calls[opnum].struct_size, \"struct %s\", ndr_table_$name.calls[opnum].name);");
+	$self->pidl("NT_STATUS_HAVE_NO_MEMORY(*r);");
+	$self->pidl("");
+	$self->pidl("/* unravel the NDR for the packet */");
+	$self->pidl("ndr_err = ndr_table_$name.calls[opnum].ndr_pull(pull, NDR_IN, *r);");
+	$self->pidl("if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {");
+	$self->indent();
+	$self->pidl("dce_call->fault_code = DCERPC_FAULT_NDR;");
+	$self->pidl("return NT_STATUS_NET_WRITE_FAULT;");
+	$self->deindent();
+	$self->pidl("}");
+	$self->pidl("");
+	$self->pidl("return NT_STATUS_OK;");
+	$self->deindent();
+	$self->pidl("}");


-- 
Samba Shared Repository



More information about the samba-cvs mailing list