RPC_SAMR_OBJ = rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \
rpc_server/srv_samr_util.o
-RPC_UNIXINFO_OBJ = rpc_server/srv_unixinfo.o rpc_server/srv_unixinfo_nt.o rpc_parse/parse_unixinfo.o
+RPC_UNIXINFO_OBJ = librpc/gen_ndr/srv_unixinfo.o rpc_server/srv_unixinfo_nt.o
REGFIO_OBJ = registry/regfio.o
RPC_REG_OBJ = rpc_server/srv_reg.o rpc_server/srv_reg_nt.o $(REGFIO_OBJ)
#include "rpc_ds.h"
#include "rpc_echo.h"
#include "rpc_shutdown.h"
-#include "rpc_unixinfo.h"
#include "rpc_perfcount.h"
#include "rpc_perfcount_defs.h"
#include "nt_printing.h"
+++ /dev/null
-/*
- Unix SMB/CIFS implementation.
-
- Unixinfo definitions.
-
- Copyright (C) Volker Lendecke 2005
-
- 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _RPC_UNIXINFO_H
-#define _RPC_UNIXINFO_H
-
-#define UNIXINFO_SID_TO_UID 0x00
-#define UNIXINFO_UID_TO_SID 0x01
-#define UNIXINFO_SID_TO_GID 0x02
-#define UNIXINFO_GID_TO_SID 0x03
-#define UNIXINFO_GETPWUID 0x04
-
-typedef struct unixinfo_q_sid_to_uid {
- DOM_SID sid;
-} UNIXINFO_Q_SID_TO_UID;
-
-typedef struct unixinfo_r_sid_to_uid {
- uint64 uid;
- NTSTATUS status;
-} UNIXINFO_R_SID_TO_UID;
-
-typedef struct unixinfo_q_uid_to_sid {
- uint64 uid;
-} UNIXINFO_Q_UID_TO_SID;
-
-typedef struct unixinfo_r_uid_to_sid {
- uint32 sidptr;
- DOM_SID sid;
- NTSTATUS status;
-} UNIXINFO_R_UID_TO_SID;
-
-typedef struct unixinfo_q_sid_to_gid {
- DOM_SID sid;
-} UNIXINFO_Q_SID_TO_GID;
-
-typedef struct unixinfo_r_sid_to_gid {
- uint64 gid;
- NTSTATUS status;
-} UNIXINFO_R_SID_TO_GID;
-
-typedef struct unixinfo_q_gid_to_sid {
- uint64 gid;
-} UNIXINFO_Q_GID_TO_SID;
-
-typedef struct unixinfo_r_gid_to_sid {
- uint32 sidptr;
- DOM_SID sid;
- NTSTATUS status;
-} UNIXINFO_R_GID_TO_SID;
-
-typedef struct unixinfo_q_getpwuid {
- uint32 count;
- uint64 *uid;
-} UNIXINFO_Q_GETPWUID;
-
-struct unixinfo_getpwuid {
- /* name, gid and gecos explicitly excluded, these values can be
- retrieved via other means */
- NTSTATUS status;
- const char *homedir;
- const char *shell;
-};
-
-typedef struct unixinfo_r_getpwuid {
- uint32 count;
- struct unixinfo_getpwuid *info;
- NTSTATUS status;
-} UNIXINFO_R_GETPWUID;
-
-#endif
-/*
- Unix SMB/CIFS implementation.
-
- Unixinfo definitions.
-
- Copyright (C) Volker Lendecke 2005
-
- 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _RPC_UNIXINFO_H
-#define _RPC_UNIXINFO_H
-
-#define UNIXINFO_SID_TO_UID 0x00
-#define UNIXINFO_UID_TO_SID 0x01
-#define UNIXINFO_SID_TO_GID 0x02
-#define UNIXINFO_GID_TO_SID 0x03
-#define UNIXINFO_GETPWUID 0x04
-
-typedef struct unixinfo_q_sid_to_uid {
- DOM_SID sid;
-} UNIXINFO_Q_SID_TO_UID;
-
-typedef struct unixinfo_r_sid_to_uid {
- uint64 uid;
- NTSTATUS status;
-} UNIXINFO_R_SID_TO_UID;
-
-typedef struct unixinfo_q_uid_to_sid {
- uint64 uid;
-} UNIXINFO_Q_UID_TO_SID;
-
-typedef struct unixinfo_r_uid_to_sid {
- uint32 sidptr;
- DOM_SID sid;
- NTSTATUS status;
-} UNIXINFO_R_UID_TO_SID;
-
-typedef struct unixinfo_q_sid_to_gid {
- DOM_SID sid;
-} UNIXINFO_Q_SID_TO_GID;
-
-typedef struct unixinfo_r_sid_to_gid {
- uint64 gid;
- NTSTATUS status;
-} UNIXINFO_R_SID_TO_GID;
-
-typedef struct unixinfo_q_gid_to_sid {
- uint64 gid;
-} UNIXINFO_Q_GID_TO_SID;
-
-typedef struct unixinfo_r_gid_to_sid {
- uint32 sidptr;
- DOM_SID sid;
- NTSTATUS status;
-} UNIXINFO_R_GID_TO_SID;
-
-typedef struct unixinfo_q_getpwuid {
- uint64 uid;
-} UNIXINFO_Q_GETPWUID;
-
-typedef struct unixinfo_r_getpwuid {
- /* name and gid explicitly excluded, these values can be retrieved via
- other means */
- const char *gecos;
- const char *homedir;
- const char *shell;
- NTSTATUS status;
-} UNIXINFO_R_GETPWUID;
-
-#endif
NTSTATUS ndr_push_unixinfo_GetPWUid(struct ndr_push *ndr, int flags, const struct unixinfo_GetPWUid *r)
{
uint32_t cntr_uids_0;
- uint32_t cntr_infos_1;
+ uint32_t cntr_infos_0;
if (flags & NDR_IN) {
if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.count));
if (flags & NDR_OUT) {
if (r->out.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
- if (r->out.infos == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
- for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
- NDR_CHECK(ndr_push_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_1]));
+ for (cntr_infos_0 = 0; cntr_infos_0 < *r->out.count; cntr_infos_0++) {
+ NDR_CHECK(ndr_push_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_0]));
}
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
NTSTATUS ndr_pull_unixinfo_GetPWUid(struct ndr_pull *ndr, int flags, struct unixinfo_GetPWUid *r)
{
uint32_t cntr_uids_0;
- uint32_t cntr_infos_1;
+ uint32_t cntr_infos_0;
TALLOC_CTX *_mem_save_count_0;
TALLOC_CTX *_mem_save_uids_0;
- TALLOC_CTX *_mem_save_infos_1;
+ TALLOC_CTX *_mem_save_infos_0;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uids_0, 0);
NDR_PULL_ALLOC(ndr, r->out.count);
*r->out.count = *r->in.count;
- if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
- NDR_PULL_ALLOC_N(ndr, r->out.infos, *r->in.count);
- memset(r->out.infos, 0, *r->in.count * sizeof(*r->out.infos));
if (r->in.uids) {
if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.uids, *r->in.count));
}
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_array_size(ndr, &r->out.infos));
- if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
- NDR_PULL_ALLOC_N(ndr, r->out.infos, ndr_get_array_size(ndr, &r->out.infos));
- }
- _mem_save_infos_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_ALLOC_N(ndr, r->out.infos, ndr_get_array_size(ndr, &r->out.infos));
+ _mem_save_infos_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.infos, 0);
- for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
- NDR_CHECK(ndr_pull_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_1]));
+ for (cntr_infos_0 = 0; cntr_infos_0 < *r->out.count; cntr_infos_0++) {
+ NDR_CHECK(ndr_pull_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_0]));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_infos_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_infos_0, 0);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
if (r->out.infos) {
if (r->out.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
_PUBLIC_ void ndr_print_unixinfo_GetPWUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GetPWUid *r)
{
uint32_t cntr_uids_0;
- uint32_t cntr_infos_1;
+ uint32_t cntr_infos_0;
ndr_print_struct(ndr, name, "unixinfo_GetPWUid");
ndr->depth++;
if (flags & NDR_SET_VALUES) {
ndr->depth++;
ndr_print_uint32(ndr, "count", *r->out.count);
ndr->depth--;
- ndr_print_ptr(ndr, "infos", r->out.infos);
- ndr->depth++;
ndr->print(ndr, "%s: ARRAY(%d)", "infos", *r->out.count);
ndr->depth++;
- for (cntr_infos_1=0;cntr_infos_1<*r->out.count;cntr_infos_1++) {
- char *idx_1=NULL;
- asprintf(&idx_1, "[%d]", cntr_infos_1);
- if (idx_1) {
- ndr_print_unixinfo_GetPWUidInfo(ndr, "infos", &r->out.infos[cntr_infos_1]);
- free(idx_1);
+ for (cntr_infos_0=0;cntr_infos_0<*r->out.count;cntr_infos_0++) {
+ char *idx_0=NULL;
+ asprintf(&idx_0, "[%d]", cntr_infos_0);
+ if (idx_0) {
+ ndr_print_unixinfo_GetPWUidInfo(ndr, "infos", &r->out.infos[cntr_infos_0]);
+ free(idx_0);
}
}
ndr->depth--;
- ndr->depth--;
ndr_print_NTSTATUS(ndr, "result", r->out.result);
ndr->depth--;
}
return False;
}
+ r.out.exist_flag = talloc_size(mem_ctx, sizeof(*r.out.exist_flag));
+ if (r.out.exist_flag == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
_dfs_GetManagerVersion(p, r.out.exist_flag);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _dfs_GetInfo(p, r.in.path, r.in.server, r.in.share, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
}
r.out.resume_handle = r.in.resume_handle;
+ r.out.privs = talloc_size(mem_ctx, sizeof(*r.out.privs));
+ if (r.out.privs == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumPrivs(p, r.in.handle, r.in.resume_handle, r.in.max_count, r.out.privs);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.sdbuf = talloc_size(mem_ctx, sizeof(*r.out.sdbuf));
+ if (r.out.sdbuf == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QuerySecurity(p, r.in.handle, r.in.sec_info, r.out.sdbuf);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle));
+ if (r.out.handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_OpenPolicy(p, r.in.system_name, r.in.attr, r.in.access_mask, r.out.handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QueryInfoPolicy(p, r.in.handle, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.acct_handle = talloc_size(mem_ctx, sizeof(*r.out.acct_handle));
+ if (r.out.acct_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_CreateAccount(p, r.in.handle, r.in.sid, r.in.access_mask, r.out.acct_handle);
push = ndr_push_init_ctx(mem_ctx);
}
r.out.resume_handle = r.in.resume_handle;
+ r.out.sids = talloc_size(mem_ctx, sizeof(*r.out.sids));
+ if (r.out.sids == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumAccounts(p, r.in.handle, r.in.resume_handle, r.in.num_entries, r.out.sids);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.trustdom_handle = talloc_size(mem_ctx, sizeof(*r.out.trustdom_handle));
+ if (r.out.trustdom_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_CreateTrustedDomain(p, r.in.handle, r.in.info, r.in.access_mask, r.out.trustdom_handle);
push = ndr_push_init_ctx(mem_ctx);
}
r.out.resume_handle = r.in.resume_handle;
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumTrustDom(p, r.in.handle, r.in.resume_handle, r.in.max_size, r.out.domains);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.sids = r.in.sids;
r.out.count = r.in.count;
r.out.result = _lsa_LookupNames(p, r.in.handle, r.in.num_names, r.in.names, r.out.domains, r.in.sids, r.in.level, r.in.count);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.names = r.in.names;
r.out.count = r.in.count;
r.out.result = _lsa_LookupSids(p, r.in.handle, r.in.sids, r.out.domains, r.in.names, r.in.level, r.in.count);
return False;
}
+ r.out.sec_handle = talloc_size(mem_ctx, sizeof(*r.out.sec_handle));
+ if (r.out.sec_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_CreateSecret(p, r.in.handle, r.in.name, r.in.access_mask, r.out.sec_handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.acct_handle = talloc_size(mem_ctx, sizeof(*r.out.acct_handle));
+ if (r.out.acct_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_OpenAccount(p, r.in.handle, r.in.sid, r.in.access_mask, r.out.acct_handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.privs = talloc_size(mem_ctx, sizeof(*r.out.privs));
+ if (r.out.privs == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumPrivsAccount(p, r.in.handle, r.out.privs);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.trustdom_handle = talloc_size(mem_ctx, sizeof(*r.out.trustdom_handle));
+ if (r.out.trustdom_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_OpenTrustedDomain(p, r.in.handle, r.in.sid, r.in.access_mask, r.out.trustdom_handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QueryTrustedDomainInfo(p, r.in.trustdom_handle, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.sec_handle = talloc_size(mem_ctx, sizeof(*r.out.sec_handle));
+ if (r.out.sec_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_OpenSecret(p, r.in.handle, r.in.name, r.in.access_mask, r.out.sec_handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.luid = talloc_size(mem_ctx, sizeof(*r.out.luid));
+ if (r.out.luid == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_LookupPrivValue(p, r.in.handle, r.in.name, r.out.luid);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.name = talloc_size(mem_ctx, sizeof(*r.out.name));
+ if (r.out.name == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_LookupPrivName(p, r.in.handle, r.in.luid, r.out.name);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.disp_name = talloc_size(mem_ctx, sizeof(*r.out.disp_name));
+ if (r.out.disp_name == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.language_id = r.in.language_id;
r.out.result = _lsa_LookupPrivDisplayName(p, r.in.handle, r.in.name, r.out.disp_name, r.in.language_id, r.in.unknown);
return False;
}
+ r.out.sids = talloc_size(mem_ctx, sizeof(*r.out.sids));
+ if (r.out.sids == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumAccountsWithUserRight(p, r.in.handle, r.in.name, r.out.sids);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.rights = talloc_size(mem_ctx, sizeof(*r.out.rights));
+ if (r.out.rights == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumAccountRights(p, r.in.handle, r.in.sid, r.out.rights);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QueryTrustedDomainInfoBySid(p, r.in.handle, r.in.dom_sid, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle));
+ if (r.out.handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_OpenPolicy2(p, r.in.system_name, r.in.attr, r.in.access_mask, r.out.handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QueryInfoPolicy2(p, r.in.handle, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QueryTrustedDomainInfoByName(p, r.in.handle, r.in.trusted_domain, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
}
r.out.resume_handle = r.in.resume_handle;
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_EnumTrustedDomainsEx(p, r.in.handle, r.in.resume_handle, r.out.domains, r.in.max_size);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
+ if (r.out.info == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_QueryDomainInformationPolicy(p, r.in.handle, r.in.level, r.out.info);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.trustdom_handle = talloc_size(mem_ctx, sizeof(*r.out.trustdom_handle));
+ if (r.out.trustdom_handle == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _lsa_OpenTrustedDomainByName(p, r.in.handle, r.in.name, r.in.access_mask, r.out.trustdom_handle);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.names = r.in.names;
r.out.count = r.in.count;
r.out.result = _lsa_LookupSids2(p, r.in.handle, r.in.sids, r.out.domains, r.in.names, r.in.level, r.in.count, r.in.unknown1, r.in.unknown2);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.sids = r.in.sids;
r.out.count = r.in.count;
r.out.result = _lsa_LookupNames2(p, r.in.handle, r.in.num_names, r.in.names, r.out.domains, r.in.sids, r.in.level, r.in.count, r.in.unknown1, r.in.unknown2);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.sids = r.in.sids;
r.out.count = r.in.count;
r.out.result = _lsa_LookupNames3(p, r.in.handle, r.in.num_names, r.in.names, r.out.domains, r.in.sids, r.in.level, r.in.count, r.in.unknown1, r.in.unknown2);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.names = r.in.names;
r.out.count = r.in.count;
r.out.result = _lsa_LookupSids3(p, r.in.sids, r.out.domains, r.in.names, r.in.level, r.in.count, r.in.unknown1, r.in.unknown2);
return False;
}
+ r.out.domains = talloc_size(mem_ctx, sizeof(*r.out.domains));
+ if (r.out.domains == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.sids = r.in.sids;
r.out.count = r.in.count;
r.out.result = _lsa_LookupNames4(p, r.in.num_names, r.in.names, r.out.domains, r.in.sids, r.in.level, r.in.count, r.in.unknown1, r.in.unknown2);
*n_fns = sizeof(api_lsarpc_cmds) / sizeof(struct api_struct);
}
-NTSTATUS rpc_netdfs_init(void)
+NTSTATUS rpc_lsarpc_init(void)
{
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsarpc", api_lsarpc_cmds, sizeof(api_lsarpc_cmds) / sizeof(struct api_struct));
}
NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p);
NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p);
void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_netdfs_init(void);
+NTSTATUS rpc_lsarpc_init(void);
#endif /* __SRV_LSARPC__ */
return False;
}
+ r.out.uid = talloc_size(mem_ctx, sizeof(*r.out.uid));
+ if (r.out.uid == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _unixinfo_SidToUid(p, r.in.sid, r.out.uid);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.sid = talloc_size(mem_ctx, sizeof(*r.out.sid));
+ if (r.out.sid == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _unixinfo_UidToSid(p, r.in.uid, r.out.sid);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.gid = talloc_size(mem_ctx, sizeof(*r.out.gid));
+ if (r.out.gid == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _unixinfo_SidToGid(p, r.in.sid, r.out.gid);
push = ndr_push_init_ctx(mem_ctx);
return False;
}
+ r.out.sid = talloc_size(mem_ctx, sizeof(*r.out.sid));
+ if (r.out.sid == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _unixinfo_GidToSid(p, r.in.gid, r.out.sid);
push = ndr_push_init_ctx(mem_ctx);
}
r.out.count = r.in.count;
+ r.out.infos = talloc_array_size(mem_ctx, sizeof(*r.out.infos), *r.in.count);
+ if (r.out.infos == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
r.out.result = _unixinfo_GetPWUid(p, r.in.count, r.in.uids, r.out.infos);
push = ndr_push_init_ctx(mem_ctx);
*n_fns = sizeof(api_unixinfo_cmds) / sizeof(struct api_struct);
}
-NTSTATUS rpc_netdfs_init(void)
+NTSTATUS rpc_unixinfo_init(void)
{
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "unixinfo", "unixinfo", api_unixinfo_cmds, sizeof(api_unixinfo_cmds) / sizeof(struct api_struct));
}
NTSTATUS _unixinfo_GidToSid(pipes_struct *p, uint64_t gid, struct dom_sid *sid);
NTSTATUS _unixinfo_GetPWUid(pipes_struct *p, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos);
void unixinfo_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_netdfs_init(void);
+NTSTATUS rpc_unixinfo_init(void);
#endif /* __SRV_UNIXINFO__ */
struct {
uint32_t *count;/* [keepref,ref,range(0 1023)] */
- struct unixinfo_GetPWUidInfo *infos;/* [keepref,ref,size_is(*count)] */
+ struct unixinfo_GetPWUidInfo *infos;/* [keepref,size_is(*count)] */
NTSTATUS result;
} out;
+++ /dev/null
-/*
- * Unix SMB/CIFS implementation.
- *
- * RPC Pipe client / server routines
- *
- * Copyright (C) Volker Lendecke 2005
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_PARSE
-
-void init_q_unixinfo_sid_to_uid(UNIXINFO_Q_SID_TO_UID *q_d, const DOM_SID *sid)
-{
- sid_copy(&q_d->sid, sid);
-}
-
-BOOL unixinfo_io_q_unixinfo_sid_to_uid(const char *desc, UNIXINFO_Q_SID_TO_UID *q_d,
- prs_struct *ps, int depth)
-{
- return smb_io_dom_sid(desc, &q_d->sid, ps, depth);
-}
-
-BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID *r_d,
- prs_struct *ps, int depth)
-{
- if (!prs_uint64(desc, ps, depth, &r_d->uid))
- return False;
-
- if (!prs_ntstatus(desc, ps, depth, &r_d->status))
- return False;
-
- return True;
-}
-
-void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, uint64 uid)
-{
- q_d->uid = uid;
-}
-
-BOOL unixinfo_io_q_unixinfo_uid_to_sid(const char *desc, UNIXINFO_Q_UID_TO_SID *q_d,
- prs_struct *ps, int depth)
-{
- return prs_uint64(desc, ps, depth, &q_d->uid);
-}
-
-void init_r_unixinfo_uid_to_sid(UNIXINFO_R_UID_TO_SID *r_d, DOM_SID *sid)
-{
- if (sid == NULL) {
- r_d->sidptr = 0;
- return;
- }
- r_d->sidptr = 1;
- sid_copy(&r_d->sid, sid);
-}
-
-BOOL unixinfo_io_r_unixinfo_uid_to_sid(const char *desc, UNIXINFO_R_UID_TO_SID *r_d,
- prs_struct *ps, int depth)
-{
- if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr))
- return False;
-
- if (r_d->sidptr != 0) {
- if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth))
- return False;
- }
-
- if (!prs_ntstatus(desc, ps, depth, &r_d->status))
- return False;
-
- return True;
-}
-
-void init_q_unixinfo_sid_to_gid(UNIXINFO_Q_SID_TO_GID *q_d, const DOM_SID *sid)
-{
- sid_copy(&q_d->sid, sid);
-}
-
-BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID *q_d,
- prs_struct *ps, int depth)
-{
- return smb_io_dom_sid(desc, &q_d->sid, ps, depth);
-}
-
-void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, uint64 gid)
-{
- r_d->gid = gid;
- r_d->status = NT_STATUS_OK;
-}
-
-BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID *r_d,
- prs_struct *ps, int depth)
-{
- if (!prs_uint64(desc, ps, depth, &r_d->gid))
- return False;
-
- if (!prs_ntstatus(desc, ps, depth, &r_d->status))
- return False;
-
- return True;
-}
-
-void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, uint64 gid)
-{
- q_d->gid = gid;
-}
-
-BOOL unixinfo_io_q_unixinfo_gid_to_sid(const char *desc, UNIXINFO_Q_GID_TO_SID *q_d,
- prs_struct *ps, int depth)
-{
- return prs_uint64(desc, ps, depth, &q_d->gid);
-}
-
-void init_r_unixinfo_gid_to_sid(UNIXINFO_R_GID_TO_SID *r_d, DOM_SID *sid)
-{
- if (sid == NULL) {
- r_d->sidptr = 0;
- return;
- }
- r_d->sidptr = 1;
- sid_copy(&r_d->sid, sid);
-}
-
-BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID *r_d,
- prs_struct *ps, int depth)
-{
- if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr))
- return False;
-
- if (r_d->sidptr != 0) {
- if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth))
- return False;
- }
-
- if (!prs_ntstatus(desc, ps, depth, &r_d->status))
- return False;
-
- return True;
-}
-
-void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count,
- uint64 *uids)
-{
- r_d->count = count;
- r_d->uid = uids;
-}
-
-BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc,
- UNIXINFO_Q_GETPWUID *q_d,
- prs_struct *ps, int depth)
-{
- uint32 arraysize;
- int i;
-
- if (!prs_uint32("count", ps, depth, &q_d->count))
- return False;
-
- arraysize = q_d->count;
-
- if (!prs_uint32("arraysize", ps, depth, &arraysize))
- return False;
-
- if (arraysize != q_d->count) {
- DEBUG(10, ("count!=arraysize\n"));
- return False;
- }
-
- if (q_d->count > 1023) {
- DEBUG(10, ("Range exceeded\n"));
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- q_d->uid = PRS_ALLOC_MEM(ps, uint64, q_d->count);
- if (q_d->uid == NULL) {
- return False;
- }
- }
-
- for (i=0; i<q_d->count; i++) {
- if (!prs_uint64(desc, ps, depth+1, &q_d->uid[i]))
- return False;
- }
-
- return True;
-}
-
-void init_r_unixinfo_getpwuid(UNIXINFO_R_GETPWUID *r_d, uint32 count,
- struct unixinfo_getpwuid *info)
-{
- r_d->count = count;
- r_d->info = info;
-}
-
-BOOL unixinfo_io_r_unixinfo_getpwuid(const char *desc,
- UNIXINFO_R_GETPWUID *r_d,
- prs_struct *ps, int depth)
-{
- uint32 arraysize;
- int i;
-
- if (!prs_uint32("count", ps, depth, &r_d->count))
- return False;
-
- arraysize = r_d->count;
-
- if (!prs_uint32("arraysize", ps, depth, &arraysize))
- return False;
-
- if (arraysize != r_d->count) {
- DEBUG(10, ("count!=arraysize\n"));
- return False;
- }
-
- if (r_d->count > 1023) {
- DEBUG(10, ("Range exceeded\n"));
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- r_d->info = PRS_ALLOC_MEM(ps, struct unixinfo_getpwuid,
- r_d->count);
- if (r_d->info == NULL) {
- return False;
- }
- }
-
- for (i=0; i<r_d->count; i++) {
- if (!prs_align(ps))
- return False;
-
- if (!prs_ntstatus("status", ps, depth+1, &r_d->info[i].status))
- return False;
-
- if (!prs_string_alloc("homedir", ps, depth+1,
- &r_d->info[i].homedir))
- return False;
-
- if (!prs_string_alloc("shell", ps, depth+1,
- &r_d->info[i].shell))
- return False;
- }
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_ntstatus(desc, ps, depth, &r_d->status))
- return False;
-
- return True;
-}
+++ /dev/null
-/*
- * Unix SMB/CIFS implementation.
- * RPC Pipe client / server routines for unixinfo-pipe
- * Copyright (C) Volker Lendecke 2005
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* This is the interface to the rpcunixinfo pipe. */
-
-#include "includes.h"
-#include "nterr.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_SRV
-
-static BOOL api_sid_to_uid(pipes_struct *p)
-{
- UNIXINFO_Q_SID_TO_UID q_u;
- UNIXINFO_R_SID_TO_UID r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if (!unixinfo_io_q_unixinfo_sid_to_uid("", &q_u, data, 0))
- return False;
-
- r_u.status = _unixinfo_sid_to_uid(p, &q_u, &r_u);
-
- if (!unixinfo_io_r_unixinfo_sid_to_uid("", &r_u, rdata, 0))
- return False;
-
- return True;
-}
-
-static BOOL api_uid_to_sid(pipes_struct *p)
-{
- UNIXINFO_Q_UID_TO_SID q_u;
- UNIXINFO_R_UID_TO_SID r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if (!unixinfo_io_q_unixinfo_uid_to_sid("", &q_u, data, 0))
- return False;
-
- r_u.status = _unixinfo_uid_to_sid(p, &q_u, &r_u);
-
- if (!unixinfo_io_r_unixinfo_uid_to_sid("", &r_u, rdata, 0))
- return False;
-
- return True;
-}
-
-static BOOL api_sid_to_gid(pipes_struct *p)
-{
- UNIXINFO_Q_SID_TO_GID q_u;
- UNIXINFO_R_SID_TO_GID r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if (!unixinfo_io_q_unixinfo_sid_to_gid("", &q_u, data, 0))
- return False;
-
- r_u.status = _unixinfo_sid_to_gid(p, &q_u, &r_u);
-
- if (!unixinfo_io_r_unixinfo_sid_to_gid("", &r_u, rdata, 0))
- return False;
-
- return True;
-}
-
-static BOOL api_gid_to_sid(pipes_struct *p)
-{
- UNIXINFO_Q_GID_TO_SID q_u;
- UNIXINFO_R_GID_TO_SID r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if (!unixinfo_io_q_unixinfo_gid_to_sid("", &q_u, data, 0))
- return False;
-
- r_u.status = _unixinfo_gid_to_sid(p, &q_u, &r_u);
-
- if (!unixinfo_io_r_unixinfo_gid_to_sid("", &r_u, rdata, 0))
- return False;
-
- return True;
-}
-
-static BOOL api_getpwuid(pipes_struct *p)
-{
- UNIXINFO_Q_GETPWUID q_u;
- UNIXINFO_R_GETPWUID r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if (!unixinfo_io_q_unixinfo_getpwuid("", &q_u, data, 0))
- return False;
-
- r_u.status = _unixinfo_getpwuid(p, &q_u, &r_u);
-
- if (!unixinfo_io_r_unixinfo_getpwuid("", &r_u, rdata, 0))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-\pipe\unixinfo commands
-********************************************************************/
-
-struct api_struct api_unixinfo_cmds[] = {
- {"SID_TO_UID", UNIXINFO_SID_TO_UID, api_sid_to_uid },
- {"UID_TO_SID", UNIXINFO_UID_TO_SID, api_uid_to_sid },
- {"SID_TO_GID", UNIXINFO_SID_TO_GID, api_sid_to_gid },
- {"GID_TO_SID", UNIXINFO_GID_TO_SID, api_gid_to_sid },
- {"GETPWUID", UNIXINFO_GETPWUID, api_getpwuid },
-};
-
-
-void unixinfo_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
- *fns = api_unixinfo_cmds;
- *n_fns = sizeof(api_unixinfo_cmds) / sizeof(struct api_struct);
-}
-
-NTSTATUS rpc_unixinfo_init(void)
-{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
- "unixinfo", "unixinfo", api_unixinfo_cmds,
- sizeof(api_unixinfo_cmds) / sizeof(struct api_struct));
-}
#include "includes.h"
#include "nterr.h"
+
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
/* Map a sid to a uid */
-NTSTATUS _unixinfo_sid_to_uid(pipes_struct *p,
- UNIXINFO_Q_SID_TO_UID *q_u,
- UNIXINFO_R_SID_TO_UID *r_u)
+NTSTATUS _unixinfo_SidToUid(pipes_struct *p, struct dom_sid sid, uint64_t *uid)
{
- uid_t uid;
+ uid_t real_uid;
+ NTSTATUS status;
+ *uid = 0;
- r_u->uid = 0;
+ status = sid_to_uid(&sid, &real_uid) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED;
+ if (NT_STATUS_IS_OK(status))
+ *uid = real_uid;
- r_u->status = sid_to_uid(&q_u->sid, &uid) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED;
- if (NT_STATUS_IS_OK(r_u->status))
- r_u->uid = uid;
-
- return r_u->status;
+ return status;
}
/* Map a uid to a sid */
-NTSTATUS _unixinfo_uid_to_sid(pipes_struct *p,
- UNIXINFO_Q_UID_TO_SID *q_u,
- UNIXINFO_R_UID_TO_SID *r_u)
+NTSTATUS _unixinfo_UidToSid(pipes_struct *p, uint64_t uid, struct dom_sid *sid)
{
- DOM_SID sid;
+ NTSTATUS status = NT_STATUS_NO_SUCH_USER;
- r_u->status = NT_STATUS_NO_SUCH_USER;
+ uid_to_sid(sid, (uid_t)uid);
+ status = NT_STATUS_OK;
- if (q_u->uid == 0) {
- uid_to_sid(&sid, q_u->uid);
- r_u->status = NT_STATUS_OK;
- }
-
- init_r_unixinfo_uid_to_sid(r_u,
- NT_STATUS_IS_OK(r_u->status) ? &sid : NULL);
-
- return r_u->status;
+ return status;
}
/* Map a sid to a gid */
-NTSTATUS _unixinfo_sid_to_gid(pipes_struct *p,
- UNIXINFO_Q_SID_TO_GID *q_u,
- UNIXINFO_R_SID_TO_GID *r_u)
+NTSTATUS _unixinfo_SidToGid(pipes_struct *p, struct dom_sid sid, uint64_t *gid)
{
- gid_t gid;
+ gid_t real_gid;
+ NTSTATUS status;
- r_u->gid = 0;
+ *gid = 0;
- r_u->status = sid_to_gid(&q_u->sid, &gid) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED;
- if (NT_STATUS_IS_OK(r_u->status))
- r_u->gid = gid;
+ status = sid_to_gid(&sid, &real_gid) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED;
+ if (NT_STATUS_IS_OK(status))
+ *gid = real_gid;
- return r_u->status;
+ return status;
}
/* Map a gid to a sid */
-NTSTATUS _unixinfo_gid_to_sid(pipes_struct *p,
- UNIXINFO_Q_GID_TO_SID *q_u,
- UNIXINFO_R_GID_TO_SID *r_u)
+NTSTATUS _unixinfo_GidToSid(pipes_struct *p, uint64_t gid, struct dom_sid *sid)
{
- DOM_SID sid;
+ NTSTATUS status = NT_STATUS_NO_SUCH_GROUP;
- r_u->status = NT_STATUS_NO_SUCH_GROUP;
+ gid_to_sid(sid, (gid_t)gid);
+ status = NT_STATUS_OK;
- if (q_u->gid == 0) {
- gid_to_sid(&sid, q_u->gid);
- r_u->status = NT_STATUS_OK;
- }
-
- init_r_unixinfo_gid_to_sid(r_u,
- NT_STATUS_IS_OK(r_u->status) ? &sid : NULL);
-
- return r_u->status;
+ return status;
}
/* Get unix struct passwd information */
-NTSTATUS _unixinfo_getpwuid(pipes_struct *p,
- UNIXINFO_Q_GETPWUID *q_u,
- UNIXINFO_R_GETPWUID *r_u)
+NTSTATUS _unixinfo_GetPWUid(pipes_struct *p, uint32_t *count, uint64_t *uids,
+ struct unixinfo_GetPWUidInfo *infos)
{
int i;
+ NTSTATUS status;
- if (r_u->count > 1023) {
+ if (*count > 1023)
return NT_STATUS_INVALID_PARAMETER;
- }
-
- r_u->info = TALLOC_ARRAY(p->mem_ctx, struct unixinfo_getpwuid,
- q_u->count);
-
- if ((r_u->count > 0) && (r_u->info == NULL)) {
- return NT_STATUS_NO_MEMORY;
- }
- r_u->status = NT_STATUS_OK;
- r_u->count = q_u->count;
+ status = NT_STATUS_OK;
- for (i=0; i<r_u->count; i++) {
+ for (i=0; i<*count; i++) {
struct passwd *pw;
char *homedir, *shell;
ssize_t len1, len2;
- r_u->info[i].status = NT_STATUS_NO_SUCH_USER;
- r_u->info[i].homedir = "";
- r_u->info[i].shell = "";
+ infos[i].status = NT_STATUS_NO_SUCH_USER;
+ infos[i].homedir = "";
+ infos[i].shell = "";
- pw = getpwuid(q_u->uid[i]);
+ pw = getpwuid(uids[i]);
if (pw == NULL) {
- DEBUG(10, ("Did not find uid %lld\n", q_u->uid[i]));
+ DEBUG(10, ("Did not find uid %lld\n", uids[i]));
continue;
}
if ((len1 < 0) || (len2 < 0) || (homedir == NULL) ||
(shell == NULL)) {
DEBUG(3, ("push_utf8_talloc failed\n"));
- r_u->info[i].status = NT_STATUS_NO_MEMORY;
+ infos[i].status = NT_STATUS_NO_MEMORY;
continue;
}
- r_u->info[i].status = NT_STATUS_OK;
- r_u->info[i].homedir = homedir;
- r_u->info[i].shell = shell;
+ infos[i].status = NT_STATUS_OK;
+ infos[i].homedir = homedir;
+ infos[i].shell = shell;
}
- return r_u->status;
+ return status;
}