can't open /tmp/mc-<username>/mcextXXXXXX if username contains '\'

4 просмотра
Перейти к первому непрочитанному сообщению

BmW

не прочитано,
14 дек. 2010 г., 05:51:2014.12.2010
– mc-bugs
Hello!

I found a bug that makes it impossible to use filters in MC when
username contains character '\'.
In ubuntu when it connect to windows AD username looks like "DOMAINNAME
\username", so it contains '\' and when i try to view .html (for
example) i got this error message:

/bin/sh: Can't open /tmp/mc-DOMAINNAMEusername/mcextQj6A7d

to reproduce this bug you can create user a\b, run mc by this user and
try to view .html file.

# useradd a\\b
# su - a\\b
$ mc

...

'\' character eaten by function popen in mcview_load_command_output.

sample patch for 4.7.0.6 (easy adopted for other versions)


--- 1/src/viewer/datasource.c<->2010-06-05 00:58:04.000000000 +0600
+++ 2/src/viewer/datasource.c<->2010-12-14 13:56:09.000000000 +0500
@@ -360,7 +360,7 @@
mcview_close_datasource (view);
.
open_error_pipe ();
- if ((fp = popen (command, "r")) == NULL)
+ if ((fp = popen (g_strescape (command,""), "r")) == NULL)
{
/* Avoid two messages. Message from stderr has priority. */
mcview_display (view);

andrew_b

не прочитано,
14 дек. 2010 г., 08:10:3814.12.2010
– mc-bugs
On 14 дек, 13:51, BmW <bazano...@gmail.com> wrote:
> -    if ((fp = popen (command, "r")) == NULL)
> +    if ((fp = popen (g_strescape (command,""), "r")) == NULL)

Now the memory leak here. g_strescape() returns the newly-allocated
string.

--
Andrew

BmW

не прочитано,
15 дек. 2010 г., 03:19:5415.12.2010
– mc-bugs
Sorry, i have mad skilz in C++. Is it right way - create another const
char* and g_free it at the end of the function?

BmW

не прочитано,
15 дек. 2010 г., 03:20:5815.12.2010
– mc-bugs
Sorry, i have mad skilz in C++. Is it right way - create another const
char* and g_free it at the end of the function?


On 14 дек, 18:10, andrew_b <andrew.boro...@gmail.com> wrote:
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений