unix(4): Enhance LOCAL_CREDS_PERSISTENT ABI
As this ABI is still fresh (r367287), let's correct some mistakes now: - Version the structure to allow for future changes - Include sender's pid in control message structure - Use a distinct control message type from the cmsgcred / sockcred mess Discussed with: kib, markj, trasz Differential Revision: https://reviews.freebsd.org/D27084
This commit is contained in:
parent
55dec604f8
commit
3f7425e8bb
|
@ -495,7 +495,7 @@ struct cmsgcred {
|
|||
};
|
||||
|
||||
/*
|
||||
* Socket credentials.
|
||||
* Socket credentials (LOCAL_CREDS).
|
||||
*/
|
||||
struct sockcred {
|
||||
uid_t sc_uid; /* real user id */
|
||||
|
@ -512,6 +512,22 @@ struct sockcred {
|
|||
#define SOCKCREDSIZE(ngrps) \
|
||||
(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
|
||||
|
||||
/*
|
||||
* Socket credentials (LOCAL_CREDS_PERSISTENT).
|
||||
*/
|
||||
struct sockcred2 {
|
||||
int sc_version; /* version of this structure */
|
||||
pid_t sc_pid; /* PID of sending process */
|
||||
uid_t sc_uid; /* real user id */
|
||||
uid_t sc_euid; /* effective user id */
|
||||
gid_t sc_gid; /* real group id */
|
||||
gid_t sc_egid; /* effective group id */
|
||||
int sc_ngroups; /* number of supplemental groups */
|
||||
gid_t sc_groups[1]; /* variable length */
|
||||
};
|
||||
#define SOCKCRED2SIZE(ngrps) \
|
||||
(sizeof(struct sockcred2) + (sizeof(gid_t) * ((ngrps) - 1)))
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
/* given pointer to struct cmsghdr, return pointer to data */
|
||||
|
@ -552,6 +568,7 @@ struct sockcred {
|
|||
#define SCM_REALTIME 0x05 /* timestamp (struct timespec) */
|
||||
#define SCM_MONOTONIC 0x06 /* timestamp (struct timespec) */
|
||||
#define SCM_TIME_INFO 0x07 /* timestamp info */
|
||||
#define SCM_CREDS2 0x08 /* process creds (struct sockcred2) */
|
||||
|
||||
struct sock_timestamp_info {
|
||||
__uint32_t st_info_flags;
|
||||
|
|
Loading…
Reference in New Issue