1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

adding group parsing: add/modify/delete/add members.

This commit is contained in:
Luke Leighton 0001-01-01 00:00:00 +00:00
parent 74f826af36
commit 13a656b0e5
4 changed files with 248 additions and 103 deletions

View File

@ -1836,8 +1836,8 @@ or it is a member of a domain using link(bf("security = domain"))(security),
the latter format can be used: the default Domain name is the Samba Server's
Domain name, specified by link(bf("workgroup = MYGROUP"))(workgroup).
Any UNIX groups that are em(NOT) specified in this map file are assumed
to be Domain Groups, but it depends on the role of the Samba Server.
Any UNIX groups that are em(NOT) specified in this map file are assumed to
be either Local or Domain Groups, depending on the role of the Samba Server.
In the case when Samba is an bf(EXPERIMENTAL) Domain Controller, Samba
will present em(ALL) such unspecified UNIX groups as its own NT Domain
@ -2007,7 +2007,7 @@ In the case when Samba is an bf(EXPERIMENTAL) Domain Controller, Samba
will present em(ALL) such unspecified UNIX users as its own NT Domain
Users, with the same name.
In the case where Samba is member of a domain using
In the case where Samba is a member of a domain using
link(bf("security = domain"))(security), Samba will check the UNIX name with
its Domain Controller (see link(bf("password server"))(passwordserver))
as if it was an NT Domain User. If the Domain Controller says that it is not,
@ -2782,7 +2782,7 @@ the latter format can be used: the default Domain name is the Samba Server's
Domain name, specified by link(bf("workgroup = MYGROUP"))(workgroup).
Any UNIX groups that are em(NOT) specified in this map file are treated
as Local Groups depending on the role of the Samba Server.
as either Local or Domain Groups depending on the role of the Samba Server.
In the case when Samba is an bf(EXPERIMENTAL) Domain Controller, Samba
will present em(ALL) unspecified UNIX groups as its own NT Domain

View File

@ -1609,9 +1609,9 @@ BOOL do_samr_open_domain(struct cli_state *cli,
POLICY_HND *domain_pol);
BOOL do_samr_query_unknown_12(struct cli_state *cli,
POLICY_HND *pol, uint32 rid, uint32 num_gids, uint32 *gids,
uint32 *num_aliases,
fstring als_names [MAX_LOOKUP_SIDS],
uint32 num_als_users[MAX_LOOKUP_SIDS]);
uint32 *num_names,
fstring names[MAX_LOOKUP_SIDS],
uint32 type [MAX_LOOKUP_SIDS]);
BOOL do_samr_query_useraliases(struct cli_state *cli,
POLICY_HND *pol, DOM_SID *sid,
uint32 *num_aliases, uint32 *rid);
@ -2053,6 +2053,26 @@ void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept
void make_samr_group_info4(GROUP_INFO4 *gr4, char *acct_desc);
void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth);
void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth);
void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e,
POLICY_HND *pol,
char *acct_desc);
void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth);
void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol,
uint32 rid, uint32 status);
void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth);
void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e,
POLICY_HND *pol,
uint32 rid);
void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth);
void make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol,
uint32 status);
void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth);
void make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e,
POLICY_HND *pol, GROUP_INFO_CTR *ctr);
void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth);
void make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u,
uint32 status);
void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth);
void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e,
POLICY_HND *pol,
uint16 switch_level);
@ -2115,7 +2135,7 @@ void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u,
uint32 num_gids, uint32 *gid);
void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth);
void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u,
uint32 num_aliases, fstring *als_name, uint8 *num_als_usrs,
uint32 num_names, fstring *name, uint8 *type,
uint32 status);
void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth);
void make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd);

View File

