mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3/rpc_client: move copy_netr_SamInfo3() to util_netlogon
The next commit will add an additional caller that in rpc_client and I don't want to pull in AUTH_COMMON. The natural place to consolidate netlogon related helper functions seems to be util_netlogon.c which already has copy_netr_SamBaseInfo(). No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
a1a9feb720
commit
158c89068b
@ -36,6 +36,7 @@
|
||||
#include "../librpc/gen_ndr/idmap.h"
|
||||
#include "lib/param/loadparm.h"
|
||||
#include "../lib/tsocket/tsocket.h"
|
||||
#include "rpc_client/util_netlogon.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_AUTH
|
||||
|
@ -322,8 +322,6 @@ NTSTATUS passwd_to_SamInfo3(TALLOC_CTX *mem_ctx,
|
||||
const struct passwd *pwd,
|
||||
struct netr_SamInfo3 **pinfo3,
|
||||
struct extra_auth_info *extra);
|
||||
struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
|
||||
const struct netr_SamInfo3 *orig);
|
||||
|
||||
/* The following definitions come from auth/pampass.c */
|
||||
|
||||
|
@ -711,45 +711,3 @@ done:
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#undef RET_NOMEM
|
||||
|
||||
#define RET_NOMEM(ptr) do { \
|
||||
if (!ptr) { \
|
||||
TALLOC_FREE(info3); \
|
||||
return NULL; \
|
||||
} } while(0)
|
||||
|
||||
struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
|
||||
const struct netr_SamInfo3 *orig)
|
||||
{
|
||||
struct netr_SamInfo3 *info3;
|
||||
unsigned int i;
|
||||
NTSTATUS status;
|
||||
|
||||
info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
|
||||
if (!info3) return NULL;
|
||||
|
||||
status = copy_netr_SamBaseInfo(info3, &orig->base, &info3->base);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(info3);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (orig->sidcount) {
|
||||
info3->sidcount = orig->sidcount;
|
||||
info3->sids = talloc_array(info3, struct netr_SidAttr,
|
||||
orig->sidcount);
|
||||
RET_NOMEM(info3->sids);
|
||||
for (i = 0; i < orig->sidcount; i++) {
|
||||
info3->sids[i].sid = dom_sid_dup(info3->sids,
|
||||
orig->sids[i].sid);
|
||||
RET_NOMEM(info3->sids[i].sid);
|
||||
info3->sids[i].attributes =
|
||||
orig->sids[i].attributes;
|
||||
}
|
||||
}
|
||||
|
||||
return info3;
|
||||
}
|
||||
|
||||
|
@ -61,3 +61,44 @@ NTSTATUS copy_netr_SamBaseInfo(TALLOC_CTX *mem_ctx,
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
#undef RET_NOMEM
|
||||
|
||||
#define RET_NOMEM(ptr) do { \
|
||||
if (!ptr) { \
|
||||
TALLOC_FREE(info3); \
|
||||
return NULL; \
|
||||
} } while(0)
|
||||
|
||||
struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
|
||||
const struct netr_SamInfo3 *orig)
|
||||
{
|
||||
struct netr_SamInfo3 *info3;
|
||||
unsigned int i;
|
||||
NTSTATUS status;
|
||||
|
||||
info3 = talloc_zero(mem_ctx, struct netr_SamInfo3);
|
||||
if (!info3) return NULL;
|
||||
|
||||
status = copy_netr_SamBaseInfo(info3, &orig->base, &info3->base);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(info3);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (orig->sidcount) {
|
||||
info3->sidcount = orig->sidcount;
|
||||
info3->sids = talloc_array(info3, struct netr_SidAttr,
|
||||
orig->sidcount);
|
||||
RET_NOMEM(info3->sids);
|
||||
for (i = 0; i < orig->sidcount; i++) {
|
||||
info3->sids[i].sid = dom_sid_dup(info3->sids,
|
||||
orig->sids[i].sid);
|
||||
RET_NOMEM(info3->sids[i].sid);
|
||||
info3->sids[i].attributes =
|
||||
orig->sids[i].attributes;
|
||||
}
|
||||
}
|
||||
|
||||
return info3;
|
||||
}
|
||||
|
@ -25,5 +25,7 @@
|
||||
NTSTATUS copy_netr_SamBaseInfo(TALLOC_CTX *mem_ctx,
|
||||
const struct netr_SamBaseInfo *in,
|
||||
struct netr_SamBaseInfo *out);
|
||||
struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
|
||||
const struct netr_SamInfo3 *orig);
|
||||
|
||||
#endif /* _RPC_CLIENT_UTIL_NETLOGON_H_ */
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "librpc/crypto/gse_krb5.h"
|
||||
#include "lib/afs/afs_funcs.h"
|
||||
#include "libsmb/samlogon_cache.h"
|
||||
#include "rpc_client/util_netlogon.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_WINBIND
|
||||
|
Loading…
Reference in New Issue
Block a user