s3:libsmb: add 'cli_state_client_guid'
authorStefan Metzmacher <metze@samba.org>
Thu, 19 Jun 2014 23:03:08 +0000 (01:03 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 19 Sep 2014 07:15:13 +0000 (09:15 +0200)
This can be used by tests to use the same client guid for multiple connections.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/libsmb/clientgen.c
source3/libsmb/proto.h

index 8a3881018ea500e2dbcdf1a444c53d2a4d564225..71ec1dcc99a11992e2f6212631e589d398b051cf 100644 (file)
@@ -131,6 +131,8 @@ NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char
  Set the signing state (used from the command line).
 ****************************************************************************/
 
+struct GUID cli_state_client_guid;
+
 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                                   int fd,
                                   const char *remote_name,
@@ -144,7 +146,13 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
        bool use_level_II_oplocks = false;
        uint32_t smb1_capabilities = 0;
        uint32_t smb2_capabilities = 0;
-       struct GUID client_guid = GUID_random();
+       struct GUID client_guid;
+
+       if (!GUID_all_zero(&cli_state_client_guid)) {
+               client_guid = cli_state_client_guid;
+       } else {
+               client_guid = GUID_random();
+       }
 
        /* Check the effective uid - make sure we are not setuid */
        if (is_setuid_root()) {
index 63d2df4a37cd1c13a328e7c92926f06b0c36a6f4..2efb20839820327dccd3df59ecf091790d92e3af 100644 (file)
@@ -165,6 +165,7 @@ NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
+extern struct GUID cli_state_client_guid;
 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                                   int fd,
                                   const char *remote_name,