[SCM] SAMBA-CTDB repository - branch v3-2-ctdb updated - build_3.2.7_ctdb.54-195-gace9b51

Michael Adam obnox at samba.org
Wed Mar 4 10:20:18 GMT 2009


The branch, v3-2-ctdb has been updated
       via  ace9b51a1bee3500f83a531d14ccfdea2e3f4474 (commit)
       via  c8bfcb5e352797570b1d02ca22bcac1ae5e3ca89 (commit)
       via  d7230a735d8ea4faf22652f1ec9abc341a96631f (commit)
       via  ad37b95b0fd6007f2d848cf9c8e281ed05bf1a10 (commit)
       via  daf55b73022942b06508ca549d9cd7ce89428d9d (commit)
       via  7aed4d006a5aaa9105206df346973816037fb189 (commit)
       via  a138e775e0a73a914ae762dee2da0ef0ee6c5b65 (commit)
       via  389169fbe247c4a989d9fe5394e9fd3dda1faef7 (commit)
       via  f88be619fc110c6e9ea41c50b8e03ca7eec8bcd6 (commit)
       via  2f562d57d9ba2f6e0fdf7dc35b32878e5d2115da (commit)
       via  1cdca4cd4b6a2595e284da9f999321a32741251c (commit)
       via  5e94a031c4684900c0020b36b30fdfc68b232f52 (commit)
       via  c07a2c9716ab267b04376c1cc7210e8dc59aa0dc (commit)
       via  32700b54e4082a39a09f2a36d3cb803eec91aec9 (commit)
       via  e6db18da0c93042d38f75413f95d6488c3f788ae (commit)
      from  a19b56ddc07866bbcbb92e9e79b23cc440ef49e2 (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-2-ctdb


- Log -----------------------------------------------------------------
commit ace9b51a1bee3500f83a531d14ccfdea2e3f4474
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 30 14:36:48 2009 +0100

    s3:smbconftort: don't use reserved words ('test:', 'failure:', 'success:')
    
    Temporary results printfs should not contain reserved subunit words.
    
    metze

commit c8bfcb5e352797570b1d02ca22bcac1ae5e3ca89
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 18:25:47 2009 +0100

    s3:libsmbconf: include smbconf headers with lib/smbconf prefix
    
    Michael

commit d7230a735d8ea4faf22652f1ec9abc341a96631f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 17:14:56 2009 +0100

    s3:libsmbconf: use talloc_free instead of TALLOC_FREE in txt backend
    
    Michael

commit ad37b95b0fd6007f2d848cf9c8e281ed05bf1a10
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 17:12:50 2009 +0100

    s3:libsmbconf: use talloc_free instead of TALLOC_FREE in smbconf_init
    
    Michael

commit daf55b73022942b06508ca549d9cd7ce89428d9d
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 17:11:46 2009 +0100

    s3:libsmbconf: use talloc_free instead of TALLOC_FREE in testsuite
    
    Michael

commit 7aed4d006a5aaa9105206df346973816037fb189
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 17:11:02 2009 +0100

    s3:libsmbconf: use talloc_free instead of TALLOC_FREE in smbconf_util.c
    
    Michael

commit a138e775e0a73a914ae762dee2da0ef0ee6c5b65
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 17:10:20 2009 +0100

    s3:libsmbconf: use talloc_free instead of TALLOC_FREE in smbconf.c
    
    Michael

commit 389169fbe247c4a989d9fe5394e9fd3dda1faef7
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 16:59:09 2009 +0100

    s3:libsmbconf: remove the init headers from smbconf.h
    
    give the smbconf_init() dispatcher and the backends
    (smbconf_reg and smbconf_txt) a header of their own each.
    
    This allows to use the basic infrastructure and
    single backends individually.
    
    Michael

commit f88be619fc110c6e9ea41c50b8e03ca7eec8bcd6
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 16:24:32 2009 +0100

    s3:libsmbconf: remove unused function smbconf_is_writeable_bystring()
    
    Michael

commit 2f562d57d9ba2f6e0fdf7dc35b32878e5d2115da
Author: Michael Adam <obnox at samba.org>
Date:   Fri Oct 24 10:36:29 2008 +0200

    libsmbconf: add utility function smbconf_is_writeable_bystring()
    
    This checks the writeability of a config source specified by the
    config source name.
    
    Michael

commit 1cdca4cd4b6a2595e284da9f999321a32741251c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Oct 24 00:00:20 2008 +0200

    libsmbconf: create text config in smbconftort
    
    Michael

commit 5e94a031c4684900c0020b36b30fdfc68b232f52
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 23 16:05:19 2008 +0200

    libsmbconf: return WERR_BADFILE when no path to text backend is provided.
    
    Michael

commit c07a2c9716ab267b04376c1cc7210e8dc59aa0dc
Author: Michael Adam <obnox at samba.org>
Date:   Tue Oct 21 23:20:57 2008 +0200

    libsmbconf: fall back to file backend when no valid backend was found
    
    Interpret the source string as a file name when it contains
    a ':' sign but the initial part is not a known backend.
    This might occur even implicitly when "%T" is used in an
    include file name (even though this is not realistic..).
    
    Michael

commit 32700b54e4082a39a09f2a36d3cb803eec91aec9
Author: Michael Adam <obnox at samba.org>
Date:   Tue Oct 21 23:20:31 2008 +0200

    libsmbconf: fix comment typo.
    
    Michael

commit e6db18da0c93042d38f75413f95d6488c3f788ae
Author: Michael Adam <obnox at samba.org>
Date:   Mon Oct 20 16:10:54 2008 +0200

    libsmbconf: remove unused define.
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source/include/includes.h                          |    3 +
 source/lib/smbconf/smbconf.c                       |    4 +-
 source/lib/smbconf/smbconf.h                       |   19 ----
 source/lib/smbconf/smbconf_init.c                  |   20 ++--
 .../libnet.h => lib/smbconf/smbconf_init.h}        |   20 +++--
 source/lib/smbconf/smbconf_reg.c                   |    2 +-
 .../{libnet/libnet.h => lib/smbconf/smbconf_reg.h} |   21 +++--
 source/lib/smbconf/smbconf_txt.c                   |   13 ++-
 .../{libnet/libnet.h => lib/smbconf/smbconf_txt.h} |   21 +++--
 source/lib/smbconf/smbconf_util.c                  |    4 +-
 source/lib/smbconf/testsuite.c                     |   97 +++++++++++++------
 11 files changed, 132 insertions(+), 92 deletions(-)
 copy source/{libnet/libnet.h => lib/smbconf/smbconf_init.h} (63%)
 copy source/{libnet/libnet.h => lib/smbconf/smbconf_reg.h} (65%)
 copy source/{libnet/libnet.h => lib/smbconf/smbconf_txt.h} (65%)


