Thread View: news.software.readers
1 messages
1 total messages
Started by Volker Hejny
Thu, 12 Mar 1998 00:00
PGP check in slrn
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads