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