#include <sys/mount.h>
#include <grp.h>
#include <shadow.h>

#ifdef	SECURITY
#ifndef	SYS_MLS_H
#include "sys/mls.h"
#endif	/* !SYS_MLS_H */
#endif	/* SECURITY */

static struct spwd *shpwd;	/* Shadow password structure */
struct	usrauth *ua;
struct spwd *getspnam();
int setpwent();
int shad_flag=1;


#ifdef SECURITY
	setpwent();
	if (access(SHADOW,0) == 0) {
		shad_flag = 1;
		setspent();
		if (!(shpwd = getspnam("root"))) 
		  if (shpwd->sp_lock ) 
		{
	          LP_ERRMSG1(ERROR, E_LP_DENYPRM, "root");
	          err_exit();
		}
	} else shad_flag = 0;

	if (access(USRAUTH,0) == 0) 
	  if (!(ua = getuanam("root")))  
		{
	          LP_ERRMSG1(ERROR, E_LP_DENYPRM, "root");
	          err_exit();
		}
	else
	{ setmac(&ua->ua_label);
	  setpriv(&ua->ua_priv);
	}

	if (((pw = getpwnam("root")) == NULL) ||
			(shad_flag && (shpwd = getspnam("root")) == NULL) ||
			(shad_flag && (shpwd->sp_lock > 0)) 
			) 
		{
	          LP_ERRMSG1(ERROR, E_LP_DENYPRM, "root");
	          err_exit();
		}

	if (shad_flag) endspent();	/* Closing the shadow password file */
	endpwent();
#else
		pw=getpwnam("root");
#endif

#ifdef	SECURITY
	if ( (!isprived("PRIV_SA", uid))
#else	/* SECURITY */
		(uid != RUid) 
#endif

