object new_user_connection(string first_line) { if(!AUTHORIZED()) error("Can't call function! Not authorized!"); if(!find_object(GAME_USER)) compile_object(GAME_USER); return clone_object(GAME_USER); }
string get_sitebanned_message(object connection) { if(!AUTHORIZED()) error("Can't call function! Not authorized!"); return sitebanned_message; }
int site_is_banned(string ip_address) { if(!AUTHORIZED()) error("Can't call function! Not authorized!"); return 0; }
/* * Sends a signal to a process or a process group. */ PUBLIC int sys_kill(pid_t pid, int sig) { int err; struct process *p; /* Invalid signal. */ if ((sig < 0) || (sig > NR_SIGNALS - 1)) return (-EINVAL); err = -ESRCH; /* Send signal to process. */ if (pid > 0) { /* Search for process. */ for (p = FIRST_PROC; p <= LAST_PROC; p++) { /* Skip invalid processes. */ if (!IS_VALID(p)) continue; /* Found. */ if (pid == p->pid) { err = -EPERM; if (AUTHORIZED(curr_proc, p, sig)) { err = 0; sndsig(p, sig); } } } } /* Send signal to process group. */ else if (pid == 0) { /* Search for processes. */ for (p = FIRST_PROC; p <= LAST_PROC; p++) { /* Skip invalid processes. */ if (!IS_VALID(p)) continue; /* Found. */ if (curr_proc->pgrp == p->pgrp) { err = -EPERM; if (AUTHORIZED(curr_proc, p, sig)) { err = 0; sndsig(p, sig); } } } } /* Send signal to all processes. */ else if (pid == -1) { err = -EPERM; /* Search for processes. */ for (p = FIRST_PROC; p <= LAST_PROC; p++) { /* Skip invalid processes. */ if (!IS_VALID(p)) continue; if (AUTHORIZED(curr_proc, p, sig)) { err = 0; sndsig(p, sig); } } } /* Send signal to absolute proces group. */ else { /* Search for processes. */ for (p = FIRST_PROC; p <= LAST_PROC; p++) { /* Skip invalid processes. */ if (!IS_VALID(p)) continue; /* Found. */ if (p->pgrp->pid == -pid) { err = -EPERM; if (AUTHORIZED(curr_proc, p, sig)) { err = 0; sndsig(p, sig); } } } } return (err); }