mlsvc_util.h revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SMBSRV_MLSVC_UTIL_H
#define _SMBSRV_MLSVC_UTIL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* MLSVC RPC interface and utility function definitions.
*/
#include <smbsrv/smb_token.h>
#ifndef _KERNEL
#include <stdio.h>
#include <string.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Predefined global RIDs.
*/
#define MLSVC_DOMAIN_GROUP_RID_ADMINS 0x00000200L
#define MLSVC_DOMAIN_GROUP_RID_USERS 0x00000201L
#define MLSVC_DOMAIN_GROUP_RID_GUESTS 0x00000202L
#define MLSVC_DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
#define MLSVC_DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
#define MLSVC_DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
#define MLSVC_DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
/*
* Predefined local alias RIDs.
*/
#define MLSVC_LOCAL_GROUP_RID_ADMINS 0x00000220L
#define MLSVC_LOCAL_GROUP_RID_USERS 0x00000221L
#define MLSVC_LOCAL_GROUP_RID_GUESTS 0x00000222L
#define MLSVC_LOCAL_GROUP_RID_POWER_USERS 0x00000223L
#define MLSVC_LOCAL_GROUP_RID_ACCOUNT_OPS 0x00000224L
#define MLSVC_LOCAL_GROUP_RID_SERVER_OPS 0x00000225L
#define MLSVC_LOCAL_GROUP_RID_PRINT_OPS 0x00000226L
#define MLSVC_LOCAL_GROUP_RID_BACKUP_OPS 0x00000227L
#define MLSVC_LOCAL_GROUP_RID_REPLICATOR 0x00000228L
/*
* All predefined local group RIDs belong
* to a special domain called BUILTIN.
*/
#define MLSVC_BUILTIN_DOMAIN_NAME "BUILTIN"
#define MLSVC_BUILTIN_DOMAIN_SIDSTRLEN 8
/*
* Universal and NT well-known SIDs
*/
#define MLSVC_NULL_SIDSTR "S-1-0-0"
#define MSLVC_WORLD_SIDSTR "S-1-1-0"
#define MSLVC_LOCAL_SIDSTR "S-1-2-0"
#define MSLVC_CREATOR_OWNER_ID_SIDSTR "S-1-3-0"
#define MSLVC_CREATOR_GROUP_ID_SIDSTR "S-1-3-1"
#define MSLVC_CREATOR_OWNER_SERVER_ID_SIDSTR "S-1-3-2"
#define MSLVC_CREATOR_GROUP_SERVER_ID_SIDSTR "S-1-3-3"
#define MSLVC_NON_UNIQUE_IDS_SIDSTR "S-1-4"
#define MLSVC_NT_AUTHORITY_SIDSTR "S-1-5"
#define MLSVC_DIALUP_SIDSTR "S-1-5-1"
#define MLSVC_NETWORK_SIDSTR "S-1-5-2"
#define MLSVC_BATCH_SIDSTR "S-1-5-3"
#define MLSVC_INTERACTIVE_SIDSTR "S-1-5-4"
#define MLSVC_SERVICE_SIDSTR "S-1-5-6"
#define MLSVC_ANONYMOUS_LOGON_SIDSTR "S-1-5-7"
#define MLSVC_PROXY_SIDSTR "S-1-5-8"
#define MLSVC_SERVER_LOGON_SIDSTR "S-1-5-9"
#define MLSVC_SELF_SIDSTR "S-1-5-10"
#define MLSVC_AUTHENTICATED_USER_SIDSTR "S-1-5-11"
#define MLSVC_RESTRICTED_CODE_SIDSTR "S-1-5-12"
#define MLSVC_NT_LOCAL_SYSTEM_SIDSTR "S-1-5-18"
#define MLSVC_NT_NON_UNIQUE_SIDSTR "S-1-5-21"
#define MLSVC_BUILTIN_DOMAIN_SIDSTR "S-1-5-32"
smb_userinfo_t *mlsvc_alloc_user_info(void);
char *mlsvc_sid_name_use(unsigned int snu_id);
/*
* The definition of a local unique id (LUID). This is an opaque id
* used by servers to identify local resources, such as privileges.
* A client will use lookup functions to translate the LUID to a
* more general, machine independent form; like a string.
*/
struct ms_luid {
};
/*
* As with SIDs, this is the generic, interface independent string
* definition.
*/
struct ms_string_desc {
};
typedef struct ms_string_desc ms_string_t;
/*
* This is the generic, interface independent handle definition.
*/
typedef struct ms_handle {
} ms_handle_t;
/*
* List of interface specifications: can be used to identify the
* sub-system to which a handle is assigned. The handle management
* library doesn't check or care about the ifspec value.
*/
typedef enum ms_ifspec {
} ms_ifspec_t;
#define MLSVC_HANDLE_KEY_MAX 32
typedef struct ms_handle_desc {
struct ms_handle_desc *next;
char key[MLSVC_HANDLE_KEY_MAX];
/*
* The mlsvc_rpc_context structure provides the connection binding context
* for client RPC calls. This space must be provided by the client library
* for use by the underlying RPC library. Note that we need two binding
* pools per connection.
*/
#define CTXT_N_BINDING_POOL 2
struct mlsvc_rpc_context {
struct mlrpc_client cli;
int fid;
int server_os;
int server_pdc;
struct mlrpc_binding *binding;
};
/*
* Each RPC interface requires a context and each RPC call within that
* interface requires a handle. Handles are call specific, however, so
* a number of different handles may be used during a sequence of calls
* to a specific RPC interface. Contexts are interface specific so
* there is one per interface per thread of execution. This structure
* provides a handle to context relationship so that we know which
* context to use with any particular handle.
*
* The context contains a pointer to the top level handle for the
* interface, which is assigned during the bind. It's used when closing
* to detect when to free the context.
*
* I know this is really tacky but the elements in the descriptor are
* arranged so that a handle can be overlaid directly onto a descriptor.
* I probably won't do this but now you know - just in case you see it
* in the code.
*/
typedef struct mlsvc_rpc_desc {
struct mlsvc_rpc_context *context;
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_MLSVC_UTIL_H */