GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / saslauthd / auth_sia.c
1 /* MODULE: auth_sia */
2
3 /* COPYRIGHT
4  * Copyright (c) 1998 Messaging Direct Ltd.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY MESSAGING DIRECT LTD. ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL MESSAGING DIRECT LTD. OR
20  * ITS EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27  * DAMAGE.
28  * END COPYRIGHT */
29
30 #ifdef __GNUC__
31 #ident "$Id: auth_sia.c,v 1.3 2001/12/04 02:06:55 rjs3 Exp $"
32 #endif
33
34 /* PUBLIC DEPENDENCIES */
35 #include "mechanisms.h"
36
37 #ifdef AUTH_SIA
38
39 #include <string.h>
40 #include <sia.h>
41 #include <siad.h>
42
43 #include "auth_sia.h"
44 #include "globals.h"
45 /* END PUBLIC DEPENDENCIES */
46 \f
47 /* FUNCTION: auth_sia */
48
49 /* SYNOPSIS
50  * Authenticate against the Digital UNIX SIA environment.
51  */
52
53 char *                                  /* R: allocated response string */
54 auth_sia (
55   /* PARAMETERS */
56   const char *login,                    /* I: plaintext authenticator */
57   const char *password,                 /* I: plaintext password */
58   const char *service __attribute__((unused)),
59   const char *realm __attribute__((unused))
60   /* END PARAMETERS */
61   )
62 {
63     /* VARIABLES */
64     int rc;
65     /* END VARIABLES */
66
67     rc = sia_validate_user(0, g_argc, g_argv, 0, login, 0, 0, 0, password);
68     if (rc == SIASUCCESS) {
69         return strdup("OK");
70     }
71     if (rc == SIAFAIL) {
72         return strdup("NO");
73     }
74     /* Shouldn't happen */
75     syslog(LOG_WARNING,
76            "auth_sia: impossible return (%d) from sia_validate_user", rc);
77     return strdup("NO (possible system error)");
78 }
79
80 #else /* ! AUTH_SIA */
81
82 char *
83 auth_sia(
84   const char *login __attribute__((unused)),
85   const char *password __attribute__((unused)),
86   const char *service __attribute__((unused)),
87   const char *realm __attribute__((unused))
88   )
89 {
90     return NULL;
91 }
92 #endif
93
94 /* END FUNCTION: auth_sia */
95
96 /* END MODULE: auth_sia */