Changeset truncated at 500 lines:

diff --git a/source/include/includes.h b/source/include/includes.h
index c5dfa24..d140552 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -724,6 +724,9 @@ typedef char fstring[FSTRING_LEN];
 #include "async_smb.h"
 
 #include "lib/smbconf/smbconf.h"
+#include "lib/smbconf/smbconf_init.h"
+#include "lib/smbconf/smbconf_reg.h"
+#include "lib/smbconf/smbconf_txt.h"
 
 /* used in net.c */
 struct functable {
diff --git a/source/lib/smbconf/smbconf.c b/source/lib/smbconf/smbconf.c
index 5534f97..3290198 100644
--- a/source/lib/smbconf/smbconf.c
+++ b/source/lib/smbconf/smbconf.c
@@ -64,7 +64,7 @@ bool smbconf_is_writeable(struct smbconf_ctx *ctx)
  */
 void smbconf_shutdown(struct smbconf_ctx *ctx)
 {
-	TALLOC_FREE(ctx);
+	talloc_free(ctx);
 }
 
 /**
@@ -157,7 +157,7 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx,
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
diff --git a/source/lib/smbconf/smbconf.h b/source/lib/smbconf/smbconf.h
index 699a62d..517302a 100644
--- a/source/lib/smbconf/smbconf.h
+++ b/source/lib/smbconf/smbconf.h
@@ -34,25 +34,6 @@ struct smbconf_service {
 	char **param_values;
 };
 
-
-/**
- * intialization dispatcher function.
- * takes source string in the form of "backend:path"
- */
-WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
-		    const char *source);
-
-/**
- * initialization functions for the available modules
- */
-
-WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
-			const char *path);
-
-WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx,
-			struct smbconf_ctx **conf_ctx,
-			const char *path);
-
 /*
  * the smbconf API functions
  */
diff --git a/source/lib/smbconf/smbconf_init.c b/source/lib/smbconf/smbconf_init.c
index 4efc440..58bb9d9 100644
--- a/source/lib/smbconf/smbconf_init.c
+++ b/source/lib/smbconf/smbconf_init.c
@@ -18,10 +18,9 @@
  */
 
 #include "includes.h"