@ -2,9 +2,9 @@
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
Copyright (C) Andrew Tridgell 1992-1997
Copyright (C) Luke Kenneth Casson Leighton 1996-1997
Copyright (C) Paul Ashton 1997
Copyright (C) Andrew Tridgell 1992-1998
Copyright (C) Luke Kenneth Casson Leighton 1996-1998
Copyright (C) Paul Ashton 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -695,8 +695,6 @@ typedef struct r_samr_query_dispinfo_info
} SAMR_R_QUERY_DISPINFO;
#define SAMR_CREATE_DOM_GROUP 0x0a
/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
typedef struct q_samr_create_dom_group_info
{

View File

@ -2,9 +2,9 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Andrew Tridgell 1992-1998,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
* Copyright (C) Paul Ashton 1997-1998.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1284,93 +1284,6 @@ void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, i
}
#if 0
/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
typedef struct q_samr_create_dom_group_info
{
POLICY_HND pol; /* policy handle */
UNIHDR hdr_acct_desc;
UNISTR2 uni_acct_desc;
uint16 unknown_1; /* 0x0002 */
uint16 unknown_2; /* 0x0001 */
} SAMR_Q_CREATE_DOM_GROUP;
/* SAMR_R_CREATE_DOM_GROUP - SAM create group */
typedef struct r_samr_create_dom_group_info
{
POLICY_HND pol; /* policy handle */
uint32 rid;
uint32 status;
} SAMR_R_CREATE_DOM_GROUP;
/* SAMR_Q_SET_GROUPINFO - SAM Group Info */
typedef struct q_samr_set_group_info
{
POLICY_HND pol; /* policy handle */
uint16 switch_value1; /* 0x0004 seen */
uint16 switch_value2; /* 0x0004 seen */
union
{
GROUP_INFO4 info4;
} group;
} SAMR_Q_SET_GROUPINFO;
/* SAMR_R_SET_GROUPINFO - SAM Group Info */
typedef struct r_samr_set_group_info
{
uint32 status;
} SAMR_R_SET_GROUPINFO;
/* SAMR_Q_ADD_GROUPMEM - probably an add group member */
typedef struct q_samr_add_group_mem_info
{
POLICY_HND pol; /* policy handle */
uint32 rid; /* rid */
uint32 unknown; /* 0x0000 0005 */
} SAMR_Q_ADD_GROUPMEM;
/* SAMR_R_ADD_GROUPMEM - probably an add group member */
typedef struct r_samr_add_group_mem_info
{
uint32 status; /* return status */
} SAMR_R_ADD_GROUPMEM;
/* SAMR_Q_OPEN_GROUP - probably an open */
typedef struct q_samr_open_group_info
{
POLICY_HND domain_pol;
uint32 unknown; /* 0x0000 0001, 0x0000 0003, 0x0000 001f */
uint32 rid_group; /* rid */
} SAMR_Q_OPEN_GROUP;
/* SAMR_R_OPEN_GROUP - probably an open */
typedef struct r_samr_open_group_info
{
POLICY_HND pol; /* policy handle */
uint32 status; /* return status */
} SAMR_R_OPEN_GROUP;
#endif
/*******************************************************************
makes a GROUP_INFO1 structure.
********************************************************************/
@ -1487,6 +1400,220 @@ void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int d
}
/*******************************************************************
makes a SAMR_Q_CREATE_DOM_GROUP structure.
********************************************************************/
void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e,
POLICY_HND *pol,
char *acct_desc)
{
int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
if (q_e == NULL || pol == NULL) return;
DEBUG(5,("make_samr_q_create_dom_group\n"));
memcpy(&(q_e->pol), pol, sizeof(*pol));
make_uni_hdr(&(q_e->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len);
q_e->unknown_1 = 0x0002;
q_e->unknown_2 = 0x0001;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth)
{
if (q_e == NULL) return;
prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
depth++;
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
prs_align(ps);
smb_io_unihdr ("hdr_acct_desc", &(q_e->hdr_acct_desc), ps, depth);
smb_io_unistr2("uni_acct_desc", &(q_e->uni_acct_desc), q_e->hdr_acct_desc.buffer, ps, depth);
prs_align(ps);
prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1));
prs_uint16("unknown_2", ps, depth, &(q_e->unknown_2));
}
/*******************************************************************
makes a SAMR_R_CREATE_DOM_GROUP structure.
********************************************************************/
void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol,
uint32 rid, uint32 status)
{
if (r_u == NULL) return;
DEBUG(5,("make_samr_r_create_dom_group\n"));
memcpy(&(r_u->pol), pol, sizeof(*pol));
r_u->rid = rid ;
r_u->status = status;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
depth++;
prs_align(ps);
smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
prs_align(ps);
prs_uint32("rid ", ps, depth, &(r_u->rid ));
prs_uint32("status", ps, depth, &(r_u->status));
}
/*******************************************************************
makes a SAMR_Q_ADD_GROUPMEM structure.
********************************************************************/
void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e,
POLICY_HND *pol,
uint32 rid)
{
if (q_e == NULL || pol == NULL) return;
DEBUG(5,("make_samr_q_add_groupmem\n"));
memcpy(&(q_e->pol), pol, sizeof(*pol));
q_e->rid = rid;
q_e->unknown = 0x0005;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth)
{
if (q_e == NULL) return;
prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
depth++;
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
prs_align(ps);
prs_uint32("rid ", ps, depth, &(q_e->rid));
prs_uint32("unknown", ps, depth, &(q_e->unknown));
}
/*******************************************************************
makes a SAMR_R_ADD_GROUPMEM structure.
********************************************************************/
void make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol,
uint32 status)
{
if (r_u == NULL) return;
DEBUG(5,("make_samr_r_add_groupmem\n"));
r_u->status = status;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
depth++;
prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
}
/*******************************************************************
makes a SAMR_Q_SET_GROUPINFO structure.
********************************************************************/
void make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e,
POLICY_HND *pol, GROUP_INFO_CTR *ctr)
{
if (q_e == NULL || pol == NULL) return;
DEBUG(5,("make_samr_q_set_groupinfo\n"));
memcpy(&(q_e->pol), pol, sizeof(*pol));
q_e->ctr = ctr;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth)
{
if (q_e == NULL) return;
prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
depth++;
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
prs_align(ps);
samr_group_info_ctr("ctr", q_e->ctr, ps, depth);
}
/*******************************************************************
makes a SAMR_R_SET_GROUPINFO structure.
********************************************************************/
void make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u,
uint32 status)
{
if (r_u == NULL) return;
DEBUG(5,("make_samr_r_set_groupinfo\n"));
r_u->status = status;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
depth++;
prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
}
/*******************************************************************
makes a SAMR_Q_QUERY_GROUPINFO structure.
********************************************************************/