You will need to enclose the recipient email address in single quotes, or escape the if you use double quotes.Įmail sent in this way will have a sender address of your own University email address. Our Safe Perl implementation includes a convenience function for sending email. The syntax is:įor 'Test mail', "Hello world\n") or oops("mail failed") This means there must be a blank line after the last header line. The header output must be followed by two pairs of. If your script outputs an HTML page, the correct format is: If your program generates body output, it must include a Content-type header line indicating what kind of document (MIME type) it is producing. Required outputĮvery CGI script must output at least one header line. To sort an array into increasing ASCII order = sort into increasing numerical order = you want a decreasing order, then just use the standard Perl reverse operator on the resulting array. Two functions are provided for sorting lists in the two most common collating sequences: ASCII and numeric. The perl built in sort operator is masked for security reasons. You are responsible for the CGI programs you write and you must ensure that your CGI programs do not contravene IT Services rules. Even with the file limitations, for example, your program may have a bug which lets someone see the contents of any file you own. Please be aware that it is possible that someone out on the web will be able to persuade your script do something you weren't expecting, even with the above restrictions. The error message will be something like "opname trapped by operation mask at line. A "masked operator" is an operator which is restricted but, unlike "open", is not aliased to a sanitised version. When the web server runs your program it will run it with the privileges of your Oxford account.Īny use of a masked operator in your Perl program will trigger a compile time error and the program will not run at all. Supposing that your username is abcd1234 and your program is called myscript, the URL to run your program is There is no need to include a leading "#!" line, nor will one be honoured if you do. Once you have written and debugged your CGI program, put it in ~/cgi/bin (creating that directory if necessary). The filename is taken to live in the directory ~/cgi/out and the file must already exist at the time the open is performed. Files opened for writing must be opened by using a filename containing no "/" characters.It is strongly recommended that you use relative pathnames (for example, "./public_html/foo") Your CGI program is run with a current directory of ~/cgi/. Files opened for reading must be owned by the user.Opening files for reading/writing is restricted: Calling perl on other files (require, use, do 'file').System V IPC (shared memory, message queues, semaphores). File munging (rename, link, opendir, chown.network access (socket, bind, connect.system, backticks (``), exec, fork, syscall, signal handlers, pipes.The following list of restricted operators is not exhaustive but includes the most common cases: Usage of unsafe features (even within eval statements) are trapped and the program is not run. You do not need to include the usual "#!/usr/bin/perl" line in your script as it will always be executed with Safe Perl.Ī restricted set of the Perl language is available. Safe Perl is configured to provide a more secure way of running Perl CGI scripts in a multiuser environment. Note that the value for AuthUserFile is the result of the webhome command, followed by the name of the file you created with htpasswd earlier ( cgi/htpasswd)ĪuthUserFile /web/users/.ac.uk/6/e/fred/cgi/htpasswd In the pico editor, type the following lines as shown, then press Ctrl X to save the file and exit.Make this file readable and check its location on the web server:.Omit the "-c" part of the command if you are adding further users HOW TO SEARCH A PAGE ON AC PASSWORDYou will need to enter and confirm a password for "fred" (the password won't be displayed on screen, and you will need to press Enter after typing it each time). Use SSH to login to linux.ox.ac.uk, then run the following commands to create user "fred" and make this information usable by the web server:.
1 Comment
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |