os: secure-rpc: make build option tristate
Add support `auto` mode, which only enables secure-rpc when dependencies are met. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1441>
This commit is contained in:
parent
339717bac6
commit
620b678cfe
|
@ -33,7 +33,8 @@ option('serverconfigdir', type: 'string',
|
|||
option('glx', type: 'boolean', value: true)
|
||||
option('xdmcp', type: 'boolean', value: true)
|
||||
option('xdm-auth-1', type: 'boolean', value: true)
|
||||
option('secure-rpc', type: 'boolean', value: true)
|
||||
option('secure-rpc', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
|
||||
description: 'Enable Secure-RPC (DES) authentication')
|
||||
option('ipv6', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto')
|
||||
option('input_thread', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto')
|
||||
|
||||
|
|
|
@ -60,23 +60,38 @@ os_dep = []
|
|||
os_c_args = []
|
||||
|
||||
rpc_dep = []
|
||||
if get_option('secure-rpc')
|
||||
opt_secure_rpc = get_option('secure-rpc')
|
||||
if opt_secure_rpc != 'false'
|
||||
build_secure_rpc = true
|
||||
|
||||
# prefer libtirpc (if available), otherwise ensure RPC functions are
|
||||
# provided by libc.
|
||||
rpc_dep = dependency('libtirpc', required: false, include_type: 'system')
|
||||
if not (rpc_dep.found() or cc.has_header('rpc/rpc.h'))
|
||||
error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
|
||||
if opt_secure_rpc == 'true'
|
||||
error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
|
||||
else
|
||||
message('secure-rpc disabled since neither libtirpc or libc RPC support were found')
|
||||
build_secure_rpc = false
|
||||
endif
|
||||
endif
|
||||
# XXX: also check if RPC library provides xdr_opaque_auth, authdes_(sec)create ???
|
||||
srcs_os += 'rpcauth.c'
|
||||
|
||||
if not (cc.has_member('struct authdes_cred', 'adc_fullname',
|
||||
prefix : '#include <rpc/rpc.h>',
|
||||
dependencies: rpc_dep))
|
||||
error('secure-rpc requested, but RPC implementation lacking struct authdes_cred')
|
||||
if opt_secure_rpc == 'true'
|
||||
error('secure-rpc requested, but RPC implementation lacking struct authdes_cred')
|
||||
else
|
||||
message('secure-rpc disable since RPC implementation lacking struct authdes_cred')
|
||||
build_secure_rpc = false
|
||||
endif
|
||||
endif
|
||||
|
||||
os_c_args += '-DSECURE_RPC'
|
||||
if build_secure_rpc
|
||||
os_c_args += '-DSECURE_RPC'
|
||||
srcs_os += 'rpcauth.c'
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('xres')
|
||||
|
|
Loading…
Reference in New Issue