From 46f79934b79ef526ed42bbe5a565e6b5d884d24a Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 4 Jan 2005 21:22:40 +0000 Subject: lib9pclient is the new libfs --- src/lib9pclient/auth.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/lib9pclient/auth.c (limited to 'src/lib9pclient/auth.c') diff --git a/src/lib9pclient/auth.c b/src/lib9pclient/auth.c new file mode 100644 index 00000000..2c740e12 --- /dev/null +++ b/src/lib9pclient/auth.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */ +/* See COPYRIGHT */ + +#include +#include +#include +#include <9pclient.h> +#include "fsimpl.h" + +CFid* +fsauth(CFsys *fsys, char *uname, char *aname) +{ + Fcall tx, rx; + void *freep; + CFid *afid; + + if((fid = _fsgetfid(fsys)) == nil) + return nil; + + tx.type = Tauth; + tx.afid = afid->fid; + tx.uname = uname; + tx.aname = aname; + + if(_fsrpc(fsys, &tx, &rx, &freep) < 0){ + _fsputfid(afid); + return nil; + } + if(rx.type == Rerror){ + werrstr("%s", rx.ename); + free(freep); + _fsputfid(afid); + return nil; + } + afid->qid = rx.aqid; + free(freep); + return afid; +} -- cgit v1.2.3