Projects / sn / Comments

Comments for sn

12 Oct 2011 15:24 kensington

Second try:

--- file_not_specified_in_diff
+++ file_not_specified_in_diff
@@ -9,6 +9,7 @@
* Get a single line from an fd.
*/

+#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -6,6 +6,7 @@
*/

#include <unistd.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <sys/wait.h>

12 Oct 2011 15:23 kensington

A patch from Debian to fix warnings (posted here due to this being the most likely place anyone interested will see it):

--- file_not_specified_in_diff
+++ file_not_specified_in_diff
@@ -9,6 +9,7 @@
* Get a single line from an fd.
*/

+#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -6,6 +6,7 @@
*/

#include <unistd.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <sys/wait.h>

03 May 2003 08:27 patrikr

Use the mailing list
Please, if you have patches or other enhancements that you want to submit to sn, send them to the mailing list. This forum is not the right place for them.

Signed,
the maintainer :)

02 May 2003 12:54 DominicB

Re: username/password authentication
Ok, this is not, what I expected to happen ;-)

The pre-commands are stripped. See sourcecode of html page for the original diff file.

02 May 2003 12:51 DominicB

Re: username/password authentication
This should fix some problems:


--- nntp.sh.old 2003-05-02 21:31:21.000000000 +0200
+++ nntp.sh.new 2003-05-02 21:36:02.000000000 +0200
@@ -42,5 +42,5 @@
}

-echo "200 Hi, you can post (sn simple auth script)"
+printf "200 Hi, you can post (sn simple auth script)\r\n"


@@ -59,11 +59,17 @@
#switchpart=`echo ${currentline:0:14} | tr [:lower:] [:upper:]`
case "$switchpart" in
- "LIST EXTENSION")
+ "LIST EXTENSIONS")

- echo "202-Extensions supported:"
- echo " AUTHINFO USER"
- echo "."
+ printf "202-Extensions supported:\r\n"
+ printf " AUTHINFO USER\r\n"
+ printf " MODE READER\r\n"
+ printf ".\r\n"
haveuser=""
;;
+ "MODE READER")
+ # some newsreaders (e.g. MacSoup ;-))
+ # send this command at the very beginning
+ printf "200 You are already in this mode. Ignored.\r\n"
+ ;;
"QUIT")

@@ -73,5 +79,5 @@
# extract username
haveuser=${currentline:14}
- echo "381 Continue with authorization sequence"
+ printf "381 Continue with authorization sequence\r\n"

# echo $haveuser
@@ -84,10 +90,10 @@

if checkuser $haveuser $havepass ; then
- echo "281 Authorization accepted"
+ printf "281 Authorization accepted\r\n"
export POSTING_OK=1 # is this necessary?

exec $SNNTPD -S logger -p news.info
else
- echo "482 Authorization rejected $msg"
+ printf "482 Authorization rejected $msg\r\n"
fi

@@ -95,5 +101,5 @@
;;
*)
- echo "450 Authorization required for this command"
+ printf "450 Authorization required for this command\r\n"
haveuser=""

19 Feb 2003 02:32 johill

username/password authentication

The sn documentation tells you to use another script for it. Since we found none, we wrote our own, which I'll put here for everyone's convenience.


#!/bin/bash

#&nbsp;simple&nbsp;script&nbsp;for&nbsp;doing&nbsp;authentication&nbsp;with&nbsp;sn,&nbsp;


#&nbsp;the&nbsp;usernames&nbsp;and&nbsp;passwords&nbsp;are&nbsp;defined&nbsp;inline

#&nbsp;in&nbsp;this&nbsp;file


#&nbsp;settings

timeout=20&nbsp;&nbsp;#&nbsp;seconds!

SNNTPD=/usr/sbin/snntpd&nbsp;

#users&nbsp;(array)


users=(user1&nbsp;user2&nbsp;user3)

#corresponding&nbsp;passwords&nbsp;(must&nbsp;not&nbsp;be&nbsp;shorter&nbsp;than&nbsp;users&nbsp;array!)

passwords=(password1&nbsp;password2&nbsp;password3)


#&nbsp;end&nbsp;settings

