Accepting request 214384 from network:utilities

- 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 (forwarded request 214314 from elvigia)

OBS-URL: https://build.opensuse.org/request/show/214384
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/netcat-openbsd?expand=0&rev=21
This commit is contained in:
Stephan Kulow 2014-01-23 13:03:48 +00:00 committed by Git OBS Bridge
commit ac1ad7a63d
4 changed files with 20 additions and 38 deletions

View File

@ -10,19 +10,12 @@
PROJECT(netcat-openbsd C) PROJECT(netcat-openbsd C)
SET(CMAKE_VERBOSE_MAKEFILE ON) 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(${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) SET(NETCAT_SRCS netcat.c atomicio.c socks.c openbsd-compat/base64.c openbsd-compat/readpassphrase.c)
ADD_EXECUTABLE(nc ${NETCAT_SRCS}) ADD_EXECUTABLE(nc ${NETCAT_SRCS})
TARGET_LINK_LIBRARIES(nc ${GLIB2_LIBRARY})
INSTALL(PROGRAMS nc DESTINATION bin) INSTALL(PROGRAMS nc DESTINATION bin)
INSTALL(FILES nc.1 DESTINATION share/man/man1) INSTALL(FILES nc.1 DESTINATION share/man/man1)

View File

@ -1,35 +1,15 @@
Index: netcat-openbsd-1.89/netcat.c --- netcat-openbsd-1.89.orig/netcat.c
=================================================================== +++ 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
@@ -55,6 +55,8 @@ @@ -55,6 +55,8 @@
#include <limits.h> #include <limits.h>
#include "atomicio.h" #include "atomicio.h"
+#include <glib.h> +#define strlcpy(d,s,n) snprintf((d),(n),"%s",(s))
+ +
#ifndef SUN_LEN #ifndef SUN_LEN
#define SUN_LEN(su) \ #define SUN_LEN(su) \
(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
@@ -414,7 +416,7 @@ @@ -549,11 +551,11 @@ local_listen(char *host, char *port, str
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 @@
if ((s = socket(res0->ai_family, res0->ai_socktype, if ((s = socket(res0->ai_family, res0->ai_socktype,
res0->ai_protocol)) < 0) res0->ai_protocol)) < 0)
continue; continue;
@ -43,7 +23,7 @@ Index: netcat-openbsd-1.89/netcat.c
set_common_sockopts(s); set_common_sockopts(s);
if (bind(s, (struct sockaddr *)res0->ai_addr, if (bind(s, (struct sockaddr *)res0->ai_addr,
@@ -719,7 +721,8 @@ @@ -719,7 +721,8 @@ build_ports(char *p)
char *c; char *c;
for (x = 0; x <= (hi - lo); x++) { for (x = 0; x <= (hi - lo); x++) {
@ -53,7 +33,7 @@ Index: netcat-openbsd-1.89/netcat.c
c = portlist[x]; c = portlist[x];
portlist[x] = portlist[y]; portlist[x] = portlist[y];
portlist[y] = c; portlist[y] = c;
@@ -761,21 +764,25 @@ @@ -761,21 +764,25 @@ set_common_sockopts(int s)
{ {
int x = 1; int x = 1;
@ -79,7 +59,7 @@ Index: netcat-openbsd-1.89/netcat.c
if (Tflag != -1) { if (Tflag != -1) {
if (setsockopt(s, IPPROTO_IP, IP_TOS, if (setsockopt(s, IPPROTO_IP, IP_TOS,
&Tflag, sizeof(Tflag)) == -1) &Tflag, sizeof(Tflag)) == -1)
@@ -816,9 +823,11 @@ @@ -816,9 +823,11 @@ help(void)
\t-n Suppress name/port resolutions\n\ \t-n Suppress name/port resolutions\n\
\t-P proxyuser\tUsername for proxy authentication\n\ \t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\ \t-p port\t Specify local port for remote connects\n\

View File

@ -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 Mon Sep 2 20:12:17 CEST 2013 - pth@suse.de
- Split up the huge ubuntu patch into a debian specific patch, - Split up the huge ubuntu patch into a debian specific patch,

View File

@ -1,7 +1,7 @@
# #
# spec file for package netcat-openbsd # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -23,8 +23,6 @@ Version: 1.89
Release: 0 Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: cmake BuildRequires: cmake
BuildRequires: glib2-devel
BuildRequires: quilt
PreReq: update-alternatives PreReq: update-alternatives
Summary: TCP/IP swiss army knife Summary: TCP/IP swiss army knife
License: BSD-3-Clause License: BSD-3-Clause