🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Florian Weimer Mon, 26 Feb 2001 11:04
CANLOCK status
#50847
Author: Florian Weimer
Date: Mon, 26 Feb 2001 11:04
3 lines
843 bytes
What is the status of CANLOCK?  How's the standardization process
proceeding?  Are there any implementations yet?
Re: CANLOCK status
#50846
Author: Marco d'Itri
Date: Mon, 26 Feb 2001 13:56
14 lines
1379 bytes
fw@deneb.enyo.de wrote:

>What is the status of CANLOCK?  How's the standardization process
It's dead, AFAIK.

>proceeding?  Are there any implementations yet?
There is the original implementation by Fluffy and another one I wrote
using more modern perl modules.

-- 
ciao, |
Marco | * The Internet is full. Go away.  -- Joel Furr *

Re: CANLOCK status
#50854
Author: Florian Weimer
Date: Mon, 26 Feb 2001 16:42
8 lines
1058 bytes
Marco d'Itri <abuse@1.2.0.1.0.0.1.e.f.f.3.ip6.int> writes:

> >What is the status of CANLOCK?  How's the standardization process

> It's dead, AFAIK.

What caused its death?
Re: CANLOCK status
#50850
Author: Marco d'Itri
Date: Mon, 26 Feb 2001 19:24
122 lines
4091 bytes
urs@tin.org wrote:

>> There is the original implementation by Fluffy
>IIRC that one required as last INN 2.x. many ppl. are still running
Yes, but you can easily make it work with INN 1.x using this perl
module I wrote: http://www.linux.it/~md/software/News-ICC-0.2.tar.gz .
It's a native perl implementation of the interface used by ctlinnd.

>> and another one I wrote using more modern perl modules.
>just gessing (didn't find the source): requires INN => 2.x?
I wrote only the client part, but the code can be put in the original
cleanfeed add on:

# Copyright 1999 by Marco d'Itri <md.linux.it>
#
# This code may be used and/or distributed under the same terms as Perl
# itself.
#
# Based on the perl cancel lock implementation by Fluffy.

package News::Gateway;

use strict;

$HOOKS{canlock} = ['canlock'];
sub canlock_conf {
	my ($self, $directive, $command, $arg) = @_;
	if ($command eq 'secret') {
		$$self{LockSecret} = $arg;
	} elsif ($command eq 'usemd5') {
		$$self{LockMD5} = 1;
	}
	undef;	
}

sub canlock_mesg {
	my $self = shift;
	$self->get_article->add_canlock($$self{LockSecret}, $$self{LockMD5} || 0)
		and undef;
}

package News::Article;
use strict;
use Digest;
use Digest::HMAC;
use Digest::MD5;
use Digest::SHA1;

sub add_cancelkey {
	my ($self, $secret, $usemd5) = @_;
	my ($tocancel, $key);
	$secret || return undef;

	if (($self->header('control') || '') =~ /^\s+cancel\s+(.+)/i) {
		$tocancel = $1;
	} elsif ($tocancel == $self->header('supersedes')) {
	} else {
		return 1;
	}

	if ($usemd5) {
		$key = 'md5:'.make_key_md5($secret, $tocancel);
	} else {
		$key = 'sha1:'.make_key_sha1($secret, $tocancel);
	}

	my $o = $self->header('cancel-key');
	$self->set_headers('Cancel-Key', ($o ? "$o\n\t" : '') . $key);
	1;
}

sub add_canlock {
	my ($self, $secret, $usemd5) = @_;
	my $lock;
	$secret || return undef;

	$self->add_message_id;
	my $id = $self->header('message-id');
	if ($usemd5) {
		$lock = 'md5:'.make_canlock_md5($secret, $id);
	} else {
		$lock = 'sha1:'.make_canlock_sha1($secret, $id);
	}

	my $o = $self->header('cancel-lock');
	$self->set_headers('Cancel-Lock', ($o ? "$o\n\t" : '') . $lock);
	1;
}

sub make_key_md5 {
	my ($secret, $id) = @_;
	my $hmac = Digest::HMAC->new($secret, 'Digest::MD5');
	$hmac->add($id);
	return $hmac->b64digest.'==';
}

sub make_key_sha1 {
	my ($secret, $id) = @_;
	my $hmac = Digest::HMAC->new($secret, 'Digest::SHA1');
	$hmac->add($id);
	return $hmac->b64digest.'=';
}

sub make_canlock_md5 {
	my ($secret, $id) = @_;
	my $hash = Digest->new('MD5');
	$hash->add(make_key_md5($secret, $id));
	return $hash->b64digest.'==';
}

sub make_canlock_sha1 {
	my ($secret, $id) = @_;
	my $hash = Digest->new('SHA1');
	$hash->add(make_key_sha1($secret, $id));
	return $hash->b64digest.'=';
}

-- 
ciao, |
Marco | * The Internet is full. Go away.  -- Joel Furr *

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