changeset 4638:689a02ca02d3 HEAD

Tru64 SIA authentication support. Patch by Simon L Jackson (simon jackson carringbush net)
author Timo Sirainen <tss@iki.fi>
date Mon, 09 Oct 2006 00:25:15 +0300
parents 0af548f101f8
children 47531abcf691
files configure.in src/auth/Makefile.am src/auth/passdb-sia.c src/auth/passdb.c
diffstat 4 files changed, 82 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Sun Oct 08 23:09:48 2006 +0300
+++ b/configure.in	Mon Oct 09 00:25:15 2006 +0300
@@ -135,6 +135,15 @@
 	fi,
 	want_gssapi=no)
 
+AC_ARG_WITH(sia,
+[  --with-sia              Build with Tru64 SIA support],
+      if test x$withval = xno; then
+              want_sia=no
+      else
+              want_sia=yes
+      fi,
+      want_sia=no)
+
 AC_ARG_WITH(ldap,
 [  --with-ldap             Build with LDAP support],
 	if test x$withval = xno; then
@@ -1438,6 +1447,14 @@
 	fi
 fi
 
+if test $want_sia = yes; then
+	AC_CHECK_FUNC(sia_validate_user, [
+		AC_DEFINE(PASSDB_SIA,, Build with Tru64 SIA support)
+		passdb="$passdb sia"
+		AUTH_LIBS="$AUTH_LIBS -depth_ring_search"
+	])
+fi
+
 if test $want_ldap = yes; then
 	AC_CHECK_LIB(ldap, ldap_init, [
 		AC_CHECK_HEADER(ldap.h, [
--- a/src/auth/Makefile.am	Sun Oct 08 23:09:48 2006 +0300
+++ b/src/auth/Makefile.am	Mon Oct 09 00:25:15 2006 +0300
@@ -69,6 +69,7 @@
 	passdb-pam.c \
 	passdb-checkpassword.c \
 	passdb-shadow.c \
+	passdb-sia.c \
 	passdb-vpopmail.c \
 	passdb-sql.c \
 	userdb.c \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/auth/passdb-sia.c	Mon Oct 09 00:25:15 2006 +0300
@@ -0,0 +1,60 @@
+/* Copyright (C) 2006 Simon L Jackson */
+
+/* Tru64 SIA support */
+
+#include "common.h"
+
+#ifdef PASSDB_SIA
+
+#include "safe-memset.h"
+#include "passdb.h"
+
+#include <sia.h>
+#include <siad.h>
+#include <sys/security.h>
+
+static int checkpw_collect(int timeout __attr_unused__, int rendition,
+			   uchar_t *title __attr_unused__,
+			   int nprompts __attr_unused__,
+			   prompt_t *prompts __attr_unused__)
+{
+	switch (rendition) {
+	case SIAONELINER:
+	case SIAINFO:
+	case SIAWARNING:
+		return SIACOLSUCCESS;
+	}
+
+	/* everything else is bogus */
+	return SIACOLABORT;
+}
+
+static void
+local_sia_verify_plain(struct auth_request *request, const char *password,
+		       verify_plain_callback_t *callback)
+{
+	char *argutility = "dovecot";
+
+	/* check if the password is valid */
+	if (sia_validate_user(checkpw_collect, 1, &argutility, NULL,
+			      (char *)request->user, NULL, NULL, NULL,
+			      (char *)password) != SIASUCCESS) {
+		auth_request_log_info(request, "sia", "password mismatch");
+                callback(PASSDB_RESULT_PASSWORD_MISMATCH, request);
+	} else {
+		callback(PASSDB_RESULT_OK, request);
+	}
+}
+
+struct passdb_module_interface passdb_sia = {
+        "sia",
+
+        NULL,
+        NULL,
+        NULL,
+
+        local_sia_verify_plain,
+        NULL
+};
+
+#endif
--- a/src/auth/passdb.c	Sun Oct 08 23:09:48 2006 +0300
+++ b/src/auth/passdb.c	Mon Oct 09 00:25:15 2006 +0300
@@ -17,6 +17,7 @@
 extern struct passdb_module_interface passdb_vpopmail;
 extern struct passdb_module_interface passdb_ldap;
 extern struct passdb_module_interface passdb_sql;
+extern struct passdb_module_interface passdb_sia;
 
 struct passdb_module_interface *passdb_interfaces[] = {
 #ifdef PASSDB_PASSWD
@@ -46,6 +47,9 @@
 #ifdef PASSDB_SQL
 	&passdb_sql,
 #endif
+#ifdef PASSDB_SIA
+	&passdb_sia,
+#endif
 	NULL
 };