├── .gitignore ├── start-bot-sbcl ├── src ├── eval-bot.asd ├── sandbox-extra.lisp ├── common.lisp ├── sandbox-impl.lisp ├── eval-bot.lisp └── sandbox-cl.lisp ├── loader-sbcl.lisp ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | quicklisp/ 2 | build/ 3 | -------------------------------------------------------------------------------- /start-bot-sbcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sbcl=sbcl 4 | export TZ=GMT 5 | 6 | cd "$(dirname "$0")" || exit 1 7 | 8 | while true; do 9 | nice rlwrap -D -- "$sbcl" \ 10 | --control-stack-size 1 \ 11 | --disable-ldb --lose-on-corruption \ 12 | --noinform --no-sysinit --no-userinit \ 13 | --load loader-sbcl.lisp \ 14 | "$@" && exit 0 15 | done 16 | -------------------------------------------------------------------------------- /src/eval-bot.asd: -------------------------------------------------------------------------------- 1 | (defsystem "eval-bot" 2 | :description "An IRC bot for Common Lisp code evaluation" 3 | :author "Teemu Likonen " 4 | :licence "GNU Affero General Public License version 3" 5 | :depends-on ("bordeaux-threads" 6 | "trivial-irc" "alexandria" "split-sequence" "babel") 7 | :components 8 | ((:file "sandbox-impl" :depends-on ("common")) 9 | (:file "sandbox-extra" :depends-on ("common" "sandbox-impl" "sandbox-cl")) 10 | (:file "sandbox-cl" :depends-on ("sandbox-impl")) 11 | (:file "common") 12 | (:file "eval-bot" :depends-on ("common" "sandbox-impl")))) 13 | -------------------------------------------------------------------------------- /loader-sbcl.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Eval-bot loader 2 | 3 | (require :asdf) 4 | (require :sb-posix) 5 | 6 | (asdf:initialize-output-translations 7 | (list :output-translations 8 | :ignore-inherited-configuration 9 | (list (merge-pathnames "**/*.*") 10 | (merge-pathnames "build/**/*.*")))) 11 | 12 | (asdf:initialize-source-registry 13 | (list :source-registry 14 | :ignore-inherited-configuration 15 | (list :directory (merge-pathnames "src/")) 16 | (list :tree (merge-pathnames "quicklisp/dists/")))) 17 | 18 | (flet ((probe-load (path) 19 | (when (probe-file path) 20 | (load path))) 21 | (funcallstr (string &rest args) 22 | (apply (read-from-string string) args))) 23 | (or (probe-load "quicklisp/setup.lisp") 24 | (let ((url "http://beta.quicklisp.org/quicklisp.lisp") 25 | (init (nth-value 1 (sb-posix:mkstemp "/tmp/quicklisp-XXXXXX")))) 26 | (unwind-protect 27 | (progn 28 | (sb-ext:run-program "wget" (list "-O" init "--" url) 29 | :search t :output t) 30 | (when (probe-load init) 31 | (funcallstr "quicklisp-quickstart:install" 32 | :path "quicklisp/"))) 33 | (delete-file init))))) 34 | 35 | (ql:quickload '("swank" "eval-bot")) 36 | 37 | (in-package #:eval-bot) 38 | 39 | (defparameter *freenode* 40 | (make-client :server "irc.freenode.net" 41 | :nickname "clbot" 42 | :username "clbot" 43 | :realname "Common Lisp bot" 44 | :listen-targets nil 45 | :auto-join nil)) 46 | 47 | (loop :for port :from 50000 :upto 50050 48 | :do (handler-case 49 | (return (swank:create-server :port port :dont-close t)) 50 | (sb-bsd-sockets:address-in-use-error () nil))) 51 | -------------------------------------------------------------------------------- /src/sandbox-extra.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Eval-bot --- An IRC bot for evaluating Common Lisp expressions 2 | 3 | ;; Copyright (C) 2013 Teemu Likonen 4 | ;; 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU Affero General Public License as 7 | ;; published by the Free Software Foundation, either version 3 of the 8 | ;; License, or (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, but 11 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ;; Affero General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU Affero General Public 16 | ;; License along with this program. If not, see 17 | ;; . 18 | 19 | (cl:defpackage #:sandbox-extra) 20 | (cl:in-package #:sandbox-extra) 21 | 22 | (cl:declaim (cl:optimize (cl:safety 3))) 23 | 24 | (cl:defmacro export-and-lock (cl:&body symbols) 25 | `(cl:progn ,@(cl:loop :for s :in symbols 26 | :append 27 | `((cl:setf (cl:get ',s :sandbox-locked) cl:t) 28 | (cl:export (cl:list ',s)))))) 29 | 30 | (export-and-lock 31 | help tell) 32 | 33 | (cl:define-symbol-macro help 34 | (cl:signal 'common:extra-command :command "help" :arguments cl:nil)) 35 | 36 | (cl:defmacro tell (nick sexp cl:&rest ignored) 37 | (cl:declare (cl:ignore ignored)) 38 | `(cl:let* ((form (cl:let ((cl:*print-case* :downcase)) 39 | (sandbox-cl:prin1-to-string ',sexp))) 40 | (values (cl:with-output-to-string (stream) 41 | (sandbox-impl:repl form stream)))) 42 | (cl:signal 'common:extra-command :command "tell" 43 | :arguments (cl:list ',nick form values)))) 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Eval-bot 2 | ======== 3 | 4 | **An IRC bot for Common Lisp code evaluation** 5 | 6 | 7 | Introduction 8 | ------------ 9 | 10 | _Eval-bot_ is an Internet Relay Chat (IRC) robot program (a bot) which 11 | aims to help discussions related to the Common Lisp language. The bot 12 | sits on an IRC channel and can evaluate Common Lisp expressions and send 13 | their return value to IRC channel or user. 14 | 15 | The bot program is implemented in the Common Lisp language. It must be 16 | used with an implementation that supports threads through 17 | [Bordeaux Threads][BT] library. Minor parts in the bot's start and 18 | setting scripts use features specific to [SBCL][] implementation. 19 | 20 | [BT]: http://common-lisp.net/project/bordeaux-threads/ 21 | [SBCL]: http://www.sbcl.org/ 22 | 23 | 24 | IRC 25 | --- 26 | 27 | Common Lisp package `EVAL-BOT` contains the IRC part of the program. 28 | Function `make-client` creates a client object which can be used with 29 | IRC-related functions, such as `irc-connect`, `irc-join`, `irc-quit` 30 | etc. Here is an example on how to run the bot. 31 | 32 | 1. Start the bot from shell. 33 | 34 | $ ./start-bot-sbcl 35 | 36 | 2. Use SBCL's REPL from the terminal or connect to the Swank server 37 | with Emacs's Slime. 38 | 39 | M-x slime-connect RET 127.0.0.1 RET 50000 RET 40 | 41 | If you use Slime you probably want to see bot's messages in the 42 | Slime buffer. Bot's message stream can be changed with variable 43 | `eval-bot::*local-stream*`. Write this in the Slime REPL buffer: 44 | 45 | (setf eval-bot::*local-stream* *standard-output*) 46 | 47 | 3. Switch to the `EVAL-BOT` package. 48 | 49 | (in-package #:eval-bot) 50 | 51 | 4. Create a client object for connections. 52 | 53 | (defparameter *client* 54 | (make-client :server "some.server.org" 55 | :nickname "eval-bot" 56 | :username "eval-bot" 57 | :realname "Common Lisp Eval Bot" 58 | :listen-targets '("#mychannel") 59 | :auto-join '("#mychannel"))) 60 | 61 | There is `*freenode*` client already. If you choose to use it, you 62 | may just change some of the slots: 63 | 64 | (setf (nickname *freenode*) "eval-bot") 65 | (push "#mychannel" (listen-targets *freenode*)) 66 | (push "#mychannel" (auto-join *freenode*)) 67 | 68 | 5. Connect. 69 | 70 | (irc-connect *client*) 71 | 72 | The bot will connect and automatically join to `#mychannel`. You can 73 | also use `(irc-join client channel &optional password)` function. 74 | Functions with `irc-` prefix are the IRC commands for the server. 75 | Raw IRC protocol commands can be sent with `(irc-raw client 76 | raw-message)`. 77 | 78 | 6. Use the bot! 79 | 80 | ,(values 1 2 3) 81 | => 1, 2, 3 82 | ,help 83 | [bot prints information] 84 | 85 | Comma `,` is the default prefix for code evaluation. It can be 86 | changed with variable `*eval-prefix*`. Not all Common Lisp's 87 | features are supported. See the Sandbox section below. 88 | 89 | If you want to make the startup process automatic you could create a 90 | Lisp file for your commands and start the bot with `./start-bot-sbcl 91 | --load mysettings.lisp`. 92 | 93 | 94 | Sandbox 95 | ------- 96 | 97 | Common Lisp expressions from IRC channels are evaluated in a restricted 98 | sandbox environment which provides a subset of Common Lisp's features. 99 | In general, many features related to symbols, packages and operating 100 | system have been disabled. Some standard functions and macros have been 101 | replaced with safer versions. The sandbox is implemented in packages 102 | `SANDBOX-IMPL`, `SANDBOX-CL` and `SANDBOX-EXTRA`. Function 103 | `sandbox-impl:repl` is the interface for sandbox code evaluation. 104 | 105 | A single eval message from IRC results in a single answer message from 106 | the bot. Each IRC user has automatically her own sandbox package. So 107 | user-defined variables and functions are not shared between users. Users 108 | have their own REPL variables too: `* ** *** / // /// + ++ +++`. The 109 | user-specific sandbox package is temporary and is automatically deleted 110 | if not used for a while. 111 | 112 | 113 | The source code 114 | --------------- 115 | 116 | GitHub repository: 117 | 118 | 119 | Copyright and license 120 | --------------------- 121 | 122 | Copyright (C) 2012-2016 Teemu Likonen <> ([web][], 123 | [PGP][]) 124 | 125 | This program is free software: you can redistribute it and/or modify it 126 | under the terms of the GNU Affero General Public License as published by 127 | the Free Software Foundation, either version 3 of the License, or (at 128 | your option) any later version. 129 | 130 | This program is distributed in the hope that it will be useful, but 131 | WITHOUT ANY WARRANTY; without even the implied warranty of 132 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero 133 | General Public License for more details. 134 | 135 | The license text: 136 | 137 | [web]: http://www.iki.fi/tlikonen/ 138 | [PGP]: http://www.iki.fi/tlikonen/teemu.pgp 139 | -------------------------------------------------------------------------------- /src/common.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Eval-bot --- An IRC bot for evaluating Common Lisp expressions 2 | 3 | ;; Copyright (C) 2012-2013 Teemu Likonen 4 | ;; 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU Affero General Public License as 7 | ;; published by the Free Software Foundation, either version 3 of the 8 | ;; License, or (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, but 11 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ;; Affero General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU Affero General Public 16 | ;; License along with this program. If not, see 17 | ;; . 18 | 19 | (defpackage #:common 20 | (:use #:cl) 21 | (:export #:with-thread #:update-sandbox-usage #:delete-unused-packages 22 | #:delete-all-packages #:list-user-sandbox-packages 23 | #:user-to-sandbox-name 24 | #:queue #:queue-add #:queue-pop #:queue-clear 25 | #:queue-length #:extra-command #:command #:arguments)) 26 | 27 | (in-package #:common) 28 | 29 | 30 | (define-condition extra-command () 31 | ((command :reader command :initarg :command) 32 | (arguments :reader arguments :initarg :arguments))) 33 | 34 | ;;; Threads 35 | 36 | (defmacro with-thread ((name &key timeout) &body body) 37 | (let ((main (gensym "MAIN-THREAD")) 38 | (time (gensym "TIMEOUT")) 39 | (main-body (loop :for form :in body 40 | :until (eql form :timeout) 41 | :collect form)) 42 | (timeout-body (rest (member :timeout body)))) 43 | `(let ((,time ,timeout)) 44 | (assert (or (not ,time) (and (realp ,time) (not (minusp ,time)))) 45 | nil "TIMEOUT must be a non-negative real number or NIL.") 46 | (let ((,main (bt:make-thread (lambda () ,@main-body) :name ,name))) 47 | (when ,time 48 | (bt:make-thread (lambda () 49 | (sleep ,time) 50 | (when (bt:thread-alive-p ,main) 51 | (bt:destroy-thread ,main) 52 | ,@timeout-body)) 53 | :name (format nil "~A timeout" 54 | (bt:thread-name ,main)))) 55 | ,main)))) 56 | 57 | ;;; Maintenance 58 | 59 | (defclass sandbox-package () 60 | ((lock :reader lock :initform (bt:make-lock "sandbox-package")) 61 | (last-use :accessor last-use))) 62 | 63 | (defvar *sandbox-usage* (make-hash-table :test #'equal)) 64 | 65 | (defun update-sandbox-usage (sandbox-name) 66 | (let ((package (gethash sandbox-name *sandbox-usage*))) 67 | (unless (typep package 'sandbox-package) 68 | (setf package (make-instance 'sandbox-package) 69 | (gethash sandbox-name *sandbox-usage*) package)) 70 | (bt:with-lock-held ((lock (gethash sandbox-name *sandbox-usage*))) 71 | (setf (last-use package) (get-universal-time))))) 72 | 73 | (defvar *max-sandbox-age* (* 15 60)) 74 | 75 | (defun delete-unused-packages () 76 | (let ((current-time (get-universal-time))) 77 | (maphash (lambda (package-name package) 78 | (bt:with-lock-held ((lock package)) 79 | (when (or (not (find-package package-name)) 80 | (> (- current-time (last-use package)) 81 | *max-sandbox-age*)) 82 | (remhash package-name *sandbox-usage*) 83 | (delete-package package-name)))) 84 | *sandbox-usage*))) 85 | 86 | (defun delete-all-packages () 87 | (maphash (lambda (package-name package) 88 | (bt:with-lock-held ((lock package)) 89 | (remhash package-name *sandbox-usage*) 90 | (delete-package package-name))) 91 | *sandbox-usage*)) 92 | 93 | (defvar *sandbox-package-prefix* "SANDBOX/") 94 | 95 | (defun list-user-sandbox-packages () 96 | (remove-if-not (lambda (item) 97 | (string= *sandbox-package-prefix* 98 | (subseq item 0 99 | (min (length item) 100 | (length *sandbox-package-prefix*))))) 101 | (list-all-packages) 102 | :key #'package-name)) 103 | 104 | (defun user-to-sandbox-name (user) 105 | (let ((excl (position #\! user))) 106 | (string-upcase (concatenate 'string 107 | *sandbox-package-prefix* 108 | (subseq user (or excl 0)))))) 109 | 110 | ;;; Queues 111 | 112 | (defclass queue () 113 | ((queue-first :accessor queue-first :initform nil) 114 | (queue-last :accessor queue-last :initform nil) 115 | (queue-length :accessor queue-length :initform 0) 116 | (lock :reader lock :initform (bt:make-lock "queue")))) 117 | 118 | (defun queue-add (queue item) 119 | (bt:with-lock-held ((lock queue)) 120 | (with-slots (queue-first queue-last queue-length) queue 121 | (let ((new-cons (cons item nil))) 122 | (if (and queue-first queue-last) 123 | (setf (cdr queue-last) new-cons) 124 | (setf queue-first new-cons)) 125 | (setf queue-last new-cons) 126 | (incf queue-length) 127 | item)))) 128 | 129 | (defun queue-pop (queue) 130 | (bt:with-lock-held ((lock queue)) 131 | (with-slots (queue-first queue-last queue-length) queue 132 | (if queue-first 133 | (let ((first (pop queue-first))) 134 | (decf queue-length) 135 | (unless queue-first 136 | (setf queue-last nil)) 137 | (values first t)) 138 | (values nil nil))))) 139 | 140 | (defun queue-clear (queue) 141 | (bt:with-lock-held ((lock queue)) 142 | (setf (queue-first queue) nil 143 | (queue-last queue) nil 144 | (queue-length queue) 0))) 145 | -------------------------------------------------------------------------------- /src/sandbox-impl.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Eval-bot --- An IRC bot for evaluating Common Lisp expressions 2 | 3 | ;; Copyright (C) 2012-2013 Teemu Likonen 4 | ;; 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU Affero General Public License as 7 | ;; published by the Free Software Foundation, either version 3 of the 8 | ;; License, or (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, but 11 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ;; Affero General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU Affero General Public 16 | ;; License along with this program. If not, see 17 | ;; . 18 | 19 | (defpackage #:sandbox-impl 20 | (:use #:cl) 21 | (:import-from #:alexandria #:with-gensyms #:circular-tree-p) 22 | (:export #:repl #:reset #:translate-form #:*sandbox* #:sandbox-error 23 | #:disabled-feature)) 24 | 25 | (in-package #:sandbox-impl) 26 | 27 | (declaim (optimize (safety 3))) 28 | 29 | (defvar *sandbox* "SANDBOX/LOCAL") 30 | (defvar *msg-value-prefix* "=> ") 31 | (defvar *msg-error-prefix* ";; ") 32 | (defvar *max-elements* 500) 33 | 34 | (define-condition sandbox-error (error) nil 35 | (:report "Sandbox error.")) 36 | 37 | (define-condition unsupported-type (sandbox-error) 38 | ((type :initarg :type :reader unsupported-type)) 39 | (:report (lambda (c s) 40 | (format s "Type ~A is not supported." (unsupported-type c))))) 41 | 42 | (define-condition disabled-feature (sandbox-error) 43 | ((name :initarg :name :reader disabled-feature-name)) 44 | (:report (lambda (c s) 45 | (format s "The feature ~A is disabled." 46 | (disabled-feature-name c))))) 47 | 48 | (define-condition circular-list (sandbox-error) nil 49 | (:report "Circular list was detected.")) 50 | 51 | (define-condition dimension-error (sandbox-error) nil 52 | (:report (lambda (c s) 53 | (declare (ignore c)) 54 | (format s "Array or list dimensions too large (max ~D elements)." 55 | *max-elements*)))) 56 | 57 | (define-condition all-read (sandbox-error) nil) 58 | 59 | (define-condition sandbox-package-error (sandbox-error) nil) 60 | 61 | (defmacro with-sandbox-env (&body body) 62 | (with-gensyms (input output two-way) 63 | `(with-open-stream (,input (make-string-input-stream 64 | "This is the standard input stream!")) 65 | (with-open-stream (,output (make-broadcast-stream)) 66 | (with-open-stream (,two-way (make-two-way-stream ,input ,output)) 67 | (with-standard-io-syntax 68 | (let ((*standard-output* ,output) 69 | (*error-output* ,output) 70 | (*trace-output* ,output) 71 | (*standard-input* ,input) 72 | (*debug-io* ,two-way) 73 | (*query-io* ,two-way) 74 | (*terminal-io* ,two-way) 75 | (*package* (find-package *sandbox*)) 76 | (*features* nil) 77 | (*print-length* 50) 78 | (*print-level* 10) 79 | (*print-readably* nil) 80 | (*read-eval* nil) 81 | (*default-pathname-defaults* 82 | (make-pathname :directory '(:absolute "home" "sandbox") 83 | :name nil :type nil))) 84 | ,@body))))))) 85 | 86 | (defvar *allowed-extra-symbols* nil) 87 | 88 | (defun translate-form (form) 89 | (when (and (consp form) 90 | (circular-tree-p form)) 91 | (error 'circular-list)) 92 | (let ((cons-count 0)) 93 | (labels ((translate (form) 94 | (typecase form 95 | (cons (if (> (incf cons-count) *max-elements*) 96 | (error 'dimension-error) 97 | (cons (translate (car form)) 98 | (translate (cdr form))))) 99 | (number form) 100 | (character form) 101 | (pathname form) 102 | (array (if (> (array-total-size form) *max-elements*) 103 | (error 'dimension-error) 104 | (let ((arr (make-array (array-dimensions form) 105 | :element-type 106 | (array-element-type form)))) 107 | (dotimes (i (array-total-size arr) arr) 108 | (setf (row-major-aref arr i) 109 | (translate-form 110 | (row-major-aref form i))))))) 111 | (keyword form) 112 | (symbol (if (member form *allowed-extra-symbols*) 113 | form 114 | (intern (symbol-name form) *sandbox*))) 115 | (t (error 'unsupported-type :type (type-of form)))))) 116 | (translate form)))) 117 | 118 | (defun msge (stream format-string &rest params) 119 | (apply #'format stream (concatenate 'string "~&" *msg-error-prefix* 120 | format-string "~%") 121 | params)) 122 | 123 | (defun msgv (stream format-string &rest params) 124 | (apply #'format stream (concatenate 'string "~&" *msg-value-prefix* 125 | format-string "~%") 126 | params)) 127 | 128 | (defun sandbox-print (values &optional (stream *standard-output*)) 129 | (if values 130 | (msgv stream "~{~S~^, ~}" values) 131 | (msge stream "No value")) 132 | nil) 133 | 134 | (defun reset () 135 | (ignore-errors 136 | (delete-package *sandbox*)) 137 | (make-package *sandbox* :use '(#:sandbox-cl #:sandbox-extra)) 138 | (loop :for name :in '("+" "++" "+++" "*" "**" "***" "/" "//" "///" "-") 139 | :do (eval `(defparameter ,(intern name *sandbox*) nil))) 140 | (loop :for fn :in '(+ - * /) 141 | :for symbol := (intern (symbol-name fn) *sandbox*) 142 | :do (setf (get symbol :sandbox-locked) t) 143 | (eval `(defun ,symbol (&rest args) 144 | (apply ',fn args)))) 145 | *sandbox*) 146 | 147 | (defun repl (string &optional (stream *standard-output*)) 148 | (unless (or (find-package *sandbox*) (reset)) 149 | (msge stream "SANDBOX-PACKAGE-ERROR: Sandbox package not found.") 150 | (return-from repl nil)) 151 | 152 | (with-sandbox-env 153 | (with-input-from-string (s string) 154 | 155 | (flet ((sread (stream) 156 | (translate-form (handler-case (read stream) 157 | (end-of-file () 158 | (signal 'all-read))))) 159 | 160 | (ssetq (name value) 161 | (setf (symbol-value (find-symbol (string-upcase name) *sandbox*)) 162 | value)) 163 | 164 | (muffle (c) 165 | (declare (ignore c)) 166 | (when (find-restart 'muffle-warning) 167 | (muffle-warning)))) 168 | 169 | (let (form values) 170 | 171 | (handler-case 172 | (handler-bind ((warning #'muffle)) 173 | (loop (setf values (multiple-value-list 174 | (eval (prog1 (setf form (sread s)) 175 | (ssetq "-" form))))))) 176 | 177 | (common:extra-command (c) 178 | (signal c)) 179 | 180 | (all-read () 181 | (sandbox-print values stream)) 182 | 183 | (undefined-function (c) 184 | (msge stream "~A: The function ~A is undefined." 185 | (type-of c) (cell-error-name c))) 186 | 187 | (end-of-file (c) 188 | (msge stream "~A" (type-of c))) 189 | 190 | (reader-error () 191 | (msge stream "READER-ERROR")) 192 | 193 | (package-error () 194 | (msge stream "PACKAGE-ERROR")) 195 | 196 | (stream-error (c) 197 | (msge stream "~A" (type-of c))) 198 | 199 | (storage-condition () 200 | (msge stream "STORAGE-CONDITION")) 201 | 202 | (t (c) 203 | (msge stream "~A: ~A" (type-of c) c))) 204 | 205 | (flet ((svalue (string) 206 | (symbol-value (find-symbol string *sandbox*)))) 207 | (ssetq "///" (svalue "//")) 208 | (ssetq "//" (svalue "/")) 209 | (ssetq "/" values) 210 | (ssetq "***" (svalue "**")) 211 | (ssetq "**" (svalue "*")) 212 | (ssetq "*" (first values)) 213 | (ssetq "+++" (svalue "++")) 214 | (ssetq "++" (svalue "+")) 215 | (ssetq "+" form)))))) 216 | nil) 217 | -------------------------------------------------------------------------------- /src/eval-bot.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Eval-bot --- An IRC bot for evaluating Common Lisp expressions 2 | 3 | ;; Copyright (C) 2012-2013 Teemu Likonen 4 | ;; 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU Affero General Public License as 7 | ;; published by the Free Software Foundation, either version 3 of the 8 | ;; License, or (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, but 11 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ;; Affero General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU Affero General Public 16 | ;; License along with this program. If not, see 17 | ;; . 18 | 19 | (defpackage #:eval-bot 20 | (:use #:cl) 21 | (:import-from #:common 22 | #:queue #:queue-add #:queue-pop #:queue-clear #:queue-length 23 | #:with-thread) 24 | (:import-from #:split-sequence #:split-sequence)) 25 | 26 | (in-package #:eval-bot) 27 | 28 | (declaim (optimize (safety 3))) 29 | 30 | ;;; Misc 31 | 32 | (defvar *enabled* t) 33 | 34 | (defun enable () (setf *enabled* t)) 35 | (defun disable () (setf *enabled* nil)) 36 | 37 | ;;; Clients 38 | 39 | (defclass client (trivial-irc:client) 40 | ((send-queue :reader send-queue :initform (make-instance 'queue)) 41 | (input-queue :reader input-queue :initform (make-instance 'queue)) 42 | (listen-targets :accessor listen-targets :initarg :listen-targets 43 | :initform nil) 44 | (auto-join :accessor auto-join :initarg :auto-join :initform nil) 45 | (send-queue-thread :accessor send-queue-thread :initform nil) 46 | (input-queue-thread :accessor input-queue-thread :initform nil) 47 | (server-message-thread :accessor server-message-thread :initform nil) 48 | (nick-uniq-count :accessor nick-uniq-count :initform 1))) 49 | 50 | (defun connectedp (client) 51 | (ignore-errors (trivial-irc:connected-p client))) 52 | 53 | (defun make-client (&key server (port 6667) password 54 | nickname username realname listen-targets auto-join) 55 | (make-instance 'client :server server :port port :password password 56 | :nickname nickname :username username :realname realname 57 | :listen-targets listen-targets :auto-join auto-join)) 58 | 59 | ;;; Messages 60 | 61 | (defvar *eval-prefix* ",") 62 | (defvar *local-stream* *terminal-io*) 63 | (defvar *irc-message-max-length* 480) 64 | 65 | (defclass message () 66 | ((timestamp :reader timestamp :initform (get-universal-time)))) 67 | 68 | (defclass server-message (message) 69 | ((command :reader command :initarg :command) 70 | (prefix :reader prefix :initarg :prefix) 71 | (arguments :reader arguments :initarg :arguments))) 72 | 73 | (defclass server-privmsg (server-message) nil) 74 | (defclass server-privmsg-eval (server-privmsg) nil) 75 | 76 | (defclass client-message (message) nil) 77 | 78 | (defclass client-privmsg (client-message) 79 | ((command :reader command :initform "PRIVMSG") 80 | (target :accessor target :initarg :target) 81 | (contents :accessor contents :initarg :contents))) 82 | (defclass client-action (client-privmsg) nil) 83 | 84 | (defconstant +action-char+ (code-char 1)) 85 | 86 | (defun action-to-string (action-string) 87 | (let ((len (length action-string))) 88 | (when (and (>= len 9) 89 | (string= (format nil "~CACTION " +action-char+) 90 | (subseq action-string 0 8)) 91 | (char= +action-char+ (elt action-string (1- len)))) 92 | (subseq action-string 8 (1- len))))) 93 | 94 | (defun string-to-action (string) 95 | (if (action-to-string string) 96 | string 97 | (format nil "~CACTION ~A~C" +action-char+ string +action-char+))) 98 | 99 | (defun iso-time (&optional (universal-time (get-universal-time))) 100 | (multiple-value-bind (sec min hour date month year day dst tz) 101 | (decode-universal-time universal-time 0) 102 | (declare (ignore dst day tz)) 103 | (format nil "~D~2,'0D~2,'0DT~2,'0D~2,'0D~2,'0DZ" 104 | year month date hour min sec))) 105 | 106 | (defun truncate-message (string) 107 | (if (<= (or (ignore-errors (babel:string-size-in-octets string)) 108 | (length string)) 109 | *irc-message-max-length*) 110 | string 111 | (loop :for i :from 1 :upto (length string) 112 | :for lisp := (subseq string 0 i) 113 | :if (> (or (ignore-errors (babel:string-size-in-octets lisp)) 114 | (length lisp)) 115 | *irc-message-max-length*) 116 | :return (concatenate 'string (subseq string 0 (1- i)) "...")))) 117 | 118 | (defgeneric send (context message)) 119 | 120 | (defmethod send ((client client) (message client-privmsg)) 121 | (trivial-irc:send-privmsg client (target message) 122 | (truncate-message (contents message)))) 123 | 124 | (defmethod send ((client client) (message client-action)) 125 | (trivial-irc:send-privmsg client (target message) 126 | (string-to-action (truncate-message 127 | (contents message))))) 128 | 129 | (defmethod send ((target stream) (message server-message)) 130 | (format target "~&~A ~A ~{~A~^ ~}~%" 131 | (command message) (prefix message) (arguments message))) 132 | 133 | (defmethod send ((target stream) (message server-privmsg)) 134 | (format target "~&~A [~A] <~A> (~A)~%> ~A~%" 135 | (command message) 136 | (iso-time (timestamp message)) 137 | (prefix message) 138 | (first (arguments message)) 139 | (second (arguments message)))) 140 | 141 | (defmethod send ((target stream) (message client-privmsg)) 142 | (format target "~&~A~A [~A] *ME* (~A)~%> ~A~%" 143 | (command message) 144 | (if (typep message 'client-action) "/ACTION" "") 145 | (iso-time (timestamp message)) 146 | (target message) 147 | (truncate-message (contents message)))) 148 | 149 | (defmethod send ((target stream) (message string)) 150 | (format target "~&~A~%" message)) 151 | 152 | (defmethod send ((target (eql :terminal)) message) 153 | (send *local-stream* message)) 154 | 155 | (defun bot-message (format-string &rest args) 156 | (apply #'format nil format-string args)) 157 | 158 | (defun bot-comment (format-string &rest args) 159 | (apply #'format nil (concatenate 'string ";; " format-string) 160 | args)) 161 | 162 | ;;; General maintainer 163 | 164 | (defvar *maintainer-thread* nil) 165 | (defvar *maintainer-interval* 60) 166 | 167 | (defun start-maintainer () 168 | (when (and (bt:threadp *maintainer-thread*) 169 | (bt:thread-alive-p *maintainer-thread*)) 170 | (bt:destroy-thread *maintainer-thread*)) 171 | (setf *maintainer-thread* 172 | (with-thread ("eval-bot maintainer") 173 | (loop (sleep *maintainer-interval*) 174 | (ignore-errors 175 | (common:delete-unused-packages)))))) 176 | 177 | ;;; IRC 178 | 179 | (defvar *default-quit-message* "clbot") 180 | 181 | (defun irc-raw (client raw-message) 182 | (trivial-irc:send-raw-message client raw-message)) 183 | 184 | (defun irc-quit (client &optional (message *default-quit-message*)) 185 | (queue-clear (input-queue client)) 186 | (queue-clear (send-queue client)) 187 | (trivial-irc:disconnect client :message message)) 188 | 189 | (defun irc-join (client channel &optional password) 190 | (irc-raw client (format nil "JOIN ~A~@[ ~A~]" channel password))) 191 | 192 | (defun irc-part (client channel &optional message) 193 | (irc-raw client (format nil "PART ~A~@[ :~A~]" channel message))) 194 | 195 | (defun irc-mode (client target &rest args) 196 | (irc-raw client (format nil "MODE ~A ~{~A~^ ~}" target args))) 197 | 198 | (defun irc-nick (client nick) 199 | (irc-raw client (format nil "NICK ~A" nick))) 200 | 201 | (defun irc-msg (client target message) 202 | (let ((msg (make-instance 'client-privmsg :target target :contents message))) 203 | (queue-add (send-queue client) msg) 204 | (send :terminal msg))) 205 | 206 | (defun start-server-message-handler (client) 207 | (let ((thread (server-message-thread client))) 208 | (when (and (bt:threadp thread) 209 | (bt:thread-alive-p thread)) 210 | (bt:destroy-thread thread))) 211 | (setf (server-message-thread client) 212 | (with-thread ("server message handler") 213 | (block nil 214 | (handler-bind 215 | 216 | ((trivial-irc:connection-lost 217 | (lambda (c) 218 | (send :terminal (format nil "~A" (type-of c))) 219 | (ignore-errors (irc-quit client)) 220 | (with-thread ("eval-bot reconnect") 221 | #+sbcl (declare (sb-ext:muffle-conditions style-warning)) 222 | (sleep 5) 223 | (irc-connect client)) 224 | (return))) 225 | 226 | (t (lambda (c) 227 | (send :terminal (format nil "~A: ~A" (type-of c) c)) 228 | (sleep 2) 229 | (invoke-restart 'ignore)))) 230 | 231 | (loop :while (connectedp client) 232 | :do (with-simple-restart (ignore "Continue handling") 233 | (trivial-irc:receive-message client)))))))) 234 | 235 | (defun irc-connect (client) 236 | (loop :for slot :in '(server-message-thread send-queue-thread 237 | input-queue-thread) 238 | :for value := (slot-value client slot) 239 | :if (and (bt:threadp value) 240 | (bt:thread-alive-p value)) 241 | :do 242 | (bt:destroy-thread value) 243 | (setf (slot-value client slot) nil)) 244 | 245 | (setf (nick-uniq-count client) 1) 246 | (queue-clear (input-queue client)) 247 | (queue-clear (send-queue client)) 248 | 249 | (handler-case (trivial-irc:connect client) 250 | (trivial-irc:connection-failed () 251 | (send :terminal "Connection failed.") 252 | (ignore-errors (irc-quit client)) 253 | (with-thread ("eval-bot reconnect") 254 | (sleep 5) 255 | (irc-connect client)) 256 | (return-from irc-connect))) 257 | 258 | (when (connectedp client) 259 | (start-server-message-handler client) 260 | client)) 261 | 262 | ;;; Handlers 263 | 264 | (defvar *eval-timeout* .2) 265 | 266 | (defun clean-string (string) 267 | (delete-if-not #'graphic-char-p 268 | (substitute-if #\Space (lambda (char) 269 | (member char '(#\Newline #\Tab))) 270 | string))) 271 | 272 | (defun sandbox-repl (sandbox-name string &optional (stream *standard-output*)) 273 | (common:update-sandbox-usage sandbox-name) 274 | (let ((sandbox-impl:*sandbox* sandbox-name)) 275 | (sandbox-impl:repl string stream))) 276 | 277 | (defun sandbox-init (sandbox-name) 278 | (common:update-sandbox-usage sandbox-name) 279 | (unless (find-package sandbox-name) 280 | (let ((sandbox-impl:*sandbox* sandbox-name)) 281 | (sandbox-impl:reset)))) 282 | 283 | 284 | (defvar *help-strings* 285 | (list (format nil "~ 286 | ~Aforms = Eval forms and print the values of the last one.~0@* / ~ 287 | ~Ahelp = This help message.~0@* / ~ 288 | ~A(tell nick form) = Eval form and send the form and its value to nick." 289 | *eval-prefix*))) 290 | 291 | 292 | (defun valid-nick-p (string) 293 | (loop :for char :across string 294 | :always (or (alphanumericp char) 295 | (find char "_-\\[]{}^`|")))) 296 | 297 | 298 | (defun extra-cmd-help (client target) 299 | (send :terminal (format nil "[Sending help to ~A]" target)) 300 | (loop :for line :in *help-strings* 301 | :for msg := (make-instance 'client-privmsg 302 | :target target 303 | :contents (bot-comment "~A" line)) 304 | :do (queue-add (send-queue client) msg))) 305 | 306 | 307 | (defun extra-cmd-tell (client user args) 308 | (destructuring-bind (nick form value) args 309 | (let ((msgs nil)) 310 | (if (not (or (stringp nick) 311 | (symbolp nick) 312 | (characterp nick))) 313 | (setf msgs (list (make-instance 314 | 'client-privmsg :target user 315 | :contents (bot-comment "In TELL macro the NICK ~ 316 | argument must be a string (designator).")))) 317 | (progn 318 | (setf nick (string nick)) 319 | (if (not (valid-nick-p nick)) 320 | (setf msgs (list (make-instance 321 | 'client-privmsg :target user 322 | :contents (bot-comment "\"~A\" doesn't look ~ 323 | like a valid nick." nick)))) 324 | (setf msgs 325 | (loop :for string 326 | :in (list (bot-comment "Nick \"~A\" tells: ~A" user 327 | (clean-string form)) 328 | (bot-message "~A" (clean-string value))) 329 | :collect (make-instance 'client-privmsg 330 | :target nick 331 | :contents string)))))) 332 | 333 | (loop :for msg :in msgs 334 | :do 335 | (send :terminal msg) 336 | (queue-add (send-queue client) msg))))) 337 | 338 | 339 | (defgeneric handle-input-message (client message)) 340 | 341 | (defmethod handle-input-message ((client client) (message server-privmsg-eval)) 342 | (let ((target (first (arguments message))) 343 | (user (trivial-irc:prefix-nickname (prefix message))) 344 | (contents (subseq (second (arguments message)) 345 | (length *eval-prefix*))) 346 | (sandbox-name (common:user-to-sandbox-name (prefix message)))) 347 | 348 | (send :terminal message) 349 | (sandbox-init sandbox-name) 350 | 351 | (with-thread ("eval and print" :timeout *eval-timeout*) 352 | (handler-case 353 | (let ((string (clean-string (with-output-to-string (stream) 354 | (sandbox-repl sandbox-name 355 | contents stream))))) 356 | (when (plusp (length string)) 357 | (let ((msg (make-instance 'client-privmsg :target target 358 | :contents string))) 359 | (send :terminal msg) 360 | (queue-add (send-queue client) msg)))) 361 | 362 | (common:extra-command (c) 363 | (with-thread ("extra command") 364 | (let ((cmd (common:command c)) 365 | (args (common:arguments c))) 366 | (cond ((equalp cmd "help") 367 | (extra-cmd-help client target)) 368 | ((equalp cmd "tell") 369 | (extra-cmd-tell client user args))))))) 370 | 371 | :timeout 372 | (let ((msg (make-instance 'client-privmsg :target target 373 | :contents (bot-comment "EVAL-TIMEOUT")))) 374 | (send :terminal msg) 375 | (queue-add (send-queue client) msg))))) 376 | 377 | (defun match-prefix-p (prefix string) 378 | (string= prefix string :end2 (min (length prefix) (length string)))) 379 | 380 | (defvar *max-input-queue-length* 10) 381 | 382 | (defmethod handle-input-message ((client client) (message server-privmsg)) 383 | (let ((contents (second (arguments message)))) 384 | (when (and (match-prefix-p *eval-prefix* contents) 385 | (< (queue-length (input-queue client)) 386 | *max-input-queue-length*)) 387 | (queue-add (input-queue client) 388 | (make-instance 'server-privmsg-eval 389 | :command (command message) 390 | :prefix (prefix message) 391 | :arguments (arguments message)))))) 392 | 393 | (defvar *send-queue-interval* .5) 394 | (defvar *input-queue-interval* .1) 395 | 396 | (defun start-queue-handlers (client) 397 | (with-slots (input-queue-thread send-queue-thread) client 398 | (when (and (bt:threadp input-queue-thread) 399 | (bt:thread-alive-p input-queue-thread)) 400 | (bt:destroy-thread input-queue-thread)) 401 | (when (and (bt:threadp send-queue-thread) 402 | (bt:thread-alive-p send-queue-thread)) 403 | (bt:destroy-thread send-queue-thread)) 404 | 405 | (setf send-queue-thread 406 | (with-thread ("send queue handler") 407 | (loop :for msg := (queue-pop (send-queue client)) 408 | :while (connectedp client) 409 | :do (sleep *send-queue-interval*) 410 | :if (typep msg 'client-privmsg) 411 | :do (send client msg))) 412 | 413 | input-queue-thread 414 | (with-thread ("input queue handler") 415 | (loop :for msg := (queue-pop (input-queue client)) 416 | :while (connectedp client) 417 | :do (sleep *input-queue-interval*) 418 | :if (typep msg 'server-privmsg) 419 | :do (with-thread ("input message handler") 420 | (handle-input-message client msg))))))) 421 | 422 | (defun connection-established (client) 423 | (start-maintainer) 424 | (start-queue-handlers client) 425 | (ignore-errors 426 | (loop :for ch :in (auto-join client) 427 | :do (sleep 1) 428 | (cond ((stringp ch) 429 | (irc-join client ch)) 430 | ((and (consp ch) 431 | (stringp (car ch)) 432 | (stringp (cdr ch))) 433 | (irc-join client (car ch) (cdr ch))))))) 434 | 435 | (defmethod trivial-irc:handle ((command (eql :privmsg)) 436 | (client client) prefix arguments) 437 | (let ((target (first arguments)) 438 | (contents (second arguments))) 439 | 440 | (when (and *enabled* 441 | (member target (listen-targets client) :test #'string-equal) 442 | (not (action-to-string contents))) 443 | (handle-input-message 444 | client (make-instance 'server-privmsg 445 | :command (symbol-name command) 446 | :prefix prefix :arguments arguments))))) 447 | 448 | (defmethod trivial-irc:handle ((command (eql :err_nicknameinuse)) 449 | (client client) prefix arguments) 450 | (irc-nick client (format nil "~A~A" (trivial-irc:nickname client) 451 | (incf (nick-uniq-count client)))) 452 | (call-next-method)) 453 | 454 | (defmethod trivial-irc:handle ((command (eql :err_nickcollision)) 455 | (client client) prefix arguments) 456 | (irc-nick client (format nil "~A~A" (trivial-irc:nickname client) 457 | (incf (nick-uniq-count client)))) 458 | (call-next-method)) 459 | 460 | (defmethod trivial-irc:handle ((command (eql :rpl_endofmotd)) 461 | (client client) prefix arguments) 462 | (with-thread ("connection established") 463 | (sleep 3) 464 | (handler-case (connection-established client) 465 | (t (c) 466 | (send :terminal (princ-to-string (type-of c))) 467 | (send :terminal (princ-to-string c))))) 468 | (call-next-method)) 469 | 470 | (defvar *ignored-server-messages* 471 | '("JOIN" "PART" "QUIT")) 472 | 473 | (defmethod trivial-irc:handle ((command symbol) 474 | (client client) prefix arguments) 475 | (unless (member (symbol-name command) *ignored-server-messages* 476 | :test #'string-equal) 477 | (send :terminal (make-instance 'server-message 478 | :command (symbol-name command) 479 | :prefix prefix :arguments arguments)))) 480 | -------------------------------------------------------------------------------- /src/sandbox-cl.lisp: -------------------------------------------------------------------------------- 1 | ;;;; Eval-bot --- An IRC bot for evaluating Common Lisp expressions 2 | 3 | ;; Copyright (C) 2012-2016 Teemu Likonen 4 | ;; 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU Affero General Public License as 7 | ;; published by the Free Software Foundation, either version 3 of the 8 | ;; License, or (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, but 11 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ;; Affero General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU Affero General Public 16 | ;; License along with this program. If not, see 17 | ;; . 18 | 19 | (cl:defpackage #:sandbox-cl) 20 | (cl:in-package #:sandbox-cl) 21 | 22 | (cl:declaim (cl:optimize (cl:safety 3))) 23 | 24 | ;;; Helpers for defining, importing and exporting 25 | 26 | (cl:defmacro import-export-symbols (cl:&body symbols) 27 | `(cl:loop :for symbol :in ',symbols 28 | :do 29 | (cl:shadowing-import (cl:list symbol)) 30 | (cl:export (cl:list symbol)))) 31 | 32 | (cl:defmacro sdefparameter (name initial-value) 33 | `(cl:progn 34 | (cl:export (cl:list ',name)) 35 | (cl:defparameter ,name ,initial-value))) 36 | 37 | (cl:defmacro sdefun (name lambda-list cl:&body body) 38 | `(cl:progn 39 | (cl:setf (cl:get ',name :sandbox-locked) cl:t) 40 | (cl:export (cl:list ',name)) 41 | (cl:defun ,name ,lambda-list ,@body))) 42 | 43 | (cl:defmacro sdefmacro (name lambda-list cl:&body body) 44 | `(cl:progn 45 | (cl:setf (cl:get ',name :sandbox-locked) cl:t) 46 | (cl:export (cl:list ',name)) 47 | (cl:defmacro ,name ,lambda-list ,@body))) 48 | 49 | (cl:defmacro disabled-features (cl:&body symbols) 50 | `(cl:loop :for symbol :in ',symbols 51 | :do 52 | (cl:setf (cl:get symbol :sandbox-locked) cl:t) 53 | (cl:export (cl:list symbol)) 54 | (cl:let ((name (cl:symbol-name symbol))) 55 | 56 | (cl:setf (cl:macro-function symbol) 57 | (cl:lambda (cl:&rest ignored) 58 | (cl:declare (cl:ignore ignored)) 59 | `(cl:error 'sandbox-impl:disabled-feature 60 | :name ,name)) 61 | 62 | (cl:symbol-function symbol) 63 | (cl:lambda (cl:&rest ignored) 64 | (cl:declare (cl:ignore ignored)) 65 | (cl:error 'sandbox-impl:disabled-feature 66 | :name name))) 67 | 68 | (cl:eval `(cl:defsetf ,symbol (cl:&rest ignored) () 69 | (cl:declare (cl:ignore ignored)) 70 | `(cl:error 'sandbox-impl:disabled-feature 71 | :name ,,name)))))) 72 | 73 | ;;; General 74 | 75 | #+sbcl 76 | (cl:eval-when (:compile-toplevel :load-toplevel :execute) 77 | (sb-ext:unlock-package "SB-IMPL")) 78 | 79 | #+sbcl 80 | (import-export-symbols ;SB-IMPL package is locked. 81 | sb-impl::backq-list sb-impl::backq-list* sb-impl::backq-append 82 | sb-impl::backq-cons sb-impl::backq-nconc sb-impl::backq-vector) 83 | 84 | (import-export-symbols 85 | cl:&allow-other-keys cl:&aux cl:&body cl:&environment cl:&key cl:&optional 86 | cl:&rest cl:&whole) 87 | 88 | ;;; The Evaluation and Compilation Dictionary 89 | 90 | (import-export-symbols 91 | cl:lambda cl:quote cl:special-operator-p cl:constantp) 92 | 93 | (disabled-features 94 | compile eval-when load-time-value compiler-macro-function 95 | define-compiler-macro macro-function macroexpand 96 | macroexpand-1 define-symbol-macro symbol-macrolet proclaim declaim 97 | the declare locally) 98 | 99 | (sdefun eval (form) 100 | (cl:values-list (sandbox-impl:translate-form 101 | (cl:multiple-value-list 102 | (cl:eval (sandbox-impl:translate-form form)))))) 103 | 104 | (sdefmacro defmacro (name lambda-list cl:&body body) 105 | (cl:if (cl:get name :sandbox-locked) 106 | (cl:error 'cl:package-error :package cl:nil) 107 | `(cl:defmacro ,name ,lambda-list ,@body))) 108 | 109 | ;;; The Types and Classes Dictionary 110 | 111 | (import-export-symbols 112 | cl:nil cl:boolean cl:function cl:compiled-function cl:generic-function 113 | cl:standard-generic-function cl:class cl:built-in-class cl:structure-class 114 | cl:standard-class cl:method cl:standard-method cl:structure-object 115 | cl:standard-object cl:method-combination cl:t cl:satisfies 116 | ;; cl:member Also a function. Imported later. 117 | cl:not cl:and cl:or cl:values cl:eql cl:coerce cl:subtypep cl:type-of 118 | cl:typep cl:type-error-datum cl:type-error-expected-type) 119 | 120 | (disabled-features 121 | deftype) 122 | 123 | ;;; The Data and Control Flow Dictionary 124 | 125 | (import-export-symbols 126 | cl:apply cl:fboundp cl:flet cl:labels cl:macrolet cl:funcall cl:function 127 | cl:functionp cl:compiled-function-p cl:call-arguments-limit 128 | cl:lambda-list-keywords cl:lambda-parameters-limit cl:defparameter cl:defvar 129 | cl:destructuring-bind cl:let cl:let* cl:progv cl:setq cl:psetq cl:block 130 | cl:go cl:return-from cl:return cl:tagbody 131 | cl:nil cl:not cl:t cl:eq cl:eql cl:equal cl:equalp 132 | cl:identity cl:complement cl:constantly cl:every cl:some cl:notevery 133 | cl:notany cl:and cl:cond cl:if cl:or cl:when cl:unless cl:case cl:ccase 134 | cl:ecase cl:typecase cl:ctypecase cl:etypecase cl:multiple-value-bind 135 | cl:multiple-value-list cl:multiple-value-prog1 cl:multiple-value-setq 136 | cl:values cl:values-list cl:multiple-values-limit cl:nth-value cl:prog 137 | cl:prog* cl:prog1 cl:prog2 cl:progn cl:setf cl:psetf cl:shiftf cl:rotatef) 138 | 139 | (disabled-features 140 | fdefinition fmakunbound function-lambda-expression 141 | defconstant define-modify-macro defsetf define-setf-expander 142 | get-setf-expansion unwind-protect catch throw) 143 | 144 | (sdefmacro defun (name lambda-list cl:&body body) 145 | (cl:if (cl:or (cl:and (cl:symbolp name) 146 | (cl:get name :sandbox-locked)) 147 | (cl:and (cl:consp name) 148 | (cl:eql (cl:first name) 'cl:setf) 149 | (cl:get (cl:second name) :sandbox-locked))) 150 | (cl:error 'cl:package-error :package cl:nil) 151 | `(cl:defun ,name ,lambda-list ,@body))) 152 | 153 | ;;; The Iteration Dictionary 154 | 155 | (import-export-symbols 156 | cl:do cl:do* cl:dotimes cl:dolist) 157 | 158 | (disabled-features 159 | loop) 160 | 161 | ;;; The Objects Dictionary 162 | 163 | (import-export-symbols 164 | cl:class-of) 165 | 166 | (disabled-features 167 | function-keywords ensure-generic-function allocate-instance 168 | reinitialize-instance shared-initialize 169 | update-instance-for-different-class update-instance-for-redefined-class 170 | change-class slot-boundp slot-exists-p slot-makunbound slot-missing 171 | slot-unbound slot-value method-qualifiers no-applicable-method 172 | remove-method make-instance make-instances-obsolete make-load-form 173 | make-load-form-saving-slots with-accessors with-slots defclass 174 | defgeneric defmethod find-class next-method-p call-method 175 | make-method call-next-method compute-applicable-methods 176 | define-method-combination find-method add-method initialize-instance 177 | class-name unbound-slot-instance) 178 | 179 | ;;; The Structures Dictionary 180 | 181 | (disabled-features 182 | defstruct copy-structure) 183 | 184 | ;;; The Conditions Dictionary 185 | 186 | (import-export-symbols 187 | cl:restart) 188 | 189 | (disabled-features 190 | cell-error-name assert error cerror check-type 191 | invalid-method-error method-combination-error signal 192 | simple-condition-format-control simple-condition-format-arguments 193 | warn invoke-debugger break handler-bind handler-case 194 | ignore-errors define-condition make-condition compute-restarts 195 | find-restart invoke-restart invoke-restart-interactively 196 | restart-bind restart-case restart-name with-condition-restarts 197 | with-simple-restart abort continue muffle-warning store-value 198 | use-value) 199 | 200 | ;;; The Symbols Dictionary 201 | 202 | (import-export-symbols 203 | cl:symbol cl:keyword cl:symbolp cl:keywordp cl:symbol-name cl:boundp) 204 | 205 | (disabled-features 206 | make-symbol copy-symbol gensym gentemp symbol-function 207 | symbol-package symbol-plist symbol-value get remprop makunbound 208 | set) 209 | 210 | ;;; The Packages Dictionary 211 | 212 | (disabled-features 213 | export find-symbol find-package find-all-symbols import 214 | list-all-packages rename-package shadow shadowing-import 215 | delete-package make-package with-package-iterator unexport unintern 216 | in-package unuse-package use-package defpackage do-symbols 217 | do-external-symbols do-all-symbols intern package-name 218 | package-nicknames package-shadowing-symbols package-use-list 219 | package-used-by-list packagep package-error-package) 220 | 221 | ;;; The Numbers Dictionary 222 | 223 | (import-export-symbols 224 | cl:number cl:complex cl:real cl:float cl:short-float cl:single-float 225 | cl:double-float cl:long-float cl:rational cl:ratio cl:integer cl:signed-byte 226 | cl:unsigned-byte cl:mod cl:bit cl:fixnum cl:bignum cl:= cl:/= cl:< cl:> 227 | cl:<= cl:>= cl:max cl:min cl:minusp cl:plusp cl:zerop cl:floor cl:ffloor 228 | cl:ceiling cl:fceiling cl:truncate cl:ftruncate cl:round cl:fround cl:sin 229 | cl:cos cl:tan cl:asin cl:acos cl:atan cl:pi cl:sinh cl:cosh cl:tanh cl:asinh 230 | cl:acosh cl:atanh cl:1+ cl:1- cl:abs cl:evenp cl:oddp cl:exp cl:expt cl:gcd 231 | cl:incf cl:decf cl:lcm cl:log cl:mod cl:rem cl:signum cl:sqrt cl:isqrt 232 | cl:random-state cl:make-random-state cl:random cl:random-state-p 233 | cl:*random-state* cl:numberp cl:cis cl:complex cl:complexp cl:conjugate 234 | cl:phase cl:realpart cl:imagpart cl:upgraded-complex-part-type cl:realp 235 | cl:numerator cl:denominator cl:rational cl:rationalize cl:rationalp cl:ash 236 | cl:integer-length cl:integerp cl:parse-integer cl:boole cl:boole-1 237 | cl:boole-2 cl:boole-and cl:boole-andc1 cl:boole-andc2 cl:boole-c1 cl:boole-c2 238 | cl:boole-clr cl:boole-eqv cl:boole-ior cl:boole-nand cl:boole-nor 239 | cl:boole-orc1 cl:boole-orc2 cl:boole-set cl:boole-xor cl:logand cl:logandc1 240 | cl:logandc2 cl:logeqv cl:logior cl:lognand cl:lognor cl:lognot cl:logorc1 241 | cl:logorc2 cl:logxor cl:logbitp cl:logcount cl:logtest cl:byte cl:byte-size 242 | cl:byte-position cl:deposit-field cl:dpb cl:ldb cl:ldb-test cl:mask-field 243 | cl:most-positive-fixnum cl:most-negative-fixnum cl:decode-float 244 | cl:scale-float cl:float-radix cl:float-sign cl:float-digits 245 | cl:float-precision cl:integer-decode-float cl:float cl:floatp 246 | cl:most-positive-short-float cl:least-positive-short-float 247 | cl:least-positive-normalized-short-float cl:most-positive-double-float 248 | cl:least-positive-double-float cl:least-positive-normalized-double-float 249 | cl:most-positive-long-float cl:least-positive-long-float 250 | cl:least-positive-normalized-long-float cl:most-positive-single-float 251 | cl:least-positive-single-float cl:least-positive-normalized-single-float 252 | cl:most-negative-short-float cl:least-negative-short-float 253 | cl:least-negative-normalized-short-float cl:most-negative-single-float 254 | cl:least-negative-single-float cl:least-negative-normalized-single-float 255 | cl:most-negative-double-float cl:least-negative-double-float 256 | cl:least-negative-normalized-double-float cl:most-negative-long-float 257 | cl:least-negative-long-float cl:least-negative-normalized-long-float 258 | cl:short-float-epsilon cl:short-float-negative-epsilon 259 | cl:single-float-epsilon cl:single-float-negative-epsilon 260 | cl:double-float-epsilon cl:double-float-negative-epsilon 261 | cl:long-float-epsilon cl:long-float-negative-epsilon) 262 | 263 | (disabled-features 264 | arithmetic-error-operands arithmetic-error-operation) 265 | 266 | ;;; The Characters Dictionary 267 | 268 | (import-export-symbols 269 | cl:character cl:base-char cl:standard-char cl:extended-char cl:char= 270 | cl:char/= cl:char< cl:char> cl:char<= cl:char>= cl:char-equal 271 | cl:char-not-equal cl:char-lessp cl:char-greaterp cl:char-not-greaterp 272 | cl:char-not-lessp cl:characterp cl:alpha-char-p cl:alphanumericp 273 | cl:digit-char cl:digit-char-p cl:graphic-char-p cl:standard-char-p 274 | cl:char-upcase cl:char-downcase cl:upper-case-p cl:lower-case-p 275 | cl:both-case-p cl:char-code cl:char-int cl:code-char cl:char-code-limit 276 | cl:char-name cl:name-char) 277 | 278 | ;;; The Conses Dictionary 279 | 280 | (import-export-symbols 281 | cl:list cl:null cl:cons cl:atom cl:cons cl:consp cl:atom cl:rplaca cl:rplacd 282 | cl:car cl:cdr cl:caar cl:cadr cl:cdar cl:cddr cl:caaar cl:caadr cl:cadar 283 | cl:caddr cl:cdaar cl:cdadr cl:cddar cl:cdddr cl:caaaar cl:caaadr cl:caadar 284 | cl:caaddr cl:cadaar cl:cadadr cl:caddar cl:cadddr cl:cdaaar cl:cdaadr 285 | cl:cdadar cl:cdaddr cl:cddaar cl:cddadr cl:cdddar cl:cddddr cl:copy-tree 286 | cl:sublis cl:nsublis cl:subst cl:subst-if cl:subst-if-not cl:nsubst 287 | cl:nsubst-if cl:nsubst-if-not cl:tree-equal cl:copy-list cl:list cl:list* 288 | cl:list-length cl:listp cl:make-list cl:push cl:pop cl:first cl:second 289 | cl:third cl:fourth cl:fifth cl:sixth cl:seventh cl:eighth cl:ninth cl:tenth 290 | cl:nth cl:endp cl:null cl:nconc cl:append cl:revappend cl:nreconc cl:butlast 291 | cl:nbutlast cl:last cl:ldiff cl:tailp cl:nthcdr cl:rest cl:member 292 | cl:member-if cl:member-if-not cl:mapc cl:mapcar cl:mapcan cl:mapcan cl:mapl 293 | cl:maplist cl:mapcon cl:acons cl:assoc cl:assoc-if cl:assoc-if-not 294 | cl:copy-alist cl:pairlis cl:rassoc cl:rassoc-if cl:rassoc-if-not 295 | cl:get-properties cl:getf cl:remf cl:intersection cl:nintersection cl:adjoin 296 | cl:pushnew cl:set-difference cl:nset-difference cl:set-exclusive-or 297 | cl:nset-exclusive-or cl:subsetp cl:union cl:nunion) 298 | 299 | ;;; The Arrays Dictionary 300 | 301 | (import-export-symbols 302 | cl:array cl:simple-array cl:vector cl:simple-vector cl:bit-vector 303 | cl:simple-bit-vector cl:make-array cl:adjust-array cl:adjustable-array-p 304 | cl:aref cl:array-dimension cl:array-dimensions cl:array-element-type 305 | cl:array-has-fill-pointer-p cl:array-displacement cl:array-in-bounds-p 306 | cl:array-rank cl:array-row-major-index cl:array-total-size cl:arrayp 307 | cl:fill-pointer cl:row-major-aref cl:upgraded-array-element-type 308 | cl:array-dimension-limit cl:array-rank-limit cl:array-total-size-limit 309 | cl:simple-vector-p cl:svref cl:vector-pop cl:vector-push 310 | cl:vector-push-extend cl:vectorp cl:bit cl:sbit cl:bit-and cl:bit-andc1 311 | cl:bit-andc2 cl:bit-eqv cl:bit-ior cl:bit-nand cl:bit-nor cl:bit-not 312 | cl:bit-orc1 cl:bit-orc2 cl:bit-xor cl:bit-vector-p cl:simple-bit-vector-p) 313 | 314 | ;;; The Strings Dictionary 315 | 316 | (import-export-symbols 317 | cl:string cl:base-string cl:simple-base-string cl:simple-string-p cl:char 318 | cl:schar cl:string-upcase cl:string-downcase cl:string-capitalize 319 | cl:nstring-upcase cl:nstring-downcase cl:nstring-capitalize cl:string-trim 320 | cl:string-left-trim cl:string-right-trim cl:string= cl:string/= cl:string< 321 | cl:string> cl:string<= cl:string>= cl:string-equal cl:string-not-equal 322 | cl:string-lessp cl:string-greaterp cl:string-not-greaterp 323 | cl:string-not-lessp cl:stringp cl:make-string) 324 | 325 | ;;; The Sequence Dictionary 326 | 327 | (import-export-symbols 328 | cl:sequence cl:copy-seq cl:elt cl:fill cl:make-sequence cl:subseq cl:map 329 | cl:map-into cl:reduce cl:count cl:count-if cl:count-if-not cl:length 330 | cl:reverse cl:nreverse cl:sort cl:stable-sort cl:find cl:find-if 331 | cl:find-if-not cl:position cl:position-if cl:position-if-not cl:search 332 | cl:mismatch cl:replace cl:substitute cl:substitute-if cl:substitute-if-not 333 | cl:nsubstitute cl:nsubstitute-if cl:nsubstitute-if-not cl:concatenate 334 | cl:merge cl:remove cl:remove-if cl:remove-if-not cl:delete cl:delete-if 335 | cl:delete-if-not cl:remove-duplicates cl:delete-duplicates) 336 | 337 | ;;; The Hash Tables Dictionary 338 | 339 | (import-export-symbols 340 | cl:hash-table cl:make-hash-table cl:hash-table-p cl:hash-table-count 341 | cl:hash-table-rehash-size cl:hash-table-rehash-threshold cl:hash-table-size 342 | cl:hash-table-test cl:gethash cl:remhash cl:maphash 343 | cl:with-hash-table-iterator cl:clrhash cl:sxhash) 344 | 345 | ;;; The Filenames Dictionary 346 | 347 | (import-export-symbols 348 | cl:pathname cl:make-pathname cl:pathnamep cl:pathname-directory 349 | cl:pathname-name cl:pathname-type cl:pathname-version cl:namestring 350 | cl:file-namestring cl:directory-namestring cl:parse-namestring 351 | cl:wild-pathname-p cl:pathname-match-p cl:translate-pathname 352 | cl:merge-pathnames) 353 | 354 | (disabled-features 355 | pathname-host pathname-device load-logical-pathname-translations 356 | logical-pathname-translations logical-pathname host-namestring 357 | enough-namestring translate-logical-pathname) 358 | 359 | ;;; The Files Dictionary 360 | 361 | (disabled-features 362 | directory probe-file ensure-directories-exist truename file-author 363 | file-write-date rename-file delete-file file-error-pathname) 364 | 365 | ;;; The Stream Dictionary 366 | 367 | (import-export-symbols 368 | cl:stream cl:broadcast-stream cl:concatenated-stream cl:echo-stream 369 | cl:file-stream cl:string-stream cl:synonym-stream cl:two-way-stream 370 | cl:input-stream-p cl:output-stream-p cl:interactive-stream-p cl:open-stream-p 371 | cl:stream-element-type cl:streamp cl:peek-char cl:read-char 372 | cl:read-char-no-hang cl:terpri cl:fresh-line cl:unread-char cl:write-char 373 | cl:read-line cl:write-string cl:write-line cl:read-sequence cl:write-sequence 374 | cl:file-position cl:close cl:listen cl:clear-input cl:finish-output 375 | cl:force-output cl:clear-output cl:with-input-from-string 376 | cl:with-output-to-string) 377 | 378 | (disabled-features 379 | read-byte write-byte file-length file-string-length open 380 | stream-external-format with-open-file with-open-stream y-or-n-p 381 | yes-or-no-p make-synonym-stream synonym-stream-symbol 382 | broadcast-stream-streams make-broadcast-stream make-two-way-stream 383 | two-way-stream-input-stream two-way-stream-output-stream 384 | make-echo-stream concatenated-stream-streams make-concatenated-stream 385 | make-string-input-stream make-string-output-stream stream-error-stream) 386 | 387 | ;;; The Printer Dictionary 388 | 389 | (import-export-symbols 390 | cl:write cl:prin1 cl:print cl:pprint cl:princ cl:write-to-string 391 | cl:prin1-to-string cl:princ-to-string) 392 | 393 | (disabled-features 394 | copy-pprint-dispatch formatter pprint-dispatch 395 | pprint-exit-if-list-exhausted pprint-fill pprint-linear 396 | pprint-tabular pprint-indent pprint-logical-block pprint-newline 397 | pprint-pop pprint-tab print-object print-unreadable-object 398 | set-ppring-dispatch print-not-readable-object format) 399 | 400 | ;;; The Reader Dictionary 401 | 402 | (disabled-features 403 | copy-readtable make-dispatch-macro-character read-preserving-whitespace 404 | read-delimited-list readtable-case readtablep 405 | set-dispatch-macro-character get-dispatch-macro-character 406 | set-macro-character get-macro-character set-syntax-from-char 407 | with-standard-io-syntax) 408 | 409 | (sdefun read (cl:&rest args) 410 | (cl:values-list (sandbox-impl:translate-form 411 | (cl:multiple-value-list (cl:apply #'cl:read args))))) 412 | 413 | (sdefun read-from-string (cl:&rest args) 414 | (cl:values-list (sandbox-impl:translate-form 415 | (cl:multiple-value-list 416 | (cl:apply #'cl:read-from-string args))))) 417 | 418 | ;;; The System Construction Dictionary 419 | 420 | (disabled-features 421 | compile-file compile-file-pathname load with-compilation-unit 422 | provide require) 423 | 424 | ;;; The Environment Dictionary 425 | 426 | (import-export-symbols 427 | cl:decode-universal-time cl:encode-universal-time cl:get-universal-time 428 | cl:get-decoded-time cl:sleep cl:lisp-implementation-type 429 | cl:lisp-implementation-version) 430 | 431 | (disabled-features 432 | apropos apropos-list describe describe-object trace untrace 433 | step time get-internal-real-time get-internal-run-time disassemble 434 | documentation room ed inspect dribble short-site-name 435 | long-site-name machine-instance machine-type machine-version 436 | software-type software-version) 437 | 438 | (sdefun user-homedir-pathname (cl:&optional ignored) 439 | (cl:declare (cl:ignore ignored)) 440 | (cl:make-pathname :directory '(:absolute "home" "sandbox") 441 | :name cl:nil :type cl:nil)) 442 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------