New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OPENSSL_NO_UNIX_SOCK define to exclude unix sockets support #18256
Conversation
I am not sure this is a right fix, at least it is no straightforwardly clear |
My assumption was that since we do not include openssl/include/internal/sockets.h Lines 19 to 25 in a381897
where <sys/un.h> only defines sockaddr_un . So currently we set NO_SYS_UN_H to prevent the inclusion of <sys/un.h> and then later undef AF_UNIX to prevent us from using sockaddr_un . I think it makes sense to use the same define to decide whether we include this file and use it's symbols afterwards.
|
Hmm, but there might be other systems that do not define AF_UNIX but are not covered by the cases where we define NO_SYS_UN_H in the sockets.h. Is this PR fixing a concrete issue or what is the purpose? |
Is there any reason to import
I am working on an OS, which defines Another way would be to add something like |
You've misunderstood. There is no reason for that, but what I am saying is that the NO_SYS_UN_H is defined in sockets.h only in two particular cases but there might be other targets that weren't defining AF_UNIX and your PR would break these.
OK, then do it. Put it at the end of sockets.h and also define it when AF_UNIX is not defined. (Also do not forget to check whether OPENSSL_NO_UNIX_SOCKETS is already defined.) |
include/internal/sockets.h
Outdated
@@ -75,7 +75,7 @@ struct servent *PASCAL getservbyname(const char *, const char *); | |||
# include <inet.h> | |||
# else | |||
# include <sys/socket.h> | |||
# ifndef NO_SYS_UN_H | |||
# if (!defined NO_SYS_UN_H) && (defined AF_UNIX) && (!defined OPENSSL_NO_UNIX_SOCK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this test as well, so it is enough to set OPENSSL_NO_UNIX_SOCK
to disable the unix socket support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the same style of using parentheses here as in other cases in this source file. !defined(NO_SYS_UN_H) &&...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated them accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor nits.
include/internal/sockets.h
Outdated
@@ -75,7 +75,7 @@ struct servent *PASCAL getservbyname(const char *, const char *); | |||
# include <inet.h> | |||
# else | |||
# include <sys/socket.h> | |||
# ifndef NO_SYS_UN_H | |||
# if (!defined NO_SYS_UN_H) && (defined AF_UNIX) && (!defined OPENSSL_NO_UNIX_SOCK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the same style of using parentheses here as in other cases in this source file. !defined(NO_SYS_UN_H) &&...
This appears to build correctly on NonStop. However, other independent issues are preventing the build from completing. |
This PR is in a state where it requires action by @openssl/committers but the last update was 30 days ago |
This PR is in a state where it requires action by @openssl/committers but the last update was 61 days ago |
This pull request is ready to merge |
Merged, thanks for the contribution. |
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from #18256)
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from openssl#18256)
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from openssl#18256) (cherry picked from commit 081f348)
This replaces the usage of
#ifdef AF_UNIX
in bio/* with#ifndef NO_SYS_UN_H
. This is already set for the systems we currently undefineAF_UNIX
on.Checklist