| ---
tfsamount.c (573B)
---
1 #include
2 #include
3 #include
4 #include
5 #include <9pclient.h>
6 #include "authlocal.h"
7
8 CFsys*
9 fsamount(int fd, char *aname)
10 {
11 CFid *afid, *fid;
12 AuthInfo *ai;
13 CFsys *fs;
14
15 fs = fsinit(fd);
16 if(fs == nil)
17 return nil;
18 if((afid = fsauth(fs, getuser(), aname)) == nil)
19 goto noauth;
20 ai = fsauth_proxy(afid, amount_getkey, "proto=p9any role=client");
21 if(ai != nil)
22 auth_freeAI(ai);
23 noauth:
24 fid = fsattach(fs, afid, getuser(), aname);
25 fsclose(afid);
26 if(fid == nil){
27 _fsunmount(fs);
28 return nil;
29 }
30 fssetroot(fs, fid);
31 return fs;
32 } |