smb_wksids.c revision 89dc44ce9705974a8bc4a39f1e878a0491a5be61
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstatic int wk_init = 0;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregostatic char *wka_nbdomain[] = {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego "NT Pseudo Domain",
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego "NT Authority",
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego "Internet$",
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * Predefined well known accounts table
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego { 2, "S-1-5-9", "Enterprise Domain Controllers",
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego { 3, "S-1-5-32-544", "Administrators", SidTypeAlias,
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas "Members can fully administer the computer/domain", NULL },
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego { 3, "S-1-5-32-547", "Power Users", SidTypeAlias,
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas SMB_WKAFLG_LGRP_ENABLE, "Members can share directories", NULL },
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego { 3, "S-1-5-32-551", "Backup Operators", SidTypeAlias,
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas "Members can bypass file security to back up files", NULL },
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas#define SMB_WKA_NUM (sizeof (wka_tbl)/sizeof (wka_tbl[0]))
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * smb_wka_lookup_sid
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * Search the wka_tbl looking for a match on the specified SID. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SID matches a builtin entry, the associated name is returned.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Otherwise a null pointer is returned.
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eassmb_wka_lookup_sid(smb_sid_t *sid, uint16_t *sid_name_use)
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * smb_wka_lookup_name
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * Search the wka_tbl looking for a match on the specified name. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * name matches a builtin entry, the associated SID (which is in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * malloc'd memory) is returned. Otherwise a null pointer is returned.
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * smb_wka_lookup
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * Search the wka_tbl looking for a match on the specified name. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * name matches a builtin entry then pointer to that entry will be
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * returned. Otherwise 0 is returned.
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * smb_wka_is_wellknown
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * Search the wka_tbl looking for a match on the specified name. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * name matches a builtin entry returns 1. Otherwise returns 0.
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * smb_wka_lookup_domain
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Return the builtin domain name for the specified alias or group name.
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * Returns the Netbios domain name for the given index
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas * smb_wka_init
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Generate binary SIDs from the string SIDs in the table
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and set the proper field.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Caller MUST not store the binary SID pointer anywhere that
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * could lead to freeing it.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This function should only be called once.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (wk_init == 0) {
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas for (i = 0; i < SMB_WKA_NUM; ++i) {