port-aix.h revision 149749
1149749Sdes/* $Id: port-aix.h,v 1.26 2005/05/28 10:28:40 dtucker Exp $ */
2124208Sdes
3106121Sdes/*
4106121Sdes *
5106121Sdes * Copyright (c) 2001 Gert Doering.  All rights reserved.
6149749Sdes * Copyright (c) 2004, 2005 Darren Tucker.  All rights reserved.
7106121Sdes *
8106121Sdes * Redistribution and use in source and binary forms, with or without
9106121Sdes * modification, are permitted provided that the following conditions
10106121Sdes * are met:
11106121Sdes * 1. Redistributions of source code must retain the above copyright
12106121Sdes *    notice, this list of conditions and the following disclaimer.
13106121Sdes * 2. Redistributions in binary form must reproduce the above copyright
14106121Sdes *    notice, this list of conditions and the following disclaimer in the
15106121Sdes *    documentation and/or other materials provided with the distribution.
16106121Sdes *
17106121Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18106121Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19106121Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20106121Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21106121Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22106121Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23106121Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24106121Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25106121Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26106121Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27106121Sdes */
28106121Sdes
2998937Sdes#ifdef _AIX
30113908Sdes
31146998Sdes#ifdef HAVE_SYS_SOCKET_H
32146998Sdes# include <sys/socket.h>
33146998Sdes#endif
34146998Sdes#ifdef HAVE_UNISTD_H
35146998Sdes# include <unistd.h>	/* for seteuid() */
36146998Sdes#endif
37146998Sdes
38124208Sdes#ifdef WITH_AIXAUTHENTICATE
39124208Sdes# include <login.h>
40124208Sdes# include <userpw.h>
41124208Sdes# if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG)
42124208Sdes#  include <sys/audit.h>
43124208Sdes# endif
44124208Sdes# include <usersec.h>
45124208Sdes#endif
46124208Sdes
47146998Sdes#include "buffer.h"
48146998Sdes
49146998Sdes/* These should be in the system headers but are not. */
50146998Sdesint usrinfo(int, char *, int);
51149749Sdes#if defined(HAVE_DECL_SETAUTHDB) && (HAVE_DECL_SETAUTHDB == 0)
52146998Sdesint setauthdb(const char *, char *);
53147001Sdes#endif
54146998Sdes/* these may or may not be in the headers depending on the version */
55149749Sdes#if defined(HAVE_DECL_AUTHENTICATE) && (HAVE_DECL_AUTHENTICATE == 0)
56146998Sdesint authenticate(char *, char *, int *, char **);
57146998Sdes#endif
58149749Sdes#if defined(HAVE_DECL_LOGINFAILED) && (HAVE_DECL_LOGINFAILED == 0)
59146998Sdesint loginfailed(char *, char *, char *);
60146998Sdes#endif
61149749Sdes#if defined(HAVE_DECL_LOGINRESTRICTIONS) && (HAVE_DECL_LOGINRESTRICTIONS == 0)
62146998Sdesint loginrestrictions(char *, int, char *, char **);
63146998Sdes#endif
64149749Sdes#if defined(HAVE_DECL_LOGINSUCCESS) && (HAVE_DECL_LOGINSUCCESS == 0)
65146998Sdesint loginsuccess(char *, char *, char *, char **);
66146998Sdes#endif
67149749Sdes#if defined(HAVE_DECL_PASSWDEXPIRED) && (HAVE_DECL_PASSWDEXPIRED == 0)
68146998Sdesint passwdexpired(char *, char **);
69146998Sdes#endif
70146998Sdes
71124208Sdes/* Some versions define r_type in the above headers, which causes a conflict */
72124208Sdes#ifdef r_type
73124208Sdes# undef r_type
74124208Sdes#endif
75124208Sdes
76113908Sdes/* AIX 4.2.x doesn't have nanosleep but does have nsleep which is equivalent */
77113908Sdes#if !defined(HAVE_NANOSLEEP) && defined(HAVE_NSLEEP)
78113908Sdes# define nanosleep(a,b) nsleep(a,b)
79113908Sdes#endif
80113908Sdes
81113908Sdes/* For struct timespec on AIX 4.2.x */
82113908Sdes#ifdef HAVE_SYS_TIMERS_H
83113908Sdes# include <sys/timers.h>
84113908Sdes#endif
85113908Sdes
86126274Sdes/*
87126274Sdes * According to the setauthdb man page, AIX password registries must be 15
88126274Sdes * chars or less plus terminating NUL.
89126274Sdes */
90126274Sdes#ifdef HAVE_SETAUTHDB
91126274Sdes# define REGISTRY_SIZE	16
92126274Sdes#endif
93126274Sdes
94126274Sdesvoid aix_usrinfo(struct passwd *);
95126274Sdes
96124208Sdes#ifdef WITH_AIXAUTHENTICATE
97126274Sdes# define CUSTOM_SYS_AUTH_PASSWD 1
98137015Sdes# define CUSTOM_SYS_AUTH_ALLOWED_USER 1
99146998Sdesint sys_auth_allowed_user(struct passwd *, Buffer *);
100137015Sdes# define CUSTOM_SYS_AUTH_RECORD_LOGIN 1
101146998Sdesint sys_auth_record_login(const char *, const char *, const char *, Buffer *);
102124208Sdes# define CUSTOM_FAILED_LOGIN 1
103124208Sdes#endif
104124208Sdes
105126274Sdesvoid aix_setauthdb(const char *);
106126274Sdesvoid aix_restoreauthdb(void);
107124208Sdesvoid aix_remove_embedded_newlines(char *);
108146998Sdes
109146998Sdes#if defined(AIX_GETNAMEINFO_HACK) && !defined(BROKEN_GETADDRINFO)
110146998Sdes# ifdef getnameinfo
111146998Sdes#  undef getnameinfo
112146998Sdes# endif
113146998Sdesint sshaix_getnameinfo(const struct sockaddr *, size_t, char *, size_t,
114146998Sdes    char *, size_t, int);
115146998Sdes# define getnameinfo(a,b,c,d,e,f,g) (sshaix_getnameinfo(a,b,c,d,e,f,g))
116146998Sdes#endif
117146998Sdes
11898937Sdes#endif /* _AIX */
119