s3/rpc_client: move copy_netr_SamInfo3() to util_netlogon
authorRalph Boehme <slow@samba.org>
Sat, 2 Dec 2017 21:35:36 +0000 (22:35 +0100)
committerRalph Boehme <slow@samba.org>
Sat, 13 Jan 2018 07:24:08 +0000 (08:24 +0100)
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>
source3/auth/auth_util.c
source3/auth/proto.h
source3/auth/server_info.c
source3/rpc_client/util_netlogon.c
source3/rpc_client/util_netlogon.h
source3/winbindd/winbindd_pam.c

index 464fe25abcc7a61f60b07721edafb2f3a67be0d9..5bb5a69dfa7c808677e588a20694feb9d3bff607 100644 (file)
@@ -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
index 996b432f18c79543d8b5b1b4a8512e10df040d94..e774670102279b02f559243154afa6d0f4b3be3a 100644 (file)
@@ -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  */
 
index 8461d2089f25ae5962f94f4037e1dc59630f753d..20d43d237fa6ebbb555c9a4a090e0964e6d0cbc0 100644 (file)
@@ -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;
-}
-
index d22078be3325a3d74435cc6fc68721e690c93b79..ee2b590b7519dfa92d4a942200bf109f91fe7644 100644 (file)
@@ -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;
+}
index cea9787acb6cb9f5615336d8ec07d47562c1b609..9e717dfe68955519689c9644d55daf9b563fef62 100644 (file)
@@ -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_ */
index b6d5b05491b16f56b52494335f6e982a72becf8f..43060ee32caddedd446fdef565fb36a4011ffa8d 100644 (file)
@@ -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