hbhasker / go9p

Automatically exported from code.google.com/p/go9p
Other
0 stars 0 forks source link

Unpack should uncondititionally initialize fc.Unamenum #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Srv.attach uses Unamenum to determine if user lookup should be done by uid. if 
left uninitialized in non-dotu mode, a user lookup will be done by uid for uid 
0 in Srv.attach, when the lookup should be done by username.

the fix i believe would be to initialize fc.Unamenum to p.NOUID unconditionally.

diff -r fbcdb68b9c01 p/unpack.go
--- a/p/unpack.go       Fri Aug 23 06:37:54 2013 -0600
+++ b/p/unpack.go       Wed May 14 11:57:09 2014 -0700
@@ -106,12 +106,9 @@
                        goto szerror
                }

-               if dotu {
-                       if len(p) > 0 {
-                               fc.Unamenum, p = gint32(p)
-                       } else {
-                               fc.Unamenum = NOUID
-                       }
+               fc.Unamenum = NOUID
+               if dotu && len(p) > 0 {
+                       fc.Unamenum, p = gint32(p)
                }

        case Rerror:

Original issue reported on code.google.com by this.is....@gmail.com on 14 May 2014 at 7:03

GoogleCodeExporter commented 8 years ago
Thanks, fixed.

Original comment by lion...@gmail.com on 14 May 2014 at 7:20