Displaying 20 results from an estimated 39 matches for "listen_sock".
2008 Dec 19
2
Using realloc to remove MAX_LISTEN_SOCKS limit on sshd.c
OpenSSH developers,
I have removed the fixed, arbitrary limit on the number of ListenAddress
allowed by using realloc to dynamically expand listen_socks as needed.
This completely removes MAX_LISTEN_SOCKS from the source. I made this
change on the version of OpenSSH shipped with CentOS 5.2, version
4.3p2. Please see the attached .c file and .diff file. Please add
these changes to OpenSSH to save people from having to predetermine
their wo...
2001 Feb 17
2
Important fix (sshd && binding). Portable version only.
...sh-2.3.0p1.org/sshd.c openssh-2.3.0p1/sshd.c
--- openssh-2.3.0p1.org/sshd.c Sat Jan 6 19:54:11 2001
+++ openssh-2.3.0p1/sshd.c Sat Jan 6 19:55:48 2001
@@ -782,10 +782,10 @@
debug("Bind to port %s on %s.", strport, ntop);
/* Bind the socket to the desired port. */
- if ((bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) &&
- (!ai->ai_next)) {
- error("Bind to port %s on %s failed: %.200s.",
- strport, ntop, strerror(errno));
+ if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) {
+ if (!ai->ai_next)
+ error(&...
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
.../* Set thread-local data. */
threadlocal_new_server_thread ();
threadlocal_set_instance_num (data->instance_num);
- threadlocal_set_sockaddr (&data->addr, data->addrlen);
handle_single_connection (data->sock, data->sock);
@@ -299,12 +296,9 @@ accept_connection (int listen_sock)
}
thread_data->instance_num = instance_num++;
- thread_data->addrlen = sizeof thread_data->addr;
again:
#ifdef HAVE_ACCEPT4
- thread_data->sock = accept4 (listen_sock,
- &thread_data->addr, &thread_data->addrlen,
-...
2017 Nov 17
0
[nbdkit PATCH 4/4] sockets: Fix lifetime of thread_data
...f --git a/src/sockets.c b/src/sockets.c
index edb63b3..1d63523 100644
--- a/src/sockets.c
+++ b/src/sockets.c
@@ -261,6 +261,7 @@ start_thread (void *datav)
handle_single_connection (data->sock, data->sock);
+ free (data);
return NULL;
}
@@ -270,18 +271,25 @@ accept_connection (int listen_sock)
int err;
pthread_attr_t attrs;
pthread_t thread;
- struct thread_data thread_data;
+ struct thread_data *thread_data;
static size_t instance_num = 1;
- thread_data.instance_num = instance_num++;
- thread_data.addrlen = sizeof thread_data.addr;
+ thread_data = malloc (sizeof *thre...
2002 Sep 06
0
use of setsockopt(SO_LINGER)
...ieving revision 1.257
diff -u -r1.257 sshd.c
--- sshd.c 23 Jul 2002 16:03:10 -0000 1.257
+++ sshd.c 4 Sep 2002 17:12:55 -0000
@@ -789,7 +789,6 @@
const char *remote_ip;
int remote_port;
FILE *f;
- struct linger linger;
struct addrinfo *ai;
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
int listen_sock, maxfd;
@@ -1102,17 +1101,12 @@
continue;
}
/*
- * Set socket options. We try to make the port
- * reusable and have it close as fast as possible
- * without waiting in unnecessary wait states on
- * close.
+ * Set socket options.
+ * Allow local port reuse in TIME_W...
2008 Sep 15
0
No subject
...ions.protocol=4 ...sensitive_data.have_ssh1_key=0? sensitive_data.have_ssh2_key=1
use_privsep=1
?before get pwnam
?after get pwnam
?before set groups
?before daemon starts
?after daemon starts
before arc4random_stir
before chdir
?before signal
?after signal
?in else condition
AF_INET=2, AF_INET6=10
listen_sock=0ai->ai_family=2,ai->ai_socktype=2,ai->ai_protocol=6
listen_sock=5
Bind to port ssh on 0.0..0.0.
?strport=ssh
Server listening on 0.0.0.0 port ssh.
AF_INET=2, AF_INET6=10
listen_sock=5ai->ai_family=2,ai->ai_socktype=2,ai->ai_protocol=6
listen_sock=6
Bind to port ssh on ::.
?not bi...
2008 Sep 18
2
SSHD_PROBLEM
...ions.protocol=4 ...sensitive_data.have_ssh1_key=0 sensitive_data.have_ssh2_key=1
use_privsep=1
before get pwnam
after get pwnam
before set groups
before daemon starts
after daemon starts
before arc4random_stir
before chdir
before signal
after signal
in else condition
AF_INET=2, AF_INET6=10
listen_sock=0ai->ai_family=2,ai->ai_socktype=2,ai->ai_protocol=6
listen_sock=5
Bind to port ssh on 0.0.0.0.
strport=ssh
Server listening on 0.0.0.0 port ssh.
AF_INET=2, AF_INET6=10
listen_sock=5ai->ai_family=2,ai->ai_socktype=2,ai->ai_protocol=6
listen_sock=6
Bind to port ssh on ::.
not bin...
2020 Apr 28
2
[PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
On Haiku tests/test-socket-activation failed with:
nbdkit: locks.c:96:lock_request: conn != NULL
called from server/sockets.c: accept_connection
in the fallback path which does:
lock_request ();
thread_data->sock = set_cloexec (accept (listen_sock, NULL, NULL));
unlock_request ()
Because there is no current connection in this thread this code fails.
However it should be possible to call lock_request without a
connection, provided that
thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS (which it is
when the fallback path is engaged...
2020 Sep 25
0
[RFC PATCH 01/19] tools/virtiofsd: add support for --socket-group
...irtio.c
@@ -31,6 +31,8 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
+#include <sys/types.h>
+#include <grp.h>
#include <unistd.h>
#include "contrib/libvhost-user/libvhost-user.h"
@@ -924,15 +926,29 @@ static int fv_create_listen_socket(struct fuse_session *se)
/*
* Unfortunately bind doesn't let you set the mask on the socket,
- * so set umask to 077 and restore it later.
+ * so set umask appropriately and restore it later.
*/
- old_umask = umask(0077);
+ if (se->vu_socket_group) {
+...
2002 Sep 05
7
sshd and SIGKILL
On command:
#kill -9 `cat /var/run/sshd.pid`
sshd leave pid file !
sshd.c code:
===============
....
/*
* Arrange to restart on SIGHUP. The handler needs
* listen_sock.
*/
signal(SIGHUP, sighup_handler);
signal(SIGTERM, sigterm_handler);
signal(SIGQUIT, sigterm_handler);
....
===============
Missing line is :
signal(SIGKILL, sigterm_handler);
2005 Feb 01
5
Cannot save/migrate domains
Hi,
I had a problem trying to migrate domains, in trying to locate it I
noticed that saving domains doesn''t work either, which I believe
explains why the receiving xfrd doesn''t actually receive anything.
So here it goes...
xenone:/tmp# xm list
Name Id Mem(MB) CPU State Time(s) Console
Domain-0 0 123 0 r---- 900.6
sky 9
2017 Nov 17
7
[nbdkit PATCH 0/4] thread-safety issues prior to parallel handling
These patches should be ready to go in now; I will also post my
work-in-progress for enabling full parallel handling that depends
on these, but with that series, I was still getting crashes or
hangs with test-socket-activation (I think I've nailed all the
crashes I've seen, but the hang is rather insidious; see my other
email
2019 May 30
0
[PATCH nbdkit 2/2] server: Disable Nagle's algorithm.
...#include <sys/un.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <netdb.h>
-#include <poll.h>
-#include <errno.h>
-#include <assert.h>
#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
@@ -273,6 +275,7 @@ accept_connection (int listen_sock)
pthread_t thread;
struct thread_data *thread_data;
static size_t instance_num = 1;
+ const int flag = 1;
thread_data = malloc (sizeof *thread_data);
if (!thread_data) {
@@ -293,6 +296,11 @@ accept_connection (int listen_sock)
return;
}
+ /* Disable Nagle's algorith...
2001 Jun 22
1
PATCH: pidfile/sigterm race
...talled, since the pidfile is written out before the signal
handlers are setup.
The solution is to simply write the pidfile after the signal
handlers are setup. Here's the patch.
Rob
--- sshd.c.orig Fri Jun 22 11:16:41 2001
+++ sshd.c Fri Jun 22 11:18:32 2001
@@ -857,6 +857,19 @@
if (!num_listen_socks)
fatal("Cannot bind any address.");
+ if (options.protocol & SSH_PROTO_1)
+ generate_ephemeral_server_key();
+
+ /* Arrange to restart on SIGHUP. The handler needs listen_sock. */
+ signal(SIGHUP, sighup_handler);
+
+ signal(SIGTERM, sigterm_handler);
+ signal(SIGQUIT,...
2019 May 30
2
[PATCH nbdkit 1/2] nbd: Fix -Werror=maybe-uninitialized warning.
GCC is concerned that if we never go round the loop then fd will be
uninitialized. By asserting that getaddrinfo set result != NULL we
can avoid this.
nbd.c: In function ‘nbd_open_handle’:
nbd.c:974:5: error: ‘fd’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
974 | close (fd);
| ^~~~~~~~~~
nbd.c:954:7: note: ‘fd’ was declared here
954 | int fd;
2003 May 14
3
Changes in tonights snapshot
There are a couple of noteworthy changes in tonight's snapshot:
1. New UsePAM directive
There is a new sshd_config directive, UsePAM for systems built using
"configure --with-pam". This allows one to switch off all PAM calls
from sshd.
This is handy if one builds with PAM but wants to use the sshd's
ability to run as a non-root user. Previously this was impossible if
one
2012 May 08
1
About bug 640857
Hi, Dear OpenSSH support,
I'm writing to ask whether this bug is fixed in your openSSH 6.0. If no, do you have any plan?
https://bugzilla.redhat.com/show_bug.cgi?id=640857
Regards,
Carol
1999 Nov 20
1
openssh and DOS
...n. The parent continues listening. */
- if ((pid = fork()) == 0)
- {
- /* Child. Close the listening socket, and start using
- the accepted socket. Reinitialize logging (since our
- pid has changed). We break out of the loop to handle
- the connection. */
- close(listen_sock);
- sock_in = newsock;
- sock_out = newsock;
- log_init(av0, options.log_level, options.log_facility, log_stderr);
- break;
+ /* Make sure we don't have too many connections. */
+ if (options.max_connections > 0
+ && current_connections >=...
2019 Oct 04
4
[PATCH libnbd 1/4] generator: Allow long ‘name - shortdesc’ in man pages.
For commands with long names and/or short descriptors, you can end up
going over 72 characters in the first line of the man page (causing
podwrapper to complain). Wrap these lines.
---
generator/generator | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/generator/generator b/generator/generator
index 7d3f656..ad1cb6b 100755
--- a/generator/generator
+++ b/generator/generator
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
...e %" PRIu32,
+ blocks[i].length, blocks[i].status_flags);
#endif
/* Convert to big endian for the protocol. */
diff --git a/server/sockets.c b/server/sockets.c
index 1585a09..119cb99 100644
--- a/server/sockets.c
+++ b/server/sockets.c
@@ -365,7 +365,7 @@ accept_connection (int listen_sock)
const int flag = 1;
thread_data = malloc (sizeof *thread_data);
- if (!thread_data) {
+ if (unlikely (!thread_data)) {
perror ("malloc");
return;
}
@@ -409,7 +409,7 @@ accept_connection (int listen_sock)
pthread_attr_setdetachstate (&attrs, PTHREAD_CREATE_DE...