diff options
-rw-r--r-- | qarsh.c | 3 | ||||
-rw-r--r-- | qarsh.spec | 9 | ||||
-rw-r--r-- | sockutil.c | 9 |
3 files changed, 15 insertions, 6 deletions
@@ -46,6 +46,7 @@ #define QARSH_MINPORT 5010 #define QARSH_BUFSIZE 4096 +#define CONNECT_TIMEOUT 30 /* Globals */ @@ -508,7 +509,7 @@ again: sa.sa_handler = sig_alrm_handler; sigaction(SIGALRM, &sa, NULL); - alarm(max_timeout); + alarm(CONNECT_TIMEOUT); qarsh_fd = connect_to_host(host, port, &qarsh_ss_family); alarm(0); @@ -1,7 +1,7 @@ Summary: QA Remote Shell Name: qarsh Version: 1.26 -Release: 1%{?dist} +Release: 2%{?dist} Group: Applications/Internet License: GPL Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -35,9 +35,9 @@ WARNING: THIS PACKAGE PROVIDES REMOTE ROOT ACCESS WITHOUT AUTHENTICATION %package selinux Summary: SELinux policy module supporting qarsh Group: System Environment/Daemons -BuildRequires: checkpolicy, selinux-policy-devel, hardlink, gxpp -Requires: %{name}-server = %{version}-%{release}, make -Requires(post): /usr/sbin/semodule, /sbin/fixfiles, qarsh-server +Requires: %{name}-server = %{version}-%{release} +Requires(post): /usr/sbin/semodule, /sbin/fixfiles, gxpp, make +Requires(post): checkpolicy, selinux-policy-devel, hardlink Requires(postun): /usr/sbin/semodule @@ -93,7 +93,6 @@ fi %files selinux %defattr(-,root,root) %doc SELinux/* -%{_datadir}/selinux/packages/qarsh %changelog @@ -56,8 +56,16 @@ getsockport(int sd) int bind_any(int minport, unsigned short ss_family) { + static int lastminport = 0; + static int nextport = 0; int sd; struct sockaddr_storage addr; + + if (minport == lastminport) { + minport = nextport; + } else { + lastminport = minport; + } sd = socket(ss_family, SOCK_STREAM, 0); if (sd == -1) return -1; @@ -77,6 +85,7 @@ bind_any(int minport, unsigned short ss_family) ipv6p->sin6_port = htons(minport++); } while (bind(sd, (struct sockaddr *)&addr, sizeof addr) != 0); } + nextport = minport; if (listen(sd, 0) == -1) { syslog(LOG_WARNING, "listen error %d, %s", errno, |