Don't segfault during RPC-COUNTCALLS
authorAndrew Bartlett <abartlet@samba.org>
Fri, 12 Dec 2008 05:35:39 +0000 (16:35 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 12 Dec 2008 05:35:39 +0000 (16:35 +1100)
The iface->bind() may well fail, and we can't dereference
call->context in this case, so fall back to the previous behaviour.

Andrew Bartlett

source4/rpc_server/dcerpc_server.c

index 2c218bdc8d77922246e46a5e54c43ed8913d4288..5243d25cd33f944091531462e952384c75eb270a 100644 (file)
@@ -648,7 +648,20 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
        pkt.pfc_flags = DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST | extra_flags;
        pkt.u.bind_ack.max_xmit_frag = 0x2000;
        pkt.u.bind_ack.max_recv_frag = 0x2000;
-       pkt.u.bind_ack.assoc_group_id = call->context->assoc_group_id;
+
+       /*
+         make it possible for iface->bind() to specify the assoc_group_id
+         This helps the openchange mapiproxy plugin to work correctly.
+         
+         metze
+       */
+       if (call->context) {
+               pkt.u.bind_ack.assoc_group_id = call->context->assoc_group_id;
+       } else {
+               /* we better pick something - this chosen so as to send a non zero assoc_group_id here to make longhorn happy, it also matches samba3 */
+               pkt.u.bind_ack.assoc_group_id = SAMBA_ASSOC_GROUP;
+       }
+
        if (iface) {
                /* FIXME: Use pipe name as specified by endpoint instead of interface name */
                pkt.u.bind_ack.secondary_address = talloc_asprintf(call, "\\PIPE\\%s", iface->name);