示例#1
0
文件: afs.C 项目: bougyman/sfs
 void nfs_readlink (svccb *sbp) {
   if (const authunix_parms *aup = sbp->getaup ())
     setres (strbuf ("%d", int (aup->aup_uid)));
   else
     setres (NFSERR_ACCES);
   sendreply (sbp);
 }
示例#2
0
文件: mouse.c 项目: aahud/harvey
void
mousectl(Cmdbuf *cb)
{
	Proc *up = externup();
	Cmdtab *ct;

	qlock(&mousectlqlock);
	if(waserror()){
		qunlock(&mousectlqlock);
		nexterror();
	}

	ct = lookupcmd(cb, mousectlmsg, nelem(mousectlmsg));
	switch(ct->index){
	case CMaccelerated:
		setaccelerated(cb->nf == 1 ? 1 : atoi(cb->f[1]));
		break;
	case CMintellimouse:
		setintellimouse();
		break;
	case CMlinear:
		setlinear();
		break;
	case CMps2:
		intellimouse = 0;
		ps2mouse();
		break;
	case CMps2intellimouse:
		ps2mouse();
		setintellimouse();
		break;
	case CMres:
		if(cb->nf >= 2)
			setres(atoi(cb->f[1]));
		else
			setres(1);
		break;
	case CMreset:
		resetmouse();
		if(accelerated)
			setaccelerated(accelerated);
		if(resolution)
			setres(resolution);
		if(intellimouse)
			setintellimouse();
		break;
	case CMhwaccel:
		if(strcmp(cb->f[1], "on")==0)
			mousehwaccel = 1;
		else if(strcmp(cb->f[1], "off")==0)
			mousehwaccel = 0;
		else
			cmderror(cb, "bad mouse control message");
	}

	qunlock(&mousectlqlock);
	poperror();
}
示例#3
0
void
sfssrp_authorizer::authmore (const sfsagent_authmore_arg *argp,
			     sfsagent_auth_res *resp, cbv cb)
{
  resp->set_authenticate (false);

  sfs_autharg2 aarg (SFS_SRPAUTH);
  aarg.srpauth->req.type = SFS_SIGNED_AUTHREQ;
  aarg.srpauth->req.authid = srpc->sessid;
  aarg.srpauth->req.seqno = argp->seqno;
  aarg.srpauth->req.user = srpc->user;

  switch (srpc->next (&aarg.srpauth->msg, &argp->more)) {
  case SRP_SETPWD:
    if (!argp->checkserver) {
      getpwd (strbuf () << "Passphrase for " << srpc->getname () << ": ",
	      false,
	      wrap (this, &sfssrp_authorizer::authmore_2, argp, resp, cb));
      return;
    }
    break;
  case SRP_NEXT:
    if (!argp->checkserver) 
      setres (resp, aarg);
    break;
  case SRP_DONE:
    if (argp->checkserver)
      resp->set_authenticate (true);
    break;
  default:
    break;
  }
  (*cb) ();
}
示例#4
0
void
sfssrp_authorizer::authinit (const sfsagent_authinit_arg *argp,
			     sfsagent_auth_res *resp, cbv cb)
{
  resp->set_authenticate (false);
  if (!ntries_ok (argp->ntries)) {
    (*cb) ();
    return;
  }

  sfs_autharg2 aarg (SFS_SRPAUTH);
  if (!reqinit (&aarg.srpauth->req, argp)) {
    (*cb) ();
    return;
  }

  if (!srpc) {
    srpc = New srp_client;
    delete_srpc = true;
  }
  if (!srpc->init (&aarg.srpauth->msg, aarg.srpauth->req.authid,
		   aarg.srpauth->req.user, NULL,
		   // XXX -- eventually change next line to just 6
		   argp->server_release < 8 ? 3 : 6))
    warn ("SRP client initialization failed\n");
  else
    setres (resp, aarg);
  (*cb) ();
}