[PATCH] net conf list - improve error reporting

Michael Adam obnox at samba.org
Fri Jun 26 07:28:57 MDT 2015


Hi,

attached a small patch that makes it more obvious
why a 'net conf import' failed when it failed due
to e.g. a mis-spelled parameter.

review/push appreciated.

Thanks - Michael
-------------- next part --------------
From bd517b3361a31d573cdf78f58a8269a7ec03683d Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 26 Jun 2015 13:54:57 +0200
Subject: [PATCH] net:conf:import: print error message when importing fails.

If there is a mis-spelled option in a share definition,
'net conf import' will currently silently drop it
(but exit with code != 0). We want to be notified
of what went wrong.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/utils/net_conf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index e8481b4..8d9f1e6 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -339,6 +339,8 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
 
 		err = import_process_service(c, conf_ctx, service);
 		if (!SBC_ERROR_IS_OK(err)) {
+			d_printf(_("error importing service %s: %s\n"),
+				 servicename, sbcErrorString(err));
 			goto cancel;
 		}
 	} else {
@@ -376,6 +378,9 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
 			err = import_process_service(c, conf_ctx,
 						     services[sidx]);
 			if (!SBC_ERROR_IS_OK(err)) {
+				d_printf(_("error importing service %s: %s\n"),
+					 services[sidx]->name,
+					 sbcErrorString(err));
 				goto cancel;
 			}
 
-- 
2.4.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150626/6a7da766/attachment.pgp>


More information about the samba-technical mailing list