~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source3/passdb/pdb_wbc_sam.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:
37
37
 */
38
38
 
39
39
#include "includes.h"
 
40
#include "passdb.h"
 
41
#include "lib/winbind_util.h"
40
42
 
41
43
/***************************************************************************
42
44
  Default implementations of some functions.
50
52
        if (pwd == NULL)
51
53
                return NT_STATUS_NO_SUCH_USER;
52
54
 
53
 
        memset(user, 0, sizeof(user));
 
55
        ZERO_STRUCTP(user);
54
56
 
55
57
        /* Can we really get away with this little of information */
56
58
        user->methods = methods;
64
66
        return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwnam(sname));
65
67
}
66
68
 
67
 
static NTSTATUS pdb_wbc_sam_getsampwsid(struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
 
69
static NTSTATUS pdb_wbc_sam_getsampwsid(struct pdb_methods *methods, struct samu *user, const struct dom_sid *sid)
68
70
{
69
71
        return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwsid(sid));
70
72
}
71
73
 
72
74
static bool pdb_wbc_sam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
73
 
                                   DOM_SID *sid)
 
75
                                   struct dom_sid *sid)
74
76
{
75
77
        return winbind_uid_to_sid(sid, uid);
76
78
}
77
79
 
78
80
static bool pdb_wbc_sam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
79
 
                                   DOM_SID *sid)
 
81
                                   struct dom_sid *sid)
80
82
{
81
83
        return winbind_gid_to_sid(sid, gid);
82
84
}
83
85
 
84
86
static NTSTATUS pdb_wbc_sam_enum_group_members(struct pdb_methods *methods,
85
87
                                               TALLOC_CTX *mem_ctx,
86
 
                                               const DOM_SID *group,
 
88
                                               const struct dom_sid *group,
87
89
                                               uint32 **pp_member_rids,
88
90
                                               size_t *p_num_members)
89
91
{
93
95
static NTSTATUS pdb_wbc_sam_enum_group_memberships(struct pdb_methods *methods,
94
96
                                                   TALLOC_CTX *mem_ctx,
95
97
                                                   struct samu *user,
96
 
                                                   DOM_SID **pp_sids,
 
98
                                                   struct dom_sid **pp_sids,
97
99
                                                   gid_t **pp_gids,
98
 
                                                   size_t *p_num_groups)
 
100
                                                   uint32_t *p_num_groups)
99
101
{
100
102
        size_t i;
101
103
        const char *username = pdb_get_username(user);
110
112
                smb_panic("primary group missing");
111
113
        }
112
114
 
113
 
        *pp_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, *p_num_groups);
 
115
        *pp_sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, *p_num_groups);
114
116
 
115
117
        if (*pp_sids == NULL) {
116
118
                TALLOC_FREE(*pp_gids);
125
127
}
126
128
 
127
129
static NTSTATUS pdb_wbc_sam_lookup_rids(struct pdb_methods *methods,
128
 
                                        const DOM_SID *domain_sid,
 
130
                                        const struct dom_sid *domain_sid,
129
131
                                        int num_rids,
130
132
                                        uint32 *rids,
131
133
                                        const char **names,
185
187
 
186
188
static bool pdb_wbc_sam_search_aliases(struct pdb_methods *methods,
187
189
                                       struct pdb_search *search,
188
 
                                       const DOM_SID *sid)
 
190
                                       const struct dom_sid *sid)
189
191
{
190
192
 
191
193
        return false;
194
196
static bool pdb_wbc_sam_get_trusteddom_pw(struct pdb_methods *methods,
195
197
                                          const char *domain,
196
198
                                          char **pwd,
197
 
                                          DOM_SID *sid,
 
199
                                          struct dom_sid *sid,
198
200
                                          time_t *pass_last_set_time)
199
201
{
200
202
        return false;
204
206
static bool pdb_wbc_sam_set_trusteddom_pw(struct pdb_methods *methods,
205
207
                                          const char *domain,
206
208
                                          const char *pwd,
207
 
                                          const DOM_SID *sid)
 
209
                                          const struct dom_sid *sid)
208
210
{
209
211
        return false;
210
212
}
223
225
        return NT_STATUS_NOT_IMPLEMENTED;
224
226
}
225
227
 
226
 
static bool _make_group_map(struct pdb_methods *methods, const char *domain, const char *name, enum lsa_SidType name_type, gid_t gid, DOM_SID *sid, GROUP_MAP *map)
 
228
static bool _make_group_map(struct pdb_methods *methods, const char *domain, const char *name, enum lsa_SidType name_type, gid_t gid, struct dom_sid *sid, GROUP_MAP *map)
227
229
{
228
230
        snprintf(map->nt_name, sizeof(map->nt_name), "%s%c%s",
229
231
                domain, *lp_winbind_separator(), name);
234
236
}
235
237
 
236
238
static NTSTATUS pdb_wbc_sam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
237
 
                                 DOM_SID sid)
 
239
                                 struct dom_sid sid)
238
240
{
239
241
        NTSTATUS result = NT_STATUS_OK;
240
242
        char *name = NULL;
278
280
        NTSTATUS result = NT_STATUS_OK;
279
281
        char *name = NULL;
280
282
        char *domain = NULL;
281
 
        DOM_SID sid;
 
283
        struct dom_sid sid;
282
284
        enum lsa_SidType name_type;
283
285
 
284
286
        if (!winbind_gid_to_sid(&sid, gid)) {
317
319
{
318
320
        NTSTATUS result = NT_STATUS_OK;
319
321
        const char *domain = "";
320
 
        DOM_SID sid;
 
322
        struct dom_sid sid;
321
323
        gid_t gid;
322
324
        enum lsa_SidType name_type;
323
325
 
350
352
}
351
353
 
352
354
static NTSTATUS pdb_wbc_sam_enum_group_mapping(struct pdb_methods *methods,
353
 
                                           const DOM_SID *sid, enum lsa_SidType sid_name_use,
 
355
                                           const struct dom_sid *sid, enum lsa_SidType sid_name_use,
354
356
                                           GROUP_MAP **pp_rmap, size_t *p_num_entries,
355
357
                                           bool unix_only)
356
358
{
358
360
}
359
361
 
360
362
static NTSTATUS pdb_wbc_sam_get_aliasinfo(struct pdb_methods *methods,
361
 
                                   const DOM_SID *sid,
 
363
                                   const struct dom_sid *sid,
362
364
                                   struct acct_info *info)
363
365
{
364
366
        return NT_STATUS_NOT_IMPLEMENTED;
365
367
}
366
368
 
367
369
static NTSTATUS pdb_wbc_sam_enum_aliasmem(struct pdb_methods *methods,
368
 
                                          const DOM_SID *alias,
 
370
                                          const struct dom_sid *alias,
369
371
                                          TALLOC_CTX *mem_ctx,
370
 
                                          DOM_SID **pp_members,
 
372
                                          struct dom_sid **pp_members,
371
373
                                          size_t *p_num_members)
372
374
{
373
375
        return NT_STATUS_NOT_IMPLEMENTED;
375
377
 
376
378
static NTSTATUS pdb_wbc_sam_alias_memberships(struct pdb_methods *methods,
377
379
                                       TALLOC_CTX *mem_ctx,
378
 
                                       const DOM_SID *domain_sid,
379
 
                                       const DOM_SID *members,
 
380
                                       const struct dom_sid *domain_sid,
 
381
                                       const struct dom_sid *members,
380
382
                                       size_t num_members,
381
383
                                       uint32 **pp_alias_rids,
382
384
                                       size_t *p_num_alias_rids)