- update extension binding to be more Fedora-like
- update to upstream IPv6 patch
This commit is contained in:
parent
cd00b483c0
commit
95f47c2448
118
mc-extensions.patch
Normal file
118
mc-extensions.patch
Normal file
@ -0,0 +1,118 @@
|
||||
diff -up mc-4.7.0-pre1/configure.ac.extensions mc-4.7.0-pre1/configure.ac
|
||||
--- mc-4.7.0-pre1/configure.ac.extensions 2009-07-31 18:36:24.000000000 +0200
|
||||
+++ mc-4.7.0-pre1/configure.ac 2009-08-05 12:51:08.000000000 +0200
|
||||
@@ -67,7 +67,7 @@ AC_PROG_LN_S
|
||||
AC_CHECK_TOOL(AR, ar, ar)
|
||||
|
||||
dnl Only list browsers here that can be run in background (i.e. with `&')
|
||||
-AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
|
||||
+AC_CHECK_PROGS(X11_WWW, [firefox gnome-moz-remote mozilla konqueror opera netscape])
|
||||
|
||||
dnl
|
||||
dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
|
||||
diff -up mc-4.7.0-pre1/configure.extensions mc-4.7.0-pre1/configure
|
||||
--- mc-4.7.0-pre1/configure.extensions 2009-07-31 20:49:03.000000000 +0200
|
||||
+++ mc-4.7.0-pre1/configure 2009-08-05 12:51:08.000000000 +0200
|
||||
@@ -15250,7 +15250,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
-for ac_prog in gnome-moz-remote mozilla konqueror opera netscape
|
||||
+for ac_prog in firefox gnome-moz-remote mozilla konqueror opera netscape
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
diff -up mc-4.7.0-pre1/misc/mc.ext.in.extensions mc-4.7.0-pre1/misc/mc.ext.in
|
||||
--- mc-4.7.0-pre1/misc/mc.ext.in.extensions 2009-06-23 20:55:11.000000000 +0200
|
||||
+++ mc-4.7.0-pre1/misc/mc.ext.in 2009-08-05 13:01:48.000000000 +0200
|
||||
@@ -221,8 +221,8 @@ regex/\.rpm$
|
||||
|
||||
# deb
|
||||
regex/\.u?deb$
|
||||
- Open=%cd %p#deb
|
||||
- View=%view{ascii} dpkg-deb -I %f && echo && dpkg-deb -c %f
|
||||
+ Open=%cd %p#uar
|
||||
+ View=%view{ascii} file %f && nm %f
|
||||
|
||||
# dpkg
|
||||
shell/.debd
|
||||
@@ -397,11 +397,16 @@ regex/\.([wW][aA][wW]22)$
|
||||
Open=vplay -s 22 %f
|
||||
|
||||
regex/\.([mM][pP]3)$
|
||||
- Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
|
||||
- View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
|
||||
+ Include=audio
|
||||
+# Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
|
||||
+# View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
|
||||
+
|
||||
+regex/\.([mM][kK][aA])$
|
||||
+ Include=audio
|
||||
|
||||
regex/\.([oO][gG][gG|aA|vV|xX])$
|
||||
- Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
|
||||
+ Open=ogg123 %f
|
||||
+# Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
|
||||
View=%view{ascii} ogginfo %s
|
||||
|
||||
regex/\.([sS][pP][xX]|[fF][lL][aA][cC])$
|
||||
@@ -414,11 +419,15 @@ regex/\.([wW][mM][aA])$
|
||||
Open=mplayer -vo null %f
|
||||
View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f
|
||||
|
||||
+include/audio
|
||||
+ Open=mplayer %f
|
||||
+ View=%view{ascii} mplayer -identify -vo null -ao null -frames 0 %f 2>&1 | sed -n '/^ID_/p'
|
||||
|
||||
### Play lists ###
|
||||
|
||||
regex/\.([mM]3[uU]|[pP][lL][sS])$
|
||||
- Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f >/dev/null 2>&1 &); fi
|
||||
+ Open=mplayer -vo null -playlist %f
|
||||
+# Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f >/dev/null 2>&1 &); fi
|
||||
|
||||
|
||||
### Video ###
|
||||
@@ -432,6 +441,9 @@ regex/\.([aA][sS][fFxX])$
|
||||
regex/\.([dD][iI][vV][xX])$
|
||||
Include=video
|
||||
|
||||
+regex/\.([mM][kK][vV])$
|
||||
+ Include=video
|
||||
+
|
||||
regex/\.([mM][oO][vV]|[qQ][tT])$
|
||||
Include=video
|
||||
|
||||
@@ -496,22 +508,27 @@ shell/.abw
|
||||
|
||||
# Microsoft Word Document
|
||||
regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
|
||||
- Open=(abiword %f >/dev/null 2>&1 &)
|
||||
+ Open=(ooffice %f &)
|
||||
+# Open=(abiword %f >/dev/null 2>&1 &)
|
||||
View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f
|
||||
type/^Microsoft\ Word
|
||||
- Open=(abiword %f >/dev/null 2>&1 &)
|
||||
+ Open=(ooffice %f &)
|
||||
+# Open=(abiword %f >/dev/null 2>&1 &)
|
||||
View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f
|
||||
|
||||
# RTF document
|
||||
regex/\.([rR][tT][fF])$
|
||||
- Open=(abiword %f >/dev/null 2>&1 &)
|
||||
+ Open=(ooffice %f &)
|
||||
+# Open=(abiword %f >/dev/null 2>&1 &)
|
||||
|
||||
# Microsoft Excel Worksheet
|
||||
regex/\.([xX][lL][sSwW])$
|
||||
- Open=(gnumeric %f >/dev/null 2>&1 &)
|
||||
+ Open=(ooffice %f &)
|
||||
+# Open=(gnumeric %f >/dev/null 2>&1 &)
|
||||
View=%view{ascii} xls2csv %f || strings %f
|
||||
type/^Microsoft\ Excel
|
||||
- Open=(gnumeric %f >/dev/null 2>&1 &)
|
||||
+ Open=(ooffice %f &)
|
||||
+# Open=(gnumeric %f >/dev/null 2>&1 &)
|
||||
View=%view{ascii} xls2csv %f || strings %f
|
||||
|
||||
# Use OpenOffice.org to open any MS Office documents
|
552
mc-ipv6.patch
552
mc-ipv6.patch
@ -1,43 +1,69 @@
|
||||
--- mc-2006-09-12-21/vfs/ftpfs.c.ipv6 2006-03-08 16:17:55.000000000 +0100
|
||||
+++ mc-2006-09-12-21/vfs/ftpfs.c 2006-09-26 10:43:27.000000000 +0200
|
||||
@@ -639,12 +639,13 @@ ftpfs_get_proxy_host_and_port (const cha
|
||||
commit 883967347e817e1743d265d19a95a432cf875b5e
|
||||
Author: Slava Zanko <slavazanko@gmail.com>
|
||||
Date: Wed Aug 5 09:44:39 2009 +0300
|
||||
|
||||
Ticket #121 (support IPv6).
|
||||
|
||||
121_support_IPv6 -> origin/121_support_IPv6
|
||||
|
||||
Thanks to Dan Kopecek.
|
||||
|
||||
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
|
||||
|
||||
diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c
|
||||
index 9ac03bc..f2baaee 100644
|
||||
--- a/vfs/ftpfs.c
|
||||
+++ b/vfs/ftpfs.c
|
||||
@@ -652,17 +652,17 @@ ftpfs_get_proxy_host_and_port (const char *proxy, char **host, int *port)
|
||||
static int
|
||||
ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
- struct sockaddr_in server_address;
|
||||
- struct hostent *hp;
|
||||
- int my_socket;
|
||||
+ struct addrinfo hints, *res, *restmp;
|
||||
+ int my_socket = 0;
|
||||
char *host;
|
||||
- char *host;
|
||||
- int port = SUP.port;
|
||||
+ char *port;
|
||||
- int free_host = 0;
|
||||
+ struct addrinfo hints, *res, *curr_res;
|
||||
+ int my_socket = 0;
|
||||
+ char *host = NULL;
|
||||
+ char *port = NULL;
|
||||
+ int tmp_port;
|
||||
int free_host = 0;
|
||||
+ int e;
|
||||
|
||||
(void) me;
|
||||
|
||||
@@ -657,62 +658,83 @@ ftpfs_open_socket (struct vfs_class *me,
|
||||
return -1;
|
||||
/* Use a proxy host? */
|
||||
- host = SUP.host;
|
||||
+ host = g_strdup(SUP.host);
|
||||
|
||||
if (!host || !*host){
|
||||
print_vfs_message (_("ftpfs: Invalid host name."));
|
||||
@@ -671,61 +671,86 @@ ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
|
||||
}
|
||||
|
||||
+ port = malloc (sizeof (char) * 6);
|
||||
+ if (port == NULL) {
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* Hosts to connect to that start with a ! should use proxy */
|
||||
+ tmp_port = SUP.port;
|
||||
+
|
||||
if (SUP.proxy){
|
||||
- ftpfs_get_proxy_host_and_port (ftpfs_proxy_host, &host, &port);
|
||||
- free_host = 1;
|
||||
+ char *orig_host = host;
|
||||
+
|
||||
+ ftpfs_get_proxy_host_and_port (ftpfs_proxy_host, &host, &tmp_port);
|
||||
free_host = 1;
|
||||
+
|
||||
+ if (orig_host != host)
|
||||
+ g_free(orig_host);
|
||||
+ }
|
||||
+
|
||||
+ port = g_strdup_printf("%hu", (unsigned short) tmp_port);
|
||||
+ if (port == NULL) {
|
||||
+ g_free (host);
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
- enable_interrupt_key(); /* clear the interrupt flag */
|
||||
enable_interrupt_key(); /* clear the interrupt flag */
|
||||
-
|
||||
- /* Get host address */
|
||||
- memset ((char *) &server_address, 0, sizeof (server_address));
|
||||
@ -54,178 +80,183 @@
|
||||
- return -1;
|
||||
- }
|
||||
- server_address.sin_family = hp->h_addrtype;
|
||||
-
|
||||
|
||||
- /* We copy only 4 bytes, we cannot trust hp->h_length, as it comes from the DNS */
|
||||
- memcpy ((char *) &server_address.sin_addr, (char *) hp->h_addr, 4);
|
||||
+ if (snprintf (port, 6, "%hu", (unsigned short)tmp_port) < 0) {
|
||||
+ g_free (port);
|
||||
+ if (free_host)
|
||||
+ g_free (host);
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
- server_address.sin_port = htons (port);
|
||||
+ enable_interrupt_key(); /* clear the interrupt flag */
|
||||
|
||||
- /* Connect */
|
||||
- if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
- disable_interrupt_key();
|
||||
- ftpfs_errno = errno;
|
||||
- if (free_host)
|
||||
- g_free (host);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- print_vfs_message (_("ftpfs: making connection to %s"), host);
|
||||
- if (free_host)
|
||||
+ memset (&hints, 0, sizeof (struct addrinfo));
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+ hints.ai_flags = AI_ADDRCONFIG;
|
||||
|
||||
- server_address.sin_port = htons (port);
|
||||
|
||||
- /* Connect */
|
||||
- if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
+ e = getaddrinfo (host, port, &hints, &res);
|
||||
+ g_free (port);
|
||||
+ port = NULL;
|
||||
+
|
||||
+ if ((e = getaddrinfo (host, port, &hints, &res)) != 0) {
|
||||
+ disable_interrupt_key();
|
||||
+ print_vfs_message (_("ftpfs: %s"), gai_strerror (e));
|
||||
+ if (free_host)
|
||||
+ if ( e != 0 ) {
|
||||
disable_interrupt_key();
|
||||
- ftpfs_errno = errno;
|
||||
- if (free_host)
|
||||
- g_free (host);
|
||||
+ print_vfs_message (_("ftpfs: %s"), gai_strerror (e));
|
||||
+ g_free (host);
|
||||
+ ftpfs_errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
- print_vfs_message (_("ftpfs: making connection to %s"), host);
|
||||
- if (free_host)
|
||||
+
|
||||
+ for (curr_res = res; curr_res != NULL; curr_res = curr_res->ai_next) {
|
||||
+
|
||||
+ my_socket = socket (curr_res->ai_family, curr_res->ai_socktype, curr_res->ai_protocol);
|
||||
+
|
||||
+ if (my_socket < 0) {
|
||||
+
|
||||
+ if (curr_res->ai_next != NULL)
|
||||
+ continue;
|
||||
+
|
||||
+ disable_interrupt_key();
|
||||
+ print_vfs_message (_("ftpfs: %s"), unix_error_string (errno));
|
||||
+ g_free (host);
|
||||
+ freeaddrinfo (res);
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ print_vfs_message (_("ftpfs: making connection to %s"), host);
|
||||
g_free (host);
|
||||
-
|
||||
+ host = NULL;
|
||||
+
|
||||
+ if ( connect (my_socket, curr_res->ai_addr, curr_res->ai_addrlen) >= 0 )
|
||||
+ break;
|
||||
|
||||
- if (connect (my_socket, (struct sockaddr *) &server_address,
|
||||
- sizeof (server_address)) < 0){
|
||||
- ftpfs_errno = errno;
|
||||
ftpfs_errno = errno;
|
||||
- if (errno == EINTR && got_interrupt ())
|
||||
+ g_free (port);
|
||||
+ ftpfs_errno = EINVAL;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ g_free (port);
|
||||
+ close (my_socket);
|
||||
+
|
||||
+ for (restmp = res; res != NULL; res = res->ai_next) {
|
||||
+ my_socket = socket (res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
+ if (my_socket < 0) {
|
||||
+ if (res->ai_next == NULL) {
|
||||
+ disable_interrupt_key();
|
||||
+ print_vfs_message (_("ftpfs: %s"), unix_error_string (errno));
|
||||
+ if (free_host)
|
||||
+ g_free (host);
|
||||
+ freeaddrinfo (restmp);
|
||||
+ ftpfs_errno = errno;
|
||||
+ return -1;
|
||||
+ } else
|
||||
+ continue;
|
||||
+ } else {
|
||||
+ print_vfs_message (_("ftpfs: making connection to %s"), host);
|
||||
+ if (free_host)
|
||||
+ g_free (host);
|
||||
+
|
||||
+ if (connect (my_socket, res->ai_addr, res->ai_addrlen) < 0) {
|
||||
+ ftpfs_errno = errno;
|
||||
+ close (my_socket);
|
||||
+ if (errno == EINTR && got_interrupt ()) {
|
||||
+ if (errno == EINTR && got_interrupt ()) {
|
||||
print_vfs_message (_("ftpfs: connection interrupted by user"));
|
||||
- else
|
||||
+ } else if (res->ai_next == NULL) {
|
||||
+ } else if (res->ai_next == NULL) {
|
||||
print_vfs_message (_("ftpfs: connection to server failed: %s"),
|
||||
- unix_error_string(errno));
|
||||
- disable_interrupt_key();
|
||||
- close (my_socket);
|
||||
- return -1;
|
||||
+ unix_error_string (errno));
|
||||
+ } else
|
||||
+ unix_error_string (errno));
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ freeaddrinfo (restmp);
|
||||
+ disable_interrupt_key ();
|
||||
+ return -1;
|
||||
+ } else
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ freeaddrinfo (res);
|
||||
+ disable_interrupt_key ();
|
||||
return -1;
|
||||
}
|
||||
- disable_interrupt_key();
|
||||
+
|
||||
+ freeaddrinfo (restmp);
|
||||
+ freeaddrinfo (res);
|
||||
+ disable_interrupt_key ();
|
||||
return my_socket;
|
||||
}
|
||||
|
||||
@@ -861,93 +883,179 @@ ftpfs_get_current_directory (struct vfs_
|
||||
@@ -874,84 +899,174 @@ ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super)
|
||||
|
||||
/* Setup Passive ftp connection, we use it for source routed connections */
|
||||
static int
|
||||
-ftpfs_setup_passive (struct vfs_class *me, struct vfs_s_super *super, int my_socket, struct sockaddr_in *sa)
|
||||
+ftpfs_setup_passive (struct vfs_class *me, struct vfs_s_super *super, int my_socket, struct sockaddr_storage *sa, socklen_t *salen)
|
||||
+ftpfs_setup_passive (struct vfs_class *me, struct vfs_s_super *super,
|
||||
+ int my_socket, struct sockaddr_storage *sa, socklen_t *salen)
|
||||
{
|
||||
+ char *c;
|
||||
+
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "EPSV") == COMPLETE) {
|
||||
+ int port;
|
||||
+ /* (|||<port>|) */
|
||||
+ c = strchr (reply_str, '|');
|
||||
+ if (c == NULL)
|
||||
+ return 0;
|
||||
+ if(strlen(c) > 3)
|
||||
+ c+=3;
|
||||
+ else
|
||||
+ return 0;
|
||||
+
|
||||
+ port = atoi (c);
|
||||
+ if (port < 0 || port > 65535)
|
||||
+ return 0;
|
||||
+ port = htons (port);
|
||||
+
|
||||
+ switch (sa->ss_family) {
|
||||
+ case AF_INET:
|
||||
+ ((struct sockaddr_in *)sa)->sin_port = port;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ ((struct sockaddr_in6 *)sa)->sin6_port = port;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR (EINVAL, -1);
|
||||
+ }
|
||||
+ } else if (sa->ss_family == AF_INET) {
|
||||
int xa, xb, xc, xd, xe, xf;
|
||||
char n [6];
|
||||
- char *c;
|
||||
|
||||
if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "PASV") != COMPLETE)
|
||||
- int xa, xb, xc, xd, xe, xf;
|
||||
- char n [6];
|
||||
char *c;
|
||||
-
|
||||
- if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "PASV") != COMPLETE)
|
||||
- return 0;
|
||||
-
|
||||
+ return 0;
|
||||
+
|
||||
/* Parse remote parameters */
|
||||
for (c = reply_str + 4; (*c) && (!isdigit ((unsigned char) *c)); c++)
|
||||
- ;
|
||||
+ ;
|
||||
if (!*c)
|
||||
- return 0;
|
||||
+ return 0;
|
||||
if (!isdigit ((unsigned char) *c))
|
||||
- return 0;
|
||||
+ return 0;
|
||||
if (sscanf (c, "%d,%d,%d,%d,%d,%d", &xa, &xb, &xc, &xd, &xe, &xf) != 6)
|
||||
- return 0;
|
||||
+ return 0;
|
||||
n [0] = (unsigned char) xa;
|
||||
n [1] = (unsigned char) xb;
|
||||
n [2] = (unsigned char) xc;
|
||||
n [3] = (unsigned char) xd;
|
||||
n [4] = (unsigned char) xe;
|
||||
n [5] = (unsigned char) xf;
|
||||
+
|
||||
+ memcpy (&(((struct sockaddr_in *)sa)->sin_addr.s_addr), (void *)n, 4);
|
||||
+ memcpy (&(((struct sockaddr_in *)sa)->sin_port), (void *)&n[4], 2);
|
||||
+ } else
|
||||
+ return 0;
|
||||
|
||||
- /* Parse remote parameters */
|
||||
- for (c = reply_str + 4; (*c) && (!isdigit ((unsigned char) *c)); c++)
|
||||
- ;
|
||||
- if (!*c)
|
||||
- return 0;
|
||||
- if (!isdigit ((unsigned char) *c))
|
||||
- return 0;
|
||||
- if (sscanf (c, "%d,%d,%d,%d,%d,%d", &xa, &xb, &xc, &xd, &xe, &xf) != 6)
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "EPSV") == COMPLETE) {
|
||||
+ int port;
|
||||
+ /* (|||<port>|) */
|
||||
+ c = strchr (reply_str, '|');
|
||||
+ if (c == NULL)
|
||||
+ return 0;
|
||||
+ if(strlen(c) > 3)
|
||||
+ c+=3;
|
||||
+ else
|
||||
+ return 0;
|
||||
+
|
||||
+ port = atoi (c);
|
||||
+ if (port < 0 || port > 65535)
|
||||
+ return 0;
|
||||
+ port = htons (port);
|
||||
+
|
||||
+ switch (sa->ss_family) {
|
||||
+ case AF_INET:
|
||||
+ ((struct sockaddr_in *)sa)->sin_port = port;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ ((struct sockaddr_in6 *)sa)->sin6_port = port;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR (EINVAL, -1);
|
||||
+ }
|
||||
+ } else if (sa->ss_family == AF_INET) {
|
||||
+ int xa, xb, xc, xd, xe, xf;
|
||||
+ char n [6];
|
||||
+
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY | WANT_STRING, "PASV") != COMPLETE)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Parse remote parameters */
|
||||
+ for (c = reply_str + 4; (*c) && (!isdigit ((unsigned char) *c)); c++);
|
||||
+
|
||||
+ if (!*c)
|
||||
+ return 0;
|
||||
+ if (!isdigit ((unsigned char) *c))
|
||||
+ return 0;
|
||||
+ if (sscanf (c, "%d,%d,%d,%d,%d,%d", &xa, &xb, &xc, &xd, &xe, &xf) != 6)
|
||||
+ return 0;
|
||||
+
|
||||
+ n [0] = (unsigned char) xa;
|
||||
+ n [1] = (unsigned char) xb;
|
||||
+ n [2] = (unsigned char) xc;
|
||||
+ n [3] = (unsigned char) xd;
|
||||
+ n [4] = (unsigned char) xe;
|
||||
+ n [5] = (unsigned char) xf;
|
||||
+
|
||||
+ memcpy (&(((struct sockaddr_in *)sa)->sin_addr.s_addr), (void *)n, 4);
|
||||
+ memcpy (&(((struct sockaddr_in *)sa)->sin_port), (void *)&n[4], 2);
|
||||
+ } else
|
||||
return 0;
|
||||
- n [0] = (unsigned char) xa;
|
||||
- n [1] = (unsigned char) xb;
|
||||
- n [2] = (unsigned char) xc;
|
||||
- n [3] = (unsigned char) xd;
|
||||
- n [4] = (unsigned char) xe;
|
||||
- n [5] = (unsigned char) xf;
|
||||
-
|
||||
- memcpy (&(sa->sin_addr.s_addr), (void *)n, 4);
|
||||
- memcpy (&(sa->sin_port), (void *)&n[4], 2);
|
||||
- if (connect (my_socket, (struct sockaddr *) sa, sizeof (struct sockaddr_in)) < 0)
|
||||
- return 0;
|
||||
- return 1;
|
||||
+ if (connect (my_socket, (struct sockaddr *) sa, *salen ) < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+ if (connect (my_socket, (struct sockaddr *) sa, *salen ) < 0)
|
||||
return 0;
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -235,9 +266,9 @@
|
||||
- int data;
|
||||
- socklen_t len = sizeof(data_addr);
|
||||
- struct protoent *pe;
|
||||
+ struct sockaddr_storage data_addr;
|
||||
+ socklen_t data_addrlen;
|
||||
+ int data_sock;
|
||||
+ struct sockaddr_storage data_addr;
|
||||
+ socklen_t data_addrlen;
|
||||
+ int data_sock;
|
||||
|
||||
- pe = getprotobyname ("tcp");
|
||||
- if (pe == NULL)
|
||||
@ -250,122 +281,117 @@
|
||||
- data = socket (AF_INET, SOCK_STREAM, pe->p_proto);
|
||||
- if (data < 0)
|
||||
- ERRNOR (EIO, -1);
|
||||
+ memset (&data_addr, 0, sizeof (struct sockaddr_storage));
|
||||
+ data_addrlen = sizeof (struct sockaddr_storage);
|
||||
+ memset (&data_addr, 0, sizeof (struct sockaddr_storage));
|
||||
+ data_addrlen = sizeof (struct sockaddr_storage);
|
||||
+
|
||||
+ if (getpeername (SUP.sock, (struct sockaddr *) &data_addr, &data_addrlen) == -1)
|
||||
+ return -1;
|
||||
+
|
||||
+ switch (data_addr.ss_family) {
|
||||
+ case AF_INET:
|
||||
+ ((struct sockaddr_in *)&data_addr)->sin_port = 0;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ ((struct sockaddr_in6 *)&data_addr)->sin6_port = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR(EINVAL, -1);
|
||||
+ }
|
||||
+
|
||||
+ data_sock = socket (data_addr.ss_family, SOCK_STREAM, IPPROTO_TCP);
|
||||
+ if (data_sock < 0) {
|
||||
+ if (SUP.use_passive_connection) {
|
||||
+ print_vfs_message (_("ftpfs: could not setup passive mode: %s"), unix_error_string (errno));
|
||||
+ SUP.use_passive_connection = 0;
|
||||
+ goto again;
|
||||
+ }
|
||||
+
|
||||
+ print_vfs_message (_("ftpfs: could not create socket: %s"), unix_error_string (errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- if (SUP.use_passive_connection) {
|
||||
if (SUP.use_passive_connection) {
|
||||
- if (ftpfs_setup_passive (me, super, data, &data_addr))
|
||||
- return data;
|
||||
-
|
||||
- SUP.use_passive_connection = 0;
|
||||
- print_vfs_message (_("ftpfs: could not setup passive mode"));
|
||||
+ if (getpeername (SUP.sock, (struct sockaddr *) &data_addr, &data_addrlen) == -1)
|
||||
+ return -1;
|
||||
+
|
||||
+ switch (data_addr.ss_family) {
|
||||
+ case AF_INET:
|
||||
+ ((struct sockaddr_in *)&data_addr)->sin_port = 0;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ ((struct sockaddr_in6 *)&data_addr)->sin6_port = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR(EINVAL, -1);
|
||||
+ }
|
||||
+
|
||||
+ if (ftpfs_setup_passive (me, super, data_sock, &data_addr, &data_addrlen))
|
||||
+ return data_sock;
|
||||
|
||||
SUP.use_passive_connection = 0;
|
||||
print_vfs_message (_("ftpfs: could not setup passive mode"));
|
||||
|
||||
- /* data or data_addr may be damaged by ftpfs_setup_passive */
|
||||
- close (data);
|
||||
- goto again;
|
||||
+ data_sock = socket (data_addr.ss_family, SOCK_STREAM, IPPROTO_TCP);
|
||||
+ if (data_sock < 0) {
|
||||
+ if (SUP.use_passive_connection) {
|
||||
+ print_vfs_message (_("ftpfs: could not setup passive mode: %s"), unix_error_string (errno));
|
||||
+ SUP.use_passive_connection = 0;
|
||||
+ goto again;
|
||||
+ close (data_sock);
|
||||
goto again;
|
||||
}
|
||||
+ print_vfs_message (_("ftpfs: could not create socket: %s"), unix_error_string (errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
+ if (SUP.use_passive_connection) {
|
||||
+ if (ftpfs_setup_passive (me, super, data_sock, &data_addr, &data_addrlen))
|
||||
+ return data_sock;
|
||||
+
|
||||
+ SUP.use_passive_connection = 0;
|
||||
+ print_vfs_message (_("ftpfs: could not setup passive mode"));
|
||||
+
|
||||
+ close (data_sock);
|
||||
+ goto again;
|
||||
+ }
|
||||
+
|
||||
/* If passive setup fails, fallback to active connections */
|
||||
/* Active FTP connection */
|
||||
- if ((bind (data, (struct sockaddr *)&data_addr, len) == 0) &&
|
||||
- (getsockname (data, (struct sockaddr *) &data_addr, &len) == 0) &&
|
||||
- (listen (data, 1) == 0))
|
||||
+ if ((bind (data_sock, (struct sockaddr *)&data_addr, data_addrlen) == 0) &&
|
||||
+ (getsockname (data_sock, (struct sockaddr *)&data_addr, &data_addrlen) == 0) &&
|
||||
+ (listen (data_sock, 1) == 0))
|
||||
{
|
||||
- {
|
||||
- unsigned char *a = (unsigned char *)&data_addr.sin_addr;
|
||||
- unsigned char *p = (unsigned char *)&data_addr.sin_port;
|
||||
+ unsigned short int port;
|
||||
+ char *addr;
|
||||
+ unsigned int af;
|
||||
+ if ((bind (data_sock, (struct sockaddr *)&data_addr, data_addrlen) == 0) &&
|
||||
+ (getsockname (data_sock, (struct sockaddr *)&data_addr, &data_addrlen) == 0) &&
|
||||
+ (listen (data_sock, 1) == 0)) {
|
||||
+ unsigned short int port;
|
||||
+ char *addr;
|
||||
+ unsigned int af;
|
||||
+
|
||||
+ switch (data_addr.ss_family) {
|
||||
+ case AF_INET:
|
||||
+ af = FTP_INET;
|
||||
+ port = ((struct sockaddr_in *)&data_addr)->sin_port;
|
||||
+ switch (data_addr.ss_family) {
|
||||
+ case AF_INET:
|
||||
+ af = FTP_INET;
|
||||
+ port = ((struct sockaddr_in *)&data_addr)->sin_port;
|
||||
+ break;
|
||||
+ case AF_INET6:
|
||||
+ af = FTP_INET6;
|
||||
+ port = ((struct sockaddr_in6 *)&data_addr)->sin6_port;
|
||||
+ case AF_INET6:
|
||||
+ af = FTP_INET6;
|
||||
+ port = ((struct sockaddr_in6 *)&data_addr)->sin6_port;
|
||||
+ break;
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR (EINVAL, -1);
|
||||
+ }
|
||||
+ port = ntohs (port);
|
||||
+
|
||||
+ addr = malloc (NI_MAXHOST);
|
||||
+ if (addr == NULL)
|
||||
+ ERRNOR (ENOMEM, -1);
|
||||
+ default:
|
||||
+ print_vfs_message (_("ftpfs: invalid address family"));
|
||||
+ ERRNOR (EINVAL, -1);
|
||||
+ }
|
||||
+
|
||||
+ if (getnameinfo ((struct sockaddr *)&data_addr, data_addrlen, addr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) != 0) {
|
||||
+ g_free (addr);
|
||||
+ ERRNOR (EIO, -1);
|
||||
+ }
|
||||
+ port = ntohs (port);
|
||||
+
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY, "EPRT |%u|%s|%hu|", af, addr, port) == COMPLETE) {
|
||||
+ addr = malloc (NI_MAXHOST);
|
||||
+ if (addr == NULL)
|
||||
+ ERRNOR (ENOMEM, -1);
|
||||
+
|
||||
+ if (getnameinfo ((struct sockaddr *)&data_addr, data_addrlen, addr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) != 0) {
|
||||
+ g_free (addr);
|
||||
+ ERRNOR (EIO, -1);
|
||||
+ }
|
||||
+
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY, "EPRT |%u|%s|%hu|", af, addr, port) == COMPLETE) {
|
||||
+ g_free (addr);
|
||||
+ return data_sock;
|
||||
+ }
|
||||
+ g_free (addr);
|
||||
+ return data_sock;
|
||||
+ }
|
||||
+ g_free (addr);
|
||||
+
|
||||
+ if (FTP_INET == af) {
|
||||
+ unsigned char *a = (unsigned char *)&((struct sockaddr_in *)&data_addr)->sin_addr;
|
||||
+ unsigned char *p = (unsigned char *)&port;
|
||||
+
|
||||
+ if (FTP_INET == af) {
|
||||
+ unsigned char *a = (unsigned char *)&((struct sockaddr_in *)&data_addr)->sin_addr;
|
||||
+ unsigned char *p = (unsigned char *)&port;
|
||||
|
||||
- if (ftpfs_command (me, super, WAIT_REPLY, "PORT %d,%d,%d,%d,%d,%d", a[0], a[1],
|
||||
- a[2], a[3], p[0], p[1]) == COMPLETE)
|
||||
- return data;
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY, "PORT %u,%u,%u,%u,%u,%u", a[0], a[1], a[2], a[3],
|
||||
+ p[0], p[1]) == COMPLETE)
|
||||
+ if (ftpfs_command (me, super, WAIT_REPLY,
|
||||
+ "PORT %u,%u,%u,%u,%u,%u", a[0], a[1], a[2], a[3],
|
||||
+ p[0], p[1]) == COMPLETE)
|
||||
+ return data_sock;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- close (data);
|
||||
- ftpfs_errno = EIO;
|
||||
- return -1;
|
||||
+
|
||||
+ close (data_sock);
|
||||
+ ftpfs_errno = EIO;
|
||||
+ return -1;
|
||||
+ close (data_sock);
|
||||
ftpfs_errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -960,7 +1075,7 @@ static int
|
||||
ftpfs_open_data_connection (struct vfs_class *me, struct vfs_s_super *super, const char *cmd,
|
||||
const char *remote, int isbinary, int reget)
|
||||
{
|
||||
@ -374,9 +400,11 @@
|
||||
int s, j, data;
|
||||
socklen_t fromlen = sizeof(from);
|
||||
|
||||
--- mc-2006-09-12-21/vfs/ftpfs.h.ipv6 2005-05-29 14:10:08.000000000 +0200
|
||||
+++ mc-2006-09-12-21/vfs/ftpfs.h 2006-09-26 10:42:36.000000000 +0200
|
||||
@@ -15,6 +15,9 @@ extern int ftpfs_first_cd_then_ls;
|
||||
diff --git a/vfs/ftpfs.h b/vfs/ftpfs.h
|
||||
index b2003db..0f41b18 100644
|
||||
--- a/vfs/ftpfs.h
|
||||
+++ b/vfs/ftpfs.h
|
||||
@@ -21,6 +21,9 @@ extern int ftpfs_first_cd_then_ls;
|
||||
void ftpfs_init_passwd (void);
|
||||
void init_ftpfs (void);
|
||||
|
||||
@ -386,27 +414,29 @@
|
||||
#define OPT_FLUSH 1
|
||||
#define OPT_IGNORE_ERROR 2
|
||||
|
||||
--- mc-2006-08-12-18/vfs/utilvfs.c.ipv6 2006-01-30 18:01:58.000000000 +0100
|
||||
+++ mc-2006-08-12-18/vfs/utilvfs.c 2010-12-14 20:41:09.000000000 +0100
|
||||
@@ -109,7 +109,21 @@ vfs_split_url (const char *path, char **
|
||||
diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c
|
||||
index af05144..f53914a 100644
|
||||
--- a/vfs/utilvfs.c
|
||||
+++ b/vfs/utilvfs.c
|
||||
@@ -123,7 +123,21 @@ vfs_split_url (const char *path, char **host, char **user, int *port,
|
||||
}
|
||||
|
||||
/* Check if the host comes with a port spec, if so, chop it */
|
||||
- colon = strchr (rest, ':');
|
||||
+ if ('[' == *rest) {
|
||||
+ colon = strchr (++rest, ']');
|
||||
+ if (colon) {
|
||||
+ colon[0] = '\0';
|
||||
+ colon[1] = '\0';
|
||||
+ colon++;
|
||||
+ } else {
|
||||
+ g_free (pcopy);
|
||||
+ *host = NULL;
|
||||
+ *port = 0;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ colon = strchr (++rest, ']');
|
||||
+ if (colon) {
|
||||
+ colon[0] = '\0';
|
||||
+ colon[1] = '\0';
|
||||
+ colon++;
|
||||
+ } else {
|
||||
+ g_free (pcopy);
|
||||
+ *host = NULL;
|
||||
+ *port = 0;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ } else
|
||||
+ colon = strchr (rest, ':');
|
||||
+ colon = strchr (rest, ':');
|
||||
+
|
||||
if (colon) {
|
||||
*colon = 0;
|
||||
|
8
mc.spec
8
mc.spec
@ -1,7 +1,7 @@
|
||||
Summary: User-friendly text console file manager and visual shell
|
||||
Name: mc
|
||||
Version: 4.7.0
|
||||
Release: 0.1.pre1%{?dist}
|
||||
Release: 0.2.pre1%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2
|
||||
Group: System Environment/Shells
|
||||
@ -15,6 +15,7 @@ Requires: dev >= 3.3-3
|
||||
Patch1: mc-ipv6.patch
|
||||
Patch2: mc-prompt.patch
|
||||
Patch3: mc-exit.patch
|
||||
Patch4: mc-extensions.patch
|
||||
|
||||
%description
|
||||
Midnight Commander is a visual shell much like a file manager, only
|
||||
@ -28,6 +29,7 @@ specific files.
|
||||
%patch1 -p1 -b .ipv6
|
||||
%patch2 -p1 -b .prompt
|
||||
%patch3 -p1 -b .exit
|
||||
%patch4 -p1 -b .extensions
|
||||
|
||||
%build
|
||||
export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS"
|
||||
@ -83,6 +85,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir %{_libexecdir}/mc
|
||||
|
||||
%changelog
|
||||
* Wed Aug 5 2009 Jindrich Novy <jnovy@redhat.com> 4.7.0-0.2.pre1
|
||||
- update extension binding to be more Fedora-like
|
||||
- update to upstream IPv6 patch
|
||||
|
||||
* Mon Aug 3 2009 Jindrich Novy <jnovy@redhat.com> 4.7.0-0.1.pre1
|
||||
- update to 4.7.0-pre1 (fixes #513757)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user