[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Fri Jul 22 08:54:03 MDT 2011


The branch, master has been updated
       via  efbe160 s3:loadparm: fix the reload of the configuration: also reload activated registry shares
       via  ec113a5 s3:loadparm: add reload_registry_shares() - reload only those shares already loaded
       via  2b4bb9b s3:smbclient: print nt status code when smb echo fails
       via  d67a91b s3:smbclient: add a "tdis" command to view and change the tree id (tid).
       via  7327bde s3:smbclient: add a "tdis" command to do a tree disconnect (close a connection to a share)
       via  88d0e44 s3:smbclient: add a "tcon" command to do a tree connect (connect to a share)
       via  281c6d0 s3:smbclient: add "logoff" command to close the session
      from  a11cc88 s3:libsmb: move cli_state->outgoing to cli_state->conn.outgoing

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit efbe1602bd014eada4811f336bdccbf4692d3807
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 10:11:52 2011 +0200

    s3:loadparm: fix the reload of the configuration: also reload activated registry shares
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Fri Jul 22 16:53:49 CEST 2011 on sn-devel-104

commit ec113a58a4dc4e4f3ea03f7818eb312325f69482
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 10:10:43 2011 +0200

    s3:loadparm: add reload_registry_shares() - reload only those shares already loaded

commit 2b4bb9b7a127dbaae9af8b1d48e56986ef70b974
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 15:38:38 2011 +0200

    s3:smbclient: print nt status code when smb echo fails

commit d67a91b9556a81318fd36d7f17ce327e5f6d44e0
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 14:12:13 2011 +0200

    s3:smbclient: add a "tdis" command to view and change the tree id (tid).
    
    This low level command can be used to switch between tree connects in one
    session.

commit 7327bde81acecf4ae0c09f80cebe21a1312aeb3a
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 14:11:34 2011 +0200

    s3:smbclient: add a "tdis" command to do a tree disconnect (close a connection to a share)

commit 88d0e44df340e5954b2f57c779c2a49a5fac0b11
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 14:10:38 2011 +0200

    s3:smbclient: add a "tcon" command to do a tree connect (connect to a share)

commit 281c6d02bdcc9988c0f1660a3c77ba4b3db3dc6d
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jul 22 14:08:03 2011 +0200

    s3:smbclient: add "logoff" command to close the session

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

Summary of changes:
 source3/client/client.c  |  101 +++++++++++++++++++++++++++++++++++++++++++++-
 source3/param/loadparm.c |   37 ++++++++++++++++-
 2 files changed, 134 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/client.c b/source3/client/client.c
index 1cf4410..8c797e5 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4308,6 +4308,99 @@ static int cmd_logon(void)
 	return 0;
 }
 
+/**
+ * close the session
+ */
+
+static int cmd_logoff(void)
+{
+	NTSTATUS status;
+
+	status = cli_ulogoff(cli);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("logoff failed: %s\n", nt_errstr(status));
+		return -1;
+	}
+
+	d_printf("logoff successful\n");
+	return 0;
+}
+
+
+/**
+ * tree connect (connect to a share)
+ */
+
+static int cmd_tcon(void)
+{
+	TALLOC_CTX *ctx = talloc_tos();
+	char *sharename;
+	NTSTATUS status;
+
+	if (!next_token_talloc(ctx, &cmd_ptr, &sharename, NULL)) {
+		d_printf("tcon <sharename>\n");
+		return 0;
+	}
+
+	if (!sharename) {
+		return 1;
+	}
+
+	status = cli_tcon_andx(cli, sharename, "?????", "", 0);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("tcon failed: %s\n", nt_errstr(status));
+		return -1;
+	}
+
+	talloc_free(sharename);
+
+	d_printf("tcon to %s successful, tid: %u\n", sharename,
+		 cli_state_get_tid(cli));
+	return 0;
+}
+
+/**
+ * tree disconnect (disconnect from a share)
+ */
+
+static int cmd_tdis(void)
+{
+	NTSTATUS status;
+
+	status = cli_tdis(cli);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("tdis failed: %s\n", nt_errstr(status));
+		return -1;
+	}
+
+	d_printf("tdis successful\n");
+	return 0;
+}
+
+
+/**
+ * get or set tid
+ */
+
+static int cmd_tid(void)
+{
+	TALLOC_CTX *ctx = talloc_tos();
+	char *tid_str;
+
+	if (!next_token_talloc(ctx, &cmd_ptr, &tid_str, NULL)) {
+		if (cli_state_has_tcon(cli)) {
+			d_printf("current tid is %d\n", cli_state_get_tid(cli));
+		} else {
+			d_printf("no tcon currently\n");
+		}
+	} else {
+		uint16_t tid = atoi(tid_str);
+		cli_state_set_tid(cli, tid);
+	}
+
+	return 0;
+}
+
 
 /****************************************************************************
  list active connections
@@ -4497,6 +4590,10 @@ static struct {
   {"logon",cmd_logon,"establish new logon",{COMPL_NONE,COMPL_NONE}},
   {"listconnect",cmd_list_connect,"list open connections",{COMPL_NONE,COMPL_NONE}},
   {"showconnect",cmd_show_connect,"display the current active connection",{COMPL_NONE,COMPL_NONE}},
+  {"tcon",cmd_tcon,"connect to a share" ,{COMPL_NONE,COMPL_NONE}},
+  {"tdis",cmd_tdis,"disconnect from a share",{COMPL_NONE,COMPL_NONE}},
+  {"tid",cmd_tid,"show or set the current tid (tree-id)",{COMPL_NONE,COMPL_NONE}},
+  {"logoff",cmd_logoff,"log off (close the session)",{COMPL_NONE,COMPL_NONE}},
   {"..",cmd_cd_oneup,"change the remote directory (up one level)",{COMPL_REMOTE,COMPL_NONE}},
 
   /* Yes, this must be here, see crh's comment above. */
@@ -4927,8 +5024,8 @@ static void readline_callback(void)
 	memset(garbage, 0xf0, sizeof(garbage));
 	status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(0, ("SMBecho failed. Maybe server has closed "
-			"the connection\n"));
+		DEBUG(0, ("SMBecho failed (%s). Maybe server has closed "
+			"the connection\n", nt_errstr(status)));
 		finished = true;
 		smb_readline_done();
 	}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 16eb719..6cab934 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -6743,6 +6743,35 @@ done:
 	return ret;
 }
 
+/**
+ * reload those shares from registry that are already
+ * activated in the services array.
+ */
+static bool reload_registry_shares(void)
+{
+	int i;
+	bool ret = true;
+
+	for (i = 0; i < iNumServices; i++) {
+		if (!VALID(i)) {
+			continue;
+		}
+
+		if (ServicePtrs[i]->usershare == USERSHARE_VALID) {
+			continue;
+		}
+
+		ret = process_registry_service(ServicePtrs[i]->szService);
+		if (!ret) {
+			goto done;
+		}
+	}
+
+done:
+	return ret;
+}
+
+
 #define MAX_INCLUDE_DEPTH 100
 
 static uint8_t include_depth;
@@ -9013,8 +9042,12 @@ static bool lp_load_ex(const char *pszFname,
 		bRetval = false;
 	}
 
-	if (bRetval && lp_registry_shares() && allow_registry_shares) {
-		bRetval = process_registry_shares();
+	if (bRetval && lp_registry_shares()) {
+		if (allow_registry_shares) {
+			bRetval = process_registry_shares();
+		} else {
+			bRetval = reload_registry_shares();
+		}
 	}
 
 	lp_add_auto_services(lp_auto_services());


-- 
Samba Shared Repository


More information about the samba-cvs mailing list