Check-in [d2b4469934]
Not logged in
Overview

SHA1 Hash:d2b4469934765b9a2380cc39d80d2e5210d9aaa0
Date: 2007-11-21 13:52:26
User: drh
Comment:Append the pathname to the login cookie name so that separate cookies are used for each server.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/encode.c from [6c31150f72] to [e65fd74ba6].

@@ -402,12 +402,12 @@
 ** and non-zero if there is an error.
 */
 int encode16(const unsigned char *pIn, unsigned char *zOut, int N){
   int i;
   for(i=0; i<N; i++){
-    *(zOut++) = zEncode[pIn[0]>>4];
-    *(zOut++) = zEncode[pIn[0]&0xf];
+    *(zOut++) = zEncode[pIn[i]>>4];
+    *(zOut++) = zEncode[pIn[i]&0xf];
   }
   *zOut = 0;
   return 0;
 }
 

Modified src/login.c from [457f0114fe] to [0851edc1ca].

@@ -54,11 +54,19 @@
 
 /*
 ** Return the name of the login cookie
 */
 static char *login_cookie_name(void){
-  return "fossil_login";
+  static char *zCookieName = 0;
+  if( zCookieName==0 ){
+    int n = strlen(g.zTop);
+    zCookieName = malloc( n*2+16 );
+                      /* 0123456789 12345 */
+    strcpy(zCookieName, "fossil_login_");
+    encode16((unsigned char*)g.zTop, (unsigned char*)&zCookieName[13], n);
+  }
+  return zCookieName;
 }
 
 /*
 ** WEBPAGE: /login
 ** WEBPAGE: /logout