/*
* 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 2014 Nexenta Systems, Inc. All rights reserved.
*/
#if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <syslog.h>
#else /* !_KERNEL && !_FAKE_KERNEL */
#endif /* !_KERNEL && !_FAKE_KERNEL */
/*
* smb_sid_isvalid
*
* Performs a minimal SID validation.
*/
{
return (B_FALSE);
}
/*
* smb_sid_len
*
* Returns the number of bytes required to hold the sid.
*/
int
{
return (0);
}
/*
* smb_sid_dup
*
* Make a duplicate of the specified sid. The memory for the new sid
* should be freed by calling smb_sid_free().
* A pointer to the new sid is returned.
*/
{
int size;
return (NULL);
return (NULL);
return (new_sid);
}
/*
* smb_sid_splice
*
* Make a full sid from a domain sid and a relative id (rid).
* The memory for the result sid should be freed by calling
* smb_sid_free(). A pointer to the new sid is returned.
*/
{
int size;
if (domain_sid == NULL)
return (NULL);
return (NULL);
++sid->sid_subauthcnt;
return (sid);
}
/*
* smb_sid_getrid
*
* Return the Relative Id (RID) of the specified SID. It is the
* caller's responsibility to ensure that this is an appropriate SID.
* All we do here is return the last sub-authority from the SID.
*/
int
{
(sid->sid_subauthcnt == 0))
return (-1);
return (0);
}
/*
* smb_sid_split
*
* Take a full sid and split it into a domain sid and a relative id (rid).
* The domain SID is allocated and a pointer to it will be returned. The
* RID value is passed back in 'rid' arg if it's not NULL. The allocated
* memory for the domain SID must be freed by caller.
*/
{
int size;
return (NULL);
/*
* We will reduce sid_subauthcnt by one, because
* the domain SID does not include the RID.
*/
return (NULL);
if (rid)
return (domsid);
}
/*
* smb_sid_splitstr
*
* Takes a full sid in string form and split it into a domain sid and a
* relative id (rid).
*
* IMPORTANT: The original sid is modified in place. This function assumes
* given SID is in valid string format.
*/
int
{
char *p;
return (-1);
*p++ = '\0';
if (rid) {
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
unsigned long sua = 0;
#else
#endif
}
return (0);
}
/*
* smb_sid_cmp
*
* Compare two SIDs and return a boolean result. The checks are ordered
* such that components that are more likely to differ are checked
* first. For example, after checking that the SIDs contain the same
* sid_subauthcnt, we check the sub-authorities in reverse order because
* the RID is the most likely differentiator between two SIDs, i.e.
* they are probably going to be in the same domain.
*/
{
int i;
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
return (B_TRUE);
}
/*
* smb_sid_indomain
*
* Check if given SID is in given domain.
*/
{
int i;
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
return (B_TRUE);
}
/*
* smb_sid_tostr
*
* Fill in the passed buffer with the string form of the given
* binary sid.
*/
void
{
char *p = strsid;
int i;
return;
while (*p)
p++;
for (i = 0; i < NT_SID_AUTH_MAX; ++i) {
while (*p)
p++;
}
}
while (*p)
p++;
}
}
/*
* smb_sid_fromstr
*
* Converts a SID in string form to a SID structure. There are lots of
* simplifying assumptions in here. The memory for the SID is allocated
* as if it was the largest possible SID; the caller is responsible for
* freeing the memory when it is no longer required. We assume that the
* string starts with "S-1-" and that the authority is held in the last
* byte, which should be okay for most situations. It also assumes the
* sub-authorities are in decimal format.
*
* On success, a pointer to a SID is returned. Otherwise a null pointer
* is returned.
*/
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
{
const char *p;
int size;
uint8_t i;
unsigned long sua;
return (NULL);
return (NULL);
sua = 0;
while (*p && *p == '-')
++p;
if (*p < '0' || *p > '9') {
return (NULL);
}
sua = 0;
while (*p && *p != '-')
++p;
}
sid->sid_subauthcnt = i;
return (retsid);
}
#else /* _KERNEL */
{
const char *p;
int size;
uint8_t i;
return (NULL);
return (NULL);
return (NULL);
while (*p && *p == '-')
++p;
if (*p < '0' || *p > '9') {
return (NULL);
}
while (*p && *p != '-')
++p;
}
sid->sid_subauthcnt = i;
return (sid);
}
#endif /* _KERNEL */
/*
* smb_sid_type2str
*
* Returns the text name for a SID_NAME_USE value. The SID_NAME_USE
* provides the context for a SID, i.e. the type of resource to which
* it refers.
*/
char *
{
static char *snu_name[] = {
"SidTypeSidPrefix",
"SidTypeUser",
"SidTypeGroup",
"SidTypeDomain",
"SidTypeAlias",
"SidTypeWellKnownGroup",
"SidTypeDeletedAccount",
"SidTypeInvalid",
"SidTypeUnknown",
"SidTypeComputer",
"SidTypeLabel"
};
return (snu_name[SidTypeUnknown]);
}
static smb_sid_t *
{
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
#else
#endif
return (sid);
}
void
{
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
return;
#else
#endif
}