[openssl-dev] In s_server.c, inconsistent file when FIONBIO is not defined

Pascal Cuoq cuoq at trust-in-soft.com
Fri Jun 19 11:47:32 UTC 2015


Following additional OpenSSL tests being suggested after the call on this list (many thanks! we'll have more to say later…), we are parsing and executing previously unvisited parts of OpenSSL in a C interpreter.

The interpreter can be considered as a different compilation platform (although the long-term goal is to accurately mimic the widespread existing ones). In particular, we find ourselves pre-processing and parsing the file apps/s_server.c without FIONBIO being defined because this is not a full Unix environment yet (FIONBIO is a pre-POSIX macro usually defined by some system header). It seems to me that s_server.c is not a valid C file in these conditions, because then this file avoids declaring a variable s_nbio line 231:

https://github.com/openssl/openssl/blob/3b061a00e39d2e4ad524ff01cbdc0c53fe8171ee/apps/s_server.c#L231

… but it still uses the variable s_nbio in places without a #ifdef FIONBIO guard, e.g. line 395:

https://github.com/openssl/openssl/blob/3b061a00e39d2e4ad524ff01cbdc0c53fe8171ee/apps/s_server.c#L395

I see three options:

- I am doing something utterly wrong (beyond trying to execute OpenSSL in this C interpreter. I will stick to that mistake). If you see what, please tell me.

- the intention is to have s_server.c be compilable without FIONBIO being defined, but it drifted out of this state because it was seldom compiled in this mode. A patch like the one attached to this email should fix this. Any reviewer should pay particular attention to the last hunk, about what should happen to the original line “s_nbio = s_nbio_test = 1;”

- the fact that s_server.c does not compile any more without FIONBIO being defined is a sign that no one uses it in this mode anymore. Thus all tests for the presence of this macro should be suppressed from the file in order to remove cruft and ease code review.

Any additional alternative? We can prepare a patch for the third option if it is the rightest one.

Pascal

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_ifdef.patch
Type: application/octet-stream
Size: 1133 bytes
Desc: fix_ifdef.patch
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20150619/d68c42dc/attachment.obj>


More information about the openssl-dev mailing list