Files
mars-nwe/include/nwnss/internal/unixAuthModel.h

173 lines
5.1 KiB
C

/****************************************************************************
|
| (C) Copyright 2003 Novell, Inc.
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of version 2 of the GNU General Public
| License as published by the Free Software Foundation.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, contact Novell, Inc.
|
| To contact Novell about this file by physical or electronic mail,
| you may find current contact information at www.novell.com
|
|***************************************************************************
|
| Novell Storage Services (NSS) Initialization module
|
|---------------------------------------------------------------------------
|
| $Author: taysom $
| $Date: 2004-12-31 01:10:58 +0530 (Fri, 31 Dec 2004) $
|
| $RCSfile$
| $Revision: 465 $
|
|---------------------------------------------------------------------------
| This module is used to:
| This module defines the unix authorization system.
+-------------------------------------------------------------------------*/
#ifndef _UXASAUTHMODEL_H_
#define _UXASAUTHMODEL_H_
#ifndef _OMNI_H_
#include <omni.h>
#endif
#ifndef _LATCH_H_
#include <latch.h>
#endif
#ifndef _COMNBEASTS_H_
#include "comnBeasts.h"
#endif
#ifndef _COMNAUTHORIZE_H_
#include "comnAuthorize.h"
#endif
/*-------------------------------------------------------------------------
* Defines
*-------------------------------------------------------------------------*/
#define UXAS_CURRENT_AUTH_VERSION 1
/* Unix mode bit definitions */
#define UX_IXOTH 0x0001 /* other - execute */
#define UX_IWOTH 0x0002 /* other - write */
#define UX_IROTH 0x0004 /* other - read */
#define UX_IXGRP 0x0010 /* group - execute */
#define UX_IWGRP 0x0020 /* group - write */
#define UX_IRGRP 0x0040 /* group - read */
#define UX_IXUSR 0x0100 /* owner - execute */
#define UX_IWUSR 0x0200 /* owner - write */
#define UX_IRUSR 0x0400 /* owner - read */
#define UX_ISVTX 0x1000 /* sticky bit */
#define UX_ISGID 0x2000 /* set group ID on execution */
#define UX_ISUID 0x4000 /* set user ID on execution */
#define UX_IRWXO 0x0007 /* mask for "other" */
#define UX_IRWXG 0x0070 /* mask for "group" */
#define UX_IRWXU 0x0700 /* mask for "owner" */
#define UX_IX 0x0001 /* execute */
#define UX_IW 0x0002 /* write */
#define UX_IR 0x0004 /* read */
#define UX_IMO 0 /* shift factor for other/world */
#define UX_IMG 4 /* shift factor for group */
#define UX_IMU 8 /* shift factor for user/owner */
/*-------------------------------------------------------------------------
* Macros
*-------------------------------------------------------------------------*/
typedef struct UXASPersistentAuthInfo_s
{ /* this is a space for the z authorization system to use */
WORD version; /* the version of the authorization layout */
WORD extra1; /* alignment space */
LONG mode; /* see above (UX_*) */
UserID_t groupID;
LONG unused[8];
} NSS_MEDIA_STRUCTURE(UXASPersistentAuthInfo_s,unused[8]) UXASPersistentAuthInfo_s;
typedef struct UXASAuthorizeInfo_s
{ /* Unix authorization model */
UXASPersistentAuthInfo_s p;
} UXASAuthorizeInfo_s;
/*-------------------------------------------------------------------------
* Public Structures for the authorization model
*-------------------------------------------------------------------------*/
extern struct AuthModelOps_s UXASAuthorizeModelOps;
extern NINT UXASAuthorizeStarted;
extern NINT UX_InitialMode;
/*-------------------------------------------------------------------------
*
* Function prototypes for the Unix authorization model
*
*-------------------------------------------------------------------------*/
STATUS UXAS_Startup(void);
void UXAS_Shutdown(void);
STATUS UXAUTH_ConstructAuthBeast(
struct GeneralMsg_s *genMsg,
struct AuthBeast_s *authBeast);
void UXAUTH_DestructAuthBeast(
struct AuthBeast_s *authBeast);
NINT UXAUTH_PackedSize(
struct AuthBeast_s *authBeast);
BYTE *UXAUTH_PackAuthBeast(
struct AuthBeast_s *authBeast,
BYTE *storeBuffer);
void UXAUTH_NoPackAuthBeastCleanup(
struct AuthBeast_s *authBeast);
BYTE *UXAUTH_UnpackAuthBeast(
struct GeneralMsg_s *genMsg,
struct AuthBeast_s *authBeast,
BYTE *storeBuffer);
STATUS UXAS_ChangeOwner(
struct GeneralMsg_s *genMsg,
struct NamingMsg_s *nameMsg,
struct AuthBeast_s *beast,
UserID_t *newOwner);
STATUS UXAS_ChangeGroup(
struct AuthBeast_s *beast,
UserID_t *newGroup);
STATUS UXAS_ChangeMode(
struct AuthBeast_s *beast,
NINT mode);
STATUS UXAS_GetAuthInfo(
struct AuthBeast_s *beast,
UserID_t *groupID,
NINT *mode);
void UXAS_StoreIDInGUID(
NINT id,
UserID_t *guid);
NINT UX_GetEffectivePermissions(
struct AuthBeast_s *authBeast,
UserID_t *IDs,
NINT numIDs,
NINT *mode);
#endif /* _ZASAUTHMODL_H_ */