-#include "smbconf_private.h"
-
-#define INCLUDES_VALNAME "includes"
-
+#include "lib/smbconf/smbconf_private.h"
+#include "lib/smbconf/smbconf_txt.h"
+#include "lib/smbconf/smbconf_reg.h"
 
 /**
  * smbconf initialization dispatcher
@@ -75,21 +74,22 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
 	} else if (sep == NULL) {
 		/*
 		 * If no separator was given in the source, and the string is
-		 * not a know backend, assume file backend and use the source
+		 * not a known backend, assume file backend and use the source
 		 * string as a path argument.
 		 */
 		werr = smbconf_init_txt(mem_ctx, conf_ctx, backend);
 	} else {
 		/*
 		 * Separator was specified but this is not a known backend.
-		 * Can't handle this.
+		 * As a last resort, try to interpret the original source
+		 * string as a file name that contains a ":" sign.
+		 * This may occur with an include directive like this:
+		 * 'include = /path/to/file.%T'
 		 */
-		DEBUG(1, ("smbconf_init: ERROR - unknown backend '%s' given\n",
-			  backend));
-		werr = WERR_INVALID_PARAM;
+		werr = smbconf_init_txt(mem_ctx, conf_ctx, source);
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
diff --git a/source/libnet/libnet.h b/source/lib/smbconf/smbconf_init.h
similarity index 63%
copy from source/libnet/libnet.h
copy to source/lib/smbconf/smbconf_init.h
index 6768b94..abd62df 100644
--- a/source/libnet/libnet.h
+++ b/source/lib/smbconf/smbconf_init.h
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  libnet Support
- *  Copyright (C) Guenther Deschner 2007
+ *  libsmbconf - Samba configuration library
+ *  Copyright (C) Michael Adam 2009
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,10 +17,16 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __LIBNET_H__
-#define __LIBNET_H__
+#ifndef __LIBSMBCONF_INIT_H__
+#define __LIBSMBCONF_INIT_H__
 
-#include "librpc/gen_ndr/libnet_join.h"
-#include "libnet/libnet_proto.h"
+struct smbconf_ctx;
 
-#endif
+/**
+ * intialization dispatcher function.
+ * takes source string in the form of "backend:path"
+ */
+WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
+		    const char *source);
+
+#endif /*  _LIBSMBCONF_INIT_H_  */
diff --git a/source/lib/smbconf/smbconf_reg.c b/source/lib/smbconf/smbconf_reg.c
index 8c71c4f..59f7b62 100644
--- a/source/lib/smbconf/smbconf_reg.c
+++ b/source/lib/smbconf/smbconf_reg.c
@@ -18,7 +18,7 @@
  */
 
 #include "includes.h"
-#include "smbconf_private.h"
+#include "lib/smbconf/smbconf_private.h"
 
 #define INCLUDES_VALNAME "includes"
 
diff --git a/source/libnet/libnet.h b/source/lib/smbconf/smbconf_reg.h
similarity index 65%
copy from source/libnet/libnet.h
copy to source/lib/smbconf/smbconf_reg.h
index 6768b94..7f54b6e 100644
--- a/source/libnet/libnet.h
+++ b/source/lib/smbconf/smbconf_reg.h
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  libnet Support
- *  Copyright (C) Guenther Deschner 2007
+ *  libsmbconf - Samba configuration library
+ *  Copyright (C) Michael Adam 2009
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,10 +17,17 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __LIBNET_H__
-#define __LIBNET_H__
+#ifndef __LIBSMBCONF_REG_H__
+#define __LIBSMBCONF_REG_H__
 
-#include "librpc/gen_ndr/libnet_join.h"
-#include "libnet/libnet_proto.h"
+struct smbconf_ctx;
 
