Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Eric Blake
On 10/08/2012 01:16 PM, Marcelo Cerri wrote: >>> +int virGetUserID(const char *user, uid_t *uid) >>> +{ >>> +unsigned int uint_uid; >> >> Are we sure that 'unsigned int' is large enough for uid_t on all >> platforms? I'd feel safer with something like: >> >> verify(sizeof(unsigned int) >= siz

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Marcelo Cerri
On Mon, Oct 08, 2012 at 11:12:49AM -0600, Eric Blake wrote: > On 10/05/2012 08:52 PM, Marcelo Cerri wrote: > > This patch updates virGetUserID and virGetGroupID to be able to parse a > > user or group name in a similar way to coreutils' chown. This means that > > a numeric value with a leading plus

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Marcelo Cerri
On Mon, Oct 08, 2012 at 08:04:53PM +0200, Peter Krempa wrote: > On 10/08/12 19:57, Eric Blake wrote: > >On 10/08/2012 11:44 AM, Marcelo Cerri wrote: > > > >>This comment is actually wrong... It should be: > >> > >>/* Search in the password database for a user id that matches the user name > >> * `

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Peter Krempa
On 10/08/12 19:57, Eric Blake wrote: On 10/08/2012 11:44 AM, Marcelo Cerri wrote: This comment is actually wrong... It should be: /* Search in the password database for a user id that matches the user name * `name`. Returns 0 on success, -1 on failure or 1 if name cannot be found. Are you o

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Eric Blake
On 10/08/2012 11:44 AM, Marcelo Cerri wrote: > This comment is actually wrong... It should be: > > /* Search in the password database for a user id that matches the user name > * `name`. Returns 0 on success, -1 on failure or 1 if name cannot be found. > > Are you ok with this kind of return?

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Marcelo Cerri
On Mon, Oct 08, 2012 at 11:12:49AM -0600, Eric Blake wrote: > On 10/05/2012 08:52 PM, Marcelo Cerri wrote: > > This patch updates virGetUserID and virGetGroupID to be able to parse a > > user or group name in a similar way to coreutils' chown. This means that > > a numeric value with a leading plus

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Eric Blake
On 10/05/2012 08:52 PM, Marcelo Cerri wrote: > This patch updates virGetUserID and virGetGroupID to be able to parse a > user or group name in a similar way to coreutils' chown. This means that > a numeric value with a leading plus sign is always parsed as an ID, > otherwise the functions try to pa

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Peter Krempa
On 10/08/12 16:13, Marcelo Cerri wrote: On Mon, Oct 08, 2012 at 10:36:22AM -0300, Marcelo Cerri wrote: On Mon, Oct 08, 2012 at 02:08:59PM +0200, Peter Krempa wrote: On 10/06/12 04:52, Marcelo Cerri wrote: This patch updates virGetUserID and virGetGroupID to be able to parse a user or group nam

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Marcelo Cerri
On Mon, Oct 08, 2012 at 10:36:22AM -0300, Marcelo Cerri wrote: > On Mon, Oct 08, 2012 at 02:08:59PM +0200, Peter Krempa wrote: > > On 10/06/12 04:52, Marcelo Cerri wrote: > > >This patch updates virGetUserID and virGetGroupID to be able to parse a > > >user or group name in a similar way to coreuti

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Marcelo Cerri
On Mon, Oct 08, 2012 at 02:08:59PM +0200, Peter Krempa wrote: > On 10/06/12 04:52, Marcelo Cerri wrote: > >This patch updates virGetUserID and virGetGroupID to be able to parse a > >user or group name in a similar way to coreutils' chown. This means that > >a numeric value with a leading plus sign

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Marcelo Cerri
On Fri, Oct 05, 2012 at 11:52:23PM -0300, Marcelo Cerri wrote: > This patch updates virGetUserID and virGetGroupID to be able to parse a > user or group name in a similar way to coreutils' chown. This means that > a numeric value with a leading plus sign is always parsed as an ID, > otherwise the f

Re: [libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-08 Thread Peter Krempa
On 10/06/12 04:52, Marcelo Cerri wrote: This patch updates virGetUserID and virGetGroupID to be able to parse a user or group name in a similar way to coreutils' chown. This means that a numeric value with a leading plus sign is always parsed as an ID, otherwise the functions try to parse the inp

[libvirt] [PATCH 1/2] util: extend virGetUserID and virGetGroupID to support names and IDs

2012-10-05 Thread Marcelo Cerri
This patch updates virGetUserID and virGetGroupID to be able to parse a user or group name in a similar way to coreutils' chown. This means that a numeric value with a leading plus sign is always parsed as an ID, otherwise the functions try to parse the input first as a user or group name and if th