With multichannel things may not happen only on one connection.
We may need to disconnect all connections of a client, when something
bad happens.
The first users of this will be the lease/oplock break code,
if they are not able allocate memory or something similar
we need to bail out.
Having a special smbXsrv_client based function is better than
calling exit_server*() directly.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
#define smbd_server_connection_terminate(xconn, reason) \
smbd_server_connection_terminate_ex(xconn, reason, __location__)
+void smbd_server_disconnect_client_ex(struct smbXsrv_client *client,
+ const char *reason,
+ const char *location);
+#define smbd_server_disconnect_client(__client, __reason) \
+ smbd_server_disconnect_client_ex(__client, __reason, __location__)
+
const char *smb2_opcode_name(uint16_t opcode);
bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size);
bool smbd_smb2_is_compound(const struct smbd_smb2_request *req);
exit_server_cleanly(reason);
}
+void smbd_server_disconnect_client_ex(struct smbXsrv_client *client,
+ const char *reason,
+ const char *location)
+{
+ size_t num_ok = 0;
+
+ num_ok = smbXsrv_client_valid_connections(client);
+
+ DBG_WARNING("client[%s] num_ok[%zu] reason[%s] at %s\n",
+ client->global->remote_address, num_ok,
+ reason, location);
+
+ /*
+ * Something bad happened we need to disconnect all connections.
+ */
+ exit_server_cleanly(reason);
+}
+
static bool dup_smb2_vec4(TALLOC_CTX *ctx,
struct iovec *outvec,
const struct iovec *srcvec)