INN commit: trunk/nnrpd (perl.c python.c)
INN Commit
Russ_Allbery at isc.org
Fri Sep 26 21:36:37 UTC 2008
Date: Friday, September 26, 2008 @ 14:36:36
Author: iulius
Revision: 8053
On fatal failures during authentication, use 400 and not 502
before closing the connection.
Modified:
trunk/nnrpd/perl.c
trunk/nnrpd/python.c
----------+
perl.c | 16 ++++++++--------
python.c | 28 ++++++++++++++--------------
2 files changed, 22 insertions(+), 22 deletions(-)
Modified: perl.c
===================================================================
--- perl.c 2008-09-26 21:23:47 UTC (rev 8052)
+++ perl.c 2008-09-26 21:36:36 UTC (rev 8053)
@@ -238,7 +238,7 @@
if (perl_get_cv("access", 0) == NULL) {
syslog(L_ERROR, "Perl function access not defined");
- Reply("%d Internal Error (3). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (3). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -249,13 +249,13 @@
if (rc == 0) { /* Error occured, same as checking $@. */
syslog(L_ERROR, "Perl function access died: %s",
SvPV(ERRSV, PL_na));
- Reply("%d Internal Error (1). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (1). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
if ((rc % 2) != 0) {
syslog(L_ERROR, "Perl function access returned an odd number of arguments: %i", rc);
- Reply("%d Internal Error (2). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -300,7 +300,7 @@
if (perl_get_cv("auth_init", 0) == NULL) {
syslog(L_ERROR, "Perl function auth_init not defined");
- Reply("%d Internal Error (3). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (3). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -312,7 +312,7 @@
if (SvTRUE(ERRSV)) { /* Check $@. */
syslog(L_ERROR, "Perl function authenticate died: %s",
SvPV(ERRSV, PL_na));
- Reply("%d Internal Error (1). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (1). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -340,7 +340,7 @@
if (perl_get_cv("authenticate", 0) == NULL) {
syslog(L_ERROR, "Perl function authenticate not defined");
- Reply("%d Internal Error (3). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (3). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -364,13 +364,13 @@
if (rc == 0 ) { /* Error occurred, same as checking $@. */
syslog(L_ERROR, "Perl function authenticate died: %s",
SvPV(ERRSV, PL_na));
- Reply("%d Internal Error (1). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (1). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, false);
}
if ((rc != 3) && (rc != 2)) {
syslog(L_ERROR, "Perl function authenticate returned wrong number of results: %d", rc);
- Reply("%d Internal Error (2). Goodbye!\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, false);
}
Modified: python.c
===================================================================
--- python.c 2008-09-26 21:23:47 UTC (rev 8052)
+++ python.c 2008-09-26 21:36:36 UTC (rev 8053)
@@ -83,9 +83,9 @@
/* Structure for storage of attributes for a module file. */
typedef struct PyFile {
- char *file;
- bool loaded[PYTHONtypes_max];
- PyObject *procs[PYTHONtypes_max][PYTHONmethods_max];
+ char *file;
+ bool loaded[PYTHONtypes_max];
+ PyObject *procs[PYTHONtypes_max][PYTHONmethods_max];
} PyFile;
/* Hash for storing files. */
@@ -163,7 +163,7 @@
/*
** Now invoke authenticate method and see if it likes this user.
- **/
+ */
result = PyObject_CallFunction(proc, (char *) "O", PYauthinfo);
/* Check the response. */
@@ -171,7 +171,7 @@
|| ((PyTuple_Size(result) != 2) && (PyTuple_Size(result) != 3)))
{
syslog(L_ERROR, "python authenticate method returned wrong result");
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -182,7 +182,7 @@
if (!PyInt_Check(item))
{
syslog(L_ERROR, "python authenticate method returned bad NNTP response code");
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -196,7 +196,7 @@
if (!PyString_Check(item))
{
syslog(L_ERROR, "python authenticate method returned bad error string");
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -212,7 +212,7 @@
/* Check the item. */
if (!PyString_Check(item)) {
syslog(L_ERROR, "python authenticate method returned bad username string");
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -260,7 +260,7 @@
/* Exit if access method is not defined. */
if (proc == NULL) {
syslog(L_ERROR, "python access method not defined");
- Reply("%d Internal Error (3). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (3). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -307,7 +307,7 @@
/* Check the response. */
if (result == NULL || result == Py_None || !PyDict_Check(result)) {
syslog(L_ERROR, "python access method returned wrong result -- expected a dictionary");
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, true);
}
@@ -321,12 +321,12 @@
while(PyDict_Next(result, &i, &key, &value)) {
if (!PyString_Check(key)) {
syslog(L_ERROR, "python access method return dictionary key %i not a string", i);
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, false);
}
if (!PyString_Check(value)) {
syslog(L_ERROR, "python access method return dictionary value %i not a string", i);
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, false);
}
@@ -445,7 +445,7 @@
if (result == NULL || (result != Py_None && !PyString_Check(result)))
{
syslog(L_ERROR, "python dynamic method (%s access) returned wrong result", PostFlag ? "post" : "read");
- Reply("%d Internal Error (2). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (2). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
ExitWithStats(1, false);
}
@@ -760,7 +760,7 @@
/* See if nnrpd auth object is defined in auth module. */
if (PYAuthObject == NULL) {
syslog(L_ERROR, "python auth object is not defined");
- Reply("%d Internal Error (3). Goodbye\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Internal error (3). Goodbye!\r\n", NNTP_FAIL_TERMINATING);
PY_close_python();
ExitWithStats(1, false);
} else {
More information about the inn-committers
mailing list