]> git.samba.org - kai/samba.git/commitdiff
r7107: detect when a users session has expired and set request['SESSION_EXPIRED']
authorAndrew Tridgell <tridge@samba.org>
Mon, 30 May 2005 12:57:31 +0000 (12:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:17 +0000 (13:17 -0500)
(This used to be commit 0c2e42986ca3d10fbd19c91e2ea59af20e4fce30)

source4/web_server/http.c

index 02eab1f7d052d66a9f0e339a607cf4079572ebc2..35da56a75c945cf9299370e3cded3c22e211954e 100644 (file)
@@ -675,6 +675,7 @@ static void http_setup_session(struct esp_state *esp)
        const char *key = NULL;
        struct esp_data *edata = talloc_get_type(esp->web->task->private, struct esp_data);
        struct session_data *s;
+       BOOL generated_key = False;
 
        /* look for our session key */
        if (cookie && (p = strstr(cookie, session_key)) && 
@@ -687,6 +688,7 @@ static void http_setup_session(struct esp_state *esp)
                key = esp->web->input.session_key;
        } else if (key == NULL) {
                key = generate_random_str_list(esp, 16, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+               generated_key = True;
        }
 
        /* try to find this session in the existing session list */
@@ -706,6 +708,10 @@ static void http_setup_session(struct esp_state *esp)
                s->lifetime = lp_parm_int(-1, "web", "sessiontimeout", 300);
                DLIST_ADD(edata->sessions, s);
                talloc_set_destructor(s, session_destructor);
+               if (!generated_key) {
+                       mprSetPropertyValue(&esp->variables[ESP_REQUEST_OBJ], 
+                                           "SESSION_EXPIRED", mprCreateStringVar("True", 0));
+               }
        }
 
        http_setCookie(esp->web, session_key, key, s->lifetime, "/", 0);