]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/cwfs/auth.c
merge
[plan9front.git] / sys / src / cmd / cwfs / auth.c
index f8a433700d8d5f60cfaf5df1289be49fdc32627e..e3d51be7e383d4ff6d4d9959ac4509c76c0aac8f 100644 (file)
@@ -103,7 +103,7 @@ authnew(void)
                return nil;
        }
        if(auth_rpc(rpc, "start", keyspec, strlen(keyspec)) != ARok){
-               auth_freerpc(rpc);
+               authfree(rpc);
                return nil;
        }
        return rpc;
@@ -114,8 +114,10 @@ authfree(void *auth)
 {
        AuthRpc *rpc;
 
-       if(rpc = auth)
+       if(rpc = auth){
+               close(rpc->afd);
                auth_freerpc(rpc);
+       }
 }
 
 int
@@ -141,12 +143,13 @@ authread(File *file, uchar *data, int count)
                if((ai = auth_getinfo(rpc)) == nil)
                        goto Phase;
                file->uid = strtouid(ai->cuid);
-               auth_freeAI(ai);
                if(file->uid < 0){
                        snprint(chan->err, sizeof(chan->err),
                                "unknown user '%s'", ai->cuid);
+                       auth_freeAI(ai);
                        return -1;
                }
+               auth_freeAI(ai);
                return 0;
        case ARok:
                if(count < rpc->narg){