diff --git a/CMakeLists.txt b/CMakeLists.txt index 17b6f3d..c25f1e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,19 +10,12 @@ PROJECT(netcat-openbsd C) SET(CMAKE_VERBOSE_MAKEFILE ON) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -W -Wall") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fvisibility=hidden -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -W -Wall") -#please fix cmake to avoid this %$#$#$ , there is no findGlib2.cmake built-in ! -FIND_PATH(GLIB2_INCLUDE_DIR NAMES glib.h glibconfig.h PATHS /usr/include/glib-2.0) -FIND_PATH(GLIB2_WEIRD_INCLUDE_DIR NAMES glibconfig.h PATHS /usr/lib/glib-2.0/include /usr/lib64/glib-2.0/include) -FIND_LIBRARY(GLIB2_LIBRARY NAMES glib-2.0) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/openbsd-compat) -INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIR}) -INCLUDE_DIRECTORIES(${GLIB2_WEIRD_INCLUDE_DIR}) SET(NETCAT_SRCS netcat.c atomicio.c socks.c openbsd-compat/base64.c openbsd-compat/readpassphrase.c) ADD_EXECUTABLE(nc ${NETCAT_SRCS}) -TARGET_LINK_LIBRARIES(nc ${GLIB2_LIBRARY}) INSTALL(PROGRAMS nc DESTINATION bin) INSTALL(FILES nc.1 DESTINATION share/man/man1) diff --git a/glib-strlcpy.patch b/glib-strlcpy.patch index f96a09e..ce9cac5 100644 --- a/glib-strlcpy.patch +++ b/glib-strlcpy.patch @@ -1,35 +1,15 @@ -Index: netcat-openbsd-1.89/netcat.c -=================================================================== ---- netcat-openbsd-1.89.orig/netcat.c 2007-02-20 09:11:17.000000000 -0500 -+++ netcat-openbsd-1.89/netcat.c 2008-01-21 18:48:23.000000000 -0500 +--- netcat-openbsd-1.89.orig/netcat.c ++++ netcat-openbsd-1.89/netcat.c @@ -55,6 +55,8 @@ #include #include "atomicio.h" -+#include ++#define strlcpy(d,s,n) snprintf((d),(n),"%s",(s)) + #ifndef SUN_LEN #define SUN_LEN(su) \ (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) -@@ -414,7 +416,7 @@ - memset(&sun, 0, sizeof(struct sockaddr_un)); - sun.sun_family = AF_UNIX; - -- if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= -+ if (g_strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= - sizeof(sun.sun_path)) { - close(s); - errno = ENAMETOOLONG; -@@ -445,7 +447,7 @@ - memset(&sun, 0, sizeof(struct sockaddr_un)); - sun.sun_family = AF_UNIX; - -- if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= -+ if (g_strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= - sizeof(sun.sun_path)) { - close(s); - errno = ENAMETOOLONG; -@@ -549,11 +551,11 @@ +@@ -549,11 +551,11 @@ local_listen(char *host, char *port, str if ((s = socket(res0->ai_family, res0->ai_socktype, res0->ai_protocol)) < 0) continue; @@ -43,7 +23,7 @@ Index: netcat-openbsd-1.89/netcat.c set_common_sockopts(s); if (bind(s, (struct sockaddr *)res0->ai_addr, -@@ -719,7 +721,8 @@ +@@ -719,7 +721,8 @@ build_ports(char *p) char *c; for (x = 0; x <= (hi - lo); x++) { @@ -53,7 +33,7 @@ Index: netcat-openbsd-1.89/netcat.c c = portlist[x]; portlist[x] = portlist[y]; portlist[y] = c; -@@ -761,21 +764,25 @@ +@@ -761,21 +764,25 @@ set_common_sockopts(int s) { int x = 1; @@ -79,7 +59,7 @@ Index: netcat-openbsd-1.89/netcat.c if (Tflag != -1) { if (setsockopt(s, IPPROTO_IP, IP_TOS, &Tflag, sizeof(Tflag)) == -1) -@@ -816,9 +823,11 @@ +@@ -816,9 +823,11 @@ help(void) \t-n Suppress name/port resolutions\n\ \t-P proxyuser\tUsername for proxy authentication\n\ \t-p port\t Specify local port for remote connects\n\ diff --git a/netcat-openbsd.changes b/netcat-openbsd.changes index 4f2de7f..13fe977 100644 --- a/netcat-openbsd.changes +++ b/netcat-openbsd.changes @@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Fri Jan 17 23:36:07 UTC 2014 - crrodriguez@opensuse.org + +- drop dependency on glib, strlcpy can be implemented with + snprintf with glibc/linux +- drop "quilt" from buildrequires, no longer used. +- Use fvisibiliy=hidden to build, this is a program not + a library and no symbols should be exported. + +- modified patches: + * glib-strlcpy.patch +------------------------------------------------------------------- Mon Sep 2 20:12:17 CEST 2013 - pth@suse.de - Split up the huge ubuntu patch into a debian specific patch, diff --git a/netcat-openbsd.spec b/netcat-openbsd.spec index a68eb67..d9cf76b 100644 --- a/netcat-openbsd.spec +++ b/netcat-openbsd.spec @@ -1,7 +1,7 @@ # # spec file for package netcat-openbsd # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,8 +23,6 @@ Version: 1.89 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: cmake -BuildRequires: glib2-devel -BuildRequires: quilt PreReq: update-alternatives Summary: TCP/IP swiss army knife License: BSD-3-Clause