s3:libsmb: add cli_session_setup_anon()
authorStefan Metzmacher <metze@samba.org>
Fri, 28 Oct 2016 10:01:50 +0000 (12:01 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 15 Nov 2016 10:00:29 +0000 (11:00 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libsmb/cliconnect.c
source3/libsmb/proto.h

index 0583fa7a31cf6f88796d9894135c4b28c0594fa2..9e9de16dabcaa90c5f0e5b8df1f55c0b69e0b546 100644 (file)
@@ -1732,6 +1732,25 @@ NTSTATUS cli_session_setup_creds(struct cli_state *cli,
        return status;
 }
 
+NTSTATUS cli_session_setup_anon(struct cli_state *cli)
+{
+       NTSTATUS status = NT_STATUS_NO_MEMORY;
+       struct cli_credentials *creds = NULL;
+
+       creds = cli_credentials_init_anon(cli);
+       if (creds == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = cli_session_setup_creds(cli, creds);
+       TALLOC_FREE(creds);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return NT_STATUS_OK;
+}
+
 NTSTATUS cli_session_setup(struct cli_state *cli,
                           const char *user,
                           const char *pass,
index 00e6e32ad963518afe463d640b98a1ba0b807842..93fbc4baee2b1c8910f169063ab815daa1b88f31 100644 (file)
@@ -41,6 +41,7 @@ struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
 NTSTATUS cli_session_setup_creds(struct cli_state *cli,
                                 struct cli_credentials *creds);
+NTSTATUS cli_session_setup_anon(struct cli_state *cli);
 NTSTATUS cli_session_setup(struct cli_state *cli,
                           const char *user,
                           const char *pass,