pyldb: avoid segfault when adding an element with no name
[sfrench/samba-autobuild/.git] / lib / param / loadparm.c
index f31ef2319ac67b9b5d09cc90a0592ae07742a9e5..ebbccc22b71b5e863f9dee02e4c9d8eea862212f 100644 (file)
@@ -331,13 +331,21 @@ int lp_int(const char *s)
  */
 unsigned long lp_ulong(const char *s)
 {
+       int error = 0;
+       unsigned long int ret;
 
        if (!s || !*s) {
-               DEBUG(0,("lp_ulong(%s): is called with NULL!\n",s));
+               DBG_DEBUG("lp_ulong(%s): is called with NULL!\n",s);
                return -1;
        }
 
-       return strtoul(s, NULL, 0);
+       ret = strtoul_err(s, NULL, 0, &error);
+       if (error != 0) {
+               DBG_DEBUG("lp_ulong(%s): conversion failed\n",s);
+               return -1;
+       }
+
+       return ret;
 }
 
 /**
@@ -345,13 +353,21 @@ unsigned long lp_ulong(const char *s)
  */
 unsigned long long lp_ulonglong(const char *s)
 {
+       int error = 0;
+       unsigned long long int ret;
 
        if (!s || !*s) {
-               DEBUG(0, ("lp_ulonglong(%s): is called with NULL!\n", s));
+               DBG_DEBUG("lp_ulonglong(%s): is called with NULL!\n", s);
                return -1;
        }
 
-       return strtoull(s, NULL, 0);
+       ret = strtoull_err(s, NULL, 0, &error);
+       if (error != 0) {
+               DBG_DEBUG("lp_ulonglong(%s): conversion failed\n",s);
+               return -1;
+       }
+
+       return ret;
 }
 
 /**
@@ -2761,7 +2777,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
        lpcfg_do_global_parameter(lp_ctx, "cldap port", "389");
        lpcfg_do_global_parameter(lp_ctx, "krb5 port", "88");
        lpcfg_do_global_parameter(lp_ctx, "kpasswd port", "464");
-       lpcfg_do_global_parameter(lp_ctx, "web port", "901");
 
        lpcfg_do_global_parameter(lp_ctx, "nt status support", "True");
 
@@ -2930,7 +2945,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
        lpcfg_do_global_parameter(lp_ctx, "durable handles", "yes");
 
-       lpcfg_do_global_parameter(lp_ctx, "max stat cache size", "256");
+       lpcfg_do_global_parameter(lp_ctx, "max stat cache size", "512");
 
        lpcfg_do_global_parameter(lp_ctx, "ldap passwd sync", "no");
 
@@ -3008,6 +3023,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
        lpcfg_do_global_parameter(lp_ctx, "store dos attributes", "yes");
 
+       lpcfg_do_global_parameter(lp_ctx, "debug encryption", "no");
+
        for (i = 0; parm_table[i].label; i++) {
                if (!(lp_ctx->flags[i] & FLAG_CMDLINE)) {
                        lp_ctx->flags[i] |= FLAG_DEFAULT;