Introduce lp_safe_widelinks()
authorSimo Sorce <idra@samba.org>
Thu, 11 Feb 2010 21:12:29 +0000 (16:12 -0500)
committerSimo Sorce <idra@samba.org>
Thu, 11 Feb 2010 21:27:17 +0000 (16:27 -0500)
This way we avoid any chance that a configuration reload may turn
back on wide links when unix extensions are enabled.

source3/include/proto.h
source3/param/loadparm.c
source3/smbd/filename.c
source3/smbd/service.c
source3/smbd/vfs.c

index 95519e318f7a7c4d9692b58f7b2cc16a7d7e5c75..3549ea6c62e3f06118f26806b6d7fe1b59bce32b 100644 (file)
@@ -4393,6 +4393,7 @@ void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
 int lp_min_receive_file_size(void);
 char* lp_perfcount_module(void);
 void lp_set_passdb_backend(const char *backend);
+bool lp_safe_widelinks(int snum);
 
 /* The following definitions come from param/util.c  */
 
index 8308e995660629a2684e624da794f264705e171e..4b6fa83b048765b4543eef435a60a49f5db65964 100644 (file)
@@ -9891,3 +9891,19 @@ void lp_set_passdb_backend(const char *backend)
 {
        string_set(&Globals.szPassdbBackend, backend);
 }
+
+/*******************************************************************
+ Safe wide links checks.
+ This helper function always verify the validity of wide links,
+ even after a configuration file reload.
+********************************************************************/
+
+bool lp_safe_widelinks(int snum)
+{
+       /* wide links is always incompatible with unix extensions */
+       if (lp_unix_extensions()) {
+               return false;
+       }
+
+       return lp_widelinks(snum);
+}
index ab79dfd9269c48eac05b545fdc3e4bb103cf4e35..73a3c3606282daefb01d633b7187b4148d0e027e 100644 (file)
@@ -854,7 +854,7 @@ NTSTATUS check_name(connection_struct *conn, const char *name)
                }
        }
 
-       if (!lp_widelinks(SNUM(conn)) || !lp_symlinks(SNUM(conn))) {
+       if (!lp_safe_widelinks(SNUM(conn)) || !lp_symlinks(SNUM(conn))) {
                NTSTATUS status = check_reduced_name(conn,name);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(5,("check_name: name %s failed with %s\n",name,
index 1e8c15bfde3a8d367a51bc01e6c34d6adfdbb83b..4efa63e1dcff69d6ac87319b5cc2f1faac05094b 100644 (file)
@@ -858,12 +858,14 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
        }
 
 /* ROOT Activities: */ 
+       /* explicitly check with lp_widelinks() instead of using
+        * lp_safe_widelinks() here so that we can correctly warn
+        * in the logs. */
        if (lp_unix_extensions() && lp_widelinks(snum)) {
                DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
                        "These parameters are incompatible. "
-                       "Disabling wide links for this share.\n",
+                       "Wide links will be disabled for this share.\n",
                        lp_servicename(snum) ));
-               lp_do_parameter(snum, "wide links", "False");
        }
 
        /*
@@ -959,7 +961,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
         * below this directory. We must do this after the VFS init as we
         * depend on the realpath() pointer in the vfs table. JRA.
         */
-       if (!lp_widelinks(snum)) {
+       if (!lp_safe_widelinks(snum)) {
                if (!canonicalize_connect_path(conn)) {
                        DEBUG(0, ("canonicalize_connect_path failed "
                        "for service %s, path %s\n",
index 94bdb1f495c423ce3eb0c252ec3e0c6b3f0308b1..b575800335d69b65aaa2d2117439c26cce70873d 100644 (file)
@@ -928,7 +928,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
        }
 
        /* Check for widelinks allowed. */
-       if (!lp_widelinks(SNUM(conn))) {
+       if (!lp_safe_widelinks(SNUM(conn))) {
                    const char *conn_rootdir;
 
                    conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);