aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/export_object_dlg.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2013-03-09 08:44:14 +0000
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2013-03-09 08:44:14 +0000
commita4eb0a12ed36795fb75ab427e5bc2d09a8b95ca0 (patch)
treecfc06ac1a525d2b3b124e5dcb2e77207b6fe790f /ui/gtk/export_object_dlg.c
parente5d5bb67bc4265ab96bff535d0eb8ca8820e062f (diff)
From Jose Pico via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8377 NEW FEATURE IMPLEMENTED: SMB2 SUPPORT FOR EXPORT->OBJECTS->SMB
Added functionality: - SMB2 support for Export->Objects->SMB - support for SMB_COM_CREATE, SMB_COM_OPEN, SMB_COM_READ and SMB_COM_WRITE commands - Ability to choose between File Id and full file name as identifier for file re-building. Implemented as an option under Edit->Preferences->Protocols->SMB and Edit->Preferences->Protocols->SMB2. Other minor changes and fixes: - Full filename in file - Inclusion of IP of SMB server when treeid name (i.e. hostname) is not known - UTF-8 filenames encoding before passing them to Export Object Window - Re-written insert_chunk function of export_object_smb.c to make it easier to debug - Fixed of an error in insert_chunk function of export_object_smb.c (the verification of next free_chunk was always skipped after deleting one free_chunk). - Removed duplicated code by inserting the function feed_eo_smb in packet-smb.c and packet-smb2.c - Changed the label of Export->Objects->SMB menu into Export->Objects->SMB/SMB2 svn path=/trunk/; revision=48210
Diffstat (limited to 'ui/gtk/export_object_dlg.c')
-rw-r--r--ui/gtk/export_object_dlg.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/ui/gtk/export_object_dlg.c b/ui/gtk/export_object_dlg.c
index 6b49bbb943..27afb762b9 100644
--- a/ui/gtk/export_object_dlg.c
+++ b/ui/gtk/export_object_dlg.c
@@ -132,6 +132,26 @@ eo_win_destroy_cb(GtkWindow *win _U_, gpointer data)
if (eo_protocoldata_reset != NULL) eo_protocoldata_reset();
}
+static gchar *eo_saveable_pathname(gchar *filename) {
+gchar **splitted_pathname;
+gchar *auxstring, *saveable_pathname;
+guint nparts,i;
+
+ saveable_pathname = NULL;
+ splitted_pathname = g_strsplit_set(filename,"\\",-1);
+ nparts = g_strv_length(splitted_pathname);
+ if (nparts>0) {
+ saveable_pathname=g_strdup(splitted_pathname[0]);
+ }
+ for (i=1;i<nparts;i++) {
+ auxstring = g_strconcat(saveable_pathname,"__",splitted_pathname[i],NULL);
+ g_free(saveable_pathname);
+ saveable_pathname = auxstring;
+ }
+
+ return saveable_pathname;
+}
+
static void
eo_save_clicked_cb(GtkWidget *widget _U_, gpointer arg)
{
@@ -139,6 +159,7 @@ eo_save_clicked_cb(GtkWidget *widget _U_, gpointer arg)
export_object_list_t *object_list = arg;
export_object_entry_t *entry;
gchar *filename = NULL;
+ gchar *auxfilename = NULL;
entry = g_slist_nth_data(object_list->entries,
object_list->row_selected);
@@ -154,14 +175,18 @@ eo_save_clicked_cb(GtkWidget *widget _U_, gpointer arg)
gtk_window_set_transient_for(GTK_WINDOW(save_as_w),
GTK_WINDOW(object_list->dlg));
+ auxfilename = eo_saveable_pathname(entry->filename);
+
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(save_as_w),
- entry->filename);
+ auxfilename);
+
if(gtk_dialog_run(GTK_DIALOG(save_as_w)) == GTK_RESPONSE_ACCEPT) {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(save_as_w));
eo_save_entry(filename, entry, TRUE);
}
+ g_free(auxfilename);
g_free(filename);
window_destroy(save_as_w);
}
@@ -178,6 +203,7 @@ eo_save_all_clicked_cb(GtkWidget *widget _U_, gpointer arg)
gboolean all_saved = TRUE;
gchar *save_in_path;
GString *safe_filename;
+ gchar *auxfilename = NULL;
int count = 0;
save_in_w = file_selection_new("Wireshark: Save All Objects In ...",
@@ -194,10 +220,12 @@ eo_save_all_clicked_cb(GtkWidget *widget _U_, gpointer arg)
if ((strlen(save_in_path) < MAXFILELEN)) {
do {
g_free(save_as_fullpath);
- if (entry->filename)
- safe_filename = eo_massage_str(entry->filename,
+ if (entry->filename) {
+ auxfilename = eo_saveable_pathname(entry->filename);
+ safe_filename = eo_massage_str(auxfilename,
MAXFILELEN - strlen(save_in_path), count);
- else {
+ g_free(auxfilename);
+ } else {
char generic_name[256];
const char *ext;
ext = ct2ext(entry->content_type);