summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-05-14 03:58:49 +0000
committerTim Potter <tpot@samba.org>2001-05-14 03:58:49 +0000
commit5bcd434e6e1e5c5ab4d567e2a4c2bdaf4806ff1f (patch)
treeabed68c8e4fc26fb2f95f384313f7270e7d573b6
parentc24bf6d8ab293ec449659ea6b128a246f0dcb281 (diff)
downloadsamba-5bcd434e6e1e5c5ab4d567e2a4c2bdaf4806ff1f.tar.gz
samba-5bcd434e6e1e5c5ab4d567e2a4c2bdaf4806ff1f.tar.bz2
samba-5bcd434e6e1e5c5ab4d567e2a4c2bdaf4806ff1f.zip
Compile fixes for dynamic samr_query_userinfo() stuff.
(This used to be commit a92a0d061bd322b9d3a1fe13c6ce2d2e1f070ef7)
-rw-r--r--source3/libsmb/cli_samr.c5
-rw-r--r--source3/nsswitch/winbindd_glue.c15
-rw-r--r--source3/nsswitch/winbindd_proto.h8
-rw-r--r--source3/nsswitch/winbindd_sid.c5
-rw-r--r--source3/nsswitch/winbindd_user.c18
-rw-r--r--source3/nsswitch/winbindd_util.c2
6 files changed, 16 insertions, 37 deletions
diff --git a/source3/libsmb/cli_samr.c b/source3/libsmb/cli_samr.c
index 538574f437..a33474d1c1 100644
--- a/source3/libsmb/cli_samr.c
+++ b/source3/libsmb/cli_samr.c
@@ -320,7 +320,7 @@ uint32 cli_samr_open_group(struct cli_state *cli, TALLOC_CTX *mem_ctx,
uint32 cli_samr_query_userinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *user_pol, uint16 switch_value,
- SAM_USERINFO_CTR *ctr)
+ SAM_USERINFO_CTR **ctr)
{
prs_struct qbuf, rbuf;
SAMR_Q_QUERY_USERINFO q;
@@ -346,8 +346,6 @@ uint32 cli_samr_query_userinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Unmarshall response */
- r.ctr = ctr;
-
if (!samr_io_r_query_userinfo("", &r, &rbuf, 0)) {
goto done;
}
@@ -355,6 +353,7 @@ uint32 cli_samr_query_userinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Return output parameters */
result = r.status;
+ *ctr = r.ctr;
done:
prs_mem_free(&qbuf);
diff --git a/source3/nsswitch/winbindd_glue.c b/source3/nsswitch/winbindd_glue.c
index ac48ae1013..3c789d5a7c 100644
--- a/source3/nsswitch/winbindd_glue.c
+++ b/source3/nsswitch/winbindd_glue.c
@@ -254,17 +254,6 @@ BOOL wb_samr_open_domain(CLI_POLICY_HND *connect_pol, uint32 ace_perms,
return False;
}
-/*******************************************************************
-frees a structure.
-********************************************************************/
-void wb_free_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr)
-{
- if (ctr == NULL)
- return;
- safe_free(ctr->info.id);
- ctr->info.id = NULL;
-}
-
/****************************************************************************
do a SAMR enumerate groups
****************************************************************************/
@@ -281,10 +270,10 @@ uint32 wb_samr_enum_dom_groups(CLI_POLICY_HND *pol, uint32 *start_idx,
}
/****************************************************************************
-do a SAMR enumerate groups
+do a SAMR query userinfo
****************************************************************************/
BOOL wb_get_samr_query_userinfo(CLI_POLICY_HND *pol, uint32 info_level,
- uint32 user_rid, SAM_USERINFO_CTR *ctr)
+ uint32 user_rid, SAM_USERINFO_CTR **ctr)
{
POLICY_HND user_pol;
BOOL got_user_pol = False;
diff --git a/source3/nsswitch/winbindd_proto.h b/source3/nsswitch/winbindd_proto.h
index 6e03ec842f..11a3bc4f86 100644
--- a/source3/nsswitch/winbindd_proto.h
+++ b/source3/nsswitch/winbindd_proto.h
@@ -121,7 +121,7 @@ BOOL winbindd_lookup_sid_by_name(char *name, DOM_SID *sid,
BOOL winbindd_lookup_name_by_sid(DOM_SID *sid, fstring name,
enum SID_NAME_USE *type);
BOOL winbindd_lookup_userinfo(struct winbindd_domain *domain,
- uint32 user_rid, SAM_USERINFO_CTR *user_info);
+ uint32 user_rid, SAM_USERINFO_CTR **user_info);
BOOL winbindd_lookup_usergroups(struct winbindd_domain *domain,
uint32 user_rid, uint32 *num_groups,
DOM_GID **user_groups);
@@ -131,10 +131,6 @@ BOOL winbindd_lookup_groupmem(struct winbindd_domain *domain,
uint32 group_rid, uint32 *num_names,
uint32 **rid_mem, char ***names,
enum SID_NAME_USE **name_types);
-int winbindd_lookup_aliasmem(struct winbindd_domain *domain,
- uint32 alias_rid, uint32 *num_names,
- DOM_SID ***sids, char ***names,
- enum SID_NAME_USE **name_types);
struct winbindd_domain *find_domain_from_name(char *domain_name);
struct winbindd_domain *find_domain_from_sid(DOM_SID *sid);
void free_getent_state(struct getent_state *state);
@@ -146,4 +142,4 @@ uint32 winbindd_query_dispinfo(struct winbindd_domain *domain,
uint32 *num_entries, SAM_DISPINFO_CTR *ctr);
BOOL check_domain_env(char *domain_env, char *domain);
void parse_domain_user(char *domuser, fstring domain, fstring user);
-#endif /* _WINBINDD_PROTO_H_ */
+#endif /* _PROTO_H_ */
diff --git a/source3/nsswitch/winbindd_sid.c b/source3/nsswitch/winbindd_sid.c
index e426dd588e..bc014f2691 100644
--- a/source3/nsswitch/winbindd_sid.c
+++ b/source3/nsswitch/winbindd_sid.c
@@ -30,7 +30,7 @@ enum winbindd_result winbindd_lookupsid(struct winbindd_cli_state *state)
{
extern DOM_SID global_sid_Builtin;
enum SID_NAME_USE type;
- DOM_SID sid;
+ DOM_SID sid, tmp_sid;
uint32 rid;
fstring name;
@@ -43,7 +43,8 @@ enum winbindd_result winbindd_lookupsid(struct winbindd_cli_state *state)
/* Don't look up BUILTIN sids */
- sid_peek_rid(&sid, &rid);
+ sid_copy(&tmp_sid, &sid);
+ sid_split_rid(&tmp_sid, &rid);
if (sid_equal(&tmp_sid, &global_sid_Builtin)) {
return WINBINDD_ERROR;
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index 43227b9dc1..30416e76d7 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -95,7 +95,7 @@ enum winbindd_result winbindd_getpwnam_from_user(struct winbindd_cli_state
*state)
{
uint32 name_type, user_rid, group_rid;
- SAM_USERINFO_CTR user_info;
+ SAM_USERINFO_CTR *user_info;
DOM_SID user_sid;
fstring name_domain, name_user, name, gecos_name;
struct winbindd_domain *domain;
@@ -157,20 +157,16 @@ enum winbindd_result winbindd_getpwnam_from_user(struct winbindd_cli_state
/* The following costs 3 packets */
- ZERO_STRUCT(user_info);
-
if (!winbindd_lookup_userinfo(domain, user_rid, &user_info)) {
DEBUG(1, ("pwnam_from_user(): error getting user info for "
"user '%s'\n", name_user));
return WINBINDD_ERROR;
}
- group_rid = user_info.info.id21->group_rid;
- unistr2_to_ascii(gecos_name, &user_info.info.id21->uni_full_name,
+ group_rid = user_info->info.id21->group_rid;
+ unistr2_to_ascii(gecos_name, &user_info->info.id21->uni_full_name,
sizeof(gecos_name) - 1);
- wb_free_samr_userinfo_ctr(&user_info);
-
/* Now take all this information and fill in a passwd structure */
if (!winbindd_fill_pwent(domain->name, state->request.data.username,
@@ -195,7 +191,7 @@ enum winbindd_result winbindd_getpwnam_from_uid(struct winbindd_cli_state
uint32 user_rid, group_rid;
fstring user_name, gecos_name;
enum SID_NAME_USE name_type;
- SAM_USERINFO_CTR user_info;
+ SAM_USERINFO_CTR *user_info;
gid_t gid;
/* Bug out if the uid isn't in the winbind range */
@@ -255,12 +251,10 @@ enum winbindd_result winbindd_getpwnam_from_uid(struct winbindd_cli_state
return WINBINDD_ERROR;
}
- group_rid = user_info.info.id21->group_rid;
- unistr2_to_ascii(gecos_name, &user_info.info.id21->uni_full_name,
+ group_rid = user_info->info.id21->group_rid;
+ unistr2_to_ascii(gecos_name, &user_info->info.id21->uni_full_name,
sizeof(gecos_name) - 1);
- wb_free_samr_userinfo_ctr(&user_info);
-
/* Resolve gid number */
if (!winbindd_idmap_get_gid_from_rid(domain->name, group_rid, &gid)) {
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 6026422c30..4343f859ed 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -581,7 +581,7 @@ BOOL winbindd_lookup_name_by_sid(DOM_SID *sid, fstring name,
/* Lookup user information from a rid */
BOOL winbindd_lookup_userinfo(struct winbindd_domain *domain,
- uint32 user_rid, SAM_USERINFO_CTR *user_info)
+ uint32 user_rid, SAM_USERINFO_CTR **user_info)
{
return wb_get_samr_query_userinfo(&domain->sam_dom_handle, 0x15,
user_rid, user_info);