Check-in [31e94c0a04]
Not logged in
Overview

SHA1 Hash:31e94c0a04f2a50007ca6d4dc771cbb532fb4bf1
Date: 2008-10-25 20:43:28
User: drh
Comment:Get "configuration push" working. Fix bugs in concealed-field processing of tickets.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/encode.c from [e65fd74ba6] to [1fff362c9d].

@@ -291,11 +291,11 @@
         default:   c = z[i];  break;
       }
     }
     z[j++] = c;
   }
-  z[j] = 0;
+  if( z[j] ) z[j] = 0;
 }
 
 
 /*
 ** The characters used for HTTP base64 encoding.

Modified src/main.c from [99156e48f6] to [1a6ab5a7eb].

@@ -708,11 +708,11 @@
   int iPort;
   const char *zPort;
   char *zBrowser;
   char *zBrowserCmd = 0;
 
-  g.thTrace = find_option("th_trace", 0, 0)!=0;
+  g.thTrace = find_option("th-trace", 0, 0)!=0;
   if( g.thTrace ){
     blob_zero(&g.thLog);
   }
   zPort = find_option("port", "P", 1);
   if( zPort ){

Modified src/manifest.c from [c90f25b147] to [8c3d459bd4].

@@ -317,21 +317,22 @@
         }
         break;
       }
 
       /*
-      **     J '+'?<name> <value>
+      **     J <name> ?<value>?
       **
       ** Specifies a name value pair for ticket.  If the first character
-      ** of <name> is "+" then the value is appended to any preexisting
-      ** value.
+      ** of <name> is "+" then the <value> is appended to any preexisting
+      ** value.  If <value> is omitted then it is understood to be an
+      ** empty string.
       */
       case 'J': {
         char *zName, *zValue;
         md5sum_step_text(blob_buffer(&line), blob_size(&line));
         if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error;
-        if( blob_token(&line, &a2)==0 ) goto manifest_syntax_error;
+        blob_token(&line, &a2);
         if( blob_token(&line, &a3)!=0 ) goto manifest_syntax_error;
         zName = blob_terminate(&a1);
         zValue = blob_terminate(&a2);
         defossilize(zValue);
         if( p->nField>=p->nFieldAlloc ){

Modified src/tkt.c from [ba64402245] to [fe34796f85].

@@ -98,12 +98,13 @@
 **
 ** Only load those fields which do not already exist as
 ** variables.
 **
 ** Fields of the TICKET table that begin with "private_" are
-** expanded using the db_reveal() function.  This function will
-** decode the content so that it is legable if g.okRdAddr is true.
+** expanded using the db_reveal() function.  If g.okRdAddr is
+** true, then the db_reveal() function will decode the content
+** using the CONCEALED table so that the content legable.
 ** Otherwise, db_reveal() is a no-op and the content remains
 ** obscured.
 */
 static void initializeVariablesFromDb(void){
   const char *zName;
@@ -417,16 +418,17 @@
                    fossilize(azAppend[i], -1));
     }else{
       zValue = Th_Fetch(azField[i], &nValue);
       if( zValue ){
         while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; }
-        if( strncmp(azField[i], "private_", 8)==0 ){
-          zValue = db_conceal(zValue, nValue);
-          nValue = strlen(zValue);
-        }
         if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){
-          blob_appendf(&tktchng, "J %s %#F\n", azField[i], nValue, zValue);
+          if( strncmp(azField[i], "private_", 8)==0 ){
+            zValue = db_conceal(zValue, nValue);
+            blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue);
+          }else{
+            blob_appendf(&tktchng, "J %s %#F\n", azField[i], nValue, zValue);
+          }
         }
       }
     }
   }
   if( *(char**)pUuid ){

Modified src/xfer.c from [38cf45242e] to [0092468c7d].

@@ -390,11 +390,11 @@
       g.userUid = db_column_int(&q, 2);
       g.zLogin = mprintf("%b", pLogin);
       g.zNonce = mprintf("%b", pNonce);
     }
   }
-  db_reset(&q);
+  db_finalize(&q);
 }
 
 /*
 ** Send the content of all files in the unsent table.
 **
@@ -720,11 +720,11 @@
       Blob content;
       blob_zero(&content);
       blob_extract(xfer.pIn, size, &content);
       if( !g.okAdmin ){
         cgi_reset_content();
-        @ error not\sauthorized\sto\spush\sconfiguration\data
+        @ error not\sauthorized\sto\spush\sconfiguration
         nErr++;
         break;
       }
       if( zName[0]!='@' ){
         if( !recvConfig ){
@@ -1077,10 +1077,11 @@
           && blob_is_int(&xfer.aToken[2], &size) ){
         const char *zName = blob_str(&xfer.aToken[1]);
         Blob content;
         blob_zero(&content);
         blob_extract(xfer.pIn, size, &content);
+        g.okAdmin = g.okRdAddr = 1;
         if( configure_is_exportable(zName) & origConfigRcvMask ){
           if( zName[0]!='@' ){
             db_multi_exec(
                 "REPLACE INTO config(name,value) VALUES(%Q,%Q)",
                 zName, blob_str(&content)