|
Last change
on this file since 1027 was 414, checked in by Herwig Bauernfeind, 16 years ago |
|
Samba 3.5.0: Initial import
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | <%
|
|---|
| 2 | include("/scripting/common.js");
|
|---|
| 3 |
|
|---|
| 4 | /* this script is called on every web request. If it produces any
|
|---|
| 5 | output at all then that output is returned and the requested page
|
|---|
| 6 | is not given or processed.
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | /*
|
|---|
| 10 | check if a uri is one of the 'always allowed' pages, even when not logged in
|
|---|
| 11 | This allows the login page to use the same style sheets and images
|
|---|
| 12 | */
|
|---|
| 13 | function always_allowed(uri) {
|
|---|
| 14 | var str = string_init();
|
|---|
| 15 |
|
|---|
| 16 | /* allow jsonrpc-based applications to do their own authentication */
|
|---|
| 17 | var s = str.split('/', uri);
|
|---|
| 18 | if (s[0] == "" && s[1] == 'index.html') {
|
|---|
| 19 | return true;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | var s = str.split('.', uri);
|
|---|
| 23 | if (s.length < 2) {
|
|---|
| 24 | return false;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | var ext = s[s.length-1];
|
|---|
| 28 | var allowed = new Array("ico", "gif", "png","css", "js");
|
|---|
| 29 | for (i in allowed) {
|
|---|
| 30 | if (allowed[i] == ext) {
|
|---|
| 31 | return true;
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
| 34 | return false;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | if (server['SERVER_PROTOCOL'] == "http" &&
|
|---|
| 39 | server['TLS_SUPPORT'] == "True") {
|
|---|
| 40 | write("redirect to https");
|
|---|
| 41 | redirect("https://" + headers['HOST'] + request['REQUEST_URI']);
|
|---|
| 42 | } else if (always_allowed(request['REQUEST_URI']) != true &&
|
|---|
| 43 | session['AUTHENTICATED'] == undefined) {
|
|---|
| 44 | /* present the login page */
|
|---|
| 45 | include("/login.esp");
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | %>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.