Fossil SCM
Improve defenses against hostile command-line arguments in commands that call out to other programs (like ssh) using popen.
Commit
d4ef18966762ae6229302b5d707e05adfada5e9d1a452895967a5aed02ef13a4
Parent
c92989d3a84fa0f…
5 files changed
+2
-2
+25
-3
+5
-1
+12
+1
-1
+2
-2
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -1690,21 +1690,21 @@ | ||
| 1690 | 1690 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6x */ |
| 1691 | 1691 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, /* 7x */ |
| 1692 | 1692 | #else |
| 1693 | 1693 | /* Unix |
| 1694 | 1694 | ** Prohibit: all control characters, including tab, \r and \n |
| 1695 | -** Escape: (space) ! " # $ % & ' ( ) * ; < > ? [ \ ] ^ ` { | } | |
| 1695 | +** Escape: (space) ! " # $ % & ' ( ) * ; < > ? [ \ ] ^ ` { | } ~ | |
| 1696 | 1696 | */ |
| 1697 | 1697 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ |
| 1698 | 1698 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x */ |
| 1699 | 1699 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 1x */ |
| 1700 | 1700 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 2x */ |
| 1701 | 1701 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, /* 3x */ |
| 1702 | 1702 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4x */ |
| 1703 | 1703 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, /* 5x */ |
| 1704 | 1704 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6x */ |
| 1705 | - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, /* 7x */ | |
| 1705 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /* 7x */ | |
| 1706 | 1706 | #endif |
| 1707 | 1707 | /* all bytes 0x80 through 0xbf are unescaped, being secondary |
| 1708 | 1708 | ** bytes to UTF8 characters. Bytes 0xc0 through 0xff are the |
| 1709 | 1709 | ** first byte of a UTF8 character and do get escaped */ |
| 1710 | 1710 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 8x */ |
| 1711 | 1711 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -1690,21 +1690,21 @@ | |
| 1690 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6x */ |
| 1691 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, /* 7x */ |
| 1692 | #else |
| 1693 | /* Unix |
| 1694 | ** Prohibit: all control characters, including tab, \r and \n |
| 1695 | ** Escape: (space) ! " # $ % & ' ( ) * ; < > ? [ \ ] ^ ` { | } |
| 1696 | */ |
| 1697 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ |
| 1698 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x */ |
| 1699 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 1x */ |
| 1700 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 2x */ |
| 1701 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, /* 3x */ |
| 1702 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4x */ |
| 1703 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, /* 5x */ |
| 1704 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6x */ |
| 1705 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, /* 7x */ |
| 1706 | #endif |
| 1707 | /* all bytes 0x80 through 0xbf are unescaped, being secondary |
| 1708 | ** bytes to UTF8 characters. Bytes 0xc0 through 0xff are the |
| 1709 | ** first byte of a UTF8 character and do get escaped */ |
| 1710 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 8x */ |
| 1711 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -1690,21 +1690,21 @@ | |
| 1690 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6x */ |
| 1691 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, /* 7x */ |
| 1692 | #else |
| 1693 | /* Unix |
| 1694 | ** Prohibit: all control characters, including tab, \r and \n |
| 1695 | ** Escape: (space) ! " # $ % & ' ( ) * ; < > ? [ \ ] ^ ` { | } ~ |
| 1696 | */ |
| 1697 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ |
| 1698 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x */ |
| 1699 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 1x */ |
| 1700 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 2x */ |
| 1701 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, /* 3x */ |
| 1702 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4x */ |
| 1703 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, /* 5x */ |
| 1704 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 6x */ |
| 1705 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /* 7x */ |
| 1706 | #endif |
| 1707 | /* all bytes 0x80 through 0xbf are unescaped, being secondary |
| 1708 | ** bytes to UTF8 characters. Bytes 0xc0 through 0xff are the |
| 1709 | ** first byte of a UTF8 character and do get escaped */ |
| 1710 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 8x */ |
| 1711 |
+25
-3
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -74,19 +74,32 @@ | ||
| 74 | 74 | if( resetFlag ){ |
| 75 | 75 | transport.nSent = 0; |
| 76 | 76 | transport.nRcvd = 0; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | + | |
| 80 | +/* | |
| 81 | +** Whatever follows the host name on an ssh command line is joined into | |
| 82 | +** one string by ssh and parsed again by the login shell on the remote | |
| 83 | +** system. Quoting for the local shell does not protect an argument | |
| 84 | +** from that second parse. Return true if zArg holds none of the | |
| 85 | +** characters that a shell treats specially, so that the remote shell | |
| 86 | +** takes it as a single word, unchanged. | |
| 87 | +*/ | |
| 88 | +int ssh_remote_arg_is_safe(const char *zArg){ | |
| 89 | + return strpbrk(zArg, " !\"#$&'()*;<>?[]^`{|}")==0; | |
| 90 | +} | |
| 79 | 91 | |
| 80 | 92 | /* |
| 81 | 93 | ** Check zFossil to see if it is a reasonable "fossil" command to |
| 82 | 94 | ** run on the server. Do not allow an attacker to substitute something |
| 83 | -** like "/bin/rm". | |
| 95 | +** like "/bin/rm", or to add to the command. | |
| 84 | 96 | */ |
| 85 | 97 | static int is_safe_fossil_command(const char *zFossil){ |
| 86 | 98 | static const char *const azSafe[] = { "*/fossil", "*/fossil.exe", "*/echo" }; |
| 87 | 99 | int i; |
| 100 | + if( !ssh_remote_arg_is_safe(zFossil) ) return 0; | |
| 88 | 101 | for(i=0; i<(int)(sizeof(azSafe)/sizeof(azSafe[0])); i++){ |
| 89 | 102 | if( sqlite3_strglob(azSafe[i], zFossil)==0 ) return 1; |
| 90 | 103 | if( strcmp(azSafe[i]+2, zFossil)==0 ) return 1; |
| 91 | 104 | } |
| 92 | 105 | return 0; |
| @@ -138,21 +151,30 @@ | ||
| 138 | 151 | blob_append_escaped_arg(&zCmd, pUrlData->name, 0); |
| 139 | 152 | } |
| 140 | 153 | if( (pUrlData->flags & URL_SSH_EXE)!=0 |
| 141 | 154 | && !is_safe_fossil_command(pUrlData->fossil) |
| 142 | 155 | ){ |
| 143 | - fossil_fatal("the ssh:// URL is asking to run an unsafe command [%s] on " | |
| 144 | - "the server.", pUrlData->fossil); | |
| 156 | + socket_set_errmsg("the ssh:// URL is asking to run an unsafe command " | |
| 157 | + "[%s] on the server.", pUrlData->fossil); | |
| 158 | + blob_reset(&zCmd); | |
| 159 | + return 1; | |
| 145 | 160 | } |
| 146 | 161 | if( (pUrlData->flags & URL_SSH_EXE)==0 |
| 147 | 162 | && (pUrlData->flags & URL_SSH_PATH)!=0 |
| 148 | 163 | ){ |
| 149 | 164 | ssh_add_path_argument(&zCmd); |
| 150 | 165 | } |
| 151 | 166 | blob_append_escaped_arg(&zCmd, pUrlData->fossil, 1); |
| 152 | 167 | blob_append(&zCmd, " test-http", 10); |
| 153 | 168 | if( pUrlData->path && pUrlData->path[0] ){ |
| 169 | + if( !ssh_remote_arg_is_safe(pUrlData->path) ){ | |
| 170 | + socket_set_errmsg("the repository path \"%s\" in the ssh:// URL " | |
| 171 | + "contains a character that is special to the shell " | |
| 172 | + "on the remote system", pUrlData->path); | |
| 173 | + blob_reset(&zCmd); | |
| 174 | + return 1; | |
| 175 | + } | |
| 154 | 176 | blob_append_escaped_arg(&zCmd, pUrlData->path, 1); |
| 155 | 177 | }else{ |
| 156 | 178 | fossil_fatal("ssh:// URI does not specify a path to the repository"); |
| 157 | 179 | } |
| 158 | 180 | if( g.fSshTrace || g.fHttpTrace ){ |
| 159 | 181 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -74,19 +74,32 @@ | |
| 74 | if( resetFlag ){ |
| 75 | transport.nSent = 0; |
| 76 | transport.nRcvd = 0; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /* |
| 81 | ** Check zFossil to see if it is a reasonable "fossil" command to |
| 82 | ** run on the server. Do not allow an attacker to substitute something |
| 83 | ** like "/bin/rm". |
| 84 | */ |
| 85 | static int is_safe_fossil_command(const char *zFossil){ |
| 86 | static const char *const azSafe[] = { "*/fossil", "*/fossil.exe", "*/echo" }; |
| 87 | int i; |
| 88 | for(i=0; i<(int)(sizeof(azSafe)/sizeof(azSafe[0])); i++){ |
| 89 | if( sqlite3_strglob(azSafe[i], zFossil)==0 ) return 1; |
| 90 | if( strcmp(azSafe[i]+2, zFossil)==0 ) return 1; |
| 91 | } |
| 92 | return 0; |
| @@ -138,21 +151,30 @@ | |
| 138 | blob_append_escaped_arg(&zCmd, pUrlData->name, 0); |
| 139 | } |
| 140 | if( (pUrlData->flags & URL_SSH_EXE)!=0 |
| 141 | && !is_safe_fossil_command(pUrlData->fossil) |
| 142 | ){ |
| 143 | fossil_fatal("the ssh:// URL is asking to run an unsafe command [%s] on " |
| 144 | "the server.", pUrlData->fossil); |
| 145 | } |
| 146 | if( (pUrlData->flags & URL_SSH_EXE)==0 |
| 147 | && (pUrlData->flags & URL_SSH_PATH)!=0 |
| 148 | ){ |
| 149 | ssh_add_path_argument(&zCmd); |
| 150 | } |
| 151 | blob_append_escaped_arg(&zCmd, pUrlData->fossil, 1); |
| 152 | blob_append(&zCmd, " test-http", 10); |
| 153 | if( pUrlData->path && pUrlData->path[0] ){ |
| 154 | blob_append_escaped_arg(&zCmd, pUrlData->path, 1); |
| 155 | }else{ |
| 156 | fossil_fatal("ssh:// URI does not specify a path to the repository"); |
| 157 | } |
| 158 | if( g.fSshTrace || g.fHttpTrace ){ |
| 159 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -74,19 +74,32 @@ | |
| 74 | if( resetFlag ){ |
| 75 | transport.nSent = 0; |
| 76 | transport.nRcvd = 0; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /* |
| 81 | ** Whatever follows the host name on an ssh command line is joined into |
| 82 | ** one string by ssh and parsed again by the login shell on the remote |
| 83 | ** system. Quoting for the local shell does not protect an argument |
| 84 | ** from that second parse. Return true if zArg holds none of the |
| 85 | ** characters that a shell treats specially, so that the remote shell |
| 86 | ** takes it as a single word, unchanged. |
| 87 | */ |
| 88 | int ssh_remote_arg_is_safe(const char *zArg){ |
| 89 | return strpbrk(zArg, " !\"#$&'()*;<>?[]^`{|}")==0; |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | ** Check zFossil to see if it is a reasonable "fossil" command to |
| 94 | ** run on the server. Do not allow an attacker to substitute something |
| 95 | ** like "/bin/rm", or to add to the command. |
| 96 | */ |
| 97 | static int is_safe_fossil_command(const char *zFossil){ |
| 98 | static const char *const azSafe[] = { "*/fossil", "*/fossil.exe", "*/echo" }; |
| 99 | int i; |
| 100 | if( !ssh_remote_arg_is_safe(zFossil) ) return 0; |
| 101 | for(i=0; i<(int)(sizeof(azSafe)/sizeof(azSafe[0])); i++){ |
| 102 | if( sqlite3_strglob(azSafe[i], zFossil)==0 ) return 1; |
| 103 | if( strcmp(azSafe[i]+2, zFossil)==0 ) return 1; |
| 104 | } |
| 105 | return 0; |
| @@ -138,21 +151,30 @@ | |
| 151 | blob_append_escaped_arg(&zCmd, pUrlData->name, 0); |
| 152 | } |
| 153 | if( (pUrlData->flags & URL_SSH_EXE)!=0 |
| 154 | && !is_safe_fossil_command(pUrlData->fossil) |
| 155 | ){ |
| 156 | socket_set_errmsg("the ssh:// URL is asking to run an unsafe command " |
| 157 | "[%s] on the server.", pUrlData->fossil); |
| 158 | blob_reset(&zCmd); |
| 159 | return 1; |
| 160 | } |
| 161 | if( (pUrlData->flags & URL_SSH_EXE)==0 |
| 162 | && (pUrlData->flags & URL_SSH_PATH)!=0 |
| 163 | ){ |
| 164 | ssh_add_path_argument(&zCmd); |
| 165 | } |
| 166 | blob_append_escaped_arg(&zCmd, pUrlData->fossil, 1); |
| 167 | blob_append(&zCmd, " test-http", 10); |
| 168 | if( pUrlData->path && pUrlData->path[0] ){ |
| 169 | if( !ssh_remote_arg_is_safe(pUrlData->path) ){ |
| 170 | socket_set_errmsg("the repository path \"%s\" in the ssh:// URL " |
| 171 | "contains a character that is special to the shell " |
| 172 | "on the remote system", pUrlData->path); |
| 173 | blob_reset(&zCmd); |
| 174 | return 1; |
| 175 | } |
| 176 | blob_append_escaped_arg(&zCmd, pUrlData->path, 1); |
| 177 | }else{ |
| 178 | fossil_fatal("ssh:// URI does not specify a path to the repository"); |
| 179 | } |
| 180 | if( g.fSshTrace || g.fHttpTrace ){ |
| 181 |
+5
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -3563,16 +3563,20 @@ | ||
| 3563 | 3563 | int bRunning = 0; /* True when fossil starts up on the remote */ |
| 3564 | 3564 | int isRetry; /* True if on the second attempt */ |
| 3565 | 3565 | const char *zUrl = g.argv[2]; |
| 3566 | 3566 | char zLine[1000]; |
| 3567 | 3567 | |
| 3568 | + if( !ssh_remote_arg_is_safe(zUrl) ){ | |
| 3569 | + fossil_fatal("the repository name \"%s\" contains a character that " | |
| 3570 | + "is special to the shell on the remote system", zUrl); | |
| 3571 | + } | |
| 3568 | 3572 | blob_init(&ssh, 0, 0); |
| 3569 | 3573 | for(isRetry=0; isRetry<2 && !bRunning; isRetry++){ |
| 3570 | 3574 | blob_reset(&ssh); |
| 3571 | 3575 | transport_ssh_command(&ssh); |
| 3572 | 3576 | blob_appendf(&ssh, |
| 3573 | - " -t -L 127.0.0.1:%d:127.0.0.1:%d %!$", | |
| 3577 | + " -t -L 127.0.0.1:%d:127.0.0.1:%d -- %!$", | |
| 3574 | 3578 | iPort, iPort, zRemote |
| 3575 | 3579 | ); |
| 3576 | 3580 | if( zFossilCmd==0 ){ |
| 3577 | 3581 | if( ssh_needs_path_argument(zRemote,-1) ^ isRetry ){ |
| 3578 | 3582 | ssh_add_path_argument(&ssh); |
| 3579 | 3583 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3563,16 +3563,20 @@ | |
| 3563 | int bRunning = 0; /* True when fossil starts up on the remote */ |
| 3564 | int isRetry; /* True if on the second attempt */ |
| 3565 | const char *zUrl = g.argv[2]; |
| 3566 | char zLine[1000]; |
| 3567 | |
| 3568 | blob_init(&ssh, 0, 0); |
| 3569 | for(isRetry=0; isRetry<2 && !bRunning; isRetry++){ |
| 3570 | blob_reset(&ssh); |
| 3571 | transport_ssh_command(&ssh); |
| 3572 | blob_appendf(&ssh, |
| 3573 | " -t -L 127.0.0.1:%d:127.0.0.1:%d %!$", |
| 3574 | iPort, iPort, zRemote |
| 3575 | ); |
| 3576 | if( zFossilCmd==0 ){ |
| 3577 | if( ssh_needs_path_argument(zRemote,-1) ^ isRetry ){ |
| 3578 | ssh_add_path_argument(&ssh); |
| 3579 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3563,16 +3563,20 @@ | |
| 3563 | int bRunning = 0; /* True when fossil starts up on the remote */ |
| 3564 | int isRetry; /* True if on the second attempt */ |
| 3565 | const char *zUrl = g.argv[2]; |
| 3566 | char zLine[1000]; |
| 3567 | |
| 3568 | if( !ssh_remote_arg_is_safe(zUrl) ){ |
| 3569 | fossil_fatal("the repository name \"%s\" contains a character that " |
| 3570 | "is special to the shell on the remote system", zUrl); |
| 3571 | } |
| 3572 | blob_init(&ssh, 0, 0); |
| 3573 | for(isRetry=0; isRetry<2 && !bRunning; isRetry++){ |
| 3574 | blob_reset(&ssh); |
| 3575 | transport_ssh_command(&ssh); |
| 3576 | blob_appendf(&ssh, |
| 3577 | " -t -L 127.0.0.1:%d:127.0.0.1:%d -- %!$", |
| 3578 | iPort, iPort, zRemote |
| 3579 | ); |
| 3580 | if( zFossilCmd==0 ){ |
| 3581 | if( ssh_needs_path_argument(zRemote,-1) ^ isRetry ){ |
| 3582 | ssh_add_path_argument(&ssh); |
| 3583 |
+12
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -1195,10 +1195,22 @@ | ||
| 1195 | 1195 | zOrig = file_newname(zV1, "original", 1); |
| 1196 | 1196 | blob_write_to_file(s.pV1, zOrig); |
| 1197 | 1197 | zOther = file_newname(zV1, "merge", 1); |
| 1198 | 1198 | blob_write_to_file(s.pV2, zOther); |
| 1199 | 1199 | if( rc>0 ){ |
| 1200 | +#if !defined(_WIN32) | |
| 1201 | + if( zGMerge && zGMerge[0] && strpbrk(zPivot, "\"$`")!=0 ){ | |
| 1202 | + /* The file names are put into the gmerge-command as they are, | |
| 1203 | + ** and the examples for that setting put double quotes around | |
| 1204 | + ** them. A name that holds one of these characters would not | |
| 1205 | + ** reach the command as one argument. zPivot stands for all | |
| 1206 | + ** four names, which differ only in their suffix. */ | |
| 1207 | + fossil_warning("not running the gmerge-command on \"%s\" because " | |
| 1208 | + "the name holds a character that is special to " | |
| 1209 | + "the shell", zV1); | |
| 1210 | + }else | |
| 1211 | +#endif | |
| 1200 | 1212 | if( zGMerge && zGMerge[0] ){ |
| 1201 | 1213 | char *zOut; /* Temporary output file */ |
| 1202 | 1214 | char *zCmd; /* Command to invoke */ |
| 1203 | 1215 | const char *azSubst[8]; /* Strings to be substituted */ |
| 1204 | 1216 | zOut = file_newname(zV1, "output", 1); |
| 1205 | 1217 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -1195,10 +1195,22 @@ | |
| 1195 | zOrig = file_newname(zV1, "original", 1); |
| 1196 | blob_write_to_file(s.pV1, zOrig); |
| 1197 | zOther = file_newname(zV1, "merge", 1); |
| 1198 | blob_write_to_file(s.pV2, zOther); |
| 1199 | if( rc>0 ){ |
| 1200 | if( zGMerge && zGMerge[0] ){ |
| 1201 | char *zOut; /* Temporary output file */ |
| 1202 | char *zCmd; /* Command to invoke */ |
| 1203 | const char *azSubst[8]; /* Strings to be substituted */ |
| 1204 | zOut = file_newname(zV1, "output", 1); |
| 1205 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -1195,10 +1195,22 @@ | |
| 1195 | zOrig = file_newname(zV1, "original", 1); |
| 1196 | blob_write_to_file(s.pV1, zOrig); |
| 1197 | zOther = file_newname(zV1, "merge", 1); |
| 1198 | blob_write_to_file(s.pV2, zOther); |
| 1199 | if( rc>0 ){ |
| 1200 | #if !defined(_WIN32) |
| 1201 | if( zGMerge && zGMerge[0] && strpbrk(zPivot, "\"$`")!=0 ){ |
| 1202 | /* The file names are put into the gmerge-command as they are, |
| 1203 | ** and the examples for that setting put double quotes around |
| 1204 | ** them. A name that holds one of these characters would not |
| 1205 | ** reach the command as one argument. zPivot stands for all |
| 1206 | ** four names, which differ only in their suffix. */ |
| 1207 | fossil_warning("not running the gmerge-command on \"%s\" because " |
| 1208 | "the name holds a character that is special to " |
| 1209 | "the shell", zV1); |
| 1210 | }else |
| 1211 | #endif |
| 1212 | if( zGMerge && zGMerge[0] ){ |
| 1213 | char *zOut; /* Temporary output file */ |
| 1214 | char *zCmd; /* Command to invoke */ |
| 1215 | const char *azSubst[8]; /* Strings to be substituted */ |
| 1216 | zOut = file_newname(zV1, "output", 1); |
| 1217 |
+1
-1
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -756,11 +756,11 @@ | ||
| 756 | 756 | blob_appendf(&cmd, " patch %s%s %$ -", zRemoteCmd, zForce, zDir); |
| 757 | 757 | }else{ |
| 758 | 758 | Blob remote; |
| 759 | 759 | *(char*)(zDir-1) = 0; |
| 760 | 760 | transport_ssh_command(&cmd); |
| 761 | - blob_appendf(&cmd, " -T"); | |
| 761 | + blob_appendf(&cmd, " -T --"); /* End of switches */ | |
| 762 | 762 | blob_append_escaped_arg(&cmd, zRemote, 0); |
| 763 | 763 | blob_init(&remote, 0, 0); |
| 764 | 764 | if( zFossilCmd==0 ){ |
| 765 | 765 | if( ssh_needs_path_argument(zRemote,-1) ^ isRetry ){ |
| 766 | 766 | ssh_add_path_argument(&cmd); |
| 767 | 767 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -756,11 +756,11 @@ | |
| 756 | blob_appendf(&cmd, " patch %s%s %$ -", zRemoteCmd, zForce, zDir); |
| 757 | }else{ |
| 758 | Blob remote; |
| 759 | *(char*)(zDir-1) = 0; |
| 760 | transport_ssh_command(&cmd); |
| 761 | blob_appendf(&cmd, " -T"); |
| 762 | blob_append_escaped_arg(&cmd, zRemote, 0); |
| 763 | blob_init(&remote, 0, 0); |
| 764 | if( zFossilCmd==0 ){ |
| 765 | if( ssh_needs_path_argument(zRemote,-1) ^ isRetry ){ |
| 766 | ssh_add_path_argument(&cmd); |
| 767 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -756,11 +756,11 @@ | |
| 756 | blob_appendf(&cmd, " patch %s%s %$ -", zRemoteCmd, zForce, zDir); |
| 757 | }else{ |
| 758 | Blob remote; |
| 759 | *(char*)(zDir-1) = 0; |
| 760 | transport_ssh_command(&cmd); |
| 761 | blob_appendf(&cmd, " -T --"); /* End of switches */ |
| 762 | blob_append_escaped_arg(&cmd, zRemote, 0); |
| 763 | blob_init(&remote, 0, 0); |
| 764 | if( zFossilCmd==0 ){ |
| 765 | if( ssh_needs_path_argument(zRemote,-1) ^ isRetry ){ |
| 766 | ssh_add_path_argument(&cmd); |
| 767 |