Article View: news.software.readers
Article #39515PGP check in slrn
From: Volker Hejny
Date: Thu, 12 Mar 1998 00:00
Date: Thu, 12 Mar 1998 00:00
163 lines
3362 bytes
3362 bytes
Hi,
I don't know if this already exists, but I hacked some code into
the slrn to check pgp-signature in slrn. This code is for pgp 5.0,
but it can be easily changed for 2.6.x. I've bound the check-option
to Control-C. (I know, this is not the most intelligent choice :-) )
The result of the check is inserted at the beginning of the article.
Here are my changes to the src/art.c file of slrn 0.9.4.6:
85a86,88
> void check_for_pgp();
> int art_insert_line(Slrn_Article_Line_Type **pos, char* line);
>
6492a6496
> A_KEY("check_for_pgp", check_for_pgp),
6671a6676
> SLkm_define_key ("^c", (FVOID_STAR) check_for_pgp, Slrn_Article_Keymap);
7624a7630,7702
>
>
> /* Some personal add-ons */
>
> void check_for_pgp() {
>
> FILE* fp;
> int output;
> Slrn_Article_Line_Type *l;
> char line[200];
>
> if (-1 == select_article (1))
> return;
>
> if (Slrn_Article_Lines == NULL)
> return;
>
> l = Slrn_Article_Lines;
> while((l->flags & HEADER_LINE) && (l->next!=NULL)) l = l->next;
>
> if (strstr(l->next->buf,"PGP Signature Check:")) {
> slrn_message("Signature check already performed.");
> return;
> }
>
> slrn_pipe_article_to_cmd("pgpv 1>/dev/null 2>/tmp/checkpgp");
>
> if ((fp=fopen("/tmp/checkpgp","r"))!=NULL) {
>
> art_insert_line(&l,"PGP Signature Check:");
>
> output = 0;
> while(fgets(line,sizeof(line),fp)) {
>
> if (strstr(line,"Good")) output = 1;
> if (strstr(line,"BAD")) output = 1;
> if (strstr(line,"unknown keyid")) art_insert_line(&l,line);
>
> if (output == 1) art_insert_line(&l,line);
> }
>
> if (output == 0) art_insert_line(&l,"No valid PGP Signature found!");
>
> art_insert_line(&l,"-------------------------------------------------------------------------------");
> art_insert_line(&l,"");
> fclose(fp);
> }
>
> l = Slrn_Article_Lines;
>
> slrn_message("Signature check done.");
> return;
> }
>
>
> int art_insert_line(Slrn_Article_Line_Type **pos, char* line) {
>
> Slrn_Article_Line_Type *l;
>
> l = (Slrn_Article_Line_Type *) slrn_malloc
> (sizeof(Slrn_Article_Line_Type),1, 1);
> if ((l == NULL)
> || (NULL == (l->buf = slrn_malloc (strlen(line) + 1, 0, 1))))
> return -1;
>
> strcpy(l->buf,line);
> l->flags = 0;
> l->prev = *pos;
> l->next = (*pos)->next;
> (*pos)->next = l;
> (*pos) = l;
> return 0;
> }
Best regards,
Volker
--
Volker Hejny, II. Phys.Institut, Univ. Giessen
EMail: Volker.Hejny@bigfoot.com
Technical Details
Message-ID:
<slrn6gg8gt.88k.Volker.Hejny@specht.physik.uni-giessen.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <slrn6gg8gt.88k.Volker.Hejny@specht.physik.uni-giessen.de> Subject: PGP check in slrn Date: Thu, 12 Mar 1998 00:00:00 +0000 From: Volker.Hejny@bigfoot.com (Volker Hejny) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 333406397 Organization: University of Giessen, Germany Newsgroups: news.software.readers