int pst_forwarding(struct rstp_interface *port) { if (!port->state[PST][EXEC]) { enableForwarding(); Dprintf("on interface %d\n", port->if_index); port->forwarding = 1; } if (!port->forward) { port->state[PST][FUNC] = PST_DISCARDING; port->state[PST][EXEC] = NOT_EXECUTED; return FSM_TRANSITIONED; } else { port->state[PST][EXEC] = EXECUTED; return FSM_NOT_TRANSITIONED; } }
void setupuser(AuthInfo *ai) { Waitmsg *w; int pid; if(ai){ strecpy(username, username+sizeof username, ai->cuid); if(auth_chuid(ai, nil) < 0) bye("user auth failed: %r"); auth_freeAI(ai); }else strecpy(username, username+sizeof username, getuser()); if(newns(username, 0) < 0) bye("user login failed: %r"); /* * hack to allow access to outgoing smtp forwarding */ enableForwarding(); snprint(mboxDir, MboxNameLen, "/mail/box/%s", username); if(myChdir(mboxDir) < 0) bye("can't open user's mailbox"); switch(pid = fork()){ case -1: bye("can't initialize mail system"); break; case 0: execl("/bin/upas/fs", "upas/fs", "-np", nil); _exits("rob1"); _exits(0); break; default: break; } if((w=wait()) == nil || w->pid != pid || w->msg[0] != '\0') bye("can't initialize mail system"); free(w); }