Beispiel #1
0
func (tag *Tag) Auth(afid *Fid, user p.User, aname string) error {
	req := tag.reqAlloc()
	req.fid = afid
	err := p.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 p.User, aname string) (*Fid, error) {
	fid := clnt.FidAlloc()
	tc := clnt.NewFcall()
	err := p.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 - p.IOHDRSZ
	fid.User = user
	fid.walked = true
	return fid, nil
}