1 marek 1.1 /*
2 //%LICENSE////////////////////////////////////////////////////////////////
3 //
4 // Licensed to The Open Group (TOG) under one or more contributor license
5 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
6 // this work for additional information regarding copyright ownership.
7 // Each contributor licenses this file to you under the OpenPegasus Open
8 // Source License; you may not use this file except in compliance with the
9 // License.
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining a
12 // copy of this software and associated documentation files (the "Software"),
13 // to deal in the Software without restriction, including without limitation
14 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 // and/or sell copies of the Software, and to permit persons to whom the
16 // Software is furnished to do so, subject to the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be included
19 // in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 marek 1.1 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29 //////////////////////////////////////////////////////////////////////////
30 */
31
32 #ifndef pam_rcToAuthStatus_h
33 #define pam_rcToAuthStatus_h
34
35 #include <security/pam_appl.h>
36 #include <Pegasus/Security/Authentication/Linkage.h>
37 #include <Pegasus/Security/Authentication/AuthenticationStatus.h>
38
39 PEGASUS_NAMESPACE_BEGIN
40
41 static AuthenticationStatus _getAuthStatusFromPAM_RC(int pam_rc)
42 {
43 marek 1.1 enum AuthenticationStatusCode authCode;
44
45 switch (pam_rc)
46 {
47 case PAM_SUCCESS:
48 {
49 authCode = AUTHSC_SUCCESS;
50 break;
51 }
52 case PAM_NEW_AUTHTOK_REQD:
53 {
54 authCode = AUTHSC_PASSWORD_CHG_REQUIRED;
55 break;
56 }
57 case PAM_ACCT_EXPIRED:
58 {
59 authCode = AUTHSC_ACCOUNT_EXPIRED;
60 break;
61 }
62 case PAM_AUTH_ERR:
63 case PAM_USER_UNKNOWN:
64 marek 1.1 {
65 authCode = AUTHSC_UNAUTHORIZED;
66 break;
67 }
68 case PAM_CRED_UNAVAIL:
69 {
70 authCode = AUTHSC_NO_ROLE_DEFINED_FOR_USER;
71 break;
72 }
73 case PAM_CRED_EXPIRED:
74 {
75 authCode = AUTHSC_PASSWORD_EXPIRED;
76 break;
77 }
78 case PAM_AUTHTOK_LOCK_BUSY:
79 {
80 authCode = AUTHSC_AUTHTOK_LOCKED;
81 break;
82 }
83 case PAM_CRED_INSUFFICIENT:
84 {
85 marek 1.1 authCode = AUTHSC_CRED_INSUFFICIENT;
86 break;
87 }
88 case PAM_SERVICE_ERR:
89 case PAM_SYSTEM_ERR:
90 {
91 authCode = AUTHSC_SERVICE_ERR;
92 break;
93 }
94 case PAM_AUTHINFO_UNAVAIL:
95 {
96 authCode = AUTHSC_SERVICE_UNAVAILABLE;
97 break;
98 }
99 default:
100 {
101 authCode = AUTHSC_UNAUTHORIZED;
102 }
103 }
104 return AuthenticationStatus(authCode);
105 }
106 marek 1.1
107 PEGASUS_NAMESPACE_END
108
109 #endif /* pam_rcToAuthStatus_h */
|