This patch destroys the admin key after we don't need it anymore.
some formatting changes to libxcpu/group.c (tabs vs spaces issues) added
more noise.

Signed-off-by: Abhishek Kulkarni <[EMAIL PROTECTED]>

Index: libxcpu/user.c
===================================================================
--- libxcpu/user.c      (revision 739)
+++ libxcpu/user.c      (working copy)
@@ -273,6 +273,7 @@
        if (n < 0)
                goto error;
        free(buf);
+       xauth_destroy(akey);
        *pwent = toks;
        return n;
 error:
@@ -282,6 +283,8 @@
                spc_umount(fs);
        if (buf)
                free(buf);
+       if (akey)
+               xauth_destroy(akey);
 
         return -1;
 }
Index: libxcpu/group.c
===================================================================
--- libxcpu/group.c     (revision 739)
+++ libxcpu/group.c     (working copy)
@@ -121,25 +121,25 @@
        int n, bufsize = 8192;
        Xkey *akey = NULL;
        Spuser *auser = NULL;
-    Spcfsys *fs;
-    Spcfid *fid;
-
+       Spcfsys *fs;
+       Spcfid *fid;
+       
        if (adminkey) {
-                       akey = xauth_privkey_create(adminkey);
-                       if (!akey)
-                                       goto error;
+               akey = xauth_privkey_create(adminkey);
+               if (!akey)
+                       return -1;
        }
-
+       
        if (xp_defaultuser(&auser, &akey) < 0)
-               goto error;        
+               goto error;
                
        fs = xp_node_mount(nd, auser, akey);
        if (!fs) {
-                       fs = xp_node_mount(nd, NULL, akey);
-                       if (!fs)
-                                       goto error;
-       }        
-
+               fs = xp_node_mount(nd, NULL, akey);
+               if (!fs)
+                       goto error;
+       }
+       
        fid = spc_open(fs, "grent", Oread);
        if (!fid) {
                sp_werror("error opening file grent", EIO);
@@ -160,9 +160,12 @@
        if (n < 0)
                goto error;
        free(buf);
+       xauth_destroy(akey);
        *grent = toks;  
        return n;
 error:
+       if (akey)
+               xauth_destroy(akey);
        if (fid)
                spc_close(fid);
        if (fs)


Reply via email to