~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/lib/util_builtin.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Unix SMB/CIFS implementation.
 
3
   Translate BUILTIN names to SIDs and vice versa
 
4
   Copyright (C) Volker Lendecke 2005
 
5
 
 
6
   This program is free software; you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 3 of the License, or
 
9
   (at your option) any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
#include "includes.h"
 
21
#include "../libcli/security/security.h"
 
22
 
 
23
struct rid_name_map {
 
24
        uint32 rid;
 
25
        const char *name;
 
26
};
 
27
 
 
28
static const struct rid_name_map builtin_aliases[] = {
 
29
        { BUILTIN_RID_ADMINISTRATORS,           "Administrators" },
 
30
        { BUILTIN_RID_USERS,            "Users" },
 
31
        { BUILTIN_RID_GUESTS,           "Guests" },
 
32
        { BUILTIN_RID_POWER_USERS,      "Power Users" },
 
33
        { BUILTIN_RID_ACCOUNT_OPERATORS,        "Account Operators" },
 
34
        { BUILTIN_RID_SERVER_OPERATORS,         "Server Operators" },
 
35
        { BUILTIN_RID_PRINT_OPERATORS,          "Print Operators" },
 
36
        { BUILTIN_RID_BACKUP_OPERATORS,         "Backup Operators" },
 
37
        { BUILTIN_RID_REPLICATOR,               "Replicator" },
 
38
        { BUILTIN_RID_RAS_SERVERS,              "RAS Servers" },
 
39
        { BUILTIN_RID_PRE_2K_ACCESS,
 
40
                "Pre-Windows 2000 Compatible Access" },
 
41
        { BUILTIN_RID_REMOTE_DESKTOP_USERS,
 
42
                "Remote Desktop Users" },
 
43
        { BUILTIN_RID_NETWORK_CONF_OPERATORS,
 
44
                "Network Configuration Operators" },
 
45
        { BUILTIN_RID_INCOMING_FOREST_TRUST,
 
46
                "Incoming Forest Trust Builders" },
 
47
        { BUILTIN_RID_PERFMON_USERS,
 
48
                "Performance Monitor Users" },
 
49
        { BUILTIN_RID_PERFLOG_USERS,
 
50
                "Performance Log Users" },
 
51
        { BUILTIN_RID_AUTH_ACCESS,
 
52
                "Windows Authorization Access Group" },
 
53
        { BUILTIN_RID_TS_LICENSE_SERVERS,
 
54
                "Terminal Server License Servers" },
 
55
        {  0, NULL}};
 
56
 
 
57
/*******************************************************************
 
58
 Look up a rid in the BUILTIN domain
 
59
 ********************************************************************/
 
60
bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name)
 
61
{
 
62
        const struct rid_name_map *aliases = builtin_aliases;
 
63
 
 
64
        while (aliases->name != NULL) {
 
65
                if (rid == aliases->rid) {
 
66
                        *name = talloc_strdup(mem_ctx, aliases->name);
 
67
                        return True;
 
68
                }
 
69
                aliases++;
 
70
        }
 
71
 
 
72
        return False;
 
73
}
 
74
 
 
75
/*******************************************************************
 
76
 Look up a name in the BUILTIN domain
 
77
 ********************************************************************/
 
78
bool lookup_builtin_name(const char *name, uint32 *rid)
 
79
{
 
80
        const struct rid_name_map *aliases = builtin_aliases;
 
81
 
 
82
        while (aliases->name != NULL) {
 
83
                if (strequal(name, aliases->name)) {
 
84
                        *rid = aliases->rid;
 
85
                        return True;
 
86
                }
 
87
                aliases++;
 
88
        }
 
89
 
 
90
        return False;
 
91
}
 
92
 
 
93
/*****************************************************************
 
94
 Return the name of the BUILTIN domain
 
95
*****************************************************************/
 
96
 
 
97
const char *builtin_domain_name(void)
 
98
{
 
99
        return "BUILTIN";
 
100
}
 
101
 
 
102
/*****************************************************************
 
103
 Check if the SID is the builtin SID (S-1-5-32).
 
104
*****************************************************************/
 
105
 
 
106
bool sid_check_is_builtin(const struct dom_sid *sid)
 
107
{
 
108
        return dom_sid_equal(sid, &global_sid_Builtin);
 
109
}
 
110
 
 
111
/*****************************************************************
 
112
 Check if the SID is one of the builtin SIDs (S-1-5-32-a).
 
113
*****************************************************************/
 
114
 
 
115
bool sid_check_is_in_builtin(const struct dom_sid *sid)
 
116
{
 
117
        struct dom_sid dom_sid;
 
118
 
 
119
        sid_copy(&dom_sid, sid);
 
120
        sid_split_rid(&dom_sid, NULL);
 
121
 
 
122
        return sid_check_is_builtin(&dom_sid);
 
123
}