Diff
Not logged in

Differences From:

File src/xfer.c part of check-in [3cb547be2c] - Code to randomize messages from client to the server. by drh on 2008-07-26 14:02:33. [view]

To:

File src/xfer.c part of check-in [bf75ea9852] - The "configuration" command will now sync ticket report formats, shunned UUIDs, and user information (but not user passwords). Added the "config merge" method. Fix an initialization bug that was given Admin privilege to anonymous by default. by drh on 2008-10-04 20:40:27. [view]

@@ -679,13 +679,22 @@
     ){
       if( g.okRead ){
         char *zName = blob_str(&xfer.aToken[1]);
         if( configure_is_exportable(zName) ){
-          char *zValue = db_get(zName, 0);
-          if( zValue ){
+          if( zName[0]!='@' ){
+            char *zValue = db_get(zName, 0);
+            if( zValue ){
+              blob_appendf(xfer.pOut, "config %s %d\n%s\n", zName,
+                           strlen(zValue), zValue);
+              free(zValue);
+            }
+          }else{
+            Blob content;
+            blob_zero(&content);
+            configure_render_special_name(zName, &content);
             blob_appendf(xfer.pOut, "config %s %d\n%s\n", zName,
-                         strlen(zValue), zValue);
-            free(zValue);
+               blob_size(&content), blob_str(&content));
+            blob_reset(&content);
           }
         }
       }
     }else
@@ -871,8 +880,11 @@
         blob_appendf(&send, "reqconfig %s\n", zName);
         zName = configure_next_name(configMask);
         nCard++;
       }
+      if( configMask & (CONFIGSET_USER|CONFIGSET_TKT) ){
+        configure_prepare_to_receive(0);
+      }
       configMask = 0;
     }
 
     /* Append randomness to the end of the message */
@@ -995,12 +1007,16 @@
         Blob content;
         blob_zero(&content);
         blob_extract(xfer.pIn, size, &content);
         if( configure_is_exportable(zName) & origConfigMask ){
-          db_multi_exec(
-              "REPLACE INTO config(name,value) VALUES(%Q,%Q)",
-              zName, blob_str(&content)
-          );
+          if( zName[0]!='@' ){
+            db_multi_exec(
+                "REPLACE INTO config(name,value) VALUES(%Q,%Q)",
+                zName, blob_str(&content)
+            );
+          }else{
+            db_multi_exec("%s", blob_str(&content));
+          }
         }
         nCard++;
         blob_reset(&content);
         blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
@@ -1050,8 +1066,12 @@
       }
       blobarray_reset(xfer.aToken, xfer.nToken);
       blob_reset(&xfer.line);
     }
+    if( origConfigMask & (CONFIGSET_TKT|CONFIGSET_USER) ){
+      configure_finalize_receive();
+    }
+    origConfigMask = 0;
     printf(zValueFormat, "Received:",
             blob_size(&recv), nCard,
             xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
     blob_reset(&recv);