smb_wksids.c revision 7f667e74610492ddbce8ce60f52ece95d2401949
/*
* 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",
};
/*
* Looks up well known accounts table for the given SID.
* Upon success returns a pointer to the account entry in
* the table, otherwise returns NULL.
*/
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
return (entry);
}
}
return (NULL);
}
/*
* Looks up well known accounts table for the given name.
* Upon success returns a pointer to the binary SID of the
* entry, otherwise returns NULL.
*/
smb_wka_get_sid(char *name)
{
return (sid);
}
/*
* Looks up well known accounts table for the given name.
* Upon success returns a pointer to the account entry in
* the table, otherwise returns NULL.
*/
smb_wka_lookup_name(char *name)
{
int i;
for (i = 0; i < SMB_WKA_NUM; ++i) {
return (entry);
}
}
return (NULL);
}
/*
* Returns the Netbios domain name for the given index
*/
char *
smb_wka_get_domain(int idx)
{
return (wka_nbdomain[idx]);
return (NULL);
}
{
static char *grps[] =
{"Authenticated Users", "NETWORK", "Administrators"};
int gcnt, i;
int total_cnt;
return (NT_STATUS_NO_MEMORY);
return (NT_STATUS_NO_MEMORY);
}
return (NT_STATUS_SUCCESS);
}
/*
* 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;
}