Introduce BSD-style user credential [2/3]
Subsystems (3)
PATCH 1/1 Introduce BSD-style user credential [2/3]
Rename 'struct ucred' in <linux/socket.h> to 'struct scm_ucred'.
Cheers,
Trond
include/linux/netlink.h +1 -1
@@ -88,7 +88,7 @@struct netlink_skb_parms { -struct ucred creds;/* Skb credentials */ +struct scm_ucred creds;/* Skb credentials */ __u32 pid;__u32 groups;__u32 dst_pid;
include/linux/socket.h +2 -2
@@ -119,10 +119,10 @@/* "Socket"-level control message types: */ #define SCM_RIGHTS 0x01/* rw: access rights (array of int) */ -#define SCM_CREDENTIALS 0x02/* rw: struct ucred */ +#define SCM_CREDENTIALS 0x02/* rw: struct scm_ucred */ #define SCM_CONNECT 0x03/* rw: struct scm_connect */ -struct ucred { +struct scm_ucred {__u32 pid;__u32 uid;__u32 gid;
include/net/af_unix.h +1 -1
@@ -27,7 +27,7 @@struct unix_skb_parms { -struct ucred creds;/* Skb credentials */ +struct scm_ucred creds;/* Skb credentials */ struct scm_fp_list *fp;/* Passed files */ };
include/net/scm.h +1 -1
@@ -16,7 +16,7 @@struct scm_cookie { -struct ucred creds;/* Skb credentials */ +struct scm_ucred creds;/* Skb credentials */ struct scm_fp_list *fp;/* Passed files */ unsigned long seq;/* Connection seqno */ };
include/net/sock.h +1 -1
@@ -164,7 +164,7 @@unsigned short type;unsigned char localroute;/* Route locally only */ unsigned char protocol; -struct ucred peercred; +struct scm_ucred peercred;int rcvlowat;long rcvtimeo;long sndtimeo;
net/core/scm.c +3 -3
@@ -38,7 +38,7 @@* setu(g)id. */ -static __inline__int scm_check_creds (struct ucred *creds) +static __inline__int scm_check_creds (struct scm_ucred *creds) { if ((creds->pid == current->pid || capable(CAP_SYS_ADMIN)) && ((creds->uid == current->uid || creds->uid == current->euid ||
@@ -141,9 +141,9 @@ goto error;break ;case SCM_CREDENTIALS : -if (cmsg->cmsg_len !=CMSG_LEN (sizeof (struct ucred ))) +if (cmsg->cmsg_len !=CMSG_LEN (sizeof (struct scm_ucred ))) goto error; -memcpy (&p->creds,CMSG_DATA (cmsg),sizeof (struct ucred )); +memcpy (&p->creds,CMSG_DATA (cmsg),sizeof (struct scm_ucred )); err =scm_check_creds (&p->creds);if (err) goto error;
net/netlink/af_netlink.c +1 -1
@@ -614,7 +614,7 @@NETLINK_CB (skb).groups = nlk->groups;NETLINK_CB (skb).dst_pid = dst_pid;NETLINK_CB (skb).dst_groups = dst_groups; -memcpy (NETLINK_CREDS (skb), &scm->creds,sizeof (struct ucred )); +memcpy (NETLINK_CREDS (skb), &scm->creds,sizeof (struct scm_ucred ));/* What can I do? Netlink is asynchronous, so that we will have to save current capabilities to
net/unix/af_unix.c +2 -2
@@ -1216,7 +1216,7 @@if (skb==NULL ) goto out; -memcpy (UNIXCREDS (skb), &scm->creds,sizeof (struct ucred )); +memcpy (UNIXCREDS (skb), &scm->creds,sizeof (struct scm_ucred ));if (scm->fp)unix_attach_fds (scm, skb);
@@ -1369,7 +1369,7 @@*/ size =min_t (int, size,skb_tailroom (skb)); -memcpy (UNIXCREDS (skb), &scm->creds,sizeof (struct ucred )); +memcpy (UNIXCREDS (skb), &scm->creds,sizeof (struct scm_ucred ));if (scm->fp)unix_attach_fds (scm, skb);