cwfs: cleanup
This commit is contained in:
parent
db7290d79e
commit
09a848d825
3 changed files with 12 additions and 7 deletions
|
@ -242,7 +242,7 @@ authorize(Chan* chan, Fcall* f)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fake read to get auth info */
|
/* fake read to get auth info */
|
||||||
authread(chan, af, nil, 0);
|
authread(af, nil, 0);
|
||||||
uid = af->uid;
|
uid = af->uid;
|
||||||
if(db)
|
if(db)
|
||||||
print("authorize: uid is %d\n", uid);
|
print("authorize: uid is %d\n", uid);
|
||||||
|
@ -283,6 +283,7 @@ attach(Chan* chan, Fcall* f, Fcall* r)
|
||||||
error = Ebadu;
|
error = Ebadu;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
chan->err[0] = 0;
|
||||||
}
|
}
|
||||||
file->uid = u;
|
file->uid = u;
|
||||||
|
|
||||||
|
@ -1001,7 +1002,7 @@ fs_read(Chan* chan, Fcall* f, Fcall* r, uchar* data)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if(file->qid.type & QTAUTH){
|
if(file->qid.type & QTAUTH){
|
||||||
nread = authread(chan, file, (uchar*)data, count);
|
nread = authread(file, (uchar*)data, count);
|
||||||
if(nread < 0)
|
if(nread < 0)
|
||||||
error = Eauth2;
|
error = Eauth2;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1198,7 +1199,7 @@ fs_write(Chan* chan, Fcall* f, Fcall* r)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file->qid.type & QTAUTH){
|
if(file->qid.type & QTAUTH){
|
||||||
nwrite = authwrite(chan, file, (uchar*)f->data, count);
|
nwrite = authwrite(file, (uchar*)f->data, count);
|
||||||
if(nwrite < 0)
|
if(nwrite < 0)
|
||||||
error = Eauth2;
|
error = Eauth2;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -119,11 +119,13 @@ authfree(void *auth)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
authread(Chan *chan, File *file, uchar *data, int count)
|
authread(File *file, uchar *data, int count)
|
||||||
{
|
{
|
||||||
AuthInfo *ai;
|
AuthInfo *ai;
|
||||||
AuthRpc *rpc;
|
AuthRpc *rpc;
|
||||||
|
Chan *chan;
|
||||||
|
|
||||||
|
chan = file->cp;
|
||||||
if((rpc = file->auth) == nil){
|
if((rpc = file->auth) == nil){
|
||||||
snprint(chan->err, sizeof(chan->err),
|
snprint(chan->err, sizeof(chan->err),
|
||||||
"not an auth fid");
|
"not an auth fid");
|
||||||
|
@ -162,10 +164,12 @@ authread(Chan *chan, File *file, uchar *data, int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
authwrite(Chan *chan, File *file, uchar *data, int count)
|
authwrite(File *file, uchar *data, int count)
|
||||||
{
|
{
|
||||||
AuthRpc *rpc;
|
AuthRpc *rpc;
|
||||||
|
Chan *chan;
|
||||||
|
|
||||||
|
chan = file->cp;
|
||||||
if((rpc = file->auth) == nil){
|
if((rpc = file->auth) == nil){
|
||||||
snprint(chan->err, sizeof(chan->err),
|
snprint(chan->err, sizeof(chan->err),
|
||||||
"not an auth fid");
|
"not an auth fid");
|
||||||
|
|
|
@ -4,8 +4,8 @@ void arpstart(void);
|
||||||
void arginit(void);
|
void arginit(void);
|
||||||
void* authnew(void);
|
void* authnew(void);
|
||||||
void authfree(void*);
|
void authfree(void*);
|
||||||
int authread(Chan*, File*, uchar*, int);
|
int authread(File*, uchar*, int);
|
||||||
int authwrite(Chan*, File*, uchar*, int);
|
int authwrite(File*, uchar*, int);
|
||||||
void cdiag(char*, int);
|
void cdiag(char*, int);
|
||||||
int cnumb(void);
|
int cnumb(void);
|
||||||
Device* config(void);
|
Device* config(void);
|
||||||
|
|
Loading…
Reference in a new issue