s3:loadparm/docs: Set default for "ldap ssl" to "start tls".
[samba.git] / source3 / param / loadparm.c
index d44d04a7a79e9eb011436bbd2c5481a1c30f148e..8f03ae8fd73601b71937a865aa12fcab3e35d78e 100644 (file)
@@ -722,24 +722,17 @@ static const struct enum_list enum_ldap_sasl_wrapping[] = {
 
 static const struct enum_list enum_ldap_ssl[] = {
        {LDAP_SSL_OFF, "no"},
-       {LDAP_SSL_OFF, "No"},
        {LDAP_SSL_OFF, "off"},
-       {LDAP_SSL_OFF, "Off"},
        {LDAP_SSL_START_TLS, "start tls"},
-       {LDAP_SSL_START_TLS, "Start_tls"},
+       {LDAP_SSL_START_TLS, "start_tls"},
        {-1, NULL}
 };
 
 static const struct enum_list enum_ldap_passwd_sync[] = {
        {LDAP_PASSWD_SYNC_OFF, "no"},
-       {LDAP_PASSWD_SYNC_OFF, "No"},
        {LDAP_PASSWD_SYNC_OFF, "off"},
-       {LDAP_PASSWD_SYNC_OFF, "Off"},
-       {LDAP_PASSWD_SYNC_ON, "Yes"},
        {LDAP_PASSWD_SYNC_ON, "yes"},
        {LDAP_PASSWD_SYNC_ON, "on"},
-       {LDAP_PASSWD_SYNC_ON, "On"},
-       {LDAP_PASSWD_SYNC_ONLY, "Only"},
        {LDAP_PASSWD_SYNC_ONLY, "only"},
        {-1, NULL}
 };
@@ -4585,6 +4578,51 @@ static void init_printer_values(struct service *pService)
        }
 }
 
+/**
+ * Common part of freeing allocated data for one parameter.
+ */
+static void free_one_parameter_common(void *parm_ptr,
+                                     struct parm_struct parm)
+{
+       if ((parm.type == P_STRING) ||
+           (parm.type == P_USTRING))
+       {
+               string_free((char**)parm_ptr);
+       } else if (parm.type == P_LIST) {
+               TALLOC_FREE(*((char***)parm_ptr));
+       }
+}
+
+/**
+ * Free the allocated data for one parameter for a share
+ * given as a service struct.
+ */
+static void free_one_parameter(struct service *service,
+                              struct parm_struct parm)
+{
+       void *parm_ptr;
+
+       if (parm.p_class != P_LOCAL) {
+               return;
+       }
+
+       parm_ptr = lp_local_ptr(service, parm.ptr);
+
+       free_one_parameter_common(parm_ptr, parm);
+}
+
+/**
+ * Free the allocated parameter data of a share given
+ * as a service struct.
+ */
+static void free_parameters(struct service *service)
+{
+       uint32_t i;
+
+       for (i=0; parm_table[i].label; i++) {
+               free_one_parameter(service, parm_table[i]);
+       }
+}
 
 /**
  * Free the allocated data for one parameter for a given share
@@ -4606,13 +4644,7 @@ static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
                parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
        }
 
-       if ((parm.type == P_STRING) ||
-           (parm.type == P_USTRING))
-       {
-               string_free((char**)parm_ptr);
-       } else if (parm.type == P_LIST) {
-               TALLOC_FREE(*((char***)parm_ptr));
-       }
+       free_one_parameter_common(parm_ptr, parm);
 }
 
 /**
@@ -4847,7 +4879,7 @@ static void init_globals(bool first_time_only)
        string_set(&Globals.szLdapIdmapSuffix, "");
 
        string_set(&Globals.szLdapAdminDn, "");
-       Globals.ldap_ssl = LDAP_SSL_ON;
+       Globals.ldap_ssl = LDAP_SSL_START_TLS;
        Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
        Globals.ldap_delete_dn = False;
        Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
@@ -5744,7 +5776,7 @@ static void free_service(struct service *pservice)
                DEBUG(5, ("free_service: Freeing service %s\n",
                       pservice->szService));
 
-       free_parameters_by_snum(getservicebyname(pservice->szService, NULL));
+       free_parameters(pservice);
 
        string_free(&pservice->szService);
        bitmap_free(pservice->copymap);