From bdc79ecbafdd2b71104750bcc120d881830594c3 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Mon, 28 Jun 2010 16:05:21 +0000 Subject: [PATCH] script-fu: make logging IPv6-aware (#198367) --- .cvsignore | 2 +- gimp-2.6.9-script-fu-ipv6.patch | 103 ++++++++++++++++++++++++++++++++ gimp.spec | 16 +++-- sources | 2 +- 4 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 gimp-2.6.9-script-fu-ipv6.patch diff --git a/.cvsignore b/.cvsignore index 8e12043..4be66cb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,2 @@ -gimp-2.6.9-1-automake.patch.bz2 gimp-2.6.9.tar.bz2 +gimp-2.6.9-3-autoreconf.patch.bz2 diff --git a/gimp-2.6.9-script-fu-ipv6.patch b/gimp-2.6.9-script-fu-ipv6.patch new file mode 100644 index 0000000..a1341d3 --- /dev/null +++ b/gimp-2.6.9-script-fu-ipv6.patch @@ -0,0 +1,103 @@ +commit 859c381a9764d9d91e1ed8539a5919afbbbf2dbc +Author: Nils Philippsen +Date: Mon Jun 28 16:36:44 2010 +0200 + + patch: script-fu-ipv6 + + Squashed commit of the following: + + commit e567516ade8ebf74598542f8b319f80eee873c65 + Author: Nils Philippsen + Date: Mon Jun 28 16:07:01 2010 +0200 + + Bug 623045 - script-fu: make logging IPv6-aware + + use getnameinfo() instead of inet_ntoa() + +diff --git a/configure.in b/configure.in +index 71f031d..a99cbe4 100644 +--- a/configure.in ++++ b/configure.in +@@ -602,14 +602,14 @@ AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT, 1, + AC_DEFINE(HAVE_RINT)])]) + + +-###################################################### +-# Check for extra libs needed for inet_ntoa and socket +-###################################################### ++######################################################## ++# Check for extra libs needed for getnameinfo and socket ++######################################################## + + gimp_save_LIBS=$LIBS + LIBS="" + +-AC_CHECK_FUNCS(inet_ntoa, , AC_CHECK_LIB(nsl, inet_ntoa)) ++AC_CHECK_FUNCS(getnameinfo, , AC_CHECK_LIB(nsl, getnameinfo)) + AC_CHECK_LIB(socket, socket) + + SOCKET_LIBS="$LIBS" +diff --git a/plug-ins/script-fu/script-fu-server.c b/plug-ins/script-fu/script-fu-server.c +index db1de13..8fb8a10 100644 +--- a/plug-ins/script-fu/script-fu-server.c ++++ b/plug-ins/script-fu/script-fu-server.c +@@ -310,12 +310,16 @@ script_fu_server_listen (gint timeout) + /* Service the server socket if it has input pending. */ + if (FD_ISSET (server_sock, &fds)) + { +- struct sockaddr_in clientname; ++ struct sockaddr_storage client; ++ struct sockaddr_in *client_in; ++ struct sockaddr_in6 *client_in6; ++ gchar clientname[NI_MAXHOST]; + + /* Connection request on original socket. */ +- guint size = sizeof (clientname); ++ guint size = sizeof (client); + gint new = accept (server_sock, +- (struct sockaddr *) &clientname, &size); ++ (struct sockaddr *) &client, &size); ++ guint portno; + + if (new < 0) + { +@@ -324,13 +328,34 @@ script_fu_server_listen (gint timeout) + } + + /* Associate the client address with the socket */ +- g_hash_table_insert (clients, +- GINT_TO_POINTER (new), +- g_strdup (inet_ntoa (clientname.sin_addr))); ++ ++ /* If all else fails ... */ ++ strncpy (clientname, "(error during host address lookup)", NI_MAXHOST-1); ++ ++ /* Lookup address */ ++ (void) getnameinfo ((struct sockaddr *) &client, size, clientname, ++ sizeof (clientname), NULL, 0, NI_NUMERICHOST); ++ ++ /* Determine port number */ ++ switch (client.ss_family) ++ { ++ case AF_INET: ++ client_in = (struct sockaddr_in *) &client; ++ portno = (guint) g_ntohs (client_in->sin_port); ++ break; ++ case AF_INET6: ++ client_in6 = (struct sockaddr_in6 *) &client; ++ portno = (guint) g_ntohs (client_in6->sin6_port); ++ break; ++ default: ++ portno = 0; ++ } ++ ++ g_hash_table_insert (clients, GINT_TO_POINTER (new), ++ g_strdup (clientname)); + + server_log ("Server: connect from host %s, port %d.\n", +- inet_ntoa (clientname.sin_addr), +- (unsigned int) ntohs (clientname.sin_port)); ++ clientname, portno); + } + + /* Service the client sockets. */ diff --git a/gimp.spec b/gimp.spec index 4a490de..d7fd78e 100644 --- a/gimp.spec +++ b/gimp.spec @@ -31,7 +31,7 @@ Summary: GNU Image Manipulation Program Name: gimp Epoch: 2 Version: 2.6.9 -Release: 2%{?dist} +Release: 3%{?dist} %define binver 2.6 %define gimp_lang_ver 20 %define interfacever 2.0 @@ -129,8 +129,12 @@ Patch2: gimp-2.6.6-minimize-dialogs.patch Patch3: gimp-2.6.8-gold.patch # backport: GIMP crashes when clicking any scroll bar from combo boxes Patch4: gimp-2.6.9-combo-popup.patch -# Makefile.in files generated by Makefile.am changed in patches -Patch10: gimp-2.6.9-1-automake.patch.bz2 +# https://bugzilla.redhat.com/show_bug.cgi?id=198367 +# https://bugzilla.gnome.org/show_bug.cgi?id=623045 +# make script-fu logging IPv6 aware +Patch5: gimp-2.6.9-script-fu-ipv6.patch +# files changed by autoreconf after applying the above +Patch10: gimp-2.6.9-3-autoreconf.patch %description GIMP (GNU Image Manipulation Program) is a powerful image composition and @@ -214,7 +218,8 @@ EOF %patch2 -p1 -b .minimize-dialogs %patch3 -p1 -b .gold %patch4 -p1 -b .combo-popup -%patch10 -p1 -b .automake +%patch5 -p1 -b .script-fu-ipv6 +%patch10 -p1 -b .autoreconf %build # Use PIC/PIE because gimp is likely to deal with files coming from untrusted @@ -476,6 +481,9 @@ fi %{_libdir}/gimp/%{interfacever}/plug-ins/help-browser %changelog +* Mon Jun 28 2010 Nils Philippsen - 2:2.6.9-3 +- script-fu: make logging IPv6-aware (#198367) + * Fri Jun 25 2010 Nils Philippsen - 2:2.6.9-2 - fix clicking scroll bar buttons from combo boxes diff --git a/sources b/sources index 53d2650..57cc4c0 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -8bd70b4fb59eb79d0009e633db9e5098 gimp-2.6.9-1-automake.patch.bz2 e5d0cc6f3ce127e51d7f3d3124b16a99 gimp-2.6.9.tar.bz2 +c9f1878af298871e0b0088583cc4ce13 gimp-2.6.9-3-autoreconf.patch.bz2