From: Volker Lendecke Date: Tue, 13 Feb 2024 11:26:22 +0000 (+0100) Subject: smbd: Add conn_protocol() X-Git-Tag: tdb-1.4.11~1499 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72492de5783cdc3b90b9983ba66178edd5f12522;p=thirdparty%2Fsamba.git smbd: Add conn_protocol() Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett --- diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 27a4d27c695..e6c1fa72dcb 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -70,6 +70,20 @@ bool conn_snum_used(struct smbd_server_connection *sconn, return false; } +enum protocol_types conn_protocol(struct smbd_server_connection *sconn) +{ + if ((sconn != NULL) && + (sconn->client != NULL) && + (sconn->client->connections != NULL)) { + return sconn->client->connections->protocol; + } + /* + * Default to what source3/lib/util.c has as default for the + * static Protocol variable to not change behaviour. + */ + return PROTOCOL_COREPLUS; +} + /**************************************************************************** Find first available connection slot, starting from a random position. The randomisation stops problems with the server dying and clients diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index d18afe3e996..e2b7ddc3e64 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -142,6 +142,7 @@ bool has_other_nonposix_opens(struct share_mode_lock *lck, int conn_num_open(struct smbd_server_connection *sconn); bool conn_snum_used(struct smbd_server_connection *sconn, int snum); +enum protocol_types conn_protocol(struct smbd_server_connection *sconn); connection_struct *conn_new(struct smbd_server_connection *sconn); bool conn_idle_all(struct smbd_server_connection *sconn, time_t t); void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint64_t vuid);