smb_wksids.c revision 89dc44ce9705974a8bc4a39f1e878a0491a5be61
/*
* 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.
*/
#include <stdlib.h>
#include <string.h>
#include <synch.h>
static int wk_init = 0;
static char *wka_nbdomain[] = {
"",
"NT Pseudo Domain",
"NT Authority",
"Builtin",
"Internet$",
};
/*
* Predefined well known accounts table
*/
{ 0, "S-1-0-0", "Null",
{ 0, "S-1-1-0", "Everyone",
{ 0, "S-1-2-0", "Local",
{ 0, "S-1-3-0", "Creator Owner",
{ 0, "S-1-3-1", "Creator Group",
{ 0, "S-1-3-2", "Creator Owner Server",
{ 0, "S-1-3-3", "Creator Group Server",
{ 0, "S-1-3-4", "Owner Rights",
{ 1, "S-1-5", "NT Pseudo Domain",
{ 2, "S-1-5-1", "Dialup",
{ 2, "S-1-5-2", "Network",
{ 2, "S-1-5-3", "Batch",
{ 2, "S-1-5-4", "Interactive",
{ 2, "S-1-5-6", "Service",
{ 2, "S-1-5-7", "Anonymous",
{ 2, "S-1-5-8", "Proxy",
{ 2, "S-1-5-9", "Enterprise Domain Controllers",
{ 2, "S-1-5-10", "Self",
{ 2, "S-1-5-11", "Authenticated Users",
{ 2, "S-1-5-12", "Restricted",
{ 2, "S-1-5-13", "Terminal Server User",
{ 2, "S-1-5-14", "Remote Interactive Logon",
{ 2, "S-1-5-15", "This Organization",
{ 2, "S-1-5-18", "System",
{ 2, "S-1-5-19", "Local Service",
{ 2, "S-1-5-20", "Network Service",
{ 2, "S-1-5-33", "Write Restricted",
{ 2, "S-1-5-1000", "Other Organization",
{ 3, "S-1-5-32", "Builtin",
{ 4, "S-1-7", "Internet$",
{ 3, "S-1-5-32-545", "Users",
{ 3, "S-1-5-32-546", "Guests",
{ 3, "S-1-5-32-548", "Account Operators",
{ 3, "S-1-5-32-549", "Server Operators",
{ 3, "S-1-5-32-550", "Print Operators",
"Members can bypass file security to back up files", NULL },
{ 3, "S-1-5-32-552", "Replicator",
};
/*
* smb_wka_lookup_sid
*
* Search the wka_tbl looking for a match on the specified SID. If the
* SID matches a builtin entry, the associated name is returned.
* Otherwise a null pointer is returned.
*/
char *
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
if (sid_name_use)
}
}
return (NULL);
}
/*
* smb_wka_lookup_name
*
* Search the wka_tbl looking for a match on the specified name. If the
* name matches a builtin entry, the associated SID (which is in
* malloc'd memory) is returned. Otherwise a null pointer is returned.
*/
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
if (sid_name_use)
}
}
return (NULL);
}
/*
* smb_wka_lookup
*
* Search the wka_tbl looking for a match on the specified name. If the
* name matches a builtin entry then pointer to that entry will be
* returned. Otherwise 0 is returned.
*/
smb_wka_lookup(char *name)
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
return (entry);
}
}
return (NULL);
}
/*
* smb_wka_is_wellknown
*
* Search the wka_tbl looking for a match on the specified name. If the
* name matches a builtin entry returns 1. Otherwise returns 0.
*/
smb_wka_is_wellknown(char *name)
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
return (B_TRUE);
}
return (B_FALSE);
}
/*
* smb_wka_lookup_domain
*
* Return the builtin domain name for the specified alias or group name.
*/
char *
smb_wka_lookup_domain(char *name)
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
}
return (NULL);
}
/*
* Returns the Netbios domain name for the given index
*/
char *
smb_wka_get_domain(int idx)
{
return (wka_nbdomain[idx]);
return (NULL);
}
/*
* smb_wka_init
*
* Generate binary SIDs from the string SIDs in the table
* and set the proper field.
*
* Caller MUST not store the binary SID pointer anywhere that
* could lead to freeing it.
*
* This function should only be called once.
*/
int
smb_wka_init(void)
{
int i;
if (wk_init) {
return (1);
}
for (i = 0; i < SMB_WKA_NUM; ++i) {
smb_wka_fini();
return (0);
}
}
wk_init = 1;
return (1);
}
void
smb_wka_fini(void)
{
int i;
if (wk_init == 0) {
return;
}
for (i = 0; i < SMB_WKA_NUM; ++i) {
if (wka_tbl[i].wka_binsid) {
}
}
wk_init = 0;
}