Function report |
Source Code:security\keys\keyctl.c |
Create Date:2022-07-28 18:20:18 |
| Last Modify:2020-03-18 07:59:52 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Change the ownership of a key* The key must grant the caller Setattr permission for this to work, though* the key need not be fully instantiated yet. For the UID to be changed, or* for the GID to be changed to a group the caller is not a member of, the
Proto:long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group)
Type:long
Parameter:
| Type | Parameter | Name |
|---|---|---|
| key_serial_t | id | |
| uid_t | user | |
| gid_t | group |
| 889 | uid = make_kuid(current_user_ns(), user) |
| 890 | gid = make_kgid(current_user_ns(), group) |
| 897 | ret = 0 |
| 908 | key = key_ref_to_ptr(key_ref) |
| 912 | lock for writing |
| 914 | If Not Check operation authority Then |
| 928 | newowner = Get the key quota record for a user, allocating a new record if one doesn't* already exist. |
| 934 | maxkeys = If uid_eq(uid, GLOBAL_ROOT_UID) Then 's key count quota Else general key count quota |
| 936 | maxbytes = If uid_eq(uid, GLOBAL_ROOT_UID) Then 's key space quota Else general key space quota |
| 948 | spin_unlock( & lock) |
| 951 | qnkeys-- |
| 952 | qnbytes -= length added to quota |
| 953 | spin_unlock( & lock) |
| 956 | atomic_dec( & nkeys) |
| 957 | atomic_inc( & umber of keys ) |
| 959 | If Key state (+) or rejection error (-) != KEY_IS_UNINSTANTIATED Then |
| 960 | atomic_dec( & nikeys) |
| 961 | atomic_inc( & umber of instantiated keys ) |
| 964 | zapowner = owner of this key |
| 965 | owner of this key = newowner |
| 973 | ret = 0 |
| 975 | error_put : |
| 978 | If zapowner Then Dispose of a user structure |
| 980 | error : |
| 981 | Return ret |
| 983 | quota_overrun : |
| 984 | spin_unlock( & lock) |
| 987 | Go to error_put |
| Name | Describe |
|---|---|
| SYSCALL_DEFINE5 | The key control system call |
| COMPAT_SYSCALL_DEFINE5 | The key control system call, 32-bit compatibility version for 64-bit archs |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |