Fossil SCM

Remove support for the legacy configuration sync transfer format, that was replaced in 2011.

drh 2017-09-20 12:10 trunk
Commit 2ed7c1123d055eafff9260c028ee32a9eb4df4ecbf09f932b13470c32723fb3f
2 files changed +12 -53 +1 -22
+12 -53
--- src/configure.c
+++ src/configure.c
@@ -39,11 +39,10 @@
3939
#define CONFIGSET_XFER 0x000080 /* Transfer configuration */
4040
4141
#define CONFIGSET_ALL 0x0000ff /* Everything */
4242
4343
#define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */
44
-#define CONFIGSET_OLDFORMAT 0x200000 /* Use the legacy format */
4544
4645
/*
4746
** This mask is used for the common TH1 configuration settings (i.e. those
4847
** that are not specific to one particular subsystem, such as the transfer
4948
** subsystem).
@@ -170,29 +169,19 @@
170169
const char *configure_first_name(int iMask){
171170
iConfig = 0;
172171
return configure_next_name(iMask);
173172
}
174173
const char *configure_next_name(int iMask){
175
- if( iMask & CONFIGSET_OLDFORMAT ){
176
- while( iConfig<count(aConfig) ){
177
- if( aConfig[iConfig].groupMask & iMask ){
178
- return aConfig[iConfig++].zName;
179
- }else{
180
- iConfig++;
181
- }
182
- }
183
- }else{
184
- if( iConfig==0 && (iMask & CONFIGSET_ALL)==CONFIGSET_ALL ){
185
- iConfig = count(aGroupName);
186
- return "/all";
187
- }
188
- while( iConfig<count(aGroupName)-1 ){
189
- if( aGroupName[iConfig].groupMask & iMask ){
190
- return aGroupName[iConfig++].zName;
191
- }else{
192
- iConfig++;
193
- }
174
+ if( iConfig==0 && (iMask & CONFIGSET_ALL)==CONFIGSET_ALL ){
175
+ iConfig = count(aGroupName);
176
+ return "/all";
177
+ }
178
+ while( iConfig<count(aGroupName)-1 ){
179
+ if( aGroupName[iConfig].groupMask & iMask ){
180
+ return aGroupName[iConfig++].zName;
181
+ }else{
182
+ iConfig++;
194183
}
195184
}
196185
return 0;
197186
}
198187
@@ -514,10 +503,11 @@
514503
** OLD FORMAT:
515504
**
516505
** The old format is retained for backwards compatibility, but is deprecated.
517506
** The cutover from old format to new was on 2011-04-25. After sufficient
518507
** time has passed, support for the old format will be removed.
508
+** Update: Support for the old format was remoed on 2017-09-20.
519509
**
520510
** zName is either the NAME of an element of the CONFIG table, or else
521511
** one of the special names "@shun", "@reportfmt", "@user", or "@concealed".
522512
** If zName is a CONFIG table name, then CONTENT replaces (overwrites) the
523513
** element in the CONFIG table. For one of the @-labels, CONTENT is raw
@@ -609,35 +599,10 @@
609599
azToken[0]/*safe-for-%s*/);
610600
db_multi_exec("%s", blob_sql_text(&sql));
611601
}
612602
blob_reset(&sql);
613603
rebuildMask |= thisMask;
614
- }else{
615
- /* Otherwise, the old format */
616
- if( (configure_is_exportable(zName) & groupMask)==0 ) return;
617
- if( fossil_strcmp(zName, "logo-image")==0 ){
618
- Stmt ins;
619
- db_prepare(&ins,
620
- "REPLACE INTO config(name, value, mtime) VALUES(:name, :value, now())"
621
- );
622
- db_bind_text(&ins, ":name", zName);
623
- db_bind_blob(&ins, ":value", pContent);
624
- db_step(&ins);
625
- db_finalize(&ins);
626
- }else if( zName[0]=='@' ){
627
- /* Notice that we are evaluating arbitrary SQL received from the
628
- ** client. But this can only happen if the client has authenticated
629
- ** as an administrator, so presumably we trust the client at this
630
- ** point.
631
- */
632
- db_multi_exec("%s", blob_str(pContent) /*safe-for-%s*/);
633
- }else{
634
- db_multi_exec(
635
- "REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now())",
636
- zName, blob_str(pContent)
637
- );
638
- }
639604
}
640605
}
641606
642607
/*
643608
** Process a file full of "config" cards.
@@ -856,22 +821,19 @@
856821
**
857822
** %fossil configuration pull AREA ?URL?
858823
**
859824
** Pull and install the configuration from a different server
860825
** identified by URL. If no URL is specified, then the default
861
-** server is used. Use the --legacy option for the older protocol
862
-** (when talking to servers compiled prior to 2011-04-27.) Use
863
-** the --overwrite flag to completely replace local settings with
864
-** content received from URL.
826
+** server is used. Use the --overwrite flag to completely
827
+** replace local settings with content received from URL.
865828
**
866829
** %fossil configuration push AREA ?URL?
867830
**
868831
** Push the local configuration into the remote server identified
869832
** by URL. Admin privilege is required on the remote server for
870833
** this to work. When the same record exists both locally and on
871834
** the remote end, the one that was most recently changed wins.
872
-** Use the --legacy flag when talking to older servers.
873835
**
874836
** %fossil configuration reset AREA
875837
**
876838
** Restore the configuration to the default. AREA as above.
877839
**
@@ -932,14 +894,12 @@
932894
|| strncmp(zMethod, "push", n)==0
933895
|| strncmp(zMethod, "sync", n)==0
934896
){
935897
int mask;
936898
const char *zServer = 0;
937
- int legacyFlag = 0;
938899
int overwriteFlag = 0;
939900
940
- if( zMethod[0]!='s' ) legacyFlag = find_option("legacy",0,0)!=0;
941901
if( strncmp(zMethod,"pull",n)==0 ){
942902
overwriteFlag = find_option("overwrite",0,0)!=0;
943903
}
944904
url_proxy_options();
945905
if( g.argc!=4 && g.argc!=5 ){
@@ -951,11 +911,10 @@
951911
}
952912
url_parse(zServer, URL_PROMPT_PW);
953913
if( g.url.protocol==0 ) fossil_fatal("no server URL specified");
954914
user_select();
955915
url_enable_proxy("via proxy: ");
956
- if( legacyFlag ) mask |= CONFIGSET_OLDFORMAT;
957916
if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE;
958917
if( strncmp(zMethod, "push", n)==0 ){
959918
client_sync(0,0,(unsigned)mask);
960919
}else if( strncmp(zMethod, "pull", n)==0 ){
961920
client_sync(0,(unsigned)mask,0);
962921
--- src/configure.c
+++ src/configure.c
@@ -39,11 +39,10 @@
39 #define CONFIGSET_XFER 0x000080 /* Transfer configuration */
40
41 #define CONFIGSET_ALL 0x0000ff /* Everything */
42
43 #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */
44 #define CONFIGSET_OLDFORMAT 0x200000 /* Use the legacy format */
45
46 /*
47 ** This mask is used for the common TH1 configuration settings (i.e. those
48 ** that are not specific to one particular subsystem, such as the transfer
49 ** subsystem).
@@ -170,29 +169,19 @@
170 const char *configure_first_name(int iMask){
171 iConfig = 0;
172 return configure_next_name(iMask);
173 }
174 const char *configure_next_name(int iMask){
175 if( iMask & CONFIGSET_OLDFORMAT ){
176 while( iConfig<count(aConfig) ){
177 if( aConfig[iConfig].groupMask & iMask ){
178 return aConfig[iConfig++].zName;
179 }else{
180 iConfig++;
181 }
182 }
183 }else{
184 if( iConfig==0 && (iMask & CONFIGSET_ALL)==CONFIGSET_ALL ){
185 iConfig = count(aGroupName);
186 return "/all";
187 }
188 while( iConfig<count(aGroupName)-1 ){
189 if( aGroupName[iConfig].groupMask & iMask ){
190 return aGroupName[iConfig++].zName;
191 }else{
192 iConfig++;
193 }
194 }
195 }
196 return 0;
197 }
198
@@ -514,10 +503,11 @@
514 ** OLD FORMAT:
515 **
516 ** The old format is retained for backwards compatibility, but is deprecated.
517 ** The cutover from old format to new was on 2011-04-25. After sufficient
518 ** time has passed, support for the old format will be removed.
 
519 **
520 ** zName is either the NAME of an element of the CONFIG table, or else
521 ** one of the special names "@shun", "@reportfmt", "@user", or "@concealed".
522 ** If zName is a CONFIG table name, then CONTENT replaces (overwrites) the
523 ** element in the CONFIG table. For one of the @-labels, CONTENT is raw
@@ -609,35 +599,10 @@
609 azToken[0]/*safe-for-%s*/);
610 db_multi_exec("%s", blob_sql_text(&sql));
611 }
612 blob_reset(&sql);
613 rebuildMask |= thisMask;
614 }else{
615 /* Otherwise, the old format */
616 if( (configure_is_exportable(zName) & groupMask)==0 ) return;
617 if( fossil_strcmp(zName, "logo-image")==0 ){
618 Stmt ins;
619 db_prepare(&ins,
620 "REPLACE INTO config(name, value, mtime) VALUES(:name, :value, now())"
621 );
622 db_bind_text(&ins, ":name", zName);
623 db_bind_blob(&ins, ":value", pContent);
624 db_step(&ins);
625 db_finalize(&ins);
626 }else if( zName[0]=='@' ){
627 /* Notice that we are evaluating arbitrary SQL received from the
628 ** client. But this can only happen if the client has authenticated
629 ** as an administrator, so presumably we trust the client at this
630 ** point.
631 */
632 db_multi_exec("%s", blob_str(pContent) /*safe-for-%s*/);
633 }else{
634 db_multi_exec(
635 "REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now())",
636 zName, blob_str(pContent)
637 );
638 }
639 }
640 }
641
642 /*
643 ** Process a file full of "config" cards.
@@ -856,22 +821,19 @@
856 **
857 ** %fossil configuration pull AREA ?URL?
858 **
859 ** Pull and install the configuration from a different server
860 ** identified by URL. If no URL is specified, then the default
861 ** server is used. Use the --legacy option for the older protocol
862 ** (when talking to servers compiled prior to 2011-04-27.) Use
863 ** the --overwrite flag to completely replace local settings with
864 ** content received from URL.
865 **
866 ** %fossil configuration push AREA ?URL?
867 **
868 ** Push the local configuration into the remote server identified
869 ** by URL. Admin privilege is required on the remote server for
870 ** this to work. When the same record exists both locally and on
871 ** the remote end, the one that was most recently changed wins.
872 ** Use the --legacy flag when talking to older servers.
873 **
874 ** %fossil configuration reset AREA
875 **
876 ** Restore the configuration to the default. AREA as above.
877 **
@@ -932,14 +894,12 @@
932 || strncmp(zMethod, "push", n)==0
933 || strncmp(zMethod, "sync", n)==0
934 ){
935 int mask;
936 const char *zServer = 0;
937 int legacyFlag = 0;
938 int overwriteFlag = 0;
939
940 if( zMethod[0]!='s' ) legacyFlag = find_option("legacy",0,0)!=0;
941 if( strncmp(zMethod,"pull",n)==0 ){
942 overwriteFlag = find_option("overwrite",0,0)!=0;
943 }
944 url_proxy_options();
945 if( g.argc!=4 && g.argc!=5 ){
@@ -951,11 +911,10 @@
951 }
952 url_parse(zServer, URL_PROMPT_PW);
953 if( g.url.protocol==0 ) fossil_fatal("no server URL specified");
954 user_select();
955 url_enable_proxy("via proxy: ");
956 if( legacyFlag ) mask |= CONFIGSET_OLDFORMAT;
957 if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE;
958 if( strncmp(zMethod, "push", n)==0 ){
959 client_sync(0,0,(unsigned)mask);
960 }else if( strncmp(zMethod, "pull", n)==0 ){
961 client_sync(0,(unsigned)mask,0);
962
--- src/configure.c
+++ src/configure.c
@@ -39,11 +39,10 @@
39 #define CONFIGSET_XFER 0x000080 /* Transfer configuration */
40
41 #define CONFIGSET_ALL 0x0000ff /* Everything */
42
43 #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */
 
44
45 /*
46 ** This mask is used for the common TH1 configuration settings (i.e. those
47 ** that are not specific to one particular subsystem, such as the transfer
48 ** subsystem).
@@ -170,29 +169,19 @@
169 const char *configure_first_name(int iMask){
170 iConfig = 0;
171 return configure_next_name(iMask);
172 }
173 const char *configure_next_name(int iMask){
174 if( iConfig==0 && (iMask & CONFIGSET_ALL)==CONFIGSET_ALL ){
175 iConfig = count(aGroupName);
176 return "/all";
177 }
178 while( iConfig<count(aGroupName)-1 ){
179 if( aGroupName[iConfig].groupMask & iMask ){
180 return aGroupName[iConfig++].zName;
181 }else{
182 iConfig++;
 
 
 
 
 
 
 
 
 
 
183 }
184 }
185 return 0;
186 }
187
@@ -514,10 +503,11 @@
503 ** OLD FORMAT:
504 **
505 ** The old format is retained for backwards compatibility, but is deprecated.
506 ** The cutover from old format to new was on 2011-04-25. After sufficient
507 ** time has passed, support for the old format will be removed.
508 ** Update: Support for the old format was remoed on 2017-09-20.
509 **
510 ** zName is either the NAME of an element of the CONFIG table, or else
511 ** one of the special names "@shun", "@reportfmt", "@user", or "@concealed".
512 ** If zName is a CONFIG table name, then CONTENT replaces (overwrites) the
513 ** element in the CONFIG table. For one of the @-labels, CONTENT is raw
@@ -609,35 +599,10 @@
599 azToken[0]/*safe-for-%s*/);
600 db_multi_exec("%s", blob_sql_text(&sql));
601 }
602 blob_reset(&sql);
603 rebuildMask |= thisMask;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604 }
605 }
606
607 /*
608 ** Process a file full of "config" cards.
@@ -856,22 +821,19 @@
821 **
822 ** %fossil configuration pull AREA ?URL?
823 **
824 ** Pull and install the configuration from a different server
825 ** identified by URL. If no URL is specified, then the default
826 ** server is used. Use the --overwrite flag to completely
827 ** replace local settings with content received from URL.
 
 
828 **
829 ** %fossil configuration push AREA ?URL?
830 **
831 ** Push the local configuration into the remote server identified
832 ** by URL. Admin privilege is required on the remote server for
833 ** this to work. When the same record exists both locally and on
834 ** the remote end, the one that was most recently changed wins.
 
835 **
836 ** %fossil configuration reset AREA
837 **
838 ** Restore the configuration to the default. AREA as above.
839 **
@@ -932,14 +894,12 @@
894 || strncmp(zMethod, "push", n)==0
895 || strncmp(zMethod, "sync", n)==0
896 ){
897 int mask;
898 const char *zServer = 0;
 
899 int overwriteFlag = 0;
900
 
901 if( strncmp(zMethod,"pull",n)==0 ){
902 overwriteFlag = find_option("overwrite",0,0)!=0;
903 }
904 url_proxy_options();
905 if( g.argc!=4 && g.argc!=5 ){
@@ -951,11 +911,10 @@
911 }
912 url_parse(zServer, URL_PROMPT_PW);
913 if( g.url.protocol==0 ) fossil_fatal("no server URL specified");
914 user_select();
915 url_enable_proxy("via proxy: ");
 
916 if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE;
917 if( strncmp(zMethod, "push", n)==0 ){
918 client_sync(0,0,(unsigned)mask);
919 }else if( strncmp(zMethod, "pull", n)==0 ){
920 client_sync(0,(unsigned)mask,0);
921
+1 -22
--- src/xfer.c
+++ src/xfer.c
@@ -1884,16 +1884,10 @@
18841884
while( zName ){
18851885
blob_appendf(&send, "reqconfig %s\n", zName);
18861886
zName = configure_next_name(configRcvMask);
18871887
nCardSent++;
18881888
}
1889
- if( (configRcvMask & (CONFIGSET_USER|CONFIGSET_TKT))!=0
1890
- && (configRcvMask & CONFIGSET_OLDFORMAT)!=0
1891
- ){
1892
- int overwrite = (configRcvMask & CONFIGSET_OVERWRITE)!=0;
1893
- configure_prepare_to_receive(overwrite);
1894
- }
18951889
origConfigRcvMask = configRcvMask;
18961890
configRcvMask = 0;
18971891
}
18981892
18991893
/* Send a request to sync unversioned files. On a clone, delay sending
@@ -1910,21 +1904,11 @@
19101904
}
19111905
19121906
/* Send configuration parameters being pushed */
19131907
if( configSendMask ){
19141908
if( zOpType==0 ) zOpType = "Push";
1915
- if( configSendMask & CONFIGSET_OLDFORMAT ){
1916
- const char *zName;
1917
- zName = configure_first_name(configSendMask);
1918
- while( zName ){
1919
- send_legacy_config_card(&xfer, zName);
1920
- zName = configure_next_name(configSendMask);
1921
- nCardSent++;
1922
- }
1923
- }else{
1924
- nCardSent += configure_send_group(xfer.pOut, configSendMask, 0);
1925
- }
1909
+ nCardSent += configure_send_group(xfer.pOut, configSendMask, 0);
19261910
configSendMask = 0;
19271911
}
19281912
19291913
/* Send unversioned files present here on the client but missing or
19301914
** obsolete on the server.
@@ -2386,15 +2370,10 @@
23862370
break;
23872371
}
23882372
blobarray_reset(xfer.aToken, xfer.nToken);
23892373
blob_reset(&xfer.line);
23902374
}
2391
- if( (configRcvMask & (CONFIGSET_USER|CONFIGSET_TKT))!=0
2392
- && (configRcvMask & CONFIGSET_OLDFORMAT)!=0
2393
- ){
2394
- configure_finalize_receive();
2395
- }
23962375
origConfigRcvMask = 0;
23972376
if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){
23982377
fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:",
23992378
blob_size(&recv), nCardRcvd,
24002379
xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
24012380
--- src/xfer.c
+++ src/xfer.c
@@ -1884,16 +1884,10 @@
1884 while( zName ){
1885 blob_appendf(&send, "reqconfig %s\n", zName);
1886 zName = configure_next_name(configRcvMask);
1887 nCardSent++;
1888 }
1889 if( (configRcvMask & (CONFIGSET_USER|CONFIGSET_TKT))!=0
1890 && (configRcvMask & CONFIGSET_OLDFORMAT)!=0
1891 ){
1892 int overwrite = (configRcvMask & CONFIGSET_OVERWRITE)!=0;
1893 configure_prepare_to_receive(overwrite);
1894 }
1895 origConfigRcvMask = configRcvMask;
1896 configRcvMask = 0;
1897 }
1898
1899 /* Send a request to sync unversioned files. On a clone, delay sending
@@ -1910,21 +1904,11 @@
1910 }
1911
1912 /* Send configuration parameters being pushed */
1913 if( configSendMask ){
1914 if( zOpType==0 ) zOpType = "Push";
1915 if( configSendMask & CONFIGSET_OLDFORMAT ){
1916 const char *zName;
1917 zName = configure_first_name(configSendMask);
1918 while( zName ){
1919 send_legacy_config_card(&xfer, zName);
1920 zName = configure_next_name(configSendMask);
1921 nCardSent++;
1922 }
1923 }else{
1924 nCardSent += configure_send_group(xfer.pOut, configSendMask, 0);
1925 }
1926 configSendMask = 0;
1927 }
1928
1929 /* Send unversioned files present here on the client but missing or
1930 ** obsolete on the server.
@@ -2386,15 +2370,10 @@
2386 break;
2387 }
2388 blobarray_reset(xfer.aToken, xfer.nToken);
2389 blob_reset(&xfer.line);
2390 }
2391 if( (configRcvMask & (CONFIGSET_USER|CONFIGSET_TKT))!=0
2392 && (configRcvMask & CONFIGSET_OLDFORMAT)!=0
2393 ){
2394 configure_finalize_receive();
2395 }
2396 origConfigRcvMask = 0;
2397 if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){
2398 fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:",
2399 blob_size(&recv), nCardRcvd,
2400 xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
2401
--- src/xfer.c
+++ src/xfer.c
@@ -1884,16 +1884,10 @@
1884 while( zName ){
1885 blob_appendf(&send, "reqconfig %s\n", zName);
1886 zName = configure_next_name(configRcvMask);
1887 nCardSent++;
1888 }
 
 
 
 
 
 
1889 origConfigRcvMask = configRcvMask;
1890 configRcvMask = 0;
1891 }
1892
1893 /* Send a request to sync unversioned files. On a clone, delay sending
@@ -1910,21 +1904,11 @@
1904 }
1905
1906 /* Send configuration parameters being pushed */
1907 if( configSendMask ){
1908 if( zOpType==0 ) zOpType = "Push";
1909 nCardSent += configure_send_group(xfer.pOut, configSendMask, 0);
 
 
 
 
 
 
 
 
 
 
1910 configSendMask = 0;
1911 }
1912
1913 /* Send unversioned files present here on the client but missing or
1914 ** obsolete on the server.
@@ -2386,15 +2370,10 @@
2370 break;
2371 }
2372 blobarray_reset(xfer.aToken, xfer.nToken);
2373 blob_reset(&xfer.line);
2374 }
 
 
 
 
 
2375 origConfigRcvMask = 0;
2376 if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){
2377 fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:",
2378 blob_size(&recv), nCardRcvd,
2379 xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
2380

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button