The branch, master has been updated via da9b3c1 s4:rpc_server/epmapper: make use of dcerpc_binding_dup() in build_ep_list() via 47fa7c8 s4:libnet: use dcerpc_binding_dup() in continue_epm_map_binding_send() via e5e8757 s4:libnet: make use of dcerpc_binding_dup() in libnet_join.c via e42a674 s4:librpc/rpc: make use of dcerpc_binding_dup() in dcerpc_epm_map_binding_send() via 4340590 s4:librpc/rpc: fix memory hierachie in dcerpc_epm_map_binding_send() via 4cf691c s4:librpc/rpc: avoid some indentation levels in dcerpc_epm_map_binding_send() via 6e813ab s4:librpc/rpc: use dcerpc_binding_dup() in dcerpc_schannel_key_send() via 9a084b4 librpc/rpc: add dcerpc_transport_by_name() via ded9576 s3:rpc_client: use address "0.0.0.0" and port "135" for epmapper requests via 98b08df librpc/rpc: simplify dcerpc_binding_build_tower() via d89ff85 librpc/rpc: fix dcerpc_floor_set_rhs_data() with NULL data. via b5eb5d9 librpc/rpc: handle dcerpc_binding->host == NULL in dcerpc_floor_get_rhs_data() via e977884 s4:torture: handle binding_struct->host == NULL in torture_parse_target() via cd4ae0f s4:librpc/test: an empty hostname means b->host == NULL via ca6da61 s4:rpc_server: fix talloc hierachie dcesrv_context => dcesrv_endpoint => dcesrv_if_list via ab32b67 s3:srv_epmapper: only replace ipv4 addresses in _epm_Lookup() and _epm_Map() via 4f344f3 s3:srv_epmapper: fix logic in endpoints_match() via ce973f7 s4:torture/rpc: fix rpc.scanner test via 9a6201e s4:torture/rpc: pass object down to test_Map_display() via 81add42 s4:torture/rpc: print out the object guid in rpc.epmapper.epmapper.Lookup_simple via 48148a4 s4:torture/rpc: test all auth_types (8bit) in rpc.mgmt via 2bc1734 s4:torture/rpc: fix rpc.mgmt test via 312860e s4:torture/rpc: remove unused variable in session_key.c via 8eb7ad2 s4:torture/rpc: remove unused variable in frsapi.c via e795b6c s4:torture/rpc: remove unused variable in dsgetinfo.c via 3fcb659 s4:torture/rpc: remove unused variable in backupkey.c via 42eb407 s4:torture/rpc: fix compiler warnings in spoolss.c via e48b641 s4:torture/drs: remove unused variables. via 129c64f s4:torture/rpc: initialize struct dcerpc_binding completely via f1a1adc s3:rpcclient: initialize struct dcerpc_binding completely via a22cc6b s3:rpc_server: initialize struct dcerpc_binding completely via 47d7b8d s3:dcerpc_up: avoid useless talloc_zero() calls via f9cc660 s3:dcerpc_ep: make ep_register() more tolerant regarding the passes binding vector via 754f2eb s3:dcerpc_ep: only use the explicitly passed object_guid via 09d3a0c s3:dcerpc_ep: only use an array of 'struct dcerpc_binding *' via 166766e s3:dcerpc_ep: make struct dcerpc_binding_vector private via 6ab7621 librpc/rpc: let dcerpc_floor_get_rhs_data() return 'char *' via 327c060 s4:librpc/rpc: remove prototypes which are already in librpc/rpc/rpc_common.h via d791f33 s4:librpc/rpc: use the correct _recv function in continue_open_pipe() via d6c9150 librpc/ndr: add ndr_table_by_syntax() via 8e4a786 s3:rpcclient: add witness command via c677498 librpc/idl: add witness.idl via ffd0585 selftest: let "make testenv SCREEN=1" use tmux if it is running via 34e6d79 s3:rpc_server: check verification trailer via 1eef03a s3:rpc_server: check header of each packet fragment via 6836ffc s3:rpc_server: only become the user if we have a valid context_id via b5f3020 s3:rpc_server: minor refactoring of process_request_pdu() via aeab960 s3:librpc/rpc: only propose header signing if we use sign or seal via 0856c63 s4:rpc_server: check verification trailer via b58f06c s4:rpc_server: check header of each packet fragment via 7676bf3 s4:rpc_server: verifiy the auth_info against the per connection values via 2e093cc s4:librpc/rpc: only propose header signing if we use sign or seal via 1137d62 s4:librpc/rpc: add forward declaration for struct resolve_context via 1fd4842 librpc/rpc: add dcerpc_sec_verification_trailer_check() via 9c5664f librpc/rpc: add dcerpc_sec_vt_header2_[from_ncacn_packet|equal]() via 3b2b0aa4 librpc/ndr: add ndr_syntax_id_[from|to]_string() via 7b57170 librpc/ndr: add ndr_pull_append/pop() via 53e0ced librpc/ndr: add support for a shallow copy to ndr_pull_subcontext_start/end via ef5e0b7 librpc/ndr: remember INCOMPLETE_BUFFER missing bytes in relative_highest_offset via e2a6214 librpc/ndr: add NDR_ERR_INCOMPLETE_BUFFER and LIBNDR_FLAG_INCOMPLETE_BUFFER via 91b3e41 librpc/ndr: fix headers in ndr_dcerpc.c via 8507885 lib/ldb-samba: add more attributes with LDB_SYNTAX_SAMBA_GUID from 41ff0f4 winbind4: Remove unused winbind_get_idmap irpc operation
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit da9b3c15d52cd3b2acccd376a41bea828292668d Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 02:33:03 2014 +0100 s4:rpc_server/epmapper: make use of dcerpc_binding_dup() in build_ep_list() We should not alter the callers binding. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> Autobuild-User(master): Günther Deschner <g...@samba.org> Autobuild-Date(master): Tue Feb 11 18:30:55 CET 2014 on sn-devel-104 commit 47fa7c83a2d9614973c3aa0addba4165055b9f75 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Feb 6 18:52:20 2014 +0100 s4:libnet: use dcerpc_binding_dup() in continue_epm_map_binding_send() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit e5e8757887bbfbc063a0a54dee3021e2e2486717 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 22:04:11 2014 +0100 s4:libnet: make use of dcerpc_binding_dup() in libnet_join.c Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit e42a6746257953c35bec3bc5877d7bcd7d77b3aa Author: Stefan Metzmacher <me...@samba.org> Date: Sat Jan 25 11:14:36 2014 +0100 s4:librpc/rpc: make use of dcerpc_binding_dup() in dcerpc_epm_map_binding_send() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 4340590ae90956c5c73141ffe56e499fdd14f376 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Jan 25 11:13:26 2014 +0100 s4:librpc/rpc: fix memory hierachie in dcerpc_epm_map_binding_send() We should allocate on 's' the internal state, not on the callers mem_ctx. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 4cf691ce1fb2af5413b2bb16afd4b4be0a8e3f35 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Jan 25 10:54:45 2014 +0100 s4:librpc/rpc: avoid some indentation levels in dcerpc_epm_map_binding_send() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 6e813ab89763892435e9a4c531950f71de814e6d Author: Stefan Metzmacher <me...@samba.org> Date: Thu Feb 6 18:51:45 2014 +0100 s4:librpc/rpc: use dcerpc_binding_dup() in dcerpc_schannel_key_send() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 9a084b4ab286d0ca73ce6ebb374e660da0820957 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 23 12:03:46 2014 +0100 librpc/rpc: add dcerpc_transport_by_name() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit ded957614bf70560f3ffa6b6021eba37f2e2dbbb Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 09:23:40 2014 +0100 s3:rpc_client: use address "0.0.0.0" and port "135" for epmapper requests Note: binding->host = NULL lets dcerpc_binding_build_tower() use "0.0.0.0". This matches Windows clients. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 98b08dfb6db0accaf7c893adf695e1d0f0b05ade Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 23:05:48 2014 +0100 librpc/rpc: simplify dcerpc_binding_build_tower() dcerpc_floor_set_rhs_data() handles the special cases now and we keep the 'host' part unmodified except EPM_PROTOCOL_IP addresses. No special '\\' handling anymore. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit d89ff8575dbc223019ee62fc65ec0ede593635f7 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 23:03:03 2014 +0100 librpc/rpc: fix dcerpc_floor_set_rhs_data() with NULL data. For EPM_PROTOCOL_IP we can only marshal ipv4 addresses, everything else gets '0.0.0.0' (4 zero bytes on the wire). Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit b5eb5d97c28ea9a13b1d7f06599626f4c4ba14f4 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Feb 10 18:56:59 2014 +0100 librpc/rpc: handle dcerpc_binding->host == NULL in dcerpc_floor_get_rhs_data() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit e977884b9bbaebd13fd2ab64fa452b942073d025 Author: Stefan Metzmacher <me...@samba.org> Date: Sun Jan 26 01:55:52 2014 +0100 s4:torture: handle binding_struct->host == NULL in torture_parse_target() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit cd4ae0f7f3d810a44afd184e08c95a89fa35e80c Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 24 09:20:50 2014 +0100 s4:librpc/test: an empty hostname means b->host == NULL In future we'll not allow b->host == "" any more. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit ca6da61a52248037fe8a0e747695b3d7525f4647 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Feb 6 18:59:53 2014 +0100 s4:rpc_server: fix talloc hierachie dcesrv_context => dcesrv_endpoint => dcesrv_if_list Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit ab32b67bbb86ef487bd1faa8120314a2418ab144 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 31 21:10:41 2014 +0100 s3:srv_epmapper: only replace ipv4 addresses in _epm_Lookup() and _epm_Map() The floor data for EPM_PROTOCOL_IP only handles a 4 byte ipv4 address. "0.0.0.0" is used for ipv6 and hostnames. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 4f344f3b80505f47549d933e3a66d5a9b5dd85bb Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 31 23:20:05 2014 +0100 s3:srv_epmapper: fix logic in endpoints_match() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit ce973f78af956c075156bb091fd4ef86281baa16 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 24 11:31:25 2014 +0100 s4:torture/rpc: fix rpc.scanner test Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 9a6201e6daf79f3c679227bd8fb41522f6dd8247 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 23:00:40 2014 +0100 s4:torture/rpc: pass object down to test_Map_display() We also pass the given tower unmodified first. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 81add4222a73728b2b6c42e07921cffb5a636c36 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 24 11:00:04 2014 +0100 s4:torture/rpc: print out the object guid in rpc.epmapper.epmapper.Lookup_simple Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 48148a454d8ba6b642bd19ba0e3ab2c58b8986ea Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 24 10:36:37 2014 +0100 s4:torture/rpc: test all auth_types (8bit) in rpc.mgmt Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 2bc1734c94f171f83ea7a64e95ab4ea2160763c0 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 24 10:31:32 2014 +0100 s4:torture/rpc: fix rpc.mgmt test Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 312860e6a6ec13c7b54e080dfd66170ba89c7677 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 10:08:48 2014 +0100 s4:torture/rpc: remove unused variable in session_key.c Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 8eb7ad289c844c6def4aeeb6fffbbde2549108cb Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 10:08:48 2014 +0100 s4:torture/rpc: remove unused variable in frsapi.c Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit e795b6c6ecb144c84fa9e72705f970037623d91a Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 10:08:48 2014 +0100 s4:torture/rpc: remove unused variable in dsgetinfo.c Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 3fcb659f33a2d295d5e09d33e74df38957b422f2 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 10:08:48 2014 +0100 s4:torture/rpc: remove unused variable in backupkey.c Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 42eb40792a2000b9ee5610306ea1f4eda1760527 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 09:52:49 2014 +0100 s4:torture/rpc: fix compiler warnings in spoolss.c Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit e48b6418b211467c915b0556126461b0fc9c21b1 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 10:07:59 2014 +0100 s4:torture/drs: remove unused variables. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 129c64f04701bce7b36bf4b8e19b90b0bc4bdf89 Author: Stefan Metzmacher <me...@samba.org> Date: Sun Jan 26 10:11:03 2014 +0100 s4:torture/rpc: initialize struct dcerpc_binding completely Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit f1a1adc04eb26beaf85d4af4e9b0caf4c5eec4a4 Author: Stefan Metzmacher <me...@samba.org> Date: Sun Jan 26 10:10:37 2014 +0100 s3:rpcclient: initialize struct dcerpc_binding completely Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit a22cc6b53c2c6b2b59572123089397a60b9d8dc8 Author: Stefan Metzmacher <me...@samba.org> Date: Sun Jan 26 10:09:49 2014 +0100 s3:rpc_server: initialize struct dcerpc_binding completely Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 47d7b8df44551c435b9924e9e39a9068ebbee2a1 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 09:54:24 2014 +0100 s3:dcerpc_up: avoid useless talloc_zero() calls Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit f9cc66055ddf09699b5bee229e10fdbf9ca5ce93 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 09:51:09 2014 +0100 s3:dcerpc_ep: make ep_register() more tolerant regarding the passes binding vector We should take a copy and set the abstract syntax to from the given interface before we construct the tower. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 754f2eba16822c998c9381d61da7bdfa9bac19ee Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 30 09:51:09 2014 +0100 s3:dcerpc_ep: only use the explicitly passed object_guid Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 09d3a0cda98b3b6b6ba4d618418a4f615f512b17 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Feb 7 15:50:29 2014 +0100 s3:dcerpc_ep: only use an array of 'struct dcerpc_binding *' In future we should not dereference struct dcerpc_binding and just keep pointers. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 166766e7725d6b4820c3b50a88561b8d260baf56 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Feb 7 15:50:29 2014 +0100 s3:dcerpc_ep: make struct dcerpc_binding_vector private Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 6ab76219cd651f1ad30eaeff87a8878c91c6969a Author: Stefan Metzmacher <me...@samba.org> Date: Mon Feb 3 09:06:08 2014 +0100 librpc/rpc: let dcerpc_floor_get_rhs_data() return 'char *' We don't return any "const char *" values here, so give the caller a chance to talloc_free() the result. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 327c060666a8cf5213e0548acb2d2be6a93fbee2 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Feb 3 09:04:49 2014 +0100 s4:librpc/rpc: remove prototypes which are already in librpc/rpc/rpc_common.h Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit d791f3354e493bee764ca8b6ebdc3673d82e2987 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 11:06:21 2014 +0100 s4:librpc/rpc: use the correct _recv function in continue_open_pipe() We start with dcerpc_pipe_open_unix_stream_send() so we need to call dcerpc_pipe_open_unix_stream_recv(). It was just luck that it worked before... Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit d6c91502c061fef9c42eaf99418ec427e96b1c20 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 24 10:28:05 2014 +0100 librpc/ndr: add ndr_table_by_syntax() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 8e4a78655a79d11055ba801046b715f0b0daad0b Author: Gregor Beck <gb...@sernet.de> Date: Mon Aug 5 11:01:34 2013 +0200 s3:rpcclient: add witness command Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit c6774989e0a878f59f53fa1fe5439b881945a042 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Nov 2 16:27:46 2012 +0100 librpc/idl: add witness.idl See [MS-SWN] for the details. Pair-Programmed-With: Gregor Beck <gb...@sernet.de> Signed-off-by: Gregor Beck <gb...@sernet.de> Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit ffd0585dd2db0af298fdbe1c7d5aba3cd3699bbc Author: Gregor Beck <gb...@sernet.de> Date: Thu Dec 12 11:38:22 2013 +0100 selftest: let "make testenv SCREEN=1" use tmux if it is running Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 34e6d793520b465d4b94d837b2e902651b1a65be Author: Gregor Beck <gb...@sernet.de> Date: Fri Jan 10 13:56:06 2014 +0100 s3:rpc_server: check verification trailer Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 1eef03aa93056f12d2614cfedee60461db3ac4a3 Author: Gregor Beck <gb...@sernet.de> Date: Thu Jan 9 13:55:27 2014 +0100 s3:rpc_server: check header of each packet fragment Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 6836ffc9fc088ea6c4444b9e4abfe2766a54f6a8 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 15 10:27:49 2014 +0100 s3:rpc_server: only become the user if we have a valid context_id Pair-Programmed-With: Gregor Beck <gb...@sernet.de> Signed-off-by: Gregor Beck <gb...@sernet.de> Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit b5f30205931a4b9d0b3b257d5855869e606f8b63 Author: Gregor Beck <gb...@sernet.de> Date: Thu Jan 9 10:15:31 2014 +0100 s3:rpc_server: minor refactoring of process_request_pdu() Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit aeab9602c07c8e7bf0daeb382fd9beadb884e6c7 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Jan 21 15:18:01 2014 +0100 s3:librpc/rpc: only propose header signing if we use sign or seal Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 0856c639f998e38238098581006e6f6a8df62725 Author: Gregor Beck <gb...@sernet.de> Date: Wed Jan 8 10:35:48 2014 +0100 s4:rpc_server: check verification trailer Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit b58f06c17be5aab57a1d419bf6db7df1c020f87e Author: Gregor Beck <gb...@sernet.de> Date: Thu Jan 9 09:47:25 2014 +0100 s4:rpc_server: check header of each packet fragment Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 7676bf32a498ac844bd1c8631c1fa8a457ede3ef Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 9 10:59:01 2014 +0100 s4:rpc_server: verifiy the auth_info against the per connection values Pair-Programmed-With: Gregor Beck <gb...@sernet.de> Signed-off-by: Gregor Beck <gb...@sernet.de> Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 2e093cc0cc0ff14ff189947ab0a267f089fab97c Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 16 07:49:56 2014 +0100 s4:librpc/rpc: only propose header signing if we use sign or seal Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 1137d62d9d1f67d2721d3fc63f5770477d42dcec Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 23 09:48:53 2014 +0100 s4:librpc/rpc: add forward declaration for struct resolve_context Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 1fd484270153ba8d47e95b8961db175d50b8b9cb Author: Gregor Beck <gb...@sernet.de> Date: Wed Jan 8 09:50:33 2014 +0100 librpc/rpc: add dcerpc_sec_verification_trailer_check() Signed-off-by: Gregor Beck <gb...@sernet.de> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 9c5664f58d1e8674ce5a53c6aa10d6343001b6c7 Author: Gregor Beck <gb...@sernet.de> Date: Mon Jan 13 13:33:09 2014 +0100 librpc/rpc: add dcerpc_sec_vt_header2_[from_ncacn_packet|equal]() Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Gregor Beck <gb...@sernet.de> Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 3b2b0aa4d4bf07971ef016e5a2ce0fec84bbf144 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Feb 4 12:54:42 2014 +0100 librpc/ndr: add ndr_syntax_id_[from|to]_string() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 7b5717058a7d7a93cda712efc7622a87d3980e48 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Sep 21 02:28:33 2013 +0200 librpc/ndr: add ndr_pull_append/pop() They can be used to parse a fragmented NDR byte stream. ndr_pull_append() appends more data that can be processed and ndr_pull_pop() removed already processed data. This will be used to implement dcerpc pipes, where we can get a verify large amount of pipe chunks, once we processed a chunk we can forget about the related data, but we may need to keep some bytes in order to get the alignment right. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 53e0ceddff7a4e668242a2db53764fa962c71163 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Sep 21 21:58:05 2013 +0200 librpc/ndr: add support for a shallow copy to ndr_pull_subcontext_start/end This will be usefull to try parsing DCERPC pipe chunks for LIBNDR_FLAG_INCOMPLETE_BUFFER. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit ef5e0b7339ace6d5bf4771d196f8868171c02103 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Sep 21 22:30:25 2013 +0200 librpc/ndr: remember INCOMPLETE_BUFFER missing bytes in relative_highest_offset Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit e2a621466e740cc7fc2a659163f8895287c9a01e Author: Stefan Metzmacher <me...@samba.org> Date: Tue Mar 8 10:14:51 2011 +0100 librpc/ndr: add NDR_ERR_INCOMPLETE_BUFFER and LIBNDR_FLAG_INCOMPLETE_BUFFER If we pull a pipe chunk we need a way to check if we have enough bytes to parse the complete chunk. Setting ndr_pull->flags |= LIBNDR_FLAG_INCOMPLETE_BUFFER would change NDR_ERR_BUFSIZE (and later maybe others) into NDR_ERR_INCOMPLETE_BUFFER. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 91b3e415d59feeb31a8255d147622a32e1bc64f1 Author: Gregor Beck <gb...@sernet.de> Date: Fri Jan 17 12:13:50 2014 +0100 librpc/ndr: fix headers in ndr_dcerpc.c Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Gregor Beck <gb...@sernet.de> Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> commit 850788591b8d1530038d9277840e554ce53abf89 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 29 08:24:11 2014 +0100 lib/ldb-samba: add more attributes with LDB_SYNTAX_SAMBA_GUID Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/ldb-samba/ldif_handlers.c | 28 ++- librpc/ABI/{ndr-0.0.2.sigs => ndr-0.0.3.sigs} | 4 + librpc/idl/witness.idl | 110 ++++++ librpc/idl/wscript_build | 2 +- librpc/ndr/libndr.h | 24 ++- librpc/ndr/ndr.c | 136 +++++++- librpc/ndr/ndr_dcerpc.c | 4 +- librpc/ndr/ndr_misc.c | 47 +++ librpc/ndr/ndr_table.c | 14 + librpc/ndr/ndr_table.h | 1 + librpc/rpc/binding.c | 80 +++-- librpc/rpc/dcerpc_util.c | 192 ++++++++++ librpc/rpc/rpc_common.h | 44 +++- librpc/wscript_build | 14 +- selftest/in_screen | 6 +- source3/librpc/rpc/dcerpc_ep.c | 68 ++-- source3/librpc/rpc/dcerpc_ep.h | 6 +- source3/rpc_client/cli_pipe.c | 17 +- source3/rpc_server/epmapper/srv_epmapper.c | 32 ++- source3/rpc_server/rpc_ep_register.c | 1 + source3/rpc_server/rpc_pipes.h | 3 + source3/rpc_server/srv_pipe.c | 121 +++++-- source3/rpcclient/cmd_epmapper.c | 1 + source3/rpcclient/cmd_witness.c | 504 +++++++++++++++++++++++++ source3/rpcclient/rpcclient.c | 2 + source3/wscript_build | 4 +- source4/libnet/libnet_join.c | 7 +- source4/libnet/libnet_rpc.c | 6 +- source4/librpc/rpc/dcerpc.h | 6 +- source4/librpc/rpc/dcerpc_auth.c | 4 +- source4/librpc/rpc/dcerpc_schannel.c | 4 +- source4/librpc/rpc/dcerpc_secondary.c | 2 +- source4/librpc/rpc/dcerpc_util.c | 67 ++-- source4/librpc/tests/binding_string.c | 3 +- source4/rpc_server/dcerpc_server.c | 70 ++++- source4/rpc_server/dcesrv_auth.c | 15 + source4/rpc_server/epmapper/rpc_epmapper.c | 15 +- source4/torture/drs/rpc/dssync.c | 12 +- source4/torture/drs/rpc/msds_intid.c | 8 +- source4/torture/rpc/backupkey.c | 49 ++-- source4/torture/rpc/dsgetinfo.c | 4 +- source4/torture/rpc/epmapper.c | 26 +- source4/torture/rpc/frsapi.c | 18 +- source4/torture/rpc/mgmt.c | 5 +- source4/torture/rpc/scanner.c | 42 ++- source4/torture/rpc/session_key.c | 6 +- source4/torture/rpc/spoolss.c | 20 +- source4/torture/smbtorture.c | 4 +- 48 files changed, 1587 insertions(+), 271 deletions(-) copy librpc/ABI/{ndr-0.0.2.sigs => ndr-0.0.3.sigs} (98%) create mode 100644 librpc/idl/witness.idl create mode 100644 source3/rpcclient/cmd_witness.c Changeset truncated at 500 lines: diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c index c7385f6..4425f86 100644 --- a/lib/ldb-samba/ldif_handlers.c +++ b/lib/ldb-samba/ldif_handlers.c @@ -1444,9 +1444,6 @@ static const struct { const char *name; const char *syntax; } samba_attributes[] = { - { "objectSid", LDB_SYNTAX_SAMBA_SID }, - { "securityIdentifier", LDB_SYNTAX_SAMBA_SID }, - { "tokenGroups", LDB_SYNTAX_SAMBA_SID }, { "ntSecurityDescriptor", LDB_SYNTAX_SAMBA_SECURITY_DESCRIPTOR }, { "oMSyntax", LDB_SYNTAX_SAMBA_INT32 }, { "objectCategory", LDB_SYNTAX_SAMBA_OBJECT_CATEGORY }, @@ -1465,6 +1462,26 @@ static const struct { /* * these are extracted by searching + * (&(attributeSyntax=2.5.5.17)(omSyntax=4)) + * + * Except: msAuthz-CentralAccessPolicyID as it might be a GUID see: + * adminDescription: For a Central Access Policy, this attribute defines a GUID t + * hat can be used to identify the set of policies when applied to a resource. + * Until we see a msAuthz-CentralAccessPolicyID value on a windows + * server, we ignore it here. + */ + { "mS-DS-CreatorSID", LDB_SYNTAX_SAMBA_SID }, + { "msDS-QuotaTrustee", LDB_SYNTAX_SAMBA_SID }, + { "objectSid", LDB_SYNTAX_SAMBA_SID }, + { "tokenGroups", LDB_SYNTAX_SAMBA_SID }, + { "tokenGroupsGlobalAndUniversal", LDB_SYNTAX_SAMBA_SID }, + { "tokenGroupsNoGCAcceptable", LDB_SYNTAX_SAMBA_SID }, + { "securityIdentifier", LDB_SYNTAX_SAMBA_SID }, + { "sIDHistory", LDB_SYNTAX_SAMBA_SID }, + { "syncWithSID", LDB_SYNTAX_SAMBA_SID }, + + /* + * these are extracted by searching * (&(attributeSyntax=2.5.5.10)(rangeLower=16)(rangeUpper=16)(omSyntax=4)) */ { "attributeSecurityGUID", LDB_SYNTAX_SAMBA_GUID }, @@ -1475,6 +1492,8 @@ static const struct { { "fRSVersionGUID", LDB_SYNTAX_SAMBA_GUID }, { "implementedCategories", LDB_SYNTAX_SAMBA_GUID }, { "msDS-AzObjectGuid", LDB_SYNTAX_SAMBA_GUID }, + { "msDS-GenerationId", LDB_SYNTAX_SAMBA_GUID }, + { "msDS-OptionalFeatureGUID", LDB_SYNTAX_SAMBA_GUID }, { "msDFSR-ContentSetGuid", LDB_SYNTAX_SAMBA_GUID }, { "msDFSR-ReplicationGroupGuid", LDB_SYNTAX_SAMBA_GUID }, { "mSMQDigests", LDB_SYNTAX_SAMBA_GUID }, @@ -1491,13 +1510,14 @@ static const struct { { "msDFS-GenerationGUIDv2", LDB_SYNTAX_SAMBA_GUID }, { "msDFS-LinkIdentityGUIDv2", LDB_SYNTAX_SAMBA_GUID }, { "msDFS-NamespaceIdentityGUIDv2", LDB_SYNTAX_SAMBA_GUID }, + { "msSPP-CSVLKSkuId", LDB_SYNTAX_SAMBA_GUID }, + { "msSPP-KMSIds", LDB_SYNTAX_SAMBA_GUID }, /* * these are known to be GUIDs */ { "invocationId", LDB_SYNTAX_SAMBA_GUID }, { "parentGUID", LDB_SYNTAX_SAMBA_GUID }, - { "msDS-OptionalFeatureGUID", LDB_SYNTAX_SAMBA_GUID }, /* These NDR encoded things we want to be able to read with --show-binary */ { "dnsRecord", LDB_SYNTAX_SAMBA_DNSRECORD }, diff --git a/librpc/ABI/ndr-0.0.2.sigs b/librpc/ABI/ndr-0.0.3.sigs similarity index 98% copy from librpc/ABI/ndr-0.0.2.sigs copy to librpc/ABI/ndr-0.0.3.sigs index 66be5ba..d9c76f0 100644 --- a/librpc/ABI/ndr-0.0.2.sigs +++ b/librpc/ABI/ndr-0.0.3.sigs @@ -95,6 +95,7 @@ ndr_pull_NTTIME_hyper: enum ndr_err_code (struct ndr_pull *, int, NTTIME *) ndr_pull_WERROR: enum ndr_err_code (struct ndr_pull *, int, WERROR *) ndr_pull_advance: enum ndr_err_code (struct ndr_pull *, uint32_t) ndr_pull_align: enum ndr_err_code (struct ndr_pull *, size_t) +ndr_pull_append: enum ndr_err_code (struct ndr_pull *, DATA_BLOB *) ndr_pull_array_length: enum ndr_err_code (struct ndr_pull *, const void *) ndr_pull_array_size: enum ndr_err_code (struct ndr_pull *, const void *) ndr_pull_array_uint8: enum ndr_err_code (struct ndr_pull *, int, uint8_t *, uint32_t) @@ -124,6 +125,7 @@ ndr_pull_netr_SamDatabaseID: enum ndr_err_code (struct ndr_pull *, int, enum net ndr_pull_netr_SchannelType: enum ndr_err_code (struct ndr_pull *, int, enum netr_SchannelType *) ndr_pull_pointer: enum ndr_err_code (struct ndr_pull *, int, void **) ndr_pull_policy_handle: enum ndr_err_code (struct ndr_pull *, int, struct policy_handle *) +ndr_pull_pop: enum ndr_err_code (struct ndr_pull *) ndr_pull_ref_ptr: enum ndr_err_code (struct ndr_pull *, uint32_t *) ndr_pull_relative_ptr1: enum ndr_err_code (struct ndr_pull *, const void *, uint32_t) ndr_pull_relative_ptr2: enum ndr_err_code (struct ndr_pull *, const void *) @@ -238,7 +240,9 @@ ndr_size_union: size_t (const void *, int, uint32_t, ndr_push_flags_fn_t) ndr_string_array_size: size_t (struct ndr_push *, const char *) ndr_string_length: uint32_t (const void *, uint32_t) ndr_syntax_id_equal: bool (const struct ndr_syntax_id *, const struct ndr_syntax_id *) +ndr_syntax_id_from_string: bool (const char *, struct ndr_syntax_id *) ndr_syntax_id_null: uuid = {time_low = 0, time_mid = 0, time_hi_and_version = 0, clock_seq = "\000", node = "\000\000\000\000\000"}, if_version = 0 +ndr_syntax_id_to_string: char *(TALLOC_CTX *, const struct ndr_syntax_id *) ndr_token_peek: uint32_t (struct ndr_token_list **, const void *) ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *) ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list **, const void *, uint32_t *, comparison_fn_t, bool) diff --git a/librpc/idl/witness.idl b/librpc/idl/witness.idl new file mode 100644 index 0000000..cf60536 --- /dev/null +++ b/librpc/idl/witness.idl @@ -0,0 +1,110 @@ +#include "idl_types.h" + +import "misc.idl"; + +[ + uuid("ccd8c074-d0e5-4a40-92b4-d074faa6ba28"), + version(1.1), + pointer_default(unique), + helpstring("SMB Witness Service"), + endpoint("ncacn_ip_tcp:") +] +interface witness +{ + typedef [v1_enum] enum { + WITNESS_V1 = 0x00010001, + WITNESS_V2 = 0x00020000 + } witness_version; + + /*****************/ + /* Function 0x00 */ + + typedef [enum16bit] enum { + WITNESS_STATE_UNKNOWN = 0x00, + WITNESS_STATE_AVAILABLE = 0x01, + WITNESS_STATE_UNAVAILABLE = 0xff + } witness_interfaceInfo_state; + + typedef [bitmap32bit] bitmap { + WITNESS_INFO_IPv4_VALID = 0x01, + WITNESS_INFO_IPv6_VALID = 0x02, + WITNESS_INFO_WITNESS_IF = 0x04 + } witness_interfaceInfo_flags; + + typedef struct { + [charset(UTF16),to_null] uint16 group_name[260]; + witness_version version; + witness_interfaceInfo_state state; + [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [flag(NDR_BIG_ENDIAN)] ipv6address ipv6; + witness_interfaceInfo_flags flags; + } witness_interfaceInfo; + + typedef struct { + uint32 num_interfaces; + [size_is(num_interfaces)] witness_interfaceInfo *interfaces; + } witness_interfaceList; + + WERROR witness_GetInterfaceList( + [out] witness_interfaceList **interface_list + ); + + /*****************/ + /* Function 0x01 */ + + WERROR witness_Register( + [out,ref] policy_handle *context_handle, + [in] witness_version version, + [in,unique,string,charset(UTF16)] uint16 *net_name, + [in,unique,string,charset(UTF16)] uint16 *ip_address, + [in,unique,string,charset(UTF16)] uint16 *client_computer_name + ); + + /*****************/ + /* Function 0x02 */ + + WERROR witness_UnRegister( + [in] policy_handle context_handle + ); + + /*****************/ + /* Function 0x03 */ + + typedef [v1_enum] enum { + WITNESS_NOTIFY_RESOURCE_CHANGE = 1, + WITNESS_NOTIFY_CLIENT_MOVE = 2, + WITNESS_NOTIFY_SHARE_MOVE = 3, + WITNESS_NOTIFY_IP_CHANGE = 4 + } witness_notifyResponse_type; + + typedef struct { + witness_notifyResponse_type message_type; + uint32 length; + uint32 num_messages; + [size_is(length)] uint8 *message_buffer; + } witness_notifyResponse; + + WERROR witness_AsyncNotify( + [in] policy_handle context_handle, + [out] witness_notifyResponse **response + ); + + /*****************/ + /* Function 0x04 */ + + typedef [bitmap32bit] bitmap { + WITNESS_REGISTER_NONE = 0x00, + WITNESS_REGISTER_IP_NOTIFICATION = 0x01 + } witness_RegisterEx_flags; + + WERROR witness_RegisterEx( + [out,ref] policy_handle *context_handle, + [in] witness_version version, + [in,unique,string,charset(UTF16)] uint16 *net_name, + [in,unique,string,charset(UTF16)] uint16 *share_name, + [in,unique,string,charset(UTF16)] uint16 *ip_address, + [in,unique,string,charset(UTF16)] uint16 *client_computer_name, + [in] witness_RegisterEx_flags flags, + [in] uint32 timeout + ); +} diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build index 854a2e2..f181786 100644 --- a/librpc/idl/wscript_build +++ b/librpc/idl/wscript_build @@ -12,7 +12,7 @@ bld.SAMBA_PIDL_LIST('PIDL', drsblobs.idl efs.idl frstrans.idl mgmt.idl netlogon.idl notify.idl policyagent.idl scerpc.idl svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl - fsrvp.idl''', + fsrvp.idl witness.idl''', options='--header --ndr-parser --samba3-ndr-server --server --client --python', output_dir='../gen_ndr') diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 8070c3c..115e10a 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -124,6 +124,14 @@ struct ndr_print { #define LIBNDR_STRING_FLAGS (0x7FFC) /* + * don't debug NDR_ERR_BUFSIZE failures, + * as the available buffer might be incomplete. + * + * return NDR_ERR_INCOMPLETE_BUFFER instead. + */ +#define LIBNDR_FLAG_INCOMPLETE_BUFFER (1<<16) + +/* * This lets ndr_pull_subcontext_end() return * NDR_ERR_UNREAD_BYTES. */ @@ -206,7 +214,8 @@ enum ndr_err_code { NDR_ERR_INVALID_POINTER, NDR_ERR_UNREAD_BYTES, NDR_ERR_NDR64, - NDR_ERR_FLAGS + NDR_ERR_FLAGS, + NDR_ERR_INCOMPLETE_BUFFER }; #define NDR_ERR_CODE_IS_SUCCESS(x) (x == NDR_ERR_SUCCESS) @@ -265,6 +274,11 @@ enum ndr_compression_alg { #define NDR_PULL_NEED_BYTES(ndr, n) do { \ if (unlikely((n) > ndr->data_size || ndr->offset + (n) > ndr->data_size)) { \ + if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \ + uint32_t _available = ndr->data_size - ndr->offset; \ + uint32_t _missing = n - _available; \ + ndr->relative_highest_offset = _missing; \ + } \ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u (%s)", (unsigned)n, __location__); \ } \ } while(0) @@ -281,6 +295,10 @@ enum ndr_compression_alg { ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \ } \ if (unlikely(ndr->offset > ndr->data_size)) { \ + if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \ + uint32_t _missing = ndr->offset - ndr->data_size; \ + ndr->relative_highest_offset = _missing; \ + } \ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", (unsigned)n); \ } \ } while(0) @@ -440,6 +458,8 @@ size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags); void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid); void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss); bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2); +char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id); +bool ndr_syntax_id_from_string(const char *s, struct ndr_syntax_id *id); enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn); enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn); size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push); @@ -462,6 +482,8 @@ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p); enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v); size_t ndr_align_size(uint32_t offset, size_t n); struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx); +enum ndr_err_code ndr_pull_append(struct ndr_pull *ndr, DATA_BLOB *blob); +enum ndr_err_code ndr_pull_pop(struct ndr_pull *ndr); enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size); struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx); DATA_BLOB ndr_push_blob(struct ndr_push *ndr); diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 3ed0310..76073ed 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -75,6 +75,111 @@ _PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX * return ndr; } +_PUBLIC_ enum ndr_err_code ndr_pull_append(struct ndr_pull *ndr, DATA_BLOB *blob) +{ + enum ndr_err_code ndr_err; + DATA_BLOB b; + uint32_t append = 0; + bool ok; + + if (blob->length == 0) { + return NDR_ERR_SUCCESS; + } + + ndr_err = ndr_token_retrieve(&ndr->array_size_list, ndr, &append); + if (ndr_err == NDR_ERR_TOKEN) { + append = 0; + ndr_err = NDR_ERR_SUCCESS; + } + NDR_CHECK(ndr_err); + + if (ndr->data_size == 0) { + ndr->data = NULL; + append = UINT32_MAX; + } + + if (append == UINT32_MAX) { + /* + * append == UINT32_MAX means that + * ndr->data is either NULL or a valid + * talloc child of ndr, which means + * we can use data_blob_append() without + * data_blob_talloc() of the existing callers data + */ + b = data_blob_const(ndr->data, ndr->data_size); + } else { + b = data_blob_talloc(ndr, ndr->data, ndr->data_size); + if (b.data == NULL) { + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__); + } + } + + ok = data_blob_append(ndr, &b, blob->data, blob->length); + if (!ok) { + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__); + } + + ndr->data = b.data; + ndr->data_size = b.length; + + return ndr_token_store(ndr, &ndr->array_size_list, ndr, UINT32_MAX); +} + +_PUBLIC_ enum ndr_err_code ndr_pull_pop(struct ndr_pull *ndr) +{ + uint32_t skip = 0; + uint32_t append = 0; + + if (ndr->relative_base_offset != 0) { + return ndr_pull_error(ndr, NDR_ERR_RELATIVE, + "%s", __location__); + } + if (ndr->relative_highest_offset != 0) { + return ndr_pull_error(ndr, NDR_ERR_RELATIVE, + "%s", __location__); + } + if (ndr->relative_list != NULL) { + return ndr_pull_error(ndr, NDR_ERR_RELATIVE, + "%s", __location__); + } + if (ndr->relative_base_list != NULL) { + return ndr_pull_error(ndr, NDR_ERR_RELATIVE, + "%s", __location__); + } + + /* + * we need to keep up to 7 bytes + * in order to get the aligment right. + */ + skip = ndr->offset & 0xFFFFFFF8; + + if (skip == 0) { + return NDR_ERR_SUCCESS; + } + + ndr->offset -= skip; + ndr->data_size -= skip; + + append = ndr_token_peek(&ndr->array_size_list, ndr); + if (append != UINT32_MAX) { + /* + * here we assume, that ndr->data is not a + * talloc child of ndr. + */ + ndr->data += skip; + return NDR_ERR_SUCCESS; + } + + memmove(ndr->data, ndr->data + skip, ndr->data_size); + + ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->data_size); + if (ndr->data_size != 0 && ndr->data == NULL) { + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "%s", __location__); + } + + return NDR_ERR_SUCCESS; +} + /* advance by 'size' bytes */ @@ -453,6 +558,15 @@ _PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr, va_list ap; int ret; + if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { + switch (ndr_err) { + case NDR_ERR_BUFSIZE: + return NDR_ERR_INCOMPLETE_BUFFER; + default: + break; + } + } + va_start(ap, format); ret = vasprintf(&s, format, ap); va_end(ap); @@ -607,6 +721,23 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &reserved)); break; } + case 0xFFFFFFFF: + /* + * a shallow copy like subcontext + * useful for DCERPC pipe chunks. + */ + subndr = talloc_zero(ndr, struct ndr_pull); + NDR_ERR_HAVE_NO_MEMORY(subndr); + + subndr->flags = ndr->flags; + subndr->current_mem_ctx = ndr->current_mem_ctx; + subndr->data = ndr->data; + subndr->offset = ndr->offset; + subndr->data_size = ndr->data_size; + + *_subndr = subndr; + return NDR_ERR_SUCCESS; + default: return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d", (int)header_size); @@ -641,7 +772,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr, uint32_t advance; uint32_t highest_ofs; - if (size_is >= 0) { + if (header_size == 0xFFFFFFFF) { + advance = subndr->offset - ndr->offset; + } else if (size_is >= 0) { advance = size_is; } else if (header_size > 0) { advance = subndr->data_size; @@ -1510,6 +1643,7 @@ const static struct { { NDR_ERR_INVALID_POINTER, "Invalid Pointer" }, { NDR_ERR_UNREAD_BYTES, "Unread Bytes" }, { NDR_ERR_NDR64, "NDR64 assertion error" }, + { NDR_ERR_INCOMPLETE_BUFFER, "Incomplete Buffer" }, { 0, NULL } }; diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c index 3cbcef0..ca09fb6 100644 --- a/librpc/ndr/ndr_dcerpc.c +++ b/librpc/ndr/ndr_dcerpc.c @@ -21,10 +21,8 @@ */ #include "includes.h" -#include "bin/default/librpc/gen_ndr/ndr_dcerpc.h" - +#include "librpc/gen_ndr/ndr_dcerpc.h" #include "librpc/gen_ndr/ndr_misc.h" -#include "lib/util/bitmap.h" const uint8_t DCERPC_SEC_VT_MAGIC[] = {0x8a,0xe3,0x13,0x71,0x02,0xf4,0x36,0x71}; diff --git a/librpc/ndr/ndr_misc.c b/librpc/ndr/ndr_misc.c index c4a1adb..fa643c8 100644 --- a/librpc/ndr/ndr_misc.c +++ b/librpc/ndr/ndr_misc.c @@ -35,3 +35,50 @@ bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, return GUID_equal(&i1->uuid, &i2->uuid) && (i1->if_version == i2->if_version); } + +_PUBLIC_ char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id) +{ -- Samba Shared Repository