Exemplo n.º 1
0
u_int32_t
sfsserv::authalloc (const sfsauth_cred *cp, u_int n)
{
  u_int32_t authno;
  for (u_int i = 0; i < n; i++) {
    const sfsauth_cred &c = cp[i];
    switch (c.type) {
    case SFS_UNIXCRED:
    case SFS_NOCRED:
      {
	if (!(authno = authnoalloc ()))
	  return 0;
	if (c.type == SFS_UNIXCRED) {
	  const sfs_unixcred &uc = *c.unixcred;
	  authtab[authno] = authunixint_create ("localhost", uc.uid, uc.gid,
						uc.groups.size (),
						uc.groups.base ());
	  credtab[authno] = c;
	} else {
	  authtab[authno] = authuint_create (authno);
	  credtab[authno].set_type (SFS_NOCRED);
	}
	return authno;
      }
      
    default:
      break;
    }
  }
  return 0;
}
Exemplo n.º 2
0
void
sfsserver_auth::userauth::finish ()
{
  assert (!aborted);
  auto_auth aa (authuint_create (authno));
  authno = 0;
  sp->authnos.insert (aid, aa);
  sp->authpending.remove (aid);
}