Refactoring: Change calling conventions for cli_rpc_pipe_open_krb5
authorVolker Lendecke <vl@samba.org>
Sun, 20 Jul 2008 09:04:31 +0000 (11:04 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 20 Jul 2008 15:37:14 +0000 (17:37 +0200)
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit f2656e5c2e700523ead7a62734d203ad0caaff0c)

source3/include/proto.h
source3/rpc_client/cli_pipe.c

index ab09462a9fa1f0d492eb42577fe4e5f5488998ad..26129530519b9239564197f96f43774eba16d50a 100644 (file)
@@ -7140,13 +7140,13 @@ NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
                                    enum pipe_auth_level auth_level,
                                    const char *domain,
                                    struct rpc_pipe_client **presult);
-struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
-                                               int pipe_idx,
-                                               enum pipe_auth_level auth_level,
-                                               const char *service_princ,
-                                               const char *username,
-                                               const char *password,
-                                               NTSTATUS *perr);
+NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
+                               const struct ndr_syntax_id *interface,
+                               enum pipe_auth_level auth_level,
+                               const char *service_princ,
+                               const char *username,
+                               const char *password,
+                               struct rpc_pipe_client **presult);
 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
                             struct rpc_pipe_client *cli,
                             DATA_BLOB *session_key);
index e9a9480e3565a2eccb9d917191389ce99712ad12..b5a188ed7628f6be3042dc239410463e2b7550f8 100644 (file)
@@ -3408,45 +3408,46 @@ NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
  NULL so long as the caller has a TGT.
  ****************************************************************************/
 
-struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
-                                               int pipe_idx,
-                                               enum pipe_auth_level auth_level,
-                                               const char *service_princ,
-                                               const char *username,
-                                               const char *password,
-                                               NTSTATUS *perr)
+NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
+                               const struct ndr_syntax_id *interface,
+                               enum pipe_auth_level auth_level,
+                               const char *service_princ,
+                               const char *username,
+                               const char *password,
+                               struct rpc_pipe_client **presult)
 {
 #ifdef HAVE_KRB5
        struct rpc_pipe_client *result;
        struct cli_pipe_auth_data *auth;
+       NTSTATUS status;
 
-       *perr = cli_rpc_pipe_open(cli, pipe_names[pipe_idx].abstr_syntax,
-                                 &result);
-       if (!NT_STATUS_IS_OK(*perr)) {
-               return NULL;
+       status = cli_rpc_pipe_open(cli, interface, &result);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
 
-       *perr = rpccli_kerberos_bind_data(result, auth_level, service_princ,
-                                         username, password, &auth);
-       if (!NT_STATUS_IS_OK(*perr)) {
+       status = rpccli_kerberos_bind_data(result, auth_level, service_princ,
+                                          username, password, &auth);
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("rpccli_kerberos_bind_data returned %s\n",
-                         nt_errstr(*perr)));
+                         nt_errstr(status)));
                TALLOC_FREE(result);
-               return NULL;
+               return status;
        }
 
-       *perr = rpc_pipe_bind(result, auth);
-       if (!NT_STATUS_IS_OK(*perr)) {
-               DEBUG(0, ("cli_rpc_pipe_open_krb5: cli_rpc_pipe_bind failed with error %s\n",
-                       nt_errstr(*perr) ));
+       status = rpc_pipe_bind(result, auth);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("cli_rpc_pipe_open_krb5: cli_rpc_pipe_bind failed "
+                         "with error %s\n", nt_errstr(status)));
                TALLOC_FREE(result);
-               return NULL;
+               return status;
        }
 
-       return result;
+       *presult = result;
+       return NT_STATUS_OK;
 #else
        DEBUG(0,("cli_rpc_pipe_open_krb5: kerberos not found at compile time.\n"));
-       return NULL;
+       return NT_STATUS_NOT_IMPLEMENTED;
 #endif
 }