INN commit: branches/2.4/samples (3 files)
INN Commit
Russ_Allbery at isc.org
Sun Jun 22 18:22:07 UTC 2008
Date: Sunday, June 22, 2008 @ 11:22:07
Author: iulius
Revision: 7899
Update old Python wrappers.
Modified:
branches/2.4/samples/nnrpd_access_wrapper.py
branches/2.4/samples/nnrpd_auth_wrapper.py
branches/2.4/samples/nnrpd_dynamic_wrapper.py
--------------------------+
nnrpd_access_wrapper.py | 66 +++++++++++++++++++++++---------------------
nnrpd_auth_wrapper.py | 57 ++++++++++++++++++++------------------
nnrpd_dynamic_wrapper.py | 67 +++++++++++++++++++++++----------------------
3 files changed, 100 insertions(+), 90 deletions(-)
Modified: nnrpd_access_wrapper.py
===================================================================
--- nnrpd_access_wrapper.py 2008-06-22 18:21:29 UTC (rev 7898)
+++ nnrpd_access_wrapper.py 2008-06-22 18:22:07 UTC (rev 7899)
@@ -1,27 +1,32 @@
-# Example wrapper nnrpd_access_wrapper.py for support of old python
-# authentication scripts, by Erik Klavon.
+## $Id$
+##
+## Example wrapper for support of old Python authentication scripts,
+## by Erik Klavon.
+##
+## This file contains a sample Python script which can be used to
+## duplicate the behaviour of the old nnrppythonauth functionality.
+## This script only supports access control.
+##
+## How to use this wrapper:
+## - insert your authentication class into this file;
+## - rename your authentication class OLDAUTH.
+##
+## See the INN Python Filtering and Authentication Hooks documentation
+## for more information.
+## The use of this file is *discouraged*.
-# This file contains a sample python script which can be used to
-# duplicate the behavior of the old nnrppythonauth functionality. This
-# script only supports access control.
+## Old AUTH class.
+## Insert your old auth class here.
+## Do not include the code which sets the hook.
-# How to use this wrapper:
-# - insert your authentication class into this file.
-# - rename your authentication class OLDAUTH
-#
-# Old AUTH class
-# Insert your old auth class here
-# do not include the code which sets the hook
-#
-# Wrapper AUTH class. It creates an instance of the old class and
-# calls its methods. Arguments and return values are munged as
-# needed to fit the new way of doing things.
-#
+## Wrapper ACCESS class. It creates an instance of the old class and
+## calls its methods. Arguments and return values are munged as
+## needed to fit the new way of doing things.
-class MYAUTH:
+class MYACCESS:
"""Provide access callbacks to nnrpd."""
def access_init(self):
self.old = OLDAUTH()
@@ -39,22 +44,21 @@
def access_close(self):
(self.old).close()
-#
-# The rest is used to hook up the auth module on nnrpd. It is unlikely
-# you will ever need to modify this.
-#
-# Import functions exposed by nnrpd. This import must succeed, or nothing
-# will work!
+## The rest is used to hook up the access module on nnrpd. It is unlikely
+## you will ever need to modify this.
+
+## Import functions exposed by nnrpd. This import must succeed, or nothing
+## will work!
from nnrpd import *
-# Create a class instance
-myauth = MYAUTH()
+## Create a class instance.
+myaccess = MYACCESS()
-# ...and try to hook up on nnrpd. This would make auth object methods visible
-# to nnrpd.
+## ...and try to hook up on nnrpd. This would make access object methods visible
+## to nnrpd.
try:
- set_auth_hook(myauth)
- syslog('notice', "authentication module successfully hooked into nnrpd")
+ set_auth_hook(myaccess)
+ syslog('notice', "access module successfully hooked into nnrpd")
except Exception, errmsg:
- syslog('error', "Cannot obtain nnrpd hook for authentication method: %s" % errmsg[0])
+ syslog('error', "Cannot obtain nnrpd hook for access method: %s" % errmsg[0])
Modified: nnrpd_auth_wrapper.py
===================================================================
--- nnrpd_auth_wrapper.py 2008-06-22 18:21:29 UTC (rev 7898)
+++ nnrpd_auth_wrapper.py 2008-06-22 18:22:07 UTC (rev 7899)
@@ -1,27 +1,31 @@
-# Example wrapper nnrpd_auth_wrapper.py for support of old python
-# authentication scripts, by Erik Klavon.
+## $Id$
+##
+## Example wrapper for support of old Python authentication scripts,
+## by Erik Klavon.
+##
+## This file contains a sample Python script which can be used to
+## duplicate the behaviour of the old nnrppythonauth functionality.
+## This script only supports authentication.
+##
+## How to use this wrapper:
+## - insert your authentication class into this file;
+## - rename your authentication class OLDAUTH.
+##
+## See the INN Python Filtering and Authentication Hooks documentation
+## for more information.
+## The use of this file is *discouraged*.
-# This file contains a sample python script which can be used to
-# duplicate the behavior of the old nnrppythonauth functionality. This
-# script only supports authentication.
+## Old AUTH class.
+## Insert your old auth class here.
+## Do not include the code which sets the hook.
-# How to use this wrapper:
-# - insert your authentication class into this file.
-# - rename your authentication class OLDAUTH
-#
-# Old AUTH class
-# Insert your old auth class here
-# do not include the code which sets the hook
+## Wrapper AUTH class. It creates an instance of the old class and
+## calls its methods. Arguments and return values are munged as
+## needed to fit the new way of doing things.
-#
-# Wrapper AUTH class. It creates an instance of the old class and
-# calls its methods. Arguments and return values are munged as
-# needed to fit the new way of doing things.
-#
-
class MYAUTH:
"""Provide auth callbacks to nnrpd."""
def authen_init(self):
@@ -38,20 +42,19 @@
def authen_close(self):
(self.old).close()
-#
-# The rest is used to hook up the auth module on nnrpd. It is unlikely
-# you will ever need to modify this.
-#
-# Import functions exposed by nnrpd. This import must succeed, or nothing
-# will work!
+## The rest is used to hook up the auth module on nnrpd. It is unlikely
+## you will ever need to modify this.
+
+## Import functions exposed by nnrpd. This import must succeed, or nothing
+## will work!
from nnrpd import *
-# Create a class instance
+## Create a class instance.
myauth = MYAUTH()
-# ...and try to hook up on nnrpd. This would make auth object methods visible
-# to nnrpd.
+## ...and try to hook up on nnrpd. This would make auth object methods visible
+## to nnrpd.
try:
set_auth_hook(myauth)
syslog('notice', "authentication module successfully hooked into nnrpd")
Modified: nnrpd_dynamic_wrapper.py
===================================================================
--- nnrpd_dynamic_wrapper.py 2008-06-22 18:21:29 UTC (rev 7898)
+++ nnrpd_dynamic_wrapper.py 2008-06-22 18:22:07 UTC (rev 7899)
@@ -1,28 +1,32 @@
-# Example wrapper nnrpd_dynamic_wrapper.py for support of old python
-# authentication scripts, by Erik Klavon.
+## $Id$
+##
+## Example wrapper for support of old Python authentication scripts,
+## by Erik Klavon.
+##
+## This file contains a sample Python script which can be used to
+## duplicate the behaviour of the old nnrppythonauth functionality.
+## This script only supports dynamic access control by group.
+##
+## How to use this wrapper:
+## - insert your authentication class into this file;
+## - rename your authentication class OLDAUTH.
+##
+## See the INN Python Filtering and Authentication Hooks documentation
+## for more information.
+## The use of this file is *discouraged*.
-# This file contains a sample python script which can be used to
-# duplicate the behavior of the old nnrppythonauth functionality. This
-# script only supports dynamic access control by group.
+## Old AUTH class.
+## Insert your old auth class here.
+## Do not include the code which sets the hook.
-# How to use this wrapper:
-# - insert your authentication class into this file.
-# - rename your authentication class OLDAUTH
-#
-# Old AUTH class
-# Insert your old auth class here
-# do not include the code which sets the hook
+## Wrapper DYNACCESS class. It creates an instance of the old class and
+## calls its methods. Arguments and return values are munged as
+## needed to fit the new way of doing things.
-#
-# Wrapper AUTH class. It creates an instance of the old class and
-# calls its methods. Arguments and return values are munged as
-# needed to fit the new way of doing things.
-#
-
-class MYAUTH:
+class MYDYNACCESS:
"""Provide dynamic access callbacks to nnrpd."""
def dynamic_init(self):
self.old = OLDAUTH()
@@ -33,22 +37,21 @@
def dynamic_close(self):
(self.old).close()
-#
-# The rest is used to hook up the auth module on nnrpd. It is unlikely
-# you will ever need to modify this.
-#
-# Import functions exposed by nnrpd. This import must succeed, or nothing
-# will work!
+## The rest is used to hook up the dynamic access module on nnrpd. It is unlikely
+## you will ever need to modify this.
+
+## Import functions exposed by nnrpd. This import must succeed, or nothing
+## will work!
from nnrpd import *
-# Create a class instance
-myauth = MYAUTH()
+## Create a class instance.
+mydynaccess = MYDYNACCESS()
-# ...and try to hook up on nnrpd. This would make auth object methods visible
-# to nnrpd.
+## ...and try to hook up on nnrpd. This would make auth object methods visible
+## to nnrpd.
try:
- set_auth_hook(myauth)
- syslog('notice', "authentication module successfully hooked into nnrpd")
+ set_auth_hook(mydynaccess)
+ syslog('notice', "dynamic access module successfully hooked into nnrpd")
except Exception, errmsg:
- syslog('error', "Cannot obtain nnrpd hook for authentication method: %s" % errmsg[0])
+ syslog('error', "Cannot obtain nnrpd hook for dynamic access method: %s" % errmsg[0])
More information about the inn-committers
mailing list