void function_node(Token *tk) {// function statement adjust_arg(); gen(tk); next(tk); // get token ( Func *fun = (Func *)malloc(sizeof(Func)); if ((fun = function_info(tk->beg, tk->line))) { tk->stype = Arg; while (tk->id != ')' && tk->id) { next(tk); expr(tk); } if(!tk->id) PANIC("illegal function call", tk->line); int offset = function(fun, tk->line); assembly_with_offset(pop(), offset); next(tk); if (tk->id != ';') PANIC("expected semicolon after function call", tk->line); } else PANIC("undefined function", tk->line); }
//makes sure decision is positive //adjusts args: //offset [read/write requests] //size [setattr for files only] //apply UMASK to sattr3.mode //sends the request to the NFS server //reply goes to pre_nfs3reply void client::nfs3post_decision_dispatch (svccb *sbp, filesrv::reqstate rqs, ptr<acltargetlist> targets) { if (!targets->get_allowop ()) { warn << "Allowop = false. Permission denied! \n"; reject_nfs (sbp, targets, NFS3ERR_ACCES); return; } adjust_arg (sbp, targets); AUTH *auth = auth_sfs; void *res = nfs_program_3.tbl[sbp->proc ()].alloc_res (); switch (sbp->proc ()){ case NFSPROC3_RENAME: { rqs.c->call (sbp->proc (), sbp->Xtmpl getarg<void> (), res, wrap (mkref (this), &client::renamecb_1, sbp, res, rqs, targets), auth); } break; case NFSPROC3_REMOVE: { // Don't allow users to remove the .SFSACL file diropargs3 *removeargs = sbp->Xtmpl getarg<diropargs3> (); if (removeargs->name == SFSDIRACL) { // Pretend to succeed so things like rm -rf work pre_nfs3reply (sbp, res, rqs, targets, RPC_SUCCESS); return; } else rqs.c->call (sbp->proc (), sbp->Xtmpl getarg<void> (), res, wrap (mkref (this), &client::pre_nfs3reply, sbp, res, rqs, targets), auth); } break; case NFSPROC3_RMDIR: { // When removing directories, remove the .SFSACL file first lookup3res *lres = New lookup3res; rqs.c->call (NFSPROC3_LOOKUP, sbp->Xtmpl getarg<void> (), lres, wrap (mkref (this), &client::rmdircb_1, sbp, res, lres, rqs, targets), auth); } break; case NFSPROC3_MKNOD: { mknod3args *nodargs = sbp->Xtmpl getarg<mknod3args> (); //change auth from auth_sfs to auth_sfssock / auth_sfsfifo switch (nodargs->what.type) { case NF3SOCK: auth = auth_sfssock; break; case NF3FIFO: auth = auth_sfsfifo; break; case NF3CHR: case NF3BLK: default: warn << "Trying to create node of unsupported type \n " ; reject_nfs (sbp, targets, NFS3ERR_NOTSUPP, res); return; } //instead of a NF3SOCK, NF3FIFO create NF3REG file create3args args; args.where = nodargs->where; args.how.set_mode (UNCHECKED); *args.how.obj_attributes = *nodargs->what.pipe_attributes; rqs.c->call (NFSPROC3_CREATE, &args, res, wrap (mkref (this), &client::pre_nfs3reply, sbp, res, rqs, targets), auth); break; } default: { rqs.c->call (sbp->proc (), sbp->Xtmpl getarg<void> (), res, wrap (mkref (this), &client::pre_nfs3reply, sbp, res, rqs, targets), auth); } } }