s3-librpc Remove unused dcesrv_gssapi.[ch] functions
authorAndrew Bartlett <abartlet@samba.org>
Mon, 2 Jan 2012 09:30:41 +0000 (20:30 +1100)
committerStefan Metzmacher <metze@samba.org>
Wed, 18 Jan 2012 15:23:22 +0000 (16:23 +0100)
The code from dcesrv_gssapi.c is now
in source3/auth/auth_generic.c as an auth callback.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/Makefile.in
source3/rpc_server/dcesrv_gssapi.c [deleted file]
source3/rpc_server/dcesrv_gssapi.h [deleted file]
source3/rpc_server/dcesrv_spnego.c
source3/rpc_server/srv_pipe.c
source3/rpc_server/wscript_build

index 69f4786695a2bebf67a624d0a06cdc731af852a0..43dabcc998c889c2c8538cf00c8897c38eb882a7 100644 (file)
@@ -763,7 +763,6 @@ RPC_CONFIG = rpc_server/rpc_config.o
 RPC_SERVICE = rpc_server/rpc_server.o
 
 RPC_CRYPTO = rpc_server/dcesrv_auth_generic.o \
-               rpc_server/dcesrv_gssapi.o \
                rpc_server/dcesrv_spnego.o
 
 RPC_PIPE_OBJ = rpc_server/srv_pipe.o rpc_server/srv_pipe_hnd.o \
