[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Mon Feb 10 19:27:03 UTC 2020
The branch, master has been updated
via f5d330403bb smbclient4: Remove unused code
via e9c1c822f88 smbclient: Don't cli_posix_stat() twice
via e033dafd142 dbwrap: Improve an error message
from c90824a24a5 krb5_wrap: map KRB5_REALM_UNKNOWN to NT_STATUS_NO_SUCH_DOMAIN
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f5d330403bb36a5fea83c82e83d79111e8ead1de
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 7 14:47:25 2020 +0200
smbclient4: Remove unused code
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Feb 10 19:26:37 UTC 2020 on sn-devel-184
commit e9c1c822f88fcfe156b289c5a9831a06ef914427
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 7 14:11:13 2020 +0200
smbclient: Don't cli_posix_stat() twice
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e033dafd142e60c296872a8d7c2c8e80ef4c4ec0
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jan 27 14:15:42 2020 +0100
dbwrap: Improve an error message
Include the path where db_open() tried to find the ctdb socket
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/client/client.c | 2 +-
source3/lib/dbwrap/dbwrap_open.c | 5 +-
source4/client/tree.c | 809 ---------------------------------------
3 files changed, 4 insertions(+), 812 deletions(-)
delete mode 100644 source4/client/tree.c
Changeset truncated at 500 lines:
diff --git a/source3/client/client.c b/source3/client/client.c
index 76180fc5ba7..d907890ddaf 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3814,7 +3814,7 @@ static int cmd_getfacl(void)
}
status = cli_posix_stat(targetcli, targetname, &sbuf);
- if (!NT_STATUS_IS_OK(cli_posix_stat(targetcli, targetname, &sbuf))) {
+ if (!NT_STATUS_IS_OK(status)) {
d_printf("%s getfacl doing a stat on file %s\n",
nt_errstr(status), src);
return 1;
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 20084bca471..eac52c5a431 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -131,8 +131,9 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
sockname = lp_ctdbd_socket();
if (!socket_exist(sockname)) {
- DEBUG(1, ("ctdb socket does not exist - is ctdb not "
- "running?\n"));
+ DBG_WARNING("ctdb socket does %s not exist - "
+ "is ctdb not running?\n",
+ sockname);
return NULL;
}
diff --git a/source4/client/tree.c b/source4/client/tree.c
deleted file mode 100644
index 035192126cf..00000000000
--- a/source4/client/tree.c
+++ /dev/null
@@ -1,809 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB client GTK+ tree-based application
- Copyright (C) Andrew Tridgell 1998
- Copyright (C) Richard Sharpe 2001
- Copyright (C) John Terpstra 2001
-
- 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
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/* example-gtk+ application, ripped off from the gtk+ tree.c sample */
-
-#include <stdio.h>
-#include <errno.h>
-#include <gtk/gtk.h>
-#include "libsmbclient.h"
-
-static GtkWidget *clist;
-
-struct tree_data {
-
- guint32 type; /* Type of tree item, an SMBC_TYPE */
- char name[256]; /* May need to change this later */
-
-};
-
-void error_message(gchar *message) {
-
- GtkWidget *dialog, *label, *okay_button;
-
- /* Create the widgets */
-
- dialog = gtk_dialog_new();
- gtk_window_set_modal(GTK_WINDOW(dialog), True);
- label = gtk_label_new (message);
- okay_button = gtk_button_new_with_label("Okay");
-
- /* Ensure that the dialog box is destroyed when the user clicks ok. */
-
- gtk_signal_connect_object (GTK_OBJECT (okay_button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy), dialog);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area),
- okay_button);
-
- /* Add the label, and show everything we've added to the dialog. */
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
- label);
- gtk_widget_show_all (dialog);
-}
-
-/*
- * We are given a widget, and we want to retrieve its URL so we
- * can do a directory listing.
- *
- * We walk back up the tree, picking up pieces until we hit a server or
- * workgroup type and return a path from there
- */
-
-static char path_string[1024];
-
-char *get_path(GtkWidget *item)
-{
- GtkWidget *p = item;
- struct tree_data *pd;
- char *comps[1024]; /* We keep pointers to the components here */
- int i = 0, j, level,type;
-
- /* Walk back up the tree, getting the private data */
-
- level = GTK_TREE(item->parent)->level;
-
- /* Pick up this item's component info */
-
- pd = (struct tree_data *)gtk_object_get_user_data(GTK_OBJECT(item));
-
- comps[i++] = pd->name;
- type = pd->type;
-
- while (level > 0 && type != SMBC_SERVER && type != SMBC_WORKGROUP) {
-
- /* Find the parent and extract the data etc ... */
-
- p = GTK_WIDGET(p->parent);
- p = GTK_WIDGET(GTK_TREE(p)->tree_owner);
-
- pd = (struct tree_data *)gtk_object_get_user_data(GTK_OBJECT(p));
-
- level = GTK_TREE(item->parent)->level;
-
- comps[i++] = pd->name;
- type = pd->type;
-
- }
-
- /*
- * Got a list of comps now, should check that we did not hit a workgroup
- * when we got other things as well ... Later
- *
- * Now, build the path
- */
-
- snprintf(path_string, sizeof(path_string), "smb:/");
-
- for (j = i - 1; j >= 0; j--) {
-
- strncat(path_string, "/", sizeof(path_string) - strlen(path_string));
- strncat(path_string, comps[j], sizeof(path_string) - strlen(path_string));
-
- }
-
- fprintf(stdout, "Path string = %s\n", path_string);
-
- return path_string;
-
-}
-
-struct tree_data *make_tree_data(guint32 type, const char *name)
-{
- struct tree_data *p = malloc_p(struct tree_data);
-
- if (p) {
-
- p->type = type;
- strncpy(p->name, name, sizeof(p->name));
-
- }
-
- return p;
-
-}
-
-/* Note that this is called every time the user clicks on an item,
- whether it is already selected or not. */
-static void cb_select_child (GtkWidget *root_tree, GtkWidget *child,
- GtkWidget *subtree)
-{
- gint dh, err, dirlen;
- char dirbuf[512];
- struct smbc_dirent *dirp;
- struct stat st1;
- char path[1024], path1[1024];
-
- g_print ("select_child called for root tree %p, subtree %p, child %p\n",
- root_tree, subtree, child);
-
- /* Now, figure out what it is, and display it in the clist ... */
-
- gtk_clist_clear(GTK_CLIST(clist)); /* Clear the CLIST */
-
- /* Now, get the private data for the subtree */
-
- strncpy(path, get_path(child), 1024);
-
- if ((dh = smbc_opendir(path)) < 0) { /* Handle error */
-
- g_print("cb_select_child: Could not open dir %s, %s\n", path,
- strerror(errno));
-
- gtk_main_quit();
-
- return;
-
- }
-
- while ((err = smbc_getdents(dh, (struct smbc_dirent *)dirbuf,
- sizeof(dirbuf))) != 0) {
-
- if (err < 0) {
-
- g_print("cb_select_child: Could not read dir %s, %s\n", path,
- strerror(errno));
-
- gtk_main_quit();
-
- return;
-
- }
-
- dirp = (struct smbc_dirent *)dirbuf;
-
- while (err > 0) {
- gchar col1[128], col2[128], col3[128], col4[128];
- gchar *rowdata[4] = {col1, col2, col3, col4};
-
- dirlen = dirp->dirlen;
-
- /* Format each of the items ... */
-
- strncpy(col1, dirp->name, 128);
-
- col2[0] = col3[0] = col4[0] = (char)0;
-
- switch (dirp->smbc_type) {
-
- case SMBC_WORKGROUP:
-
- break;
-
- case SMBC_SERVER:
-
- strncpy(col2, (dirp->comment?dirp->comment:""), 128);
-
- break;
-
- case SMBC_FILE_SHARE:
-
- strncpy(col2, (dirp->comment?dirp->comment:""), 128);
-
- break;
-
- case SMBC_PRINTER_SHARE:
-
- strncpy(col2, (dirp->comment?dirp->comment:""), 128);
- break;
-
- case SMBC_COMMS_SHARE:
-
- break;
-
- case SMBC_IPC_SHARE:
-
- break;
-
- case SMBC_DIR:
- case SMBC_FILE:
-
- /* Get stats on the file/dir and see what we have */
-
- if (!ISDOT(dirp->name) && !ISDOTDOT(dirp->name)) {
-
- strncpy(path1, path, sizeof(path1));
- strncat(path1, "/", sizeof(path) - strlen(path));
- strncat(path1, dirp->name, sizeof(path) - strlen(path));
-
- if (smbc_stat(path1, &st1) < 0) {
-
- if (errno != EBUSY) {
-
- g_print("cb_select_child: Could not stat file %s, %s\n", path1,
- strerror(errno));
-
- gtk_main_quit();
-
- return;
-
- }
- else {
-
- strncpy(col2, "Device or resource busy", sizeof(col2));
-
- }
- }
- else {
- /* Now format each of the relevant things ... */
-
- snprintf(col2, sizeof(col2), "%c%c%c%c%c%c%c%c%c(%0X)",
- (st1.st_mode&S_IRUSR?'r':'-'),
- (st1.st_mode&S_IWUSR?'w':'-'),
- (st1.st_mode&S_IXUSR?'x':'-'),
- (st1.st_mode&S_IRGRP?'r':'-'),
- (st1.st_mode&S_IWGRP?'w':'-'),
- (st1.st_mode&S_IXGRP?'x':'-'),
- (st1.st_mode&S_IROTH?'r':'-'),
- (st1.st_mode&S_IWOTH?'w':'-'),
- (st1.st_mode&S_IXOTH?'x':'-'),
- st1.st_mode);
- snprintf(col3, sizeof(col3), "%u", st1.st_size);
- snprintf(col4, sizeof(col4), "%s", ctime(&st1.st_mtime));
- }
- }
-
- break;
-
- default:
-
- break;
- }
-
- gtk_clist_append(GTK_CLIST(clist), rowdata);
-
- (char *)dirp += dirlen;
- err -= dirlen;
-
- }
-
- }
-
-}
-
-/* Note that this is never called */
-static void cb_unselect_child( GtkWidget *root_tree,
- GtkWidget *child,
- GtkWidget *subtree )
-{
- g_print ("unselect_child called for root tree %p, subtree %p, child %p\n",
- root_tree, subtree, child);
-}
-
-/* for all the GtkItem:: and GtkTreeItem:: signals */
-static void cb_itemsignal( GtkWidget *item,
- gchar *signame )
-{
- GtkWidget *real_tree, *aitem, *subtree;
- gchar *name;
- GtkLabel *label;
- gint dh, err, dirlen, level;
- char dirbuf[512];
- struct smbc_dirent *dirp;
-
- label = GTK_LABEL (GTK_BIN (item)->child);
- /* Get the text of the label */
- gtk_label_get (label, &name);
-
- level = GTK_TREE(item->parent)->level;
-
- /* Get the level of the tree which the item is in */
- g_print ("%s called for item %s->%p, level %d\n", signame, name,
- item, GTK_TREE (item->parent)->level);
-
- real_tree = GTK_TREE_ITEM_SUBTREE(item); /* Get the subtree */
-
- if (strncmp(signame, "expand", 6) == 0) { /* Expand called */
- char server[128];
-
- if ((dh = smbc_opendir(get_path(item))) < 0) { /* Handle error */
- gchar errmsg[256];
-
- g_print("cb_itemsignal: Could not open dir %s, %s\n", get_path(item),
- strerror(errno));
-
- slprintf(errmsg, sizeof(errmsg), "cb_itemsignal: Could not open dir %s, %s\n", get_path(item), strerror(errno));
-
- error_message(errmsg);
-
- /* gtk_main_quit();*/
-
- return;
-
- }
-
- while ((err = smbc_getdents(dh, (struct smbc_dirent *)dirbuf,
- sizeof(dirbuf))) != 0) {
-
- if (err < 0) { /* An error, report it */
- gchar errmsg[256];
-
- g_print("cb_itemsignal: Could not read dir smbc://, %s\n",
- strerror(errno));
-
- slprintf(errmsg, sizeof(errmsg), "cb_itemsignal: Could not read dir smbc://, %s\n", strerror(errno));
-
- error_message(errmsg);
-
- /* gtk_main_quit();*/
-
- return;
-
- }
-
- dirp = (struct smbc_dirent *)dirbuf;
-
- while (err > 0) {
- struct tree_data *my_data;
-
- dirlen = dirp->dirlen;
-
- my_data = make_tree_data(dirp->smbc_type, dirp->name);
-
- if (!my_data) {
-
- g_print("Could not allocate space for tree_data: %s\n",
- dirp->name);
-
- gtk_main_quit();
- return;
-
- }
-
- aitem = gtk_tree_item_new_with_label(dirp->name);
-
- /* Connect all GtkItem:: and GtkTreeItem:: signals */
- gtk_signal_connect (GTK_OBJECT(aitem), "select",
- GTK_SIGNAL_FUNC(cb_itemsignal), "select");
- gtk_signal_connect (GTK_OBJECT(aitem), "deselect",
- GTK_SIGNAL_FUNC(cb_itemsignal), "deselect");
- gtk_signal_connect (GTK_OBJECT(aitem), "toggle",
- GTK_SIGNAL_FUNC(cb_itemsignal), "toggle");
- gtk_signal_connect (GTK_OBJECT(aitem), "expand",
- GTK_SIGNAL_FUNC(cb_itemsignal), "expand");
- gtk_signal_connect (GTK_OBJECT(aitem), "collapse",
- GTK_SIGNAL_FUNC(cb_itemsignal), "collapse");
- /* Add it to the parent tree */
- gtk_tree_append (GTK_TREE(real_tree), aitem);
-
- gtk_widget_show (aitem);
-
- gtk_object_set_user_data(GTK_OBJECT(aitem), (gpointer)my_data);
-
- fprintf(stdout, "Added: %s, len: %u\n", dirp->name, dirlen);
-
- if (dirp->smbc_type != SMBC_FILE &&
- dirp->smbc_type != SMBC_IPC_SHARE &&
- (!ISDOT(dirp->name)) &&
- (!ISDOTDOT(dirp->name))){
-
- subtree = gtk_tree_new();
- gtk_tree_item_set_subtree(GTK_TREE_ITEM(aitem), subtree);
-
- gtk_signal_connect(GTK_OBJECT(subtree), "select_child",
- GTK_SIGNAL_FUNC(cb_select_child), real_tree);
- gtk_signal_connect(GTK_OBJECT(subtree), "unselect_child",
- GTK_SIGNAL_FUNC(cb_unselect_child), real_tree);
-
- }
-
- (char *)dirp += dirlen;
- err -= dirlen;
-
- }
-
- }
-
- smbc_closedir(dh);
-
- }
- else if (strncmp(signame, "collapse", 8) == 0) {
- GtkWidget *subtree = gtk_tree_new();
-
- gtk_tree_remove_items(GTK_TREE(real_tree), GTK_TREE(real_tree)->children);
-
- gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), subtree);
-
- gtk_signal_connect (GTK_OBJECT(subtree), "select_child",
- GTK_SIGNAL_FUNC(cb_select_child), real_tree);
- gtk_signal_connect (GTK_OBJECT(subtree), "unselect_child",
- GTK_SIGNAL_FUNC(cb_unselect_child), real_tree);
-
- }
-
-}
-
-static void cb_selection_changed( GtkWidget *tree )
-{
- GList *i;
-
- g_print ("selection_change called for tree %p\n", tree);
- g_print ("selected objects are:\n");
-
- i = GTK_TREE_SELECTION(tree);
- while (i){
- gchar *name;
- GtkLabel *label;
- GtkWidget *item;
--
Samba Shared Repository
More information about the samba-cvs
mailing list