aboutsummaryrefslogtreecommitdiffstats
path: root/apps/s_socket.c
Commit message (Collapse)AuthorAgeFilesLines
* Copyright consolidation 01/10Rich Salz2016-05-171-102/+6
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Remove stale errors from early connection attempts in a clientMatt Caswell2016-05-041-0/+2
| | | | | | | | | | | The init_client() function in the apps sets up the client connection. It may try multiple addresses until it finds one that works. We should clear the error queue if we eventually get a successful connection because otherwise we get stale errors hanging around. This can cause problems in subsequent calls to SSL_get_error(), i.e. non-fatal NBIO events appear as fatal. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix no-sockMatt Caswell2016-03-211-0/+1
| | | | | | Misc fixes for no-sock Reviewed-by: Richard Levitte <levitte@openssl.org>
* ISSUE 43: Add BIO_sock_shutdownRich Salz2016-03-071-3/+3
| | | | | | This replaces SHUTDOWN/SHUTDOWN2 with BIO_closesocket. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix typo, reformat comment.Rich Salz2016-02-241-6/+5
| | | | Reviewed-by: Andy Polyakov <appro@openssl.org>
* Remove unused parameters from internal functionsRich Salz2016-02-221-39/+13
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* The protocol variable has lost its use, remove itRichard Levitte2016-02-111-12/+2
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Use the protocol we know rather than BIO_ADDRINFO_protocol(res)Richard Levitte2016-02-101-2/+2
| | | | | | | Because some platforms won't will in any value in ai_protocol, there's no point using it if we already know what it should be. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Don't assert protocol equalityRichard Levitte2016-02-101-4/+2
| | | | | | | | | It seems that some platforms' getaddrinfo don't fill in the ai_protocol field properly. On those, the assertion 'protocol == BIO_ADDRINFO_protocol(res)' will fail. Best to remove it. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: Adapt s_client and s_serverRichard Levitte2016-02-031-529/+169
| | | | | | | | | | | | | | | | | | | s_socket.c gets brutally cleaned out and now consists of only two functions, one for client and the other for server. They both handle AF_INET, AF_INET6 and additionally AF_UNIX where supported. The rest is just easy adaptation. Both s_client and s_server get the new flags -4 and -6 to force the use of IPv4 or IPv6 only. Also, the default host "localhost" in s_client is removed. It's not certain that this host is set up for both IPv4 and IPv6. For example, Debian has "ip6-localhost" as the default hostname for [::1]. The better way is to default |host| to NULL and rely on BIO_lookup() to return a BIO_ADDRINFO with the appropriate loopback address for IPv4 or IPv6 as indicated by the |family| parameter. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Rename some BUF_xxx to OPENSSL_xxxRich Salz2015-12-161-1/+1
| | | | | | | | | Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} Add #define's for the old names. Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Explicitly cast INVALID_SOCKET to (int) to address warnings on Windows.Andy Polyakov2015-10-051-6/+6
| | | | | | | | | | | Even though SOCKET is effectively declared as (void *) on Windows, it's not actually a pointer, but an index within per-process table of kernel objects. The table size is actually limited and its upper limit is far below upper limit for signed 32-bit integer. This is what makes cast in question possible. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org>
* Use bio_err not stderr in apps.Rich Salz2015-06-091-4/+2
| | | | | | Except for VMS startup code. Reviewed-by: Richard Levitte <levitte@openssl.org>
* memset, memcpy, sizeof consistency fixesRich Salz2015-05-051-5/+5
| | | | | | | | Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove apps cache for gethostbynameRich Salz2015-05-051-50/+2
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* free null cleanup finaleRich Salz2015-05-011-2/+1
| | | | | | Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* In apps, malloc or dieRich Salz2015-04-301-5/+1
| | | | | | | | No point in proceeding if you're out of memory. So change *all* OPENSSL_malloc calls in apps to use the new routine which prints a message and exits. Reviewed-by: Richard Levitte <levitte@openssl.org>
* remove malloc castsRich Salz2015-04-281-1/+1
| | | | | | | Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Big apps cleanup (option-parsing, etc)Rich Salz2015-04-241-18/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is merges the old "rsalz-monolith" branch over to master. The biggest change is that option parsing switch from cascasding 'else if strcmp("-foo")' to a utility routine and somethin akin to getopt. Also, an error in the command line no longer prints the full summary; use -help (or --help :) for that. There have been many other changes and code-cleanup, see bullet list below. Special thanks to Matt for the long and detailed code review. TEMPORARY: For now, comment out CRYPTO_mem_leaks() at end of main Tickets closed: RT3515: Use 3DES in pkcs12 if built with no-rc2 RT1766: s_client -reconnect and -starttls broke RT2932: Catch write errors RT2604: port should be 'unsigned short' RT2983: total_bytes undeclared #ifdef RENEG RT1523: Add -nocert to fix output in x509 app RT3508: Remove unused variable introduced by b09eb24 RT3511: doc fix; req default serial is random RT1325,2973: Add more extensions to c_rehash RT2119,3407: Updated to dgst.pod RT2379: Additional typo fix RT2693: Extra include of string.h RT2880: HFS is case-insensitive filenames RT3246: req command prints version number wrong Other changes; incompatibilities marked with *: Add SCSV support Add -misalign to speed command Make dhparam, dsaparam, ecparam, x509 output C in proper style Make some internal ocsp.c functions void Only display cert usages with -help in verify Use global bio_err, remove "BIO*err" parameter from functions For filenames, - always means stdin (or stdout as appropriate) Add aliases for -des/aes "wrap" ciphers. *Remove support for IISSGC (server gated crypto) *The undocumented OCSP -header flag is now "-header name=value" *Documented the OCSP -header flag Reviewed-by: Matt Caswell <matt@openssl.org>
* Re-align some comments after running the reformat script.Matt Caswell2015-01-221-7/+7
| | | | | | | This should be a one off operation (subsequent invokation of the script should not move them) Reviewed-by: Tim Hudson <tjh@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-585/+584
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* RT3548: Remove unsupported platformsRich Salz2015-01-121-48/+3
| | | | | | | This last one for this ticket. Removes WIN16. So long, MS_CALLBACK and MS_FAR. We won't miss you. Reviewed-by: Richard Levitte <levitte@openssl.org>
* mark all block comments that need format preserving so thatTim Hudson2014-12-301-1/+1
| | | | | | | indent will not alter them when reformatting comments Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* RT3548: Remove unsupported platforms.Rich Salz2014-12-221-1/+1
| | | | | | This commit removes MPE/iX Reviewed-by: Andy Polyakov <appro@openssl.org>
* Undo a90081576c94f9f54de1755188a00ccc1760549aRich Salz2014-08-091-1/+6
| | | | Undo unapproved commit that removed DJGPP and WATT32
* Remove DJGPP (and therefore WATT32) #ifdef's.Rich Salz2014-08-081-6/+1
| | | | | | DJGPP is no longer a supported platform. Remove all #ifdef, etc., cases that refer to it. DJGPP also #define'd WATT32, so that is now removed as well.
* s_client/s_server: support unix domain socketsGeoff Thorpe2014-05-081-1/+137
| | | | | | | | | | | | | | | | | | | | | | The "-unix <path>" argument allows s_server and s_client to use a unix domain socket in the filesystem instead of IPv4 ("-connect", "-port", "-accept", etc). If s_server exits gracefully, such as when "-naccept" is used and the requested number of SSL/TLS connections have occurred, then the domain socket file is removed. On ctrl-C, it is likely that the stale socket file will be left over, such that s_server would normally fail to restart with the same arguments. For this reason, s_server also supports an "-unlink" option, which will clean up any stale socket file before starting. If you have any reason to want encrypted IPC within an O/S instance, this concept might come in handy. Otherwise it just demonstrates that there is nothing about SSL/TLS that limits it to TCP/IP in any way. (There might also be benchmarking and profiling use in this path, as unix domain sockets are much lower overhead than connecting over local IP addresses). Signed-off-by: Geoff Thorpe <geoff@openssl.org>
* coverity 966576 - close socket in error pathTim Hudson2014-05-081-0/+3
|
* PR#3342 fix resource leak coverity issue 966577Tim Hudson2014-05-081-1/+1
|
* apps: constify some string parametersGeoff Thorpe2014-04-251-6/+6
| | | | | | | There are certainly many more constifiable strings in the various interfaces, which I hope to get to eventually. Signed-off-by: Geoff Thorpe <geoff@openssl.org>
* Provisional DTLS 1.2 support.Dr. Stephen Henson2013-03-261-2/+2
| | | | | | | | Add correct flags for DTLS 1.2, update s_server and s_client to handle DTLS 1.2 methods. Currently no support for version negotiation: i.e. if client/server selects DTLS 1.2 it is that or nothing.
* don't call gethostbyname if OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL is setDr. Stephen Henson2012-11-191-0/+4
|
* add -naccept <n> option to s_server to automatically exit after <n> connectionsDr. Stephen Henson2012-11-181-2/+4
|
* Version skew reduction: trivia (I hope).Ben Laurie2012-06-031-4/+2
|
* Fix warning.Ben Laurie2011-03-121-0/+1
|
* Constify.Ben Laurie2011-01-091-2/+4
|
* i variable is used on some platformsDr. Stephen Henson2010-07-051-0/+1
|
* Fix warnings.Ben Laurie2010-06-121-4/+2
|
* Revert the size_t modifications from HEAD that had led to moreGeoff Thorpe2008-11-121-3/+1
| | | | | | knock-on work than expected - they've been extracted into a patch series that can be completed elsewhere, or in a different branch, before merging back to HEAD.
* size_tification.Ben Laurie2008-11-011-1/+3
|
* fix warningNils Larsch2006-11-061-1/+1
|
* Bug fix.Ulf Möller2006-05-011-2/+2
| | | | | PR: 1307 Submitted by: Oliver Tappe <zooey@hirschkaefer.de>
* fix problems found by coverity: remove useless codeNils Larsch2006-03-151-2/+0
|
* Netware patch submitted by Verdon Walker" <VWalker@novell.com> in PRRichard Levitte2005-06-131-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | 1107. He says: This is a followup to the NetWare patch that was applied to beta3. It does the following: - Fixes a problem in the CLib build with undefined symbols. - Adds the ability to use BSD sockets as the default for the OpenSSL socket BIO. NetWare supports 2 flavors of sockets and our Apache developers need BSD sockets as a configurable option when building OpenSSL. This adds that for them. - Updates to the INSTALL.NW file to explain new options. I have tried very hard to make sure all the changes are in NetWare specific files or guarded carefully to make sure they only impact NetWare builds. I have tested the Windows build to make sure it does not break that since we have made changes to mk1mf.pl. We are still working the gcc cross compile for NetWare issue and hope to have a patch for that before beta 6 is released.
* Fixes for signed/unsigned warnings and shadows.Dr. Stephen Henson2005-04-261-1/+1
|
* Add DTLS support.Ben Laurie2005-04-261-25/+42
|
* signed vs. unsigned.Richard Levitte2005-04-201-1/+1
|
* Give everything prototypes (well, everything that's actually used).Ben Laurie2005-03-311-1/+1
|
* DJGPP update.Andy Polyakov2005-01-041-1/+0
| | | | | PR: 989 Submitted by: Doug Kaufman
* Use BUF_strlcpy() instead of strcpy().Richard Levitte2003-12-271-1/+1
| | | | | | | Use BUF_strlcat() instead of strcat(). Use BIO_snprintf() instead of sprintf(). In some cases, keep better track of buffer lengths. This is part of a large change submitted by Markus Friedl <markus@openbsd.org>