Blob


1 #include <u.h>
2 #include <libc.h>
3 #include <auth.h>
4 #include <thread.h>
5 #include <9pclient.h>
6 #include "authlocal.h"
8 CFsys*
9 nsamount(char *name, char *aname)
10 {
11 CFid *afid, *fid;
12 AuthInfo *ai;
13 CFsys *fs;
15 fs = nsinit(name);
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 }