-#endif
+/**
+ * initialization functions for the registry backend modules
+ */
+
+WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
+			const char *path);
+
+
+#endif /*  _LIBSMBCONF_REG_H_  */
diff --git a/source/lib/smbconf/smbconf_txt.c b/source/lib/smbconf/smbconf_txt.c
index 1a75bed..3a6d0b8 100644
--- a/source/lib/smbconf/smbconf_txt.c
+++ b/source/lib/smbconf/smbconf_txt.c
@@ -138,7 +138,7 @@ static bool smbconf_txt_do_parameter(const char *param_name,
 	if (!(tpd->verbatim) &&
 	    smbconf_find_in_array(param_name, param_names, num_params, &idx))
 	{
-		TALLOC_FREE(param_values[idx]);
+		talloc_free(param_values[idx]);
 		param_values[idx] = talloc_strdup(cache, param_value);
 		if (param_values[idx] == NULL) {
 			return false;
@@ -160,7 +160,8 @@ static bool smbconf_txt_do_parameter(const char *param_name,
 
 static void smbconf_txt_flush_cache(struct smbconf_ctx *ctx)
 {
-	TALLOC_FREE(pd(ctx)->cache);
+	talloc_free(pd(ctx)->cache);
+	pd(ctx)->cache = NULL;
 }
 
 static WERROR smbconf_txt_init_cache(struct smbconf_ctx *ctx)
@@ -221,7 +222,7 @@ static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx)
 static WERROR smbconf_txt_init(struct smbconf_ctx *ctx, const char *path)
 {
 	if (path == NULL) {
-		path = get_dyn_CONFIGFILE();
+		return WERR_BADFILE;
 	}
 	ctx->path = talloc_strdup(ctx, path);
 	if (ctx->path == NULL) {
@@ -359,7 +360,7 @@ static WERROR smbconf_txt_get_share_names(struct smbconf_ctx *ctx,
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
@@ -458,7 +459,7 @@ static WERROR smbconf_txt_get_share(struct smbconf_ctx *ctx,
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
@@ -593,7 +594,7 @@ static WERROR smbconf_txt_get_includes(struct smbconf_ctx *ctx,
 	werr = WERR_OK;
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
diff --git a/source/libnet/libnet.h b/source/lib/smbconf/smbconf_txt.h
similarity index 65%
copy from source/libnet/libnet.h
copy to source/lib/smbconf/smbconf_txt.h
index 6768b94..688bbc9 100644
--- a/source/libnet/libnet.h
+++ b/source/lib/smbconf/smbconf_txt.h
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  libnet Support
- *  Copyright (C) Guenther Deschner 2007
+ *  libsmbconf - Samba configuration library
+ *  Copyright (C) Michael Adam 2009
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,10 +17,17 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __LIBNET_H__
-#define __LIBNET_H__
+#ifndef __LIBSMBCONF_TXT_H__
+#define __LIBSMBCONF_TXT_H__
 
-#include "librpc/gen_ndr/libnet_join.h"
-#include "libnet/libnet_proto.h"
+struct smbconf_ctx;
 
-#endif
+/**
+ * initialization functions for the text/file backend modules
+ */
+
+WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx,
+			struct smbconf_ctx **conf_ctx,
+			const char *path);
+
+#endif /*  _LIBSMBCONF_TXT_H_  */
diff --git a/source/lib/smbconf/smbconf_util.c b/source/lib/smbconf/smbconf_util.c
index 271fc47..5eb5e96 100644
--- a/source/lib/smbconf/smbconf_util.c
+++ b/source/lib/smbconf/smbconf_util.c
@@ -67,7 +67,7 @@ WERROR smbconf_init_internal(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
 	return werr;
 
 fail:
-	TALLOC_FREE(ctx);
+	talloc_free(ctx);
 	return werr;
 }
 
@@ -96,7 +96,7 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
 	} else {
 		new_array[count] = talloc_strdup(new_array, string);
 		if (new_array[count] == NULL) {
-			TALLOC_FREE(new_array);
+			talloc_free(new_array);
 			return WERR_NOMEM;
 		}
 	}
diff --git a/source/lib/smbconf/testsuite.c b/source/lib/smbconf/testsuite.c
index cffd239..56cba26 100644
--- a/source/lib/smbconf/testsuite.c
+++ b/source/lib/smbconf/testsuite.c
@@ -41,11 +41,11 @@ static bool test_get_includes(struct smbconf_ctx *ctx)
 	char **includes = NULL;
 	TALLOC_CTX *mem_ctx = talloc_stackframe();
 
-	printf("test: get_includes\n");
+	printf("TEST: get_includes\n");
 	werr = smbconf_get_global_includes(ctx, mem_ctx,
 					   &num_includes, &includes);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failure: get_includes - %s\n", dos_errstr(werr));
+		printf("FAIL: get_includes - %s\n", dos_errstr(werr));
 		goto done;
 	}
 
@@ -53,11 +53,11 @@ static bool test_get_includes(struct smbconf_ctx *ctx)
 	       (num_includes > 0) ? ":" : ".");
 	print_strings("", num_includes, (const char **)includes);
 
-	printf("success: get_includes\n");
+	printf("OK: get_includes\n");
 	ret = true;
 
 done:
-	TALLOC_FREE(mem_ctx);
+	talloc_free(mem_ctx);
 	return ret;
 }
 
@@ -75,11 +75,11 @@ static bool test_set_get_includes(struct smbconf_ctx *ctx)
 	uint32_t get_num_includes = 0;
 	TALLOC_CTX *mem_ctx = talloc_stackframe();
 
-	printf("test: set_get_includes\n");
+	printf("TEST: set_get_includes\n");
 
 	werr = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failure: get_set_includes (setting includes) - %s\n",
+		printf("FAIL: get_set_includes (setting includes) - %s\n",
 		       dos_errstr(werr));
 		goto done;
 	}
@@ -87,13 +87,13 @@ static bool test_set_get_includes(struct smbconf_ctx *ctx)
 	werr = smbconf_get_global_includes(ctx, mem_ctx, &get_num_includes,
 					   &get_includes);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failure: get_set_includes (getting includes) - %s\n",
+		printf("FAIL: get_set_includes (getting includes) - %s\n",
 		       dos_errstr(werr));
 		goto done;
 	}
 
 	if (get_num_includes != set_num_includes) {
-		printf("failure: get_set_includes - set %d includes, got %d\n",
+		printf("FAIL: get_set_includes - set %d includes, got %d\n",
 		       set_num_includes, get_num_includes);
 		goto done;
 	}
@@ -105,16 +105,16 @@ static bool test_set_get_includes(struct smbconf_ctx *ctx)
 			printf("got: \n");
 			print_strings("* ", get_num_includes,
 				      (const char **)get_includes);
-			printf("failure: get_set_includes - data mismatch:\n");
+			printf("FAIL: get_set_includes - data mismatch:\n");
 			goto done;
 		}
 	}
 
