[PATCH] Fix terminate connection behavior for asynchronous endpoint with PUSH notification flavors

Julien Kerihuel j.kerihuel at openchange.org
Sun Mar 29 20:15:20 MDT 2015


Good morning all,

Attached is a patch to fix how the dcerpc server handles termination of
connection for dcerpc endpoints with PUSH notification like behaviors.

The patch adds a DCERPC_CALL_STATE_FLAG_SKIP_PENDING_CALL and set it to
call->context->conn->state_flags during dcesrv_bind() and dcesrv_alter()
calls if it was available in dce_call->state_flags. This flag later used
within dcesrv_terminate_connection() to force behaving as if there was
no pending calls on the connection and unbind ops on the interface to be
called.

Context: When implementing an asynchronous dcerpc endpoint that behaves
as a PUSH notification service, the client sends a request for which the
server does not send the reply unless there is either pending
notifications to return or a timeout was reached.

If the client closes the connection before the server returns, the
connection is handled as a broken connection with pending calls on the
dcerpc server and the destructor dcesrv_connection_context_destructor is
never called. It also means that the unbind method on the interface is
never called. A sample output is available below:

ndr_pull_error(11): Pull bytes 4 (../librpc/ndr/ndr_basic.c:148)
dcesrv: terminating connection due to 'NT_STATUS_BUFFER_TOO_SMALL' defered due to pending calls
ndr_pull_error(11): Pull bytes 4 (../librpc/ndr/ndr_basic.c:148)
dcesrv: terminating connection due to 'NT_STATUS_BUFFER_TOO_SMALL' defered due to pending calls

With this patch applied, the unbind method of the interface is called:

ndr_pull_error(11): Pull bytes 4 (../librpc/ndr/ndr_basic.c:148)
Terminating connection - 'dcesrv: NT_STATUS_BUFFER_TOO_SMALL'
imessaging: cleaning up /var/lib/samba/private/smbd.tmp/msg/msg.12698.43
single_terminate: reason[dcesrv: NT_STATUS_BUFFER_TOO_SMALL]
mapiproxy/servers/default/asyncemsmdb/dcesrv_asyncemsmdb.c:339(dcerpc_server_asyncemsmdb_unbind): DISCONNECTION FROM CLIENT

If you are happy with this patch, I would really appreciate if it could
make it for the next release and be applied to 4.1.X series.

Cheers,
Julien.

-- 
Julien Kerihuel
j.kerihuel at openchange.org
OpenChange Project Founder

Twitter: http://twitter.com/jkerihuel

GPG Fingerprint: 0B55 783D A781 6329 108A  B609 7EF6 FE11 A35F 1F79

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-flag-to-dcerpc-server-to-skip-outstanding-pend.patch
Type: text/x-diff
Size: 2534 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150330/e5c2d21a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150330/e5c2d21a/attachment.pgp>


More information about the samba-technical mailing list