/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This module provides the interface to the built-in privilege names
* and id's. NT privileges are known on the network using strings. Each
* system assigns locally unique identifiers (LUID) for use within the
* system. Each built-in privilege also has a display-name, which is a
* short description of the privilege. The functions here provide an
* interface to map between LUIDs, names and display names.
*/
#include <string.h>
#include <syslog.h>
#include <smbsrv/smb_privilege.h>
/*
* Table of built-in privilege id's, names and display strings. This
* table matches the response from an NT4.0 PDC LSARPC service.
* Requests for values 0 and 1 return STATUS_NO_SUCH_PRIVILEGE.
*
* SE_UNSOLICITED_INPUT_NAME/SeUnsolicitedInputPrivilege is defined in
* winnt.h but doesn't appear in the list reported by the NT4.0 LSA.
*/
{ 0, "", "", 0 },
{ 1, "", "", 0 },
{ 9, SE_TAKE_OWNERSHIP_NAME,
"Take ownership of files or other objects", PF_PRESENTABLE },
{ 22, SE_SYSTEM_ENVIRONMENT_NAME,
"Modify firmware environment values", 0 },
{ 24, SE_REMOTE_SHUTDOWN_NAME,
"Force shutdown from a remote system", 0 }
};
/*
* smb_priv_presentable_num
*
* Returns number of presentable privileges
*/
int
{
int i, num;
num = 0;
for (i = SE_MIN_LUID; i <= SE_MAX_LUID; i++)
num++;
return (num);
}
/*
* smb_priv_presentable_ids
*
* Returns IDs of presentable privileges
* Returns 0 in case of invalid parameter and 1 on success.
*/
int
{
int i, j;
return (0);
for (i = SE_MIN_LUID, j = 0; i <= SE_MAX_LUID; i++)
return (1);
}
/*
* smb_priv_getbyvalue
*
* Return the privilege info for the specified id (low part of the LUID).
* Returns a null pointer if id is out-of-range.
*/
{
return (0);
return (&priv_table[id]);
}
/*
* smb_priv_getbyname
*
* Return the privilege info for the specified name. Returns a null
* pointer if we can't find a matching name in the table.
*/
{
int i;
if (name == 0)
return (0);
for (i = SE_MIN_LUID; i <= SE_MAX_LUID; ++i) {
entry = &priv_table[i];
return (entry);
}
return (0);
}
/*
* smb_privset_size
*
* Returns the memory block size needed to keep a complete
* set of privileges in a smb_privset_t structure.
*/
int
{
return (2 * sizeof (uint32_t) +
pcnt * sizeof (smb_luid_attrs_t));
}
/*
* smb_privset_validate
*
* Validates the given privilege set structure
* Returns 1 if the structure is Ok, otherwise returns 0.
*/
int
{
int count;
uint32_t i;
if (privset == 0) {
return (0);
}
return (0);
}
for (i = 0; i < count; i++) {
return (0);
}
i + SE_MIN_LUID) {
return (0);
}
}
return (1);
}
/*
* smb_privset_init
*
* initialize all privileges in disable state.
*/
void
{
int count;
uint32_t i;
if (privset == 0)
return;
for (i = 0; i < count; i++) {
}
}
/*
* smb_privset_new
*
* Allocate memory and initialize all privileges in disable state.
* Returns pointer to allocated space or NULL if there is not
* enough memory.
*/
{
return (NULL);
return (privset);
}
/*
* smb_privset_copy
*
* Copy privleges information specified by 'src' to the
* buffer specified by dst.
*/
void
{
return;
}
/*
* smb_privset_merge
*
* Enable the privileges that are enabled in src in dst
*/
void
{
int i;
return;
}
}
/*
* smb_privset_free
*
* This will free the memory allocated by the 'privset'.
*/
void
{
}
void
{
int i;
return;
}
}
void
{
int i, ecnt;
return;
ecnt++;
}
}
}
}
}
int
{
int i;
return (0);
return (1);
else
return (0);
}
}
return (0);
}
static char *
{
return ("Unknown Privilege");
}