DARWIN: Replace afs_osi_cred by allocated ucred 22/14922/7
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Tue, 15 Mar 2022 13:38:45 +0000 (10:38 -0300)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 13 May 2022 17:26:49 +0000 (13:26 -0400)
commit982d2f9dbe6586d06ffa2a61c02ea726b83b5902
tree6e3b07c939f28ee6acca052b1c011d2403b54dfd
parentcdbcb6f947feff528adc324dd6487b21083e23aa
DARWIN: Replace afs_osi_cred by allocated ucred

Building the current version of OpenAFS on macOS Monterey arm64 results
in the following error:

 error: globals with authenticated null values are currently unsupported
 afs_ucred_t afs_osi_cred;

To avoid this problem, replace the global in question by a pointer to a
dynamically allocated afs_osi_cred (afs_osi_credp). Ideally we would
create a new credential with kauth_cred_create(), but this function is
not well documented and using it results in crashes. Moreover, if the
kauth_cred_dup() function were still available (private since XNU
1456.1.26 - macOS 10.6), we could also duplicate the current user's
credential during startup (like commit f40f466c7f did for BSD).

Change-Id: Ied2df7590e4e671ce2643669c83ee0e4b2a97cd1
Reviewed-on: https://gerrit.openafs.org/14922
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/afs/DARWIN/osi_file.c
src/afs/DARWIN/osi_inode.c
src/afs/DARWIN/osi_machdep.h
src/afs/DARWIN/osi_vnodeops.c
src/afs/afs_osi.c