view src/auth/passdb-sia.c @ 4891:6ab2712f1a93 HEAD

Only imap binary was actually working.
author Timo Sirainen <tss@iki.fi>
date Sun, 10 Dec 2006 14:35:02 +0200
parents 2c1cc5bbc260
children 228eacfb2647
line wrap: on
line source

/* 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,
	NULL
};

#endif