# # # $Id: ucspi-tcp.spec.in,v 1.26 2024-02-11 19:53:18+05:30 Cprogrammer Exp mbhangui $ %undefine _missing_build_ids_terminate_build %global _unpackaged_files_terminate_build 1 %if %{defined _project} # define if building on openSUSE build service %global build_on_obs 1 %else %define _project local %global build_on_obs 0 %global _hardened_build 1 %endif %if %{defined nodebug} %global debug_package %{nil} %endif %global _prefix /usr %global shareddir /usr/share/indimail %global mandir /usr/share/man %global qsysconfdir /etc/indimail %global plugindir %{_prefix}/lib/indimail/plugins %global libexecdir /usr/libexec/indimail %global servicedir /service %global tcpserver_plugin 1 %global see_base For a description of ucspi-tcp visit https://github.com/indimail/indimail-mta %if %build_on_obs == 1 %global packager Manvendra Bhangui > %endif %if 0%{?suse_version} %global dist suse %global disttag suse %endif %if 0%{?fedora_version} %global dist %{?dist} %global disttag fedora %endif Summary: A collection of tools for building TCP client-server applications Name: ucspi-tcp Version: 1.1.4 Release: 1.1%{?dist} %if %build_on_obs == 1 License: GPL-3.0+ %else License: GPLv3 %endif %if %{undefined suse_version} && %{undefined sles_version} Group: System Environment/Base %else Group: Productivity/Networking/Email/Servers %endif Source0: http://downloads.sourceforge.net/indimail/%{name}-%{version}.tar.gz URL: https://github.com/mbhangui/indimail-mta #AutoReqProv: No Conflicts: indimail-mta < 2.11 BuildRequires: gcc gcc-c++ make pkgconfig BuildRequires: sed findutils diffutils gzip coreutils grep BuildRequires: glibc glibc-devel BuildRequires: openssl openssl-devel BuildRequires: libqmail-devel %if %{defined amzn} BuildRequires: mariadb-connector-c-devel %else BuildRequires: mysql-devel %endif ##################################### OBS #################################### %if %build_on_obs == 1 %if 0%{?suse_version} BuildRequires: -post-build-checks #!BuildIgnore: post-build-checks %endif %endif ############################################################################## Requires: procps /usr/bin/awk /usr/bin/which Requires: coreutils grep /bin/sh glibc openssl Requires: diffutils sed findutils pkgconfig Requires: libqmail > 0.3 %description tcpserver and tcpclient are easy-to-use command-line tools for building TCP client-server applications. tcpserver waits for incoming connections and, for each connection, runs a program of your choice. Your program receives environment variables showing the local and remote host names, IP addresses, and port numbers. tcpserver offers a concurrency limit to protect you from running out of processes and memory. When you are handling 40 (by default) simultaneous connections, tcpserver smoothly defers acceptance of new connections. tcpserver also provides TCP access control features, similar to tcp-wrappers/tcpd\'s hosts.allow but much faster. Its access control rules are compiled into a hashed format with cdb, so it can easily deal with thousands of different hosts. This package includes a recordio tool that monitors all the input and output of a server. tcpclient makes a TCP connection and runs a program of your choice. It sets up the same environment variables as tcpserver. This package includes several sample clients built on top of tcpclient: who@, date@, finger@, http@, tcpcat, and mconnect. tcpserver and tcpclient conform to UCSPI, the UNIX Client-Server Program Interface, using the TCP protocol. tcpserver and tcpclient support ipv6 and TLS connections. Original Author: Dan J. Bernstein %prep %setup -q %build ( echo "---------------- INFORMATION ------------------------" echo target %_target echo target_alias %_target_alias echo target_cpu %_target_cpu echo target_os %_target_os echo target_vendor %_target_vendor echo Building %{name}-%{version}-%{release} Build %{_build} OS %{_os} Dist %dist disttag %disttag libs %{_lib} %{_libdir} echo "------------------------------------------------------" ) > %{name}-rpm.info ( echo "NAME=%{name}" echo "Description=\"ucspi-tcp\"" echo "UCSPITCP_version="%{version}"" echo "ID=%{name}" echo "HOME_URL=\"https://github.com/mbhangui/indimail-mta\"" echo "PACKAGE_BUGREPORT=\"'Manvendra Bhangui '\"" ) > %{name}-release #### ucspi-tcp ###################### %{__sed} 's{PREFIX{%{_prefix}{' conf-prefix.in > conf-prefix %{__sed} 's{SHAREDDIR{%{shareddir}{' conf-shared.in > conf-shared %{__sed} 's{SYSCONFDIR{%{qsysconfdir}{' conf-sysconfdir.in > conf-sysconfdir %{__sed} 's{LIBEXECDIR{%{libexecdir}{' conf-libexec.in > conf-libexec %{__sed} 's{SERVICEDIR{%{servicedir}{' conf-servicedir.in > conf-servicedir %if %{tcpserver_plugin} == 1 echo "-DLOAD_SHARED_OBJECTS" > conf-dlopen %else %{__rm} -f conf-dlopen %endif ./catChangeLog doc/ChangeLog > ChangeLog echo %{__cc} -g -Wall -Wshadow -fPIC %{optflags} -fno-strict-aliasing -I/usr/include/qmail > conf-cc %if %{defined nodebug} echo %{__cc} -s -O2 > conf-ld %else echo %{__cc} -O2 > conf-ld %endif %install %{__mkdir_p} %{buildroot}%{_prefix} # rpm macros are complicated. Read https://rpm.org/user_doc/macros.html %if 0%{?build_cflags:1} CFLAGS="%{build_cflags}" %else CFLAGS="%{optflags}" %endif %if 0%{?build_ldflags:1} LDFLAGS="%{build_ldflags} $LDFLAGS" %endif %{__make} SYSTEM=LINUX %{?_smp_mflags} CC="%{__cc}" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" %if %{defined nodebug} %{__make} SYSTEM=LINUX %{?_smp_mflags} CC="%{__cc}" DESTDIR=%{buildroot} install-strip %else %{__make} SYSTEM=LINUX %{?_smp_mflags} CC="%{__cc}" DESTDIR=%{buildroot} install %endif %{__mkdir_p} %{buildroot}%{shareddir}/doc %{__mkdir_p} %{buildroot}%{qsysconfdir} #copy files not copied by setup install -m 0644 %{name}-release %{buildroot}%{qsysconfdir}/%{name}-release install -m 0644 %{name}-rpm.info %{buildroot}%{qsysconfdir}/%{name}-rpm.info install -m 0644 ChangeLog %{buildroot}%{shareddir}/doc/ChangeLog-ucspi-tcp %{__rm} -f ChangeLog %if %{undefined nodebug} chmod -R 755 %{buildroot}%{_prefix}/bin chmod -R 755 %{buildroot}%{libexecdir} chmod -R 755 %{buildroot}%{plugindir} %endif %files %dir %attr(0755,root,root) %{qsysconfdir}/perms.d %dir %attr(0755,root,root) %{qsysconfdir}/perms.d/%{name} %attr(0755,root,root) %{_prefix}/bin/tcpserver %attr(0755,root,root) %{_prefix}/bin/tcprules %attr(0755,root,root) %{_prefix}/bin/tcprulescheck %attr(0755,root,root) %{_prefix}/bin/tcpclient %attr(0755,root,root) %{_prefix}/bin/who@ %attr(0755,root,root) %{_prefix}/bin/date@ %attr(0755,root,root) %{_prefix}/bin/finger@ %attr(0755,root,root) %{_prefix}/bin/http@ %attr(0755,root,root) %{_prefix}/bin/tcpcat %attr(0755,root,root) %{_prefix}/bin/mconnect %attr(0755,root,root) %{_prefix}/bin/mconnect-io %attr(0755,root,root) %{_prefix}/bin/rblsmtpd %attr(0755,root,root) %{_prefix}/bin/argv0 %attr(0755,root,root) %{_prefix}/bin/addcr %attr(0755,root,root) %{_prefix}/bin/delcr %attr(0755,root,root) %{_prefix}/bin/fixcrio %attr(0755,root,root) %{_prefix}/bin/recordio %attr(0755,root,root) %{_prefix}/bin/dotls %attr(0444,root,root) %{qsysconfdir}/%{name}-release %attr(0444,root,root) %{qsysconfdir}/%{name}-rpm.info %attr(0644,root,root) %config(noreplace) %{qsysconfdir}/perms.d/%{name}/* %attr(0755,root,root) %{plugindir}/rblsmtpd.so %attr(0755,root,root) %{libexecdir}/instcheck.ucspi-tcp %attr(0755,root,root) %{libexecdir}/uinstaller %if "%{mandir}" != "/usr/share/man" %dir %attr(0755,root,root) %{mandir} %dir %attr(0755,root,root) %{mandir}/man1 %dir %attr(0755,root,root) %{mandir}/man8 %endif %docdir %{mandir} %attr(0644,root,root) %{mandir}/man1/tcpserver.1.* %attr(0644,root,root) %{mandir}/man1/tcprules.1.* %attr(0644,root,root) %{mandir}/man1/tcprulescheck.1.* %attr(0644,root,root) %{mandir}/man1/tcpclient.1.* %attr(0644,root,root) %{mandir}/man1/who@.1.* %attr(0644,root,root) %{mandir}/man1/date@.1.* %attr(0644,root,root) %{mandir}/man1/finger@.1.* %attr(0644,root,root) %{mandir}/man1/http@.1.* %attr(0644,root,root) %{mandir}/man1/tcpcat.1.* %attr(0644,root,root) %{mandir}/man1/mconnect.1.* %attr(0644,root,root) %{mandir}/man1/mconnect-io.1.* %attr(0644,root,root) %{mandir}/man1/rblsmtpd.1.* %attr(0644,root,root) %{mandir}/man1/argv0.1.* %attr(0644,root,root) %{mandir}/man1/addcr.1.* %attr(0644,root,root) %{mandir}/man1/delcr.1.* %attr(0644,root,root) %{mandir}/man1/fixcrio.1.* %attr(0644,root,root) %{mandir}/man1/recordio.1.* %attr(0644,root,root) %{mandir}/man1/dotls.1.* %attr(0644,root,root) %{mandir}/man1/uinstaller.1.* %attr(0644,root,root) %{mandir}/man1/instcheck-ucspi-tcp.1.* %attr(0644,root,root) %{shareddir}/doc/ChangeLog-ucspi-tcp %attr(0644,root,root) %{shareddir}/doc/README.ucspi-tcp ### SCRIPTLET ############################################################################### %pretrans argv1=$1 ID=$(id -u) if [ $ID -ne 0 ] ; then echo "You are not root" 1>&2 exit 1 fi for i in `grep -l -E "tcpserver|tcpclient" %{servicedir}/*/run 2>/dev/null` do i=$(dirname $i) %{_prefix}/bin/svok $i if [ $? -eq 0 ] ; then touch $i.down %{_prefix}/bin/svc -d $i || true fi done %post argv1=$1 ID=$(id -u) if [ $ID -ne 0 ] ; then echo "You are not root" 1>&2 exit 1 fi if [ -z "$argv1" ] ; then argv1=0 fi if [ $argv1 -eq 2 ] ; then # upgrade for i in `grep -l -E "tcpserver|tcpclient" %{servicedir}/*/run 2>/dev/null` do i=$(dirname $i) if [ -f $i.down ] ; then %{__rm} -f $i.down %{_prefix}/bin/svc -u $i || true fi done fi # fix changelog for openSUSE buildservice %changelog * Tue Nov 12 2024 11:40:09 +0000 Manvendra Bhangui 1.1.4-1.1%{?dist} Release 1.1.4-1.1 Start 08/02/2024 End 06/08/2024 - installer.c: replace chown, chmod with fchown, fchmod - installer.c: removed unused options and fixed check option fixing permissions - installer.c: fixed displaying size variable, fixed allocation of zerobuf variable - trypoll.c, tryshsgr.c: Fix compiler warnings - fix discarded-qualifier compiler warnings - fix function prototypes - tcpclient.c: fixed incorrect use of strerr_warn instead of strerr_die - tcpclient.c: added starttls capability for imap - dotls.c: added starttls handler for imap - tcpclient.c: added -e option to get remote host address from /etc/hosts - getip.c: new function getip() which uses getaddrinfo() to get remote host address - tcpserver.c: use INET6_ADDRLENSTRLEN for AF_INET6