Commit Diff


commit - 59518849d81a71284b90513f6ba76770b42ce32b
commit + 42400cf81f4fb04897bc1b609fc08720bc542df8
blob - /dev/null
blob + bece208a305d138dab08ab0d1d4c5026fa3acc2f (mode 644)
--- /dev/null
+++ src/libauth/fsamount.c
@@ -0,0 +1,33 @@
+#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;
+}
+
blob - 2512e9c7182e49cac18662a5aade243b9a79b4f6
blob + 5e5c13d2be930ea31ae4c9cf7ec25d02b13229b4
--- src/libauth/mkfile
+++ src/libauth/mkfile
@@ -16,9 +16,11 @@ OFILES=\
 	auth_rpc.$O\
 	auth_userpasswd.$O\
 	auth_wep.$O\
+	fsamount.$O\
 	login.$O\
 #	newns.$O\
 #	noworld.$O\
+	nsamount.$O\
 
 HFILES=\
 	$PLAN9/include/auth.h\
blob - /dev/null
blob + 1447904ac733cc5d26a386cca9e4f16e04bc987d (mode 644)
--- /dev/null
+++ src/libauth/nsamount.c
@@ -0,0 +1,33 @@
+#include <u.h>
+#include <libc.h>
+#include <auth.h>
+#include <thread.h>
+#include <9pclient.h>
+#include "authlocal.h"
+
+CFsys*
+nsamount(char *name, char *aname)
+{
+	CFid *afid, *fid;
+	AuthInfo *ai;
+	CFsys *fs;
+	
+	fs = nsinit(name);
+	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;
+}
+