smb_wksids.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
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
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#pragma ident "%Z%%M% %I% %E% SMI"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This module provides the interface to builtin domain information.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * These are the predefined groups and aliases in the NT AUTHORITY or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * BUILTIN domains, and some other miscellaneous bits.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This table should contain all of the NT builtin domain names.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstatic char *domain[] = {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw "BUILTIN",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw "NT AUTHORITY",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstatic int wk_init = 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This table should contain all of the builtin domains, groups and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * aliases. The order is important because we do string compares on
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the SIDs. For each domain, ensure that the domain SID appears
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * before any aliases in that domain.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw { SidTypeWellKnownGroup, 1, "S-1-3-2", "CREATOR OWNER SERVER",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw { SidTypeWellKnownGroup, 1, "S-1-3-3", "CREATOR GROUP SERVER",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw { SidTypeWellKnownGroup, 2, "S-1-5-11", "Authenticated Users",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, "Members can fully administer the computer/domain", NULL },
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, "Members can bypass file security to back up files", NULL },
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_lookup_sid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Search the wkt 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.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_lookup_name
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Search the wkt 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.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_lookup
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Search the wkt 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.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_is_wellknown
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Search the wkt looking for a match on the specified name. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * name matches a builtin entry returns 1. Otherwise returns 0.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_lookup_domain
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Return the builtin domain name for the specified alias or group name.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_findfirst
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Returns pointer to the first entry of well known sids table.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (&wkt[0]);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_findnext
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Returns pointer to the entry of well known sids table specified
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * by the iterator. Increments iterator to point to the next entry.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * nt_builtin_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);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (wk_init == 0) {