diff options
author | Keith Packard <keithp@keithp.com> | 2014-09-12 11:27:39 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-09-13 10:58:20 -0700 |
commit | fb7f198c88e97d22c8c89e76e9cd06b2b2720a96 (patch) | |
tree | 536f5c5c0d624808ea388fd51538bbc5b7116aa0 | |
parent | 17491de45c352c833442cccf17a9bd65909889db (diff) |
Add TRANS(Listen) function to re-enable specific listen sockets
This will allow a server to disable listeners by default and then
let later configuration re-enable them. In particular, this lets the X
server disable inet and unix listen sockets by default while still
providing a '-listen' command line option to re-enable them later on.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | Xtrans.c | 25 | ||||
-rw-r--r-- | Xtrans.h | 4 |
2 files changed, 29 insertions, 0 deletions
@@ -804,6 +804,31 @@ TRANS(NoListen) (const char * protocol) } int +TRANS(Listen) (const char * protocol) +{ + Xtransport *trans; + int i = 0, ret = 0; + + if ((trans = TRANS(SelectTransport)(protocol)) == NULL) + { + prmsg (1,"TransListen: unable to find transport: %s\n", + protocol); + + return -1; + } + if (trans->flags & TRANS_ALIAS) { + if (trans->nolisten) + while (trans->nolisten[i]) { + ret |= TRANS(Listen)(trans->nolisten[i]); + i++; + } + } + + trans->flags &= ~TRANS_NOLISTEN; + return ret; +} + +int TRANS(IsListening) (const char * protocol) { Xtransport *trans; @@ -311,6 +311,10 @@ int TRANS(NoListen) ( const char* /* protocol*/ ); +int TRANS(Listen) ( + const char* /* protocol*/ +); + int TRANS(IsListening) ( const char* /* protocol*/ ); |