script-fu: make logging IPv6-aware (#198367)

This commit is contained in:
Nils Philippsen 2010-06-28 16:05:21 +00:00
parent c73c9be9d5
commit bdc79ecbaf
4 changed files with 117 additions and 6 deletions

View File

@ -1,2 +1,2 @@
gimp-2.6.9-1-automake.patch.bz2
gimp-2.6.9.tar.bz2 gimp-2.6.9.tar.bz2
gimp-2.6.9-3-autoreconf.patch.bz2

View File

@ -0,0 +1,103 @@
commit 859c381a9764d9d91e1ed8539a5919afbbbf2dbc
Author: Nils Philippsen <nils@redhat.com>
Date: Mon Jun 28 16:36:44 2010 +0200
patch: script-fu-ipv6
Squashed commit of the following:
commit e567516ade8ebf74598542f8b319f80eee873c65
Author: Nils Philippsen <nils@redhat.com>
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. */

View File

@ -31,7 +31,7 @@ Summary: GNU Image Manipulation Program
Name: gimp Name: gimp
Epoch: 2 Epoch: 2
Version: 2.6.9 Version: 2.6.9
Release: 2%{?dist} Release: 3%{?dist}
%define binver 2.6 %define binver 2.6
%define gimp_lang_ver 20 %define gimp_lang_ver 20
%define interfacever 2.0 %define interfacever 2.0
@ -129,8 +129,12 @@ Patch2: gimp-2.6.6-minimize-dialogs.patch
Patch3: gimp-2.6.8-gold.patch Patch3: gimp-2.6.8-gold.patch
# backport: GIMP crashes when clicking any scroll bar from combo boxes # backport: GIMP crashes when clicking any scroll bar from combo boxes
Patch4: gimp-2.6.9-combo-popup.patch Patch4: gimp-2.6.9-combo-popup.patch
# Makefile.in files generated by Makefile.am changed in patches # https://bugzilla.redhat.com/show_bug.cgi?id=198367
Patch10: gimp-2.6.9-1-automake.patch.bz2 # 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 %description
GIMP (GNU Image Manipulation Program) is a powerful image composition and GIMP (GNU Image Manipulation Program) is a powerful image composition and
@ -214,7 +218,8 @@ EOF
%patch2 -p1 -b .minimize-dialogs %patch2 -p1 -b .minimize-dialogs
%patch3 -p1 -b .gold %patch3 -p1 -b .gold
%patch4 -p1 -b .combo-popup %patch4 -p1 -b .combo-popup
%patch10 -p1 -b .automake %patch5 -p1 -b .script-fu-ipv6
%patch10 -p1 -b .autoreconf
%build %build
# Use PIC/PIE because gimp is likely to deal with files coming from untrusted # 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 %{_libdir}/gimp/%{interfacever}/plug-ins/help-browser
%changelog %changelog
* Mon Jun 28 2010 Nils Philippsen <nils@redhat.com> - 2:2.6.9-3
- script-fu: make logging IPv6-aware (#198367)
* Fri Jun 25 2010 Nils Philippsen <nils@redhat.com> - 2:2.6.9-2 * Fri Jun 25 2010 Nils Philippsen <nils@redhat.com> - 2:2.6.9-2
- fix clicking scroll bar buttons from combo boxes - fix clicking scroll bar buttons from combo boxes

View File

@ -1,2 +1,2 @@
8bd70b4fb59eb79d0009e633db9e5098 gimp-2.6.9-1-automake.patch.bz2
e5d0cc6f3ce127e51d7f3d3124b16a99 gimp-2.6.9.tar.bz2 e5d0cc6f3ce127e51d7f3d3124b16a99 gimp-2.6.9.tar.bz2
c9f1878af298871e0b0088583cc4ce13 gimp-2.6.9-3-autoreconf.patch.bz2