mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
33 lines
575 B
C
33 lines
575 B
C
#include <u.h>
|
|
#include <libc.h>
|
|
#include <auth.h>
|
|
#include <thread.h>
|
|
#include <9pclient.h>
|
|
#include "authlocal.h"
|
|
|
|
CFsys*
|
|
fsamount(int fd, char *aname)
|
|
{
|
|
CFid *afid, *fid;
|
|
AuthInfo *ai;
|
|
CFsys *fs;
|
|
|
|
fs = fsinit(fd);
|
|
if(fs == nil)
|
|
return nil;
|
|
if((afid = fsauth(fs, getuser(), aname)) == nil)
|
|
goto noauth;
|
|
ai = fsauth_proxy(afid, amount_getkey, "proto=p9any role=client");
|
|
if(ai != nil)
|
|
auth_freeAI(ai);
|
|
noauth:
|
|
fid = fsattach(fs, afid, getuser(), aname);
|
|
fsclose(afid);
|
|
if(fid == nil){
|
|
_fsunmount(fs);
|
|
return nil;
|
|
}
|
|
fssetroot(fs, fid);
|
|
return fs;
|
|
}
|
|
|