]>
Commit | Line | Data |
---|---|---|
7cac2b65 | 1 | /* $Id$ */ |
2 | ||
d03f4262 | 3 | /* |
4 | * | |
5 | * Copyright (c) 2001 Gert Doering. 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 THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
d03f4262 | 26 | */ |
d832c38e | 27 | |
d03f4262 | 28 | #ifdef _AIX |
bfe49944 | 29 | |
dfddba3d | 30 | #ifdef HAVE_SYS_SOCKET_H |
31 | # include <sys/socket.h> | |
32 | #endif | |
33 | #ifdef HAVE_UNISTD_H | |
34 | # include <unistd.h> /* for seteuid() */ | |
35 | #endif | |
36 | ||
7cac2b65 | 37 | #ifdef WITH_AIXAUTHENTICATE |
38 | # include <login.h> | |
39 | # include <userpw.h> | |
29d88157 | 40 | # if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG) |
29e017c1 | 41 | # undef T_NULL |
7cac2b65 | 42 | # include <sys/audit.h> |
43 | # endif | |
29d88157 | 44 | # include <usersec.h> |
7cac2b65 | 45 | #endif |
46 | ||
dfddba3d | 47 | #include "buffer.h" |
48 | ||
49 | /* These should be in the system headers but are not. */ | |
50 | int usrinfo(int, char *, int); | |
51 | int setauthdb(const char *, char *); | |
52 | /* these may or may not be in the headers depending on the version */ | |
53 | #if (HAVE_DECL_AUTHENTICATE == 0) | |
54 | int authenticate(char *, char *, int *, char **); | |
55 | #endif | |
56 | #if (HAVE_DECL_LOGINFAILED == 0) | |
57 | int loginfailed(char *, char *, char *); | |
58 | #endif | |
59 | #if (HAVE_DECL_LOGINRESTRICTIONS == 0) | |
60 | int loginrestrictions(char *, int, char *, char **); | |
61 | #endif | |
62 | #if (HAVE_DECL_LOGINSUCCESS == 0) | |
63 | int loginsuccess(char *, char *, char *, char **); | |
64 | #endif | |
65 | #if (HAVE_DECL_PASSWDEXPIRED == 0) | |
66 | int passwdexpired(char *, char **); | |
67 | #endif | |
68 | ||
7cac2b65 | 69 | /* Some versions define r_type in the above headers, which causes a conflict */ |
70 | #ifdef r_type | |
71 | # undef r_type | |
72 | #endif | |
73 | ||
bfe49944 | 74 | /* AIX 4.2.x doesn't have nanosleep but does have nsleep which is equivalent */ |
75 | #if !defined(HAVE_NANOSLEEP) && defined(HAVE_NSLEEP) | |
76 | # define nanosleep(a,b) nsleep(a,b) | |
77 | #endif | |
78 | ||
79 | /* For struct timespec on AIX 4.2.x */ | |
80 | #ifdef HAVE_SYS_TIMERS_H | |
81 | # include <sys/timers.h> | |
82 | #endif | |
83 | ||
540d72c3 | 84 | /* |
85 | * According to the setauthdb man page, AIX password registries must be 15 | |
86 | * chars or less plus terminating NUL. | |
87 | */ | |
88 | #ifdef HAVE_SETAUTHDB | |
89 | # define REGISTRY_SIZE 16 | |
90 | #endif | |
91 | ||
92 | void aix_usrinfo(struct passwd *); | |
93 | ||
7cac2b65 | 94 | #ifdef WITH_AIXAUTHENTICATE |
540d72c3 | 95 | # define CUSTOM_SYS_AUTH_PASSWD 1 |
7e82606e | 96 | # define CUSTOM_SYS_AUTH_ALLOWED_USER 1 |
dfddba3d | 97 | int sys_auth_allowed_user(struct passwd *, Buffer *); |
7e82606e | 98 | # define CUSTOM_SYS_AUTH_RECORD_LOGIN 1 |
dfddba3d | 99 | int sys_auth_record_login(const char *, const char *, const char *, Buffer *); |
7cac2b65 | 100 | # define CUSTOM_FAILED_LOGIN 1 |
7cac2b65 | 101 | #endif |
102 | ||
540d72c3 | 103 | void aix_setauthdb(const char *); |
104 | void aix_restoreauthdb(void); | |
7cac2b65 | 105 | void aix_remove_embedded_newlines(char *); |
dfddba3d | 106 | |
107 | #if defined(AIX_GETNAMEINFO_HACK) && !defined(BROKEN_GETADDRINFO) | |
108 | # ifdef getnameinfo | |
109 | # undef getnameinfo | |
110 | # endif | |
111 | int sshaix_getnameinfo(const struct sockaddr *, size_t, char *, size_t, | |
112 | char *, size_t, int); | |
113 | # define getnameinfo(a,b,c,d,e,f,g) (sshaix_getnameinfo(a,b,c,d,e,f,g)) | |
114 | #endif | |
115 | ||
d832c38e | 116 | #endif /* _AIX */ |