summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-07-06 01:16:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:52 -0500
commit3b7872f69ffa0b1cde8d14ab9122a91ee8aab7a6 (patch)
treeb8743b83271b765b30961d8c2a8bdb1b6dd2043e /source4/librpc
parent49d6c46fa3fa0b074e1544d33c814f9de0f544aa (diff)
downloadsamba-3b7872f69ffa0b1cde8d14ab9122a91ee8aab7a6.tar.gz
samba-3b7872f69ffa0b1cde8d14ab9122a91ee8aab7a6.tar.bz2
samba-3b7872f69ffa0b1cde8d14ab9122a91ee8aab7a6.zip
r1351: add derpc spengo wrapper
not yet used and not working because of bugs in the gensec spnego code metze (This used to be commit b9795ed5735ad88a2ba9608d3d8804edf77e4cd4)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/config.m41
-rw-r--r--source4/librpc/rpc/dcerpc_spnego.c79
2 files changed, 80 insertions, 0 deletions
diff --git a/source4/librpc/config.m4 b/source4/librpc/config.m4
index 4df76e96be..7e0f92b3cc 100644
--- a/source4/librpc/config.m4
+++ b/source4/librpc/config.m4
@@ -39,6 +39,7 @@ SMB_SUBSYSTEM(LIBRPC_RAW,[],
librpc/rpc/dcerpc_util.o
librpc/rpc/dcerpc_schannel.o
librpc/rpc/dcerpc_ntlm.o
+ librpc/rpc/dcerpc_spnego.o
librpc/rpc/dcerpc_smb.o
librpc/rpc/dcerpc_tcp.o])
diff --git a/source4/librpc/rpc/dcerpc_spnego.c b/source4/librpc/rpc/dcerpc_spnego.c
new file mode 100644
index 0000000000..141ea787e7
--- /dev/null
+++ b/source4/librpc/rpc/dcerpc_spnego.c
@@ -0,0 +1,79 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ dcerpc authentication operations
+
+ Copyright (C) Andrew Tridgell 2003
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+/*
+ do spnego style authentication on a gensec pipe
+*/
+NTSTATUS dcerpc_bind_auth_spnego(struct dcerpc_pipe *p,
+ const char *uuid, uint_t version,
+ const char *domain,
+ const char *username,
+ const char *password)
+{
+ NTSTATUS status;
+
+ status = gensec_client_start(&p->security_state.generic_state);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start GENSEC client mode: %s\n", nt_errstr(status)));
+ return status;
+ }
+
+ status = gensec_set_domain(p->security_state.generic_state, domain);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set GENSEC client domain to %s: %s\n",
+ domain, nt_errstr(status)));
+ return status;
+ }
+
+ status = gensec_set_username(p->security_state.generic_state, username);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set GENSEC client username to %s: %s\n",
+ username, nt_errstr(status)));
+ return status;
+ }
+
+ status = gensec_set_password(p->security_state.generic_state, password);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set GENSEC client password: %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+
+ status = gensec_start_mech_by_authtype(p->security_state.generic_state, DCERPC_AUTH_TYPE_SPNEGO);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to start set GENSEC client SPNEGO mechanism: %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+
+ status = dcerpc_bind_auth(p, DCERPC_AUTH_TYPE_SPNEGO,
+ uuid, version);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(2, ("Failed to bind to pipe with SPNEGO: %s\n", nt_errstr(status)));
+ return status;
+ }
+
+ return status;
+}