s3: smbd: Add helper function msdfs_servicename_matches_connection().
authorJeremy Allison <jra@samba.org>
Tue, 9 Aug 2022 17:49:46 +0000 (10:49 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 12 Aug 2022 18:19:31 +0000 (18:19 +0000)
Not yet used so commented out.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/msdfs.c

index 21288aaf664a86456e202dd9a513ab4131029ee2..463601cf1ee7184bbcb8e5b919aea78e3f18bde5 100644 (file)
 #include "lib/global_contexts.h"
 #include "source3/lib/substitute.h"
 
+#if 0
+/**********************************************************************
+ Function to determine if a given sharename matches a connection.
+**********************************************************************/
+
+static bool msdfs_servicename_matches_connection(struct connection_struct *conn,
+                                                const char *servicename,
+                                                const char *vfs_user)
+{
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
+       char *conn_servicename = NULL;
+       int snum;
+       bool match = false;
+
+       if (conn == NULL) {
+               /* No connection always matches. */
+               return true;
+       }
+
+       snum = SNUM(conn);
+
+       conn_servicename = lp_servicename(talloc_tos(), lp_sub, snum);
+       if (conn_servicename == NULL) {
+               DBG_ERR("lp_servicename() failed, OOM!\n");
+               return false;
+       }
+
+       if (strequal(servicename, conn_servicename)) {
+               match = true;
+               goto done;
+       }
+       if (strequal(servicename, HOMES_NAME)) {
+               match = true;
+               goto done;
+       }
+       if (strequal(vfs_user, conn_servicename)) {
+               match = true;
+               goto done;
+       }
+done:
+       TALLOC_FREE(conn_servicename);
+       return match;
+}
+#endif
+
 /**********************************************************************
  Parse a DFS pathname of the form /hostname/service/reqpath
  into the dfs_path structure.