[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 3/3] lib/posix-user: Implement getresgid() and setresgid()


  • To: Stefan Teodorescu <stefanl.teodorescu@xxxxxxxxx>
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Thu, 28 Nov 2019 14:57:13 +0200
  • Cc: minios-devel@xxxxxxxxxxxxx
  • Delivery-date: Thu, 28 Nov 2019 12:57:17 +0000
  • Ironport-sdr: Ubtu8VEQA8cen84aO0uofeFlEsqTz25u3+eXNqja4yDZrG+Y7cW6Se40yM8U/76iJ9dvnzirR/ WtAj2Kl32C/A==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Yes, good catch!

Thanks,
Costin

On 11/28/19 11:27 AM, Stefan Teodorescu wrote:
> The getresgid function should set the values pointed to by rgid, egid
> and sgid (i.e. set *rgid, *egid and *sgid to that value, not the
> pointers).
> 
> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@xxxxxxxxx>
> 
> On Wed, Nov 27, 2019 at 1:26 PM Costin Lupu <costin.lupu@xxxxxxxxx> wrote:
>>
>> We accept a single group ID.
>>
>> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
>> ---
>>  lib/posix-user/user.c | 21 ++++++++++++++++++++-
>>  1 file changed, 20 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/posix-user/user.c b/lib/posix-user/user.c
>> index 5e2fc9f3..2c287297 100644
>> --- a/lib/posix-user/user.c
>> +++ b/lib/posix-user/user.c
>> @@ -205,8 +205,27 @@ int setegid(gid_t egid __unused)
>>         return 0;
>>  }
>>
>> -int getresgid(gid_t *rgid __unused, gid_t *egid __unused, gid_t *sgid 
>> __unused)
>> +int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
>>  {
>> +       if (!rgid || !egid || !sgid) {
>> +               errno = EFAULT;
>> +               return -1;
>> +       }
>> +
>> +       rgid = egid = sgid = UK_DEFAULT_GID;
>> +
>> +       return 0;
>> +}
>> +
>> +int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
>> +{
>> +       /* We allow only UK_DEFAULT_GID */
>> +       if (rgid != UK_DEFAULT_GID || egid != UK_DEFAULT_GID ||
>> +                       sgid != UK_DEFAULT_GID) {
>> +               errno = EINVAL;
>> +               return -1;
>> +       }
>> +
>>         return 0;
>>  }
>>
>> --
>> 2.20.1
>>
> 
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.