Article View: news.software.readers
Article #22153New version of the slrn PGP patch (for slrn0.8.8.2)
From: Felix von Leitner
Date: Tue, 28 May 1996 00:00
Date: Tue, 28 May 1996 00:00
142 lines
4283 bytes
4283 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hi folks,
with this patch slrn won't sign the signature any more, but sign the
body and append the signature. The signature is stored in memory, and
there is provision for up to 11 lines. No more! I think this should be
enforced anyway. I was tempted to make it 4 lines ;)
Felix
- --- slrn/src/post.c.orig Fri May 24 17:53:28 1996
+++ slrn/src/post.c Tue May 28 21:50:27 1996
@@ -37,6 +37,8 @@
char *Slrn_Save_Posts_File;
char *Slrn_Last_Message_Id;
+static char passphrase[1024];
+
#ifdef VMS
# define SYSTEM_OS_NAME "VMS"
@@ -279,6 +281,7 @@
* file for this purpose.
*/
static int check_file_for_posting (char *file)
+
{
char line[1024], *the_line;
FILE *fp;
@@ -454,11 +457,94 @@
perform_cc = 0;
while (1)
{
- - rsp = slrn_get_response ("yYnNeE", "Post the message? Y-es, N-o, E-dit");
+ rsp = slrn_get_response ("yYnNeEsSpP", "Post the message? Y-es, N-o, E-dit, S-pell check, P-GP sign");
rsp |= 0x20;
if (rsp == 'n') return -1;
if (rsp == 'y') break;
- - if (slrn_edit_file (file, 1) < 0)
+ if (rsp == 's') {
+ char cmd[1024] = "ispell -x ";
+ strcat( cmd, file );
+ slrn_posix_system( cmd, 1 );
+ }
+ if (rsp == 'p') {
+ char cmd[1024] = "pgp -als +batchmode ";
+ char tmpfile[256];
+ char *sig[11];
+ int siglines=0;
+ FILE *infp,*outfp,*pp;
+ if (passphrase[0]==0) {
+ if (slrn_read_input("Passphrase: ",passphrase,0) <= 0) continue;
+ }
+ if (NULL == (infp = fopen (file, "r+")))
+ {
+ slrn_error ("File not found: %s--- message not signed.", file);
+ return -1;
+ }
+ outfp=slrn_open_tmpfile(tmpfile,"w");
+ for(;;) {
+ char line[1024];
+ if (fgets(line,1024,infp)==NULL) {
+ slrn_error ("No body--- message not signed.");
+ return -1;
+ }
+ if (line[0]=='\n') break;
+ }
+ for(;;) {
+ char line[1024];
+ if (fgets(line,1024,infp)==NULL) break;
+ if (siglines || strcmp(line,"-- \n")==0) {
+ if (siglines<12) {
+ sig[siglines]=malloc(strlen(line)+1);
+ if (sig[siglines]) strcpy(sig[siglines++],line);
+ }
+ } else {
+ fputs(line,outfp);
+ }
+ }
+ rewind(infp);
+ fclose(outfp);
+ strcat(cmd,tmpfile);
+ putenv("PGPPASSFD=0");
+ if ((pp=slrn_popen(cmd,"w"))==NULL) {
+ fclose(pp);
+ return -1;
+ }
+ fputs(passphrase,pp);
+ slrn_pclose (pp);
+ for(;;) {
+ char line[1024];
+ if (fgets(line,1024,infp)==NULL) {
+ slrn_error ("No body--- message not signed.");
+ return -1;
+ }
+ if (line[0]=='\n') break;
+ }
+ fseek(infp,0,1);
+ unlink(tmpfile);
+ strcat(tmpfile,".asc");
+ if ((outfp=fopen(tmpfile,"r"))==NULL) {
+ slrn_error ("Cannot open file:%s--- message not signed.",tmpfile);
+ return -1;
+ }
+ for(;;) {
+ char line[1024];
+ if (fgets(line,1020,outfp)==NULL) break;
+ fputs(line,infp);
+ }
+ if (siglines) {
+ int i;
+ fputs("\n",infp);
+ for (i=0;i<siglines;i++)
+ if (sig[i]) {
+ fputs(sig[i],infp);
+ free(sig[i]);
+ }
+ }
+ fclose(outfp);
+ fclose(infp);
+ unlink(tmpfile);
+ }
+ if (rsp=='e') if (slrn_edit_file (file, 1) < 0)
{
slrn_error ("User abort.");
return -1;
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: latin1
iQCVAwUBMauKuB/Da1Yoy+f1AQGZ9QP+N8J5HRPXP9f7aMD20SXxcKxjloyLuAee
5OEpLjXe+TUIDED+LehhuSgaHBpX9RS3P8xZiAzBOLxDrPUJo6DwuHIPWPeWklCW
NES1ouwSgFmblx93jvSvfMGde+Xjv5CBAfQOS/1o31x2o1zoeSJinTbTNxEQLh6Y
tMxdnFlSKAw=
=L6bG
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<slrn4qn2lv.cr1.leitner@xorn.prz.tu-berlin.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <slrn4qn2lv.cr1.leitner@xorn.prz.tu-berlin.de> Subject: New version of the slrn PGP patch (for slrn0.8.8.2) Date: Tue, 28 May 1996 00:00:00 +0000 From: leitner@xorn.prz.tu-berlin.de (Felix von Leitner) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 157234576 Organization: PRZ/TU-Berlin Reply-to: leitner@prz.tu-berlin.de Newsgroups: news.software.readers