lib9pclient is the new libfs
This commit is contained in:
parent
5ba841dffa
commit
46f79934b7
16 changed files with 1033 additions and 0 deletions
38
src/lib9pclient/auth.c
Normal file
38
src/lib9pclient/auth.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */
|
||||
/* See COPYRIGHT */
|
||||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <fcall.h>
|
||||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue