private.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/****************************************************************************
Copyright (c) 1999,2000 WU-FTPD Development Group.
All rights reserved.
Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994
The Regents of the University of California.
Portions Copyright (c) 1993, 1994 Washington University in Saint Louis.
Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc.
Portions Copyright (c) 1989 Massachusetts Institute of Technology.
Portions Copyright (c) 1998 Sendmail, Inc.
Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman.
Portions Copyright (c) 1997 by Stan Barber.
Portions Copyright (c) 1997 by Kent Landfield.
Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
Free Software Foundation, Inc.
Use and distribution of this software and its source code are governed
by the terms and conditions of the WU-FTPD Software License ("LICENSE").
If you did not receive a copy of the license, it may be obtained online
$Id: private.c,v 1.12 2000/07/01 18:17:39 wuftpd Exp $
****************************************************************************/
#include "config.h"
#ifndef NO_PRIVATE
#include <stdio.h>
#include <errno.h>
extern char *strsep(char **, const char *);
#include <string.h>
#ifdef HAVE_SYS_SYSLOG_H
#endif
#include <syslog.h>
#endif
#include <grp.h>
#ifdef HAVE_PATHS_H
#include <paths.h>
#endif
#include "pathnames.h"
#include "extensions.h"
#include "proto.h"
#ifdef SECUREOSF
#define SecureWare /* Does this mean it works for all SecureWare? */
#endif
#ifdef HPUX_10_TRUSTED
#include <hpsecurity.h>
#endif
#if defined(SecureWare) || defined(HPUX_10_TRUSTED)
#include <prot.h>
#endif
#ifndef NO_CRYPT_PROTO
extern char *crypt(const char *, const char *);
#endif
static int group_attempts, group_given;
struct acgrp {
char *gname; /* access group name */
char *gpass; /* access group password */
};
extern int lgi_failure_threshold;
extern char remoteident[];
{
dologout(1);
}
/* add element to end of list */
if (privtail)
if (!privptr)
dologout(1);
}
else
dologout(1);
}
}
static void parsepriv(void)
{
char *ptr;
int n;
return;
/* read through passbuf, stripping comments. */
while (*acptr != '\0') {
acptr++;
*acptr++ = '\0';
/* deal with comments */
*ptr = '\0';
if (*line == '\0')
continue;
/* parse the lines... */
}
/* check their were 3 fields, if not skip the line... */
if (n != 3 || p != NULL)
continue;
}
else {
}
endgrent();
}
}
}
/*************************************************************************/
/* FUNCTION : priv_setup */
/* PURPOSE : Set things up to use the private access password file. */
/* ARGUMENTS : path, the path to the private access password file */
/*************************************************************************/
void priv_setup(char *path)
{
while (privptr) {
}
if (passbuf) {
}
return;
}
return;
}
}
else {
return;
}
return;
}
}
(void) parsepriv();
}
/*************************************************************************/
/* FUNCTION : priv_getent */
/* PURPOSE : Retrieve an entry from the in-memory copy of the group */
/* access file. */
/* ARGUMENTS : pointer to group name */
/*************************************************************************/
{
return (ptr);
return (NULL);
}
/*************************************************************************/
/* FUNCTION : priv_group */
/* PURPOSE : */
/* ARGUMENTS : */
/*************************************************************************/
void priv_group(char *group)
{
if (groupname)
dologout(1);
}
group_given = 1;
}
/*************************************************************************/
/* FUNCTION : priv_gpass */
/* PURPOSE : validate the group access request, and if OK place user */
/* in the proper group. */
/* ARGUMENTS : group access password */
/*************************************************************************/
void priv_gpass(char *gpass)
{
if (group_given == 0) {
return;
}
/* OK, now they're getting a chance to specify a password. Make them
* give the group name again if they fail... */
group_given = 0;
#if defined(SecureWare) || defined(HPUX_10_TRUSTED)
#else
#endif
&& (*gpass != '\0')
|| (*gpass == '\0'))
)) {
if (++group_attempts >= lgi_failure_threshold) {
"repeated group access failures from %s, group %s",
dologout(0);
}
return;
}
setid_priv_on(0);
group_attempts = 0;
}
#endif /* !NO_PRIVATE */