diff options
Diffstat (limited to 'src/assuan-socket-server.c')
-rw-r--r-- | src/assuan-socket-server.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c index 964720b..a5b7fd7 100644 --- a/src/assuan-socket-server.c +++ b/src/assuan-socket-server.c @@ -1,20 +1,21 @@ /* assuan-socket-server.c - Assuan socket based server - Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc. - - This file is part of Assuan. - - Assuan is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of - the License, or (at your option) any later version. - - Assuan is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program; if not, see <http://www.gnu.org/licenses/>. + * Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc. + * + * This file is part of Assuan. + * + * Assuan is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * Assuan is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see <http://www.gnu.org/licenses/>. + * SPDX-License-Identifier: LGPL-2.1+ */ #ifdef HAVE_CONFIG_H @@ -36,7 +37,7 @@ #ifdef HAVE_W32_SYSTEM # ifdef HAVE_WINSOCK2_H # include <winsock2.h> -# endif +# endif # include <windows.h> # if HAVE_SYS_SOCKET_H # include <sys/socket.h> @@ -122,7 +123,7 @@ accept_connection_bottom (assuan_context_t ctx) ctx->outbound.fd = fd; ctx->outbound.data.linelen = 0; ctx->outbound.data.error = 0; - + ctx->flags.confidential = 0; return 0; @@ -136,16 +137,16 @@ accept_connection (assuan_context_t ctx) struct sockaddr_un clnt_addr; socklen_t len = sizeof clnt_addr; - TRACE1 (ctx, ASSUAN_LOG_SYSIO, "accept_connection", ctx, + TRACE1 (ctx, ASSUAN_LOG_SYSIO, "accept_connection", ctx, "listen_fd=0x%x", ctx->listen_fd); - fd = SOCKET2HANDLE(accept (HANDLE2SOCKET(ctx->listen_fd), + fd = SOCKET2HANDLE(accept (HANDLE2SOCKET(ctx->listen_fd), (struct sockaddr*)&clnt_addr, &len )); if (fd == ASSUAN_INVALID_FD) { return _assuan_error (ctx, gpg_err_code_from_syserror ()); } - TRACE1 (ctx, ASSUAN_LOG_SYSIO, "accept_connection", ctx, + TRACE1 (ctx, ASSUAN_LOG_SYSIO, "accept_connection", ctx, "fd->0x%x", fd); if (_assuan_sock_check_nonce (ctx, fd, &ctx->listen_nonce)) { @@ -158,7 +159,7 @@ accept_connection (assuan_context_t ctx) } -/* +/* Flag bits: 0 - use sendmsg/recvmsg to allow descriptor passing 1 - FD has already been accepted. */ @@ -169,7 +170,7 @@ assuan_init_socket_server (assuan_context_t ctx, assuan_fd_t fd, gpg_error_t rc; TRACE_BEG2 (ctx, ASSUAN_LOG_CTX, "assuan_init_socket_server", ctx, "fd=0x%x, flags=0x%x", fd, flags); - + rc = _assuan_register_std_commands (ctx); if (rc) return TRACE_ERR (rc); @@ -202,7 +203,7 @@ assuan_init_socket_server (assuan_context_t ctx, assuan_fd_t fd, ctx->connected_fd = ASSUAN_INVALID_FD; } ctx->accept_handler = ((flags & ASSUAN_SOCKET_SERVER_ACCEPTED) - ? accept_connection_bottom + ? accept_connection_bottom : accept_connection); ctx->finish_handler = _assuan_server_finish; |