Fossil SCM

Remove ssh signature from manifests, when needed.

danield 2024-10-30 13:46 ssh-signing
Commit d346d6d20313e112eef0dbcf126c9d94f13057695031053a79a0a7f3cd121d00
1 file changed +7 -3
+7 -3
--- src/manifest.c
+++ src/manifest.c
@@ -318,18 +318,22 @@
318318
*/
319319
static void remove_pgp_signature(const char **pz, int *pn){
320320
const char *z = *pz;
321321
int n = *pn;
322322
int i;
323
- if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)!=0 ) return;
324
- for(i=34; i<n && !after_blank_line(z+i); i++){}
323
+ if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)==0 ) i = 34;
324
+ else if( strncmp(z, "-----BEGIN SSH SIGNED MESSAGE-----", 34)==0 ) i = 34;
325
+ else return;
326
+ for(; i<n && !after_blank_line(z+i); i++){}
325327
if( i>=n ) return;
326328
z += i;
327329
n -= i;
328330
*pz = z;
329331
for(i=n-1; i>=0; i--){
330
- if( z[i]=='\n' && strncmp(&z[i],"\n-----BEGIN PGP SIGNATURE-", 25)==0 ){
332
+ if( z[i]=='\n' &&
333
+ (strncmp(&z[i],"\n-----BEGIN PGP SIGNATURE-----", 29)==0
334
+ || strncmp(&z[i],"\n-----BEGIN SSH SIGNATURE-----", 29)==0 )){
331335
n = i+1;
332336
break;
333337
}
334338
}
335339
*pn = n;
336340
--- src/manifest.c
+++ src/manifest.c
@@ -318,18 +318,22 @@
318 */
319 static void remove_pgp_signature(const char **pz, int *pn){
320 const char *z = *pz;
321 int n = *pn;
322 int i;
323 if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)!=0 ) return;
324 for(i=34; i<n && !after_blank_line(z+i); i++){}
 
 
325 if( i>=n ) return;
326 z += i;
327 n -= i;
328 *pz = z;
329 for(i=n-1; i>=0; i--){
330 if( z[i]=='\n' && strncmp(&z[i],"\n-----BEGIN PGP SIGNATURE-", 25)==0 ){
 
 
331 n = i+1;
332 break;
333 }
334 }
335 *pn = n;
336
--- src/manifest.c
+++ src/manifest.c
@@ -318,18 +318,22 @@
318 */
319 static void remove_pgp_signature(const char **pz, int *pn){
320 const char *z = *pz;
321 int n = *pn;
322 int i;
323 if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)==0 ) i = 34;
324 else if( strncmp(z, "-----BEGIN SSH SIGNED MESSAGE-----", 34)==0 ) i = 34;
325 else return;
326 for(; i<n && !after_blank_line(z+i); i++){}
327 if( i>=n ) return;
328 z += i;
329 n -= i;
330 *pz = z;
331 for(i=n-1; i>=0; i--){
332 if( z[i]=='\n' &&
333 (strncmp(&z[i],"\n-----BEGIN PGP SIGNATURE-----", 29)==0
334 || strncmp(&z[i],"\n-----BEGIN SSH SIGNATURE-----", 29)==0 )){
335 n = i+1;
336 break;
337 }
338 }
339 *pn = n;
340

Keyboard Shortcuts

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