s3:mdssvc: new option "spotlight backend"
[bbaumbach/samba-autobuild/.git] / source3 / param / loadparm.c
index f1f453e7ef15b5cd55cd068970421122c2af345b..31819b3930cce714c26c3ece30c4c66c67bd795e 100644 (file)
@@ -193,7 +193,7 @@ static const struct loadparm_service _sDefault =
        .map_system = false,
        .map_hidden = false,
        .map_archive = true,
-       .store_dos_attributes = false,
+       .store_dos_attributes = true,
        .dmapi_support = false,
        .locking = true,
        .strict_locking = Auto,
@@ -201,7 +201,7 @@ static const struct loadparm_service _sDefault =
        .oplocks = true,
        .kernel_oplocks = false,
        .level2_oplocks = true,
-       .mangled_names = MANGLED_NAMES_YES,
+       .mangled_names = MANGLED_NAMES_ILLEGAL,
        .wide_links = false,
        .follow_symlinks = true,
        .sync_always = false,
@@ -231,20 +231,23 @@ static const struct loadparm_service _sDefault =
        ._use_sendfile = false,
        .map_acl_inherit = false,
        .afs_share = false,
-       .ea_support = false,
+       .ea_support = true,
        .acl_check_permissions = true,
        .acl_map_full_control = true,
        .acl_group_control = false,
        .acl_allow_execute_always = false,
-       .allocation_roundup_size = SMB_ROUNDUP_ALLOCATION_SIZE,
        .aio_read_size = 1,
        .aio_write_size = 1,
-       .map_readonly = MAP_READONLY_YES,
+       .map_readonly = MAP_READONLY_NO,
        .directory_name_cache_size = 100,
        .smb_encrypt = SMB_SIGNING_DEFAULT,
        .kernel_share_modes = true,
        .durable_handles = true,
+       .check_parent_directory_delete_on_close = false,
        .param_opt = NULL,
+       .smbd_search_ask_sharemode = true,
+       .smbd_getinfo_ask_sharemode = true,
+       .spotlight_backend = SPOTLIGHT_BACKEND_TRACKER,
        .dummy = ""
 };
 
@@ -638,15 +641,15 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
        Globals._disable_spoolss = false;
        Globals.max_smbd_processes = 0;/* no limit specified */
        Globals.username_level = 0;
-       Globals.deadtime = 0;
+       Globals.deadtime = 10080;
        Globals.getwd_cache = true;
        Globals.large_readwrite = true;
        Globals.max_log_size = 5000;
        Globals.max_open_files = max_open_files();
        Globals.server_max_protocol = PROTOCOL_SMB3_11;
-       Globals.server_min_protocol = PROTOCOL_LANMAN1;
+       Globals.server_min_protocol = PROTOCOL_SMB2_02;
        Globals._client_max_protocol = PROTOCOL_DEFAULT;
-       Globals.client_min_protocol = PROTOCOL_CORE;
+       Globals.client_min_protocol = PROTOCOL_SMB2_02;
        Globals._client_ipc_max_protocol = PROTOCOL_DEFAULT;
        Globals._client_ipc_min_protocol = PROTOCOL_DEFAULT;
        Globals._security = SEC_AUTO;
@@ -695,7 +698,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
        Globals.nt_status_support = true; /* Use NT status by default. */
        Globals.smbd_profiling_level = 0;
        Globals.stat_cache = true;      /* use stat cache by default */
-       Globals.max_stat_cache_size = 256; /* 256k by default */
+       Globals.max_stat_cache_size = 512; /* 512k by default */
        Globals.restrict_anonymous = 0;
        Globals.client_lanman_auth = false;     /* Do NOT use the LanMan hash if it is available */
        Globals.client_plaintext_auth = false;  /* Do NOT use a plaintext password even if is requested by the server */
@@ -711,11 +714,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
        Globals.oplock_break_wait_time = 0;     /* By Default, 0 msecs. */
        Globals.enhanced_browsing = true;
        Globals.lock_spin_time = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
-#ifdef MMAP_BLACKLIST
-       Globals.use_mmap = false;
-#else
        Globals.use_mmap = true;
-#endif
        Globals.unicode = true;
        Globals.unix_extensions = true;
        Globals.reset_on_zero_vc = false;
@@ -894,6 +893,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
        Globals._preferred_master = Auto;
 
        Globals.allow_dns_updates = DNS_UPDATE_SIGNED;
+       Globals.dns_zone_scavenging = false;
 
        lpcfg_string_set(Globals.ctx, &Globals.ntp_signd_socket_directory,
                         get_dyn_NTP_SIGND_SOCKET_DIR());
@@ -916,13 +916,15 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
        Globals.dns_update_command = str_list_make_v3_const(NULL, s, NULL);
        TALLOC_FREE(s);
 
-       s = talloc_asprintf(talloc_tos(), "%s/samba_gpoupdate", get_dyn_SCRIPTSBINDIR());
+       s = talloc_asprintf(talloc_tos(), "%s/samba-gpupdate", get_dyn_SCRIPTSBINDIR());
        if (s == NULL) {
                smb_panic("init_globals: ENOMEM");
        }
        Globals.gpo_update_command = str_list_make_v3_const(NULL, s, NULL);
        TALLOC_FREE(s);
 