-	printf("success: set_includes\n");
+	printf("OK: set_includes\n");
 	ret = true;
 
 done:
-	TALLOC_FREE(mem_ctx);
+	talloc_free(mem_ctx);
 	return ret;
 }
 
@@ -130,18 +130,18 @@ static bool test_delete_includes(struct smbconf_ctx *ctx)
 	uint32_t get_num_includes = 0;
 	TALLOC_CTX *mem_ctx = talloc_stackframe();
 
-	printf("test: delete_includes\n");
+	printf("TEST: delete_includes\n");
 
 	werr = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failure: delete_includes (setting includes) - %s\n",
+		printf("FAIL: delete_includes (setting includes) - %s\n",
 		       dos_errstr(werr));
 		goto done;
 	}
 
 	werr = smbconf_delete_global_includes(ctx);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failure: delete_includes (deleting includes) - %s\n",
+		printf("FAIL: delete_includes (deleting includes) - %s\n",
 		       dos_errstr(werr));
 		goto done;
 	}
@@ -149,56 +149,92 @@ static bool test_delete_includes(struct smbconf_ctx *ctx)
 	werr = smbconf_get_global_includes(ctx, mem_ctx, &get_num_includes,
 					   &get_includes);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failure: delete_includes (getting includes) - %s\n",
+		printf("FAIL: delete_includes (getting includes) - %s\n",
 		       dos_errstr(werr));
 		goto done;
 	}
 
 	if (get_num_includes != 0) {
-		printf("failure: delete_includes (not empty after delete)\n");
+		printf("FAIL: delete_includes (not empty after delete)\n");
 		goto done;
 	}
 
 	werr = smbconf_delete_global_includes(ctx);
 	if (!W_ERROR_IS_OK(werr)) {
-		printf("failuer: delete_includes (delete empty includes) - "
+		printf("FAIL: delete_includes (delete empty includes) - "
 		       "%s\n", dos_errstr(werr));
 		goto done;
 	}
 
-	printf("success: delete_includes\n");
+	printf("OK: delete_includes\n");
 	ret = true;
 
 done:
 	return ret;
 }
 
+static bool create_conf_file(const char *filename)
+{
+	FILE *f;
+
+	printf("TEST: creating file\n");
+	f = sys_fopen(filename, "w");
+	if (!f) {
+		printf("failure: failed to open %s for writing: %s\n",
+		       filename, strerror(errno));
+		return false;
+	}
+
+	fprintf(f, "[global]\n");
+	fprintf(f, "\tserver string = smbconf testsuite\n");
+	fprintf(f, "\tworkgroup = SAMBA\n");
+	fprintf(f, "\tsecurity = user\n");
+
+	fclose(f);
+
+	printf("OK: create file\n");
+	return true;
+}
+
 static bool torture_smbconf_txt(void)
 {
 	WERROR werr;
 	bool ret = true;
+	const char *filename = "/tmp/smb.conf.smbconf_testsuite";
 	struct smbconf_ctx *conf_ctx = NULL;
 	TALLOC_CTX *mem_ctx = talloc_stackframe();
 
 	printf("test: text backend\n");
 
-	printf("test: init\n");
-	werr = smbconf_init_txt(mem_ctx, &conf_ctx, NULL);
+	if (!create_conf_file(filename)) {
+		ret = false;
+		goto done;


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list