Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
32
cde/lib/pam/pam_modules/rhosts_auth/Imakefile
Normal file
32
cde/lib/pam/pam_modules/rhosts_auth/Imakefile
Normal file
@@ -0,0 +1,32 @@
|
||||
/* $XConsortium: Imakefile /main/4 1996/04/21 19:13:11 drk $
|
||||
*
|
||||
* (c) Copyright 1996 Digital Equipment Corporation.
|
||||
* (c) Copyright 1996 Hewlett-Packard Company.
|
||||
* (c) Copyright 1996 International Business Machines Corp.
|
||||
* (c) Copyright 1995,1996 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1996 Novell, Inc.
|
||||
* (c) Copyright 1996 FUJITSU LIMITED.
|
||||
* (c) Copyright 1996 Hitachi.
|
||||
*/
|
||||
|
||||
#define DoNormalLib NormalLibPam
|
||||
#define DoSharedLib SharedLibPam
|
||||
#define DoDebugLib DebugLibPam
|
||||
#define DoProfileLib ProfileLibPam
|
||||
#define LibName pam_rhosts_auth
|
||||
#define SoRev SOPAMREV
|
||||
#define LibHeaders NO
|
||||
|
||||
#include <Threads.tmpl>
|
||||
|
||||
SRCS = rhosts_auth.c
|
||||
|
||||
OBJS = rhosts_auth.o
|
||||
|
||||
#ifdef SharedPamRhostsAuthReqs
|
||||
REQUIREDLIBS = SharedPamRhostsAuthReqs
|
||||
#endif
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
DependTarget()
|
||||
18
cde/lib/pam/pam_modules/rhosts_auth/libpam_rhosts_auth.elist
Normal file
18
cde/lib/pam/pam_modules/rhosts_auth/libpam_rhosts_auth.elist
Normal file
@@ -0,0 +1,18 @@
|
||||
/****************************************************************************
|
||||
* Export list for libpam_rhosts_auth.
|
||||
* This list *must* be updated whenever a change is made to the
|
||||
* libpam_rhosts_auth API.
|
||||
*
|
||||
* The syntax for the symbol declarations in this list is as follows:
|
||||
* public sym => Public C symbol, i.e., publicised API
|
||||
* private sym => Private C symbol, i.e., unpublicised API
|
||||
* internal sym => Internal C symbol, i.e., not part of API
|
||||
* publicC++ sym => Public C++ symbol, i.e., publicised API
|
||||
* privateC++ sym => Private C++ symbol, i.e., unpublicised API
|
||||
* internalC++ sym => Internal C++ symbol, i.e., not part of API
|
||||
*
|
||||
* $TOG: libpam_rhosts_auth.elist /main/1 1999/09/08 15:59:05 mgreess $
|
||||
*****************************************************************************/
|
||||
|
||||
public pam_sm_authenticate
|
||||
public pam_sm_setcred
|
||||
83
cde/lib/pam/pam_modules/rhosts_auth/rhosts_auth.c
Normal file
83
cde/lib/pam/pam_modules/rhosts_auth/rhosts_auth.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/* $XConsortium: rhosts_auth.c /main/5 1996/05/09 04:29:04 drk $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992-1995, by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ident "@(#)rhosts_auth.c 1.19 96/02/02 SMI"
|
||||
|
||||
#include "unix_headers.h"
|
||||
|
||||
/*
|
||||
* pam_sm_auth_netuser - Checks if the user is allowed remote access
|
||||
*/
|
||||
|
||||
int
|
||||
pam_sm_authenticate(
|
||||
pam_handle_t *pamh,
|
||||
int flags,
|
||||
int argc,
|
||||
const char **argv)
|
||||
{
|
||||
char *host = NULL, *lusername = NULL;
|
||||
struct passwd pwd;
|
||||
char pwd_buffer[1024];
|
||||
int is_superuser;
|
||||
char *rusername;
|
||||
int err;
|
||||
int i;
|
||||
int debug = 0;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (strcasecmp(argv[i], "debug") == 0)
|
||||
debug = 1;
|
||||
else
|
||||
syslog(LOG_DEBUG, "illegal option %s", argv[i]);
|
||||
}
|
||||
|
||||
if (pam_get_item(pamh, PAM_USER, (void **) &lusername) != PAM_SUCCESS)
|
||||
return (PAM_SERVICE_ERR);
|
||||
if (pam_get_item(pamh, PAM_RHOST, (void **) &host) != PAM_SUCCESS)
|
||||
return (PAM_SERVICE_ERR);
|
||||
if (pam_get_item(pamh, PAM_RUSER, (void **)&rusername) != PAM_SUCCESS)
|
||||
return (PAM_SERVICE_ERR);
|
||||
|
||||
if (debug) {
|
||||
syslog(LOG_DEBUG,
|
||||
"rhosts authenticate: user = %s, host = %s",
|
||||
lusername, host);
|
||||
}
|
||||
|
||||
if (getpwnam_r(lusername, &pwd, pwd_buffer, sizeof (pwd_buffer))
|
||||
== NULL)
|
||||
return (PAM_USER_UNKNOWN);
|
||||
|
||||
/*
|
||||
* RHOST may not be set due to unknown USER or reset by previous
|
||||
* authentication failure.
|
||||
*/
|
||||
if ((rusername == NULL) || (rusername[0] == '\0'))
|
||||
return (PAM_AUTH_ERR);
|
||||
|
||||
if (pwd.pw_uid == 0)
|
||||
is_superuser = 1;
|
||||
else
|
||||
is_superuser = 0;
|
||||
|
||||
return (ruserok(host, is_superuser, rusername, lusername)
|
||||
== -1 ? PAM_AUTH_ERR : PAM_SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* dummy pam_sm_setcred - does nothing
|
||||
*/
|
||||
pam_sm_setcred(
|
||||
pam_handle_t *pamh,
|
||||
int flags,
|
||||
int argc,
|
||||
const char **argv)
|
||||
{
|
||||
return (PAM_SUCCESS);
|
||||
}
|
||||
69
cde/lib/pam/pam_modules/rhosts_auth/unix_headers.h
Normal file
69
cde/lib/pam/pam_modules/rhosts_auth/unix_headers.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* $XConsortium: unix_headers.h /main/4 1996/05/09 04:29:21 drk $ */
|
||||
/*
|
||||
* Copyright (c) 1992-1995, by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _UNIX_HEADERS_H
|
||||
#define _UNIX_HEADERS_H
|
||||
|
||||
#pragma ident "@(#)unix_headers.h 1.6 96/02/02 SMI" /* PAM 2.6 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
******************************************************************
|
||||
|
||||
PROPRIETARY NOTICE(Combined)
|
||||
|
||||
This source code is unpublished proprietary information
|
||||
constituting, or derived under license from AT&T's UNIX(r) System V.
|
||||
In addition, portions of such source code were derived from Berkeley
|
||||
4.3 BSD under license from the Regents of the University of
|
||||
California.
|
||||
|
||||
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Notice of copyright on this source code product does not indicate
|
||||
publication.
|
||||
|
||||
(c) 1986, 1987, 1988, 1989, 1990, 1991, 1992 Sun Microsystems, Inc
|
||||
(c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T.
|
||||
All rights reserved.
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************** *
|
||||
* *
|
||||
* Unix Scheme Header Files *
|
||||
* *
|
||||
* ******************************************************************** */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_modules.h>
|
||||
#include <pwd.h>
|
||||
#include <shadow.h>
|
||||
#include <string.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/auth.h>
|
||||
#include <locale.h>
|
||||
#include <crypt.h>
|
||||
#include <syslog.h>
|
||||
|
||||
/*
|
||||
* Miscellaneous constants
|
||||
*/
|
||||
#define ROOTUID 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _UNIX_HEADERS_H */
|
||||
Reference in New Issue
Block a user