+       Globals.apply_group_policies = false;
+
        s = talloc_asprintf(talloc_tos(), "%s/samba_spnupdate", get_dyn_SCRIPTSBINDIR());
        if (s == NULL) {
                smb_panic("init_globals: ENOMEM");
@@ -944,8 +946,6 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
 
        Globals.kpasswd_port = 464;
 
-       Globals.web_port = 901;
-
        Globals.aio_max_threads = 100;
 
        lpcfg_string_set(Globals.ctx,
@@ -953,7 +953,9 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
                         "49152-65535");
        Globals.rpc_low_port = SERVER_TCP_LOW_PORT;
        Globals.rpc_high_port = SERVER_TCP_HIGH_PORT;
-       Globals.prefork_children = 1;
+       Globals.prefork_children = 4;
+       Globals.prefork_backoff_increment = 10;
+       Globals.prefork_maximum_backoff = 120;
 
        /* Now put back the settings that were set with lp_set_cmdline() */
        apply_lp_set_cmdline();
@@ -1527,6 +1529,7 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
                 const char *user, const char *pszHomedir)
 {
        int i;
+       char *global_path;
 
        if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
                        pszHomedir[0] == '\0') {
@@ -1538,12 +1541,13 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
        if (i < 0)
                return false;
 
+       global_path = lp_path(talloc_tos(), GLOBAL_SECTION_SNUM);
        if (!(*(ServicePtrs[iDefaultService]->path))
-           || strequal(ServicePtrs[iDefaultService]->path,
-                       lp_path(talloc_tos(), GLOBAL_SECTION_SNUM))) {
+           || strequal(ServicePtrs[iDefaultService]->path, global_path)) {
                lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->path,
                                 pszHomedir);
        }
+       TALLOC_FREE(global_path);
 
        if (!(*(ServicePtrs[i]->comment))) {
                char *comment = talloc_asprintf(talloc_tos(), "Home directory of %s", user);
@@ -1830,8 +1834,8 @@ static bool is_synonym_of(int parm1, int parm2, bool *inverse)
 
 static void show_parameter(int parmIndex)
 {
-       int enumIndex, flagIndex;
-       int parmIndex2;
+       size_t enumIndex, flagIndex;
+       size_t parmIndex2;
        bool hadFlag;
        bool hadSyn;
        bool inverse;
@@ -2763,7 +2767,6 @@ bool lp_do_section(const char *pszSectionName, void *userdata)
        bool bRetval;
        bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
                         (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
-       bRetval = false;
 
        /* if we were in a global section then do the local inits */
        if (bInGlobalSection && !isglobal)
@@ -3861,8 +3864,6 @@ static bool lp_load_ex(const char *pszFname,
        TALLOC_CTX *frame = talloc_stackframe();
        struct loadparm_context *lp_ctx;
 
-       bRetval = false;
-
        DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
 
        bInGlobalSection = true;
@@ -4114,7 +4115,7 @@ bool lp_load_with_registry_shares(const char *pszFname)
                          false, /* global_only */
                          true,  /* save_defaults */
                          false, /* add_ipc */
-                         false, /* reinit_globals */
+                         true, /* reinit_globals */
                          true,  /* allow_include_registry */
                          true); /* load_all_shares*/
 }
@@ -4153,6 +4154,7 @@ void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
                fprintf(f,"\n");
                lp_dump_one(f, show_defaults, iService);
        }
+       TALLOC_FREE(lp_ctx);
 }
 
 /***************************************************************************
@@ -4206,7 +4208,7 @@ int lp_servicenumber(const char *pszServiceName)
 
                if (!usershare_exists(iService, &last_mod)) {
                        /* Remove the share security tdb entry for it. */
-                       delete_share_security(lp_servicename(talloc_tos(), iService));
+                       delete_share_security(lp_const_servicename(iService));
                        /* Remove it from the array. */
                        free_service_byindex(iService);
                        /* Doesn't exist anymore. */
@@ -4239,15 +4241,47 @@ const char *volume_label(TALLOC_CTX *ctx, int snum)
 {
        char *ret;
        const char *label = lp_volume(ctx, snum);
+       size_t end = 32;
+
        if (!*label) {
                label = lp_servicename(ctx, snum);
        }
 
-       /* This returns a 33 byte guarenteed null terminated string. */
-       ret = talloc_strndup(ctx, label, 32);
+       /*
+        * Volume label can be a max of 32 bytes. Make sure to truncate
+        * it at a codepoint boundary if it's longer than 32 and contains
+        * multibyte characters. Windows insists on a volume label being
+        * a valid mb sequence, and errors out if not.
+        */
+       if (strlen(label) > 32) {
+               /*
+                * A MB char can be a max of 5 bytes, thus
+                * we should have a valid mb character at a
+                * minimum position of (32-5) = 27.
+                */
+               while (end >= 27) {
+                       /*
+                        * Check if a codepoint starting from next byte
+                        * is valid. If yes, then the current byte is the
+                        * end of a MB or ascii sequence and the label can
+                        * be safely truncated here. If not, keep going
+                        * backwards till a valid codepoint is found.
+                        */
+                       size_t len = 0;
+                       const char *s = &label[end];
+                       codepoint_t c = next_codepoint(s, &len);
+                       if (c != INVALID_CODEPOINT) {
+                               break;
+                       }
+                       end--;
+               }
+       }
+
+       /* This returns a max of 33 byte guarenteed null terminated string. */
+       ret = talloc_strndup(ctx, label, end);
        if (!ret) {
                return "";
-       }               
+       }
        return ret;
 }
 
@@ -4523,10 +4557,10 @@ void widelinks_warning(int snum)
        }
 
        if (lp_unix_extensions() && lp_wide_links(snum)) {
-               DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
+               DBG_ERR("Share '%s' has wide links and unix extensions enabled. "
                        "These parameters are incompatible. "
                        "Wide links will be disabled for this share.\n",
-                        lp_servicename(talloc_tos(), snum) ));
+                        lp_const_servicename(snum));
        }
 }