Beispiel #1
0
func (tag *Tag) Auth(afid *Fid, user ninep.User, aname string) error {
	req := tag.reqAlloc()
	req.fid = afid
	err := ninep.PackTauth(req.Tc, afid.Fid, user.Name(), aname, uint32(user.Id()), tag.clnt.Dotu)
	if err != nil {
		return err
	}

	afid.User = user
	return tag.clnt.Rpcnb(req)
}
Beispiel #2
0
// Creates an authentication fid for the specified user. Returns the fid, if
// successful, or an Error.
func (clnt *Clnt) Auth(user ninep.User, aname string) (*Fid, error) {
	fid := clnt.FidAlloc()
	tc := clnt.NewFcall()
	err := ninep.PackTauth(tc, fid.Fid, user.Name(), aname, uint32(user.Id()), clnt.Dotu)
	if err != nil {
		return nil, err
	}

	_, err = clnt.Rpc(tc)
	if err != nil {
		return nil, err
	}

	fid.Iounit = clnt.Msize - ninep.IOHDRSZ
	fid.User = user
	fid.walked = true
	return fid, nil
}