tadd fsamount, nsamount; use ndb for authdial; use explicit %# - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 42400cf81f4fb04897bc1b609fc08720bc542df8
parent 59518849d81a71284b90513f6ba76770b42ce32b
Author: rsc 
Date:   Fri, 11 Feb 2005 17:01:18 +0000

add fsamount, nsamount; use ndb for authdial; use explicit %#

Diffstat:
  A src/libauth/fsamount.c              |      33 +++++++++++++++++++++++++++++++
  M src/libauth/mkfile                  |       2 ++
  A src/libauth/nsamount.c              |      33 +++++++++++++++++++++++++++++++

3 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/src/libauth/fsamount.c b/src/libauth/fsamount.c
t@@ -0,0 +1,33 @@
+#include 
+#include 
+#include 
+#include 
+#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;
+}
+
diff --git a/src/libauth/mkfile b/src/libauth/mkfile
t@@ -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\
diff --git a/src/libauth/nsamount.c b/src/libauth/nsamount.c
t@@ -0,0 +1,33 @@
+#include 
+#include 
+#include 
+#include 
+#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;
+}
+