auth/credentials: add cli_credentials_shallow_copy()
authorStefan Metzmacher <metze@samba.org>
Wed, 31 Jul 2013 11:21:14 +0000 (13:21 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 5 Aug 2013 05:48:01 +0000 (17:48 +1200)
This is useful for testing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/credentials.c
auth/credentials/credentials.h

index e6a471064fdddcdd7e54db6bccb6a111985569ca..c1c699303213c1653b497147dd65fe7294914018 100644 (file)
@@ -125,6 +125,21 @@ _PUBLIC_ void *_cli_credentials_callback_data(struct cli_credentials *cred)
        return cred->priv_data;
 }
 
+_PUBLIC_ struct cli_credentials *cli_credentials_shallow_copy(TALLOC_CTX *mem_ctx,
+                                               struct cli_credentials *src)
+{
+       struct cli_credentials *dst;
+
+       dst = talloc(mem_ctx, struct cli_credentials);
+       if (dst == NULL) {
+               return NULL;
+       }
+
+       *dst = *src;
+
+       return dst;
+}
+
 /**
  * Create a new anonymous credential
  * @param mem_ctx TALLOC_CTX parent for credentials structure 
index 0f498ad2d0df9c25c8cf6ee2e91f03723351d64a..1377bfa8794cfeb17a6f0b9c69a537ef7be16dc5 100644 (file)
@@ -340,6 +340,9 @@ void *_cli_credentials_callback_data(struct cli_credentials *cred);
 #define cli_credentials_callback_data_void(_cred) \
        _cli_credentials_callback_data(_cred)
 
+struct cli_credentials *cli_credentials_shallow_copy(TALLOC_CTX *mem_ctx,
+                                               struct cli_credentials *src);
+
 /**
  * Return attached NETLOGON credentials 
  */