mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-27 02:57:22 +00:00
Set cookies always with path
SVN revision: 1028
This commit is contained in:
parent
530a82412f
commit
a18bb1083b
36
src/elogd.c
36
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.437 2004/08/05 07:47:52 midas
|
||||||
|
Set cookies always with path
|
||||||
|
|
||||||
Revision 1.436 2004/08/04 13:45:15 midas
|
Revision 1.436 2004/08/04 13:45:15 midas
|
||||||
Do not print 'indexing logbooks..' when running as daemon
|
Do not print 'indexing logbooks..' when running as daemon
|
||||||
|
|
||||||
@ -5396,19 +5399,16 @@ void set_cookie(LOGBOOK * lbs, char *name, char *value, BOOL global, char *expir
|
|||||||
} else
|
} else
|
||||||
rsprintf(" path=/;");
|
rsprintf(" path=/;");
|
||||||
} else {
|
} else {
|
||||||
/* bug in lynx: path has to be absolute */
|
/* path for individual logbook */
|
||||||
if (strstr(browser, "Lynx/") != NULL) {
|
if (getcfg(lb_name, "URL", str, sizeof(str))) {
|
||||||
/* path for individual logbook */
|
extract_path(str);
|
||||||
if (getcfg(lb_name, "URL", str, sizeof(str))) {
|
url_encode(str, sizeof(str));
|
||||||
extract_path(str);
|
if (str[0])
|
||||||
url_encode(str, sizeof(str));
|
rsprintf(" path=/%s/%s;", str, lbs->name_enc);
|
||||||
if (str[0])
|
else
|
||||||
rsprintf(" path=/%s/%s;", str, lbs->name_enc);
|
|
||||||
else
|
|
||||||
rsprintf(" path=/%s;", lbs->name_enc);
|
|
||||||
} else
|
|
||||||
rsprintf(" path=/%s;", lbs->name_enc);
|
rsprintf(" path=/%s;", lbs->name_enc);
|
||||||
}
|
} else
|
||||||
|
rsprintf(" path=/%s;", lbs->name_enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
exp = atof(expiration);
|
exp = atof(expiration);
|
||||||
@ -6284,7 +6284,7 @@ void set_login_cookies(LOGBOOK * lbs, char *user, char *enc_pwd)
|
|||||||
/* get optional expriation from configuration file */
|
/* get optional expriation from configuration file */
|
||||||
if (isparam("remember")) {
|
if (isparam("remember")) {
|
||||||
if (!getcfg(lb_name, "Login expiration", exp, sizeof(exp)))
|
if (!getcfg(lb_name, "Login expiration", exp, sizeof(exp)))
|
||||||
strcpy(exp, "31*24"); /* one month by default */
|
strcpy(exp, "744"); /* one month by default = 31*24 */
|
||||||
} else
|
} else
|
||||||
exp[0] = 0;
|
exp[0] = 0;
|
||||||
|
|
||||||
@ -6295,12 +6295,18 @@ void set_login_cookies(LOGBOOK * lbs, char *user, char *enc_pwd)
|
|||||||
set_cookie(lbs, "unm", user, global, exp);
|
set_cookie(lbs, "unm", user, global, exp);
|
||||||
set_cookie(lbs, "upwd", enc_pwd, global, exp);
|
set_cookie(lbs, "upwd", enc_pwd, global, exp);
|
||||||
|
|
||||||
|
if (global && user[0] == 0 && enc_pwd[0] == 0) {
|
||||||
|
/* if logging out global, also delete possible non-global cookies */
|
||||||
|
set_cookie(lbs, "unm", user, 0, exp);
|
||||||
|
set_cookie(lbs, "upwd", enc_pwd, 0, exp);
|
||||||
|
}
|
||||||
|
|
||||||
if (user[0]) {
|
if (user[0]) {
|
||||||
/* set "remember me" cookie on login */
|
/* set "remember me" cookie on login */
|
||||||
if (isparam("remember"))
|
if (isparam("remember"))
|
||||||
set_cookie(lbs, "urem", "1", global, "24*365");
|
set_cookie(lbs, "urem", "1", global, "8760"); /* one year = 24*365 */
|
||||||
else
|
else
|
||||||
set_cookie(lbs, "urem", "0", global, "24*365");
|
set_cookie(lbs, "urem", "0", global, "8760");
|
||||||
}
|
}
|
||||||
|
|
||||||
set_redir(lbs, getparam("redir"));
|
set_redir(lbs, getparam("redir"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user