checkuser&nbsp;()&nbsp;{&nbsp;

&nbsp;&nbsp;user_count=${#users[@]}

&nbsp;&nbsp;index=0

&nbsp;&nbsp;while&nbsp;[&nbsp;&quot;$index&quot;&nbsp;-lt&nbsp;&quot;$user_count&quot;&nbsp;]&nbsp;;&nbsp;do


&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;[&nbsp;&quot;${users[$index]}&quot;&nbsp;=&nbsp;&quot;$1&quot;&nbsp;]&nbsp;;&nbsp;then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;[&nbsp;&quot;${passwords[$index]}&quot;&nbsp;=&nbsp;&quot;$2&quot;&nbsp;]&nbsp;;&nbsp;then


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;0

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;1

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi

&nbsp;&nbsp;&nbsp;&nbsp;fi

&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;&quot;index&nbsp;=&nbsp;$index&nbsp;+&nbsp;1&quot;


&nbsp;&nbsp;done

&nbsp;&nbsp;return&nbsp;1

}

echo&nbsp;&quot;200&nbsp;Hi,&nbsp;you&nbsp;can&nbsp;post&nbsp;(sn&nbsp;simple&nbsp;auth&nbsp;script)&quot;


haveuser=&quot;&quot;&nbsp;#&nbsp;no&nbsp;one&nbsp;yet

#&nbsp;simple&nbsp;loop&nbsp;as&nbsp;long&nbsp;as&nbsp;no&nbsp;timeout&nbsp;or&nbsp;other&nbsp;read&nbsp;error&nbsp;occurs


#&nbsp;loop&nbsp;also&nbsp;terminates&nbsp;when&nbsp;exec()'ing&nbsp;snntpd,&nbsp;for&nbsp;obvious&nbsp;reasons

while&nbsp;read&nbsp;-t&nbsp;$timeout&nbsp;currentline&nbsp;;&nbsp;do


&nbsp;&nbsp;lenm1=`expr&nbsp;${#currentline}&nbsp;-&nbsp;1`

&nbsp;&nbsp;currentline=${currentline:0:$lenm1}

&nbsp;&nbsp;switchpart=`echo&nbsp;${currentline:0:14}&nbsp;|&nbsp;tr&nbsp;[a-z]&nbsp;[A-Z]`


&nbsp;&nbsp;#switchpart=`echo&nbsp;${currentline:0:14}&nbsp;|&nbsp;tr&nbsp;[:lower:]&nbsp;[:upper:]`

&nbsp;&nbsp;case&nbsp;&quot;$switchpart&quot;&nbsp;in

&nbsp;&nbsp;&nbsp;&nbsp;&quot;LIST&nbsp;EXTENSION&quot;)


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;202-Extensions&nbsp;supported:&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;&nbsp;AUTHINFO&nbsp;USER&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;.&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;haveuser=&quot;&quot;

&nbsp;&nbsp;&nbsp;&nbsp;;;

&nbsp;&nbsp;&nbsp;&nbsp;&quot;QUIT&quot;)


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit&nbsp;0

&nbsp;&nbsp;&nbsp;&nbsp;;;

&nbsp;&nbsp;&nbsp;&nbsp;&quot;AUTHINFO&nbsp;USER&quot;)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;extract&nbsp;username

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;haveuser=${currentline:14}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;381&nbsp;Continue&nbsp;with&nbsp;authorization&nbsp;sequence&quot;


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$haveuser

&nbsp;&nbsp;&nbsp;&nbsp;;;

&nbsp;&nbsp;&nbsp;&nbsp;&quot;AUTHINFO&nbsp;PASS&quot;)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;check&nbsp;password

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;havepass=${currentline:14}&nbsp;#&nbsp;extract&nbsp;password


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;checkuser&nbsp;$haveuser&nbsp;$havepass&nbsp;;&nbsp;then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;281&nbsp;Authorization&nbsp;accepted&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;export&nbsp;POSTING_OK=1&nbsp;#&nbsp;is&nbsp;this&nbsp;necessary?


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exec&nbsp;$SNNTPD&nbsp;-S&nbsp;logger&nbsp;-p&nbsp;news.info

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;482&nbsp;Authorization&nbsp;rejected&nbsp;$msg&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;haveuser=&quot;&quot;

&nbsp;&nbsp;&nbsp;&nbsp;;;

&nbsp;&nbsp;&nbsp;&nbsp;*)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;450&nbsp;Authorization&nbsp;required&nbsp;for&nbsp;this&nbsp;command&quot;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;haveuser=&quot;&quot;


&nbsp;&nbsp;&nbsp;&nbsp;;;

&nbsp;&nbsp;esac

done

17 Dec 2001 09:34 blades

rpms
RPM link wrongly leads to binary rpms and the only srpm is a very old version.
I'll just keep looking or repackage it myself.

27 Apr 2001 11:27 nogin

Re: Bloody tcpd...
If only it had authentication...

It does (sort of). See my comment below.

27 Apr 2001 03:03 tictactux

Bloody tcpd...
Dang! It took me quite a while to figure out why I could not post to local newsgroups - the entry in hosts.allow was not working as advertised in the documentation.

For those with similar problems, modify the snntpd line in inetd.conf:


&nbsp;&nbsp;nntp stream tcp wait root /usr/sbin/tcpd /usr/bin/env POSTING_OK='' /usr/local/sbin/snntpd logger -p news.info


Would be cool if it were mentioned in the documentation.

Apart from that, cool product. If only it had authentication...

02 Apr 2001 21:55 cabalamat2

Leafnode
How does sn compare to Leafnode?

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.