diff --git a/source3/rpc_server/dcesrv_gssapi.c b/source3/rpc_server/dcesrv_gssapi.c
deleted file mode 100644 (file)
index be97a64..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- *  GSSAPI Acceptor
- *  DCERPC Server functions
- *  Copyright (C) Simo Sorce 2010.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "includes.h"
-#include "rpc_server/dcesrv_gssapi.h"
-#include "../librpc/gen_ndr/ndr_krb5pac.h"
-#include "../lib/tsocket/tsocket.h"
-#include "librpc/crypto/gse.h"
-#include "auth.h"
-#ifdef HAVE_KRB5
-#include "libcli/auth/krb5_wrap.h"
-#endif
-NTSTATUS gssapi_server_auth_start(TALLOC_CTX *mem_ctx,
-                                 bool do_sign,
-                                 bool do_seal,
-                                 bool is_dcerpc,
-                                 DATA_BLOB *token_in,
-                                 DATA_BLOB *token_out,
-                                 struct gse_context **ctx)
-{
-       struct gse_context *gse_ctx = NULL;
-       uint32_t add_flags = 0;
-        NTSTATUS status;
-
-       if (is_dcerpc) {
-               add_flags = GSS_C_DCE_STYLE;
-       }
-
-       /* Let's init the gssapi machinery for this connection */
-       status = gse_init_server(mem_ctx, do_sign, do_seal,
-                                add_flags, &gse_ctx);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to init dcerpc gssapi server (%s)\n",
-                         nt_errstr(status)));
-               return status;
-       }
-
-       status = gse_get_server_auth_token(mem_ctx, gse_ctx,
-                                          token_in, token_out);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to parse initial client token (%s)\n",
-                         nt_errstr(status)));
-               goto done;
-       }
-
-       *ctx = gse_ctx;
-       status = NT_STATUS_OK;
-
-done:
-       if (!NT_STATUS_IS_OK(status)) {
-               TALLOC_FREE(gse_ctx);
-       }
-
-       return status;
-}
-
-NTSTATUS gssapi_server_step(struct gse_context *gse_ctx,
-                           TALLOC_CTX *mem_ctx,
-                           DATA_BLOB *token_in,
-                           DATA_BLOB *token_out)
-{
-       NTSTATUS status;
-
-       status = gse_get_server_auth_token(mem_ctx, gse_ctx,
-                                          token_in, token_out);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       if (gse_require_more_processing(gse_ctx)) {
-               /* ask for next leg */
-               return NT_STATUS_MORE_PROCESSING_REQUIRED;
-       }
-
-       return NT_STATUS_OK;
-}
-
-NTSTATUS gssapi_server_check_flags(struct gse_context *gse_ctx)
-{
-       return gse_verify_server_auth_flags(gse_ctx);
-}
-
-NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx,
-                                    TALLOC_CTX *mem_ctx,
-                                    const struct tsocket_address *remote_address,
-                                    struct auth_session_info **session_info)
-{
-       TALLOC_CTX *tmp_ctx;
-       DATA_BLOB pac_blob;
-       struct PAC_DATA *pac_data = NULL;
-       struct PAC_LOGON_INFO *logon_info = NULL;
-       unsigned int i;
-       bool is_mapped;
-       bool is_guest;
-       char *princ_name;
-       char *ntuser;
-       char *ntdomain;
-       char *username;
-       char *rhost;
-       struct passwd *pw;
-       NTSTATUS status;
-       int rc;
-
-       tmp_ctx = talloc_new(mem_ctx);
-       if (!tmp_ctx) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       status = gse_get_pac_blob(gse_ctx, tmp_ctx, &pac_blob);
-       if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
-               /* TODO: Fetch user by principal name ? */
-               status = NT_STATUS_ACCESS_DENIED;
-               goto done;
-       }
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-
-#ifdef HAVE_KRB5
-       status = kerberos_decode_pac(tmp_ctx,
-                                    pac_blob,
-                                    NULL, NULL, NULL, NULL, 0, &pac_data);
-#else
-       status = NT_STATUS_ACCESS_DENIED;
-#endif
-       data_blob_free(&pac_blob);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-
-       status = gse_get_client_name(gse_ctx, tmp_ctx, &princ_name);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto done;
-       }
-
-       /* get logon name and logon info */
-       for (i = 0; i < pac_data->num_buffers; i++) {
-               struct PAC_BUFFER *data_buf = &pac_data->buffers[i];
-
-               switch (data_buf->type) {
-               case PAC_TYPE_LOGON_INFO:
-                       if (!data_buf->info) {
-                               break;
-                       }
-                       logon_info = data_buf->info->logon_info.info;
-                       break;
-               default:
-                       break;
-               }
-       }
-       if (!logon_info) {
-               DEBUG(1, ("Invalid PAC data, missing logon info!\n"));
-               status = NT_STATUS_NOT_FOUND;
-               goto done;
-       }
-
-       rc = get_remote_hostname(remote_address,
-                                &rhost,
-                                tmp_ctx);
-       if (rc < 0) {
-               status = NT_STATUS_NO_MEMORY;
-               goto done;
-       }
-       if (strequal(rhost, "UNKNOWN")) {
-               rhost = tsocket_address_inet_addr_string(remote_address,
-                                                        tmp_ctx);
-               if (rhost == NULL) {
-                       status = NT_STATUS_NO_MEMORY;
-                       goto done;
-               }
-       }
-
-       status = get_user_from_kerberos_info(tmp_ctx, rhost,
-                                            princ_name, logon_info,
-                                            &is_mapped, &is_guest,
-                                            &ntuser, &ntdomain,
-                                            &username, &pw);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(1, ("Failed to map kerberos principal to system user "
-                         "(%s)\n", nt_errstr(status)));
-               status = NT_STATUS_ACCESS_DENIED;
-               goto done;
-       }
-
-       /* TODO: save PAC data in netsamlogon cache ? */
-
-       status = make_session_info_krb5(mem_ctx,
-                                       ntuser, ntdomain, username, pw,
-                                       logon_info, is_guest, is_mapped, NULL /* No session key for now */,
-                                       session_info);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(1, ("Failed to map kerberos pac to server info (%s)\n",
-                         nt_errstr(status)));
-               status = NT_STATUS_ACCESS_DENIED;
-               goto done;
-       }
-
-       DEBUG(5, (__location__ "OK: user: %s domain: %s client: %s\n",
-                 ntuser, ntdomain, rhost));
-
-       status = NT_STATUS_OK;
-
-done:
-       TALLOC_FREE(tmp_ctx);
-       return status;
-}
diff --git a/source3/rpc_server/dcesrv_gssapi.h b/source3/rpc_server/dcesrv_gssapi.h
deleted file mode 100644 (file)
index 8d787b5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  GSSAPI Acceptor
- *  DCERPC Server functions
- *  Copyright (C) Simo Sorce 2010.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _DCESRV_GSSAPI_H_
-#define _DCESRV_GSSAPI_H_
-
-struct gse_context;
-
-NTSTATUS gssapi_server_auth_start(TALLOC_CTX *mem_ctx,
-                                 bool do_sign,
-                                 bool do_seal,
-                                 bool is_dcerpc,
-                                 DATA_BLOB *token_in,
-                                 DATA_BLOB *token_out,
-                                 struct gse_context **ctx);
-NTSTATUS gssapi_server_step(struct gse_context *gse_ctx,
-                           TALLOC_CTX *mem_ctx,
-                           DATA_BLOB *token_in,
-                           DATA_BLOB *token_out);
-NTSTATUS gssapi_server_check_flags(struct gse_context *gse_ctx);
-NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx,
-                                    TALLOC_CTX *mem_ctx,
-                                    const struct tsocket_address *remote_address,
-                                    struct auth_session_info **session_info);
-
-#endif /* _DCESRV_GSSAPI_H_ */
index 37d6209d65b5c6db73a4250720d9477819a05b9c..ed7d772d595ee13dea234f9f544c9b9990929848 100644 (file)
@@ -21,7 +21,6 @@
 #include "../libcli/auth/spnego.h"
 #include "../lib/tsocket/tsocket.h"
 #include "dcesrv_auth_generic.h"
-#include "dcesrv_gssapi.h"
 #include "dcesrv_spnego.h"
 #include "auth/gensec/gensec.h"
 
index 8731a28d827c1e19051dabf11b76865815f45e6d..879b6deabd01716a9c1bb981941e20cef0d3f799 100644 (file)
@@ -34,7 +34,6 @@
 #include "../libcli/auth/schannel.h"
 #include "../libcli/auth/spnego.h"
 #include "dcesrv_auth_generic.h"
-#include "dcesrv_gssapi.h"
 #include "dcesrv_spnego.h"
 #include "rpc_server.h"
 #include "rpc_dce.h"
index d22d6eb14df9e4a1886eee9b587c0c3d157b7c11..b06fcd20fb57926283ca83e318784d8af1c572e4 100755 (executable)
@@ -37,7 +37,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
                     deps='samba-util')
 
 bld.SAMBA3_SUBSYSTEM('RPC_CRYPTO',
-                     source='dcesrv_auth_generic.c dcesrv_gssapi.c dcesrv_spnego.c',
+                     source='dcesrv_auth_generic.c dcesrv_spnego.c',
                      deps = 'KRB5_PAC')
 
 bld.SAMBA3_SUBSYSTEM('RPC_PIPE_REGISTER',