On Fri, May 20, 2011 at 02:32:25PM +0200, Rene Nussbaumer wrote:
> On Fri, May 20, 2011 at 11:31 AM, Iustin Pop <[email protected]> wrote:
> > On Fri, May 20, 2011 at 10:50:25AM +0200, René Nussbaumer wrote:
> >> ---
> >>  lib/backend.py |    6 ++++++
> >>  lib/rpc.py     |    6 ++++--
> >>  2 files changed, 10 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/lib/backend.py b/lib/backend.py
> >> index 339440b..13803f7 100644
> >> --- a/lib/backend.py
> >> +++ b/lib/backend.py
> >> @@ -1821,6 +1821,12 @@ def UploadFile(file_name, data, mode, uid, gid, 
> >> atime, mtime):
> >>
> >>    raw_data = _Decompress(data)
> >>
> >> +  getents = runtime.GetEnts()
> >> +  if isinstance(uid, str):
> >> +    uid = getents.LookupUser(uid)
> >> +  if isinstance(gid, str):
> >> +    gid = getents.LookupGroup(gid)
> >
> > I wonder if we shouldn't make it so that it's always using names, i.e.
> > abort if we get integers. Otherwise it could be that someone adds a new
> > call to this RPC with IDs that are not synced. What do you think?
> 
> Good point, changed and put in assert for that.

Mmm. Since these are parameters received over the network, I don't think
an assert is right. Could you please change it into if not
isinstance(uid, str) and …: _Fail("Invalid username/groupname type")?
That will be reported much better to the master daemon.

thanks,
iustin

Reply via email to