strippwd patch against CVS20041108
- From: Leonard den Ottolander <leonard den ottolander nl>
- To: MC Devel <mc-devel gnome org>
- Cc:
- Subject: strippwd patch against CVS20041108
- Date: Tue, 09 Nov 2004 15:13:26 +0100
Hi,
These are the hunks of the strippwd patch that have not yet been
committed.
Jindrich, is there anything missing from this?
Leonard.
--
mount -t life -o ro /dev/dna /genetic/research
--- mc-4.6.1-20041108/src/util.c.strippwd 2004-11-08 10:29:10.537656816 +0100
+++ mc-4.6.1-20041108/src/util.c 2004-11-08 10:29:10.563652864 +0100
@@ -623,29 +623,29 @@ strip_password (char *p, int has_prefix)
for (i = 0; i < sizeof (prefixes)/sizeof (prefixes[0]); i++) {
char *q;
+ size_t host_len;
if (has_prefix) {
if((q = strstr (p, prefixes[i].name)) == 0)
continue;
else
p = q + prefixes[i].len;
- };
+ }
if ((dir = strchr (p, PATH_SEP)) != NULL)
- *dir = '\0';
- /* search for any possible user */
- at = strrchr (p, '@');
+ host_len = dir - p;
+ else
+ host_len = strlen (p);
+
+ /* Search for any possible user */
+ at = memchr (p, '@', host_len);
/* We have a username */
if (at) {
- *at = 0;
- inner_colon = strchr (p, ':');
- *at = '@';
+ inner_colon = memchr (p, ':', at - p);
if (inner_colon)
- strcpy (inner_colon, at);
+ memmove (inner_colon, at, strlen(at) + 1 );
}
- if (dir)
- *dir = PATH_SEP;
break;
}
return (result);
--- mc-4.6.1-20041108/src/filegui.c.strippwd 2004-11-08 10:29:10.503661984 +0100
+++ mc-4.6.1-20041108/src/filegui.c 2004-11-08 10:38:39.258198152 +0100
@@ -857,7 +857,6 @@ file_mask_dialog (FileOpContext *ctx, Fi
int source_easy_patterns = easy_patterns;
char *source_mask, *orig_mask, *dest_dir, *tmpdest;
const char *error;
- char *def_text_secure;
struct stat buf;
int val;
QuickDialog Quick_input;
@@ -884,8 +883,9 @@ file_mask_dialog (FileOpContext *ctx, Fi
fmd_widgets[FMCB22].result = &ctx->stable_symlinks;
fmd_widgets[FMCB21].result = &ctx->dive_into_subdirs;
- /* filter out a possible password from def_text */
- def_text_secure = strip_password (g_strdup (def_text), 1);
+ /* Filter out a possible password from def_text */
+
+ strip_password (def_text, 1);
/* Create the dialog */
@@ -900,7 +900,7 @@ file_mask_dialog (FileOpContext *ctx, Fi
Quick_input.i18n = 1;
Quick_input.widgets = fmd_widgets;
fmd_widgets[FMDI0].text = text;
- fmd_widgets[FMDI2].text = def_text_secure;
+ fmd_widgets[FMDI2].text = def_text;
fmd_widgets[FMDI2].str_result = &dest_dir;
fmd_widgets[FMDI1].str_result = &source_mask;
--- mc-4.6.1-20041108/src/hotlist.c.strippwd 2004-11-08 10:29:10.466667608 +0100
+++ mc-4.6.1-20041108/src/hotlist.c 2004-11-08 10:29:10.568652104 +0100
@@ -905,7 +905,8 @@ static void add_new_entry_cmd (void)
int ret;
/* Take current directory as default value for input fields */
- title = url = current_panel->cwd;
+ url = strip_password (g_strdup (current_panel->cwd), 1);
+ title = g_strdup (url);
ret = add_new_entry_input (_("New hotlist entry"), _("Directory label"),
_("Directory path"), "[Hotlist]", &title, &url);
@@ -919,6 +920,9 @@ static void add_new_entry_cmd (void)
add2hotlist (title, url, HL_TYPE_ENTRY, 1);
hotlist_state.modified = 1;
+
+ g_free (title);
+ g_free (url);
}
static int add_new_group_input (const char *header, const char *label, char **result)
@@ -1004,14 +1008,20 @@ void add2hotlist_cmd (void)
char *prompt, *label;
const char *cp = _("Label for \"%s\":");
int l = mbstrlen (cp);
-
- prompt = g_strdup_printf (cp, name_trunc (current_panel->cwd, COLS-2*UX-(l+8)));
- label = input_dialog (_(" Add to hotlist "), prompt, current_panel->cwd);
+ static char label_string[MC_MAXPATHLEN+1];
+
+ strncpy (label_string, current_panel->cwd, MC_MAXPATHLEN);
+ label_string[MC_MAXPATHLEN] = '\0';
+ strip_password (label_string, 1);
+
+ prompt = g_strdup_printf (cp, path_trunc (current_panel->cwd, COLS-2*UX-(l+8)));
+ label = input_dialog (_(" Add to hotlist "), prompt, label_string);
g_free (prompt);
+
if (!label || !*label)
return;
- add2hotlist (label,g_strdup (current_panel->cwd), HL_TYPE_ENTRY, 0);
+ add2hotlist (label, g_strdup (label_string), HL_TYPE_ENTRY, 0);
hotlist_state.modified = 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]