2003-12-14 04:09:10 +03:00
/*
Unix SMB / CIFS implementation .
server side dcerpc authentication code
Copyright ( C ) Andrew Tridgell 2003
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
Copyright ( C ) Stefan ( metze ) Metzmacher 2004
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
2003-12-14 04:09:10 +03:00
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2003-12-14 04:09:10 +03:00
( 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
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-12-14 04:09:10 +03:00
*/
# include "includes.h"
2004-11-02 10:42:47 +03:00
# include "rpc_server/dcerpc_server.h"
2008-04-02 06:53:27 +04:00
# include "rpc_server/dcerpc_server_proto.h"
# include "librpc/rpc/dcerpc_proto.h"
2005-07-28 04:27:28 +04:00
# include "librpc/gen_ndr/ndr_dcerpc.h"
2006-11-07 03:48:36 +03:00
# include "auth/credentials/credentials.h"
2005-12-28 18:38:36 +03:00
# include "auth/gensec/gensec.h"
2009-02-13 02:24:16 +03:00
# include "auth/auth.h"
2007-09-28 05:17:46 +04:00
# include "param/param.h"
2003-12-14 04:09:10 +03:00
/*
parse any auth information from a dcerpc bind request
2007-10-07 02:25:41 +04:00
return false if we can ' t handle the auth request for some
2003-12-14 13:45:50 +03:00
reason ( in which case we send a bind_nak )
2003-12-14 04:09:10 +03:00
*/
2007-10-07 02:25:41 +04:00
bool dcesrv_auth_bind ( struct dcesrv_call_state * call )
2003-12-14 04:09:10 +03:00
{
2005-10-20 07:47:55 +04:00
struct cli_credentials * server_credentials ;
2005-06-06 03:05:37 +04:00
struct ncacn_packet * pkt = & call - > pkt ;
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
struct dcesrv_connection * dce_conn = call - > conn ;
2005-04-25 08:06:59 +04:00
struct dcesrv_auth * auth = & dce_conn - > auth_state ;
2003-12-14 13:45:50 +03:00
NTSTATUS status ;
2010-02-13 07:32:23 +03:00
uint32_t auth_length ;
2003-12-14 13:45:50 +03:00
if ( pkt - > u . bind . auth_info . length = = 0 ) {
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
dce_conn - > auth_state . auth_info = NULL ;
2007-10-07 02:25:41 +04:00
return true ;
2003-12-14 13:45:50 +03:00
}
2005-01-27 10:08:20 +03:00
dce_conn - > auth_state . auth_info = talloc ( dce_conn , struct dcerpc_auth ) ;
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
if ( ! dce_conn - > auth_state . auth_info ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2010-02-13 07:32:23 +03:00
status = dcerpc_pull_auth_trailer ( pkt , call , & pkt - > u . bind . auth_info ,
dce_conn - > auth_state . auth_info ,
& auth_length , false ) ;
2005-10-20 07:47:55 +04:00
server_credentials
= cli_credentials_init ( call ) ;
if ( ! server_credentials ) {
DEBUG ( 1 , ( " Failed to init server credentials \n " ) ) ;
2007-10-07 02:25:41 +04:00
return false ;
2005-10-20 07:47:55 +04:00
}
2007-12-04 22:05:00 +03:00
cli_credentials_set_conf ( server_credentials , call - > conn - > dce_ctx - > lp_ctx ) ;
2007-12-14 00:46:17 +03:00
status = cli_credentials_set_machine_account ( server_credentials , call - > conn - > dce_ctx - > lp_ctx ) ;
2005-10-20 07:47:55 +04:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 10 , ( " Failed to obtain server credentials, perhaps a standalone server?: %s \n " , nt_errstr ( status ) ) ) ;
talloc_free ( server_credentials ) ;
server_credentials = NULL ;
}
2009-02-13 02:24:16 +03:00
status = samba_server_gensec_start ( dce_conn , call - > event_ctx ,
call - > msg_ctx ,
2010-07-16 08:32:42 +04:00
call - > conn - > dce_ctx - > lp_ctx ,
2009-02-13 02:24:16 +03:00
server_credentials ,
NULL ,
& auth - > gensec_security ) ;
2005-10-20 07:47:55 +04:00
2005-04-25 08:06:59 +04:00
status = gensec_start_mech_by_authtype ( auth - > gensec_security , auth - > auth_info - > auth_type ,
auth - > auth_info - > auth_level ) ;
2003-12-14 13:45:50 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
2005-07-04 06:27:18 +04:00
DEBUG ( 1 , ( " Failed to start GENSEC mechanism for DCERPC server: auth_type=%d, auth_level=%d: %s \n " ,
2005-04-25 08:06:59 +04:00
( int ) auth - > auth_info - > auth_type ,
2005-07-04 06:27:18 +04:00
( int ) auth - > auth_info - > auth_level ,
2005-04-25 08:06:59 +04:00
nt_errstr ( status ) ) ) ;
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2004-06-04 13:46:46 +04:00
2008-10-06 21:39:53 +04:00
if ( call - > conn - > state_flags & DCESRV_CALL_STATE_FLAG_HEADER_SIGNING ) {
gensec_want_feature ( auth - > gensec_security , GENSEC_FEATURE_SIGN_PKT_HEADER ) ;
}
2007-10-07 02:25:41 +04:00
return true ;
2003-12-14 04:09:10 +03:00
}
/*
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
add any auth information needed in a bind ack , and process the authentication
information found in the bind .
2003-12-14 04:09:10 +03:00
*/
2007-08-17 09:28:39 +04:00
NTSTATUS dcesrv_auth_bind_ack ( struct dcesrv_call_state * call , struct ncacn_packet * pkt )
2003-12-14 04:09:10 +03:00
{
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
struct dcesrv_connection * dce_conn = call - > conn ;
2003-12-14 13:45:50 +03:00
NTSTATUS status ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
if ( ! call - > conn - > auth_state . gensec_security ) {
2007-08-17 09:28:39 +04:00
return NT_STATUS_OK ;
2003-12-14 13:45:50 +03:00
}
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
status = gensec_update ( dce_conn - > auth_state . gensec_security ,
2004-09-25 15:24:10 +04:00
call ,
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
dce_conn - > auth_state . auth_info - > credentials ,
& dce_conn - > auth_state . auth_info - > credentials ) ;
if ( NT_STATUS_IS_OK ( status ) ) {
2010-05-30 16:53:36 +04:00
status = gensec_session_info ( dce_conn - > auth_state . gensec_security ,
& dce_conn - > auth_state . session_info ) ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " Failed to establish session_info: %s \n " , nt_errstr ( status ) ) ) ;
2007-08-17 09:28:39 +04:00
return status ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
}
2004-09-12 07:18:24 +04:00
2008-08-07 00:28:04 +04:00
if ( dce_conn - > state_flags & DCESRV_CALL_STATE_FLAG_HEADER_SIGNING ) {
gensec_want_feature ( dce_conn - > auth_state . gensec_security ,
GENSEC_FEATURE_SIGN_PKT_HEADER ) ;
}
2005-04-25 08:06:59 +04:00
/* Now that we are authenticated, go back to the generic session key... */
2004-09-12 07:18:24 +04:00
dce_conn - > auth_state . session_key = dcesrv_generic_session_key ;
2007-08-17 09:28:39 +04:00
return NT_STATUS_OK ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
} else if ( NT_STATUS_EQUAL ( status , NT_STATUS_MORE_PROCESSING_REQUIRED ) ) {
dce_conn - > auth_state . auth_info - > auth_pad_length = 0 ;
dce_conn - > auth_state . auth_info - > auth_reserved = 0 ;
2007-08-17 09:28:39 +04:00
return NT_STATUS_OK ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
} else {
2004-06-04 03:15:16 +04:00
DEBUG ( 2 , ( " Failed to start dcesrv auth negotiate: %s \n " , nt_errstr ( status ) ) ) ;
2007-08-17 09:28:39 +04:00
return status ;
2003-12-14 13:45:50 +03:00
}
}
/*
2004-06-04 03:15:16 +04:00
process the final stage of a auth request
2003-12-14 13:45:50 +03:00
*/
2007-10-07 02:25:41 +04:00
bool dcesrv_auth_auth3 ( struct dcesrv_call_state * call )
2003-12-14 13:45:50 +03:00
{
2005-06-06 03:05:37 +04:00
struct ncacn_packet * pkt = & call - > pkt ;
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
struct dcesrv_connection * dce_conn = call - > conn ;
2003-12-14 13:45:50 +03:00
NTSTATUS status ;
2010-02-13 07:32:23 +03:00
uint32_t auth_length ;
2003-12-14 13:45:50 +03:00
2004-09-11 16:48:27 +04:00
/* We can't work without an existing gensec state, and an new blob to feed it */
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
if ( ! dce_conn - > auth_state . auth_info | |
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
! dce_conn - > auth_state . gensec_security | |
2004-12-06 20:44:33 +03:00
pkt - > u . auth3 . auth_info . length = = 0 ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2010-02-13 07:32:23 +03:00
status = dcerpc_pull_auth_trailer ( pkt , call , & pkt - > u . auth3 . auth_info ,
dce_conn - > auth_state . auth_info , & auth_length , true ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2004-09-11 16:48:27 +04:00
/* Pass the extra data we got from the client down to gensec for processing */
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
status = gensec_update ( dce_conn - > auth_state . gensec_security ,
2004-09-25 15:24:10 +04:00
call ,
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
dce_conn - > auth_state . auth_info - > credentials ,
& dce_conn - > auth_state . auth_info - > credentials ) ;
if ( NT_STATUS_IS_OK ( status ) ) {
status = gensec_session_info ( dce_conn - > auth_state . gensec_security ,
& dce_conn - > auth_state . session_info ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " Failed to establish session_info: %s \n " , nt_errstr ( status ) ) ) ;
2007-10-07 02:25:41 +04:00
return false ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
}
2005-08-23 02:33:58 +04:00
/* Now that we are authenticated, go back to the generic session key... */
2004-09-12 07:18:24 +04:00
dce_conn - > auth_state . session_key = dcesrv_generic_session_key ;
2007-10-07 02:25:41 +04:00
return true ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
} else {
2004-06-04 03:15:16 +04:00
DEBUG ( 4 , ( " dcesrv_auth_auth3: failed to authenticate: %s \n " ,
nt_errstr ( status ) ) ) ;
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
}
2004-12-06 20:48:51 +03:00
/*
parse any auth information from a dcerpc alter request
2007-10-07 02:25:41 +04:00
return false if we can ' t handle the auth request for some
2004-12-06 20:48:51 +03:00
reason ( in which case we send a bind_nak ( is this true for here ? ) )
*/
2007-10-07 02:25:41 +04:00
bool dcesrv_auth_alter ( struct dcesrv_call_state * call )
2004-12-06 20:48:51 +03:00
{
2005-06-06 03:05:37 +04:00
struct ncacn_packet * pkt = & call - > pkt ;
2004-12-06 20:48:51 +03:00
struct dcesrv_connection * dce_conn = call - > conn ;
2010-02-13 07:32:23 +03:00
NTSTATUS status ;
uint32_t auth_length ;
2004-12-06 20:48:51 +03:00
2005-01-10 15:39:42 +03:00
/* on a pure interface change there is no auth blob */
if ( pkt - > u . alter . auth_info . length = = 0 ) {
2007-10-07 02:25:41 +04:00
return true ;
2005-01-10 15:39:42 +03:00
}
/* We can't work without an existing gensec state */
if ( ! dce_conn - > auth_state . gensec_security ) {
2007-10-07 02:25:41 +04:00
return false ;
2004-12-06 20:48:51 +03:00
}
2005-01-27 10:08:20 +03:00
dce_conn - > auth_state . auth_info = talloc ( dce_conn , struct dcerpc_auth ) ;
2004-12-06 20:48:51 +03:00
if ( ! dce_conn - > auth_state . auth_info ) {
2007-10-07 02:25:41 +04:00
return false ;
2004-12-06 20:48:51 +03:00
}
2010-02-13 07:32:23 +03:00
status = dcerpc_pull_auth_trailer ( pkt , call , & pkt - > u . alter . auth_info ,
dce_conn - > auth_state . auth_info ,
& auth_length , true ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
2007-10-07 02:25:41 +04:00
return false ;
2004-12-06 20:48:51 +03:00
}
2007-10-07 02:25:41 +04:00
return true ;
2004-12-06 20:48:51 +03:00
}
/*
add any auth information needed in a alter ack , and process the authentication
information found in the alter .
*/
2007-08-17 09:28:39 +04:00
NTSTATUS dcesrv_auth_alter_ack ( struct dcesrv_call_state * call , struct ncacn_packet * pkt )
2004-12-06 20:48:51 +03:00
{
struct dcesrv_connection * dce_conn = call - > conn ;
NTSTATUS status ;
2005-01-11 04:53:14 +03:00
/* on a pure interface change there is no auth_info structure
setup */
2005-12-29 01:47:22 +03:00
if ( ! call - > conn - > auth_state . auth_info | |
dce_conn - > auth_state . auth_info - > credentials . length = = 0 ) {
2007-08-17 09:28:39 +04:00
return NT_STATUS_OK ;
2005-01-10 15:39:42 +03:00
}
2004-12-06 20:48:51 +03:00
if ( ! call - > conn - > auth_state . gensec_security ) {
2007-08-17 09:28:39 +04:00
return NT_STATUS_INVALID_PARAMETER ;
2004-12-06 20:48:51 +03:00
}
status = gensec_update ( dce_conn - > auth_state . gensec_security ,
call ,
dce_conn - > auth_state . auth_info - > credentials ,
& dce_conn - > auth_state . auth_info - > credentials ) ;
2005-01-11 04:53:14 +03:00
2004-12-06 20:48:51 +03:00
if ( NT_STATUS_IS_OK ( status ) ) {
status = gensec_session_info ( dce_conn - > auth_state . gensec_security ,
& dce_conn - > auth_state . session_info ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
DEBUG ( 1 , ( " Failed to establish session_info: %s \n " , nt_errstr ( status ) ) ) ;
2007-08-17 09:28:39 +04:00
return status ;
2004-12-06 20:48:51 +03:00
}
/* Now that we are authenticated, got back to the generic session key... */
dce_conn - > auth_state . session_key = dcesrv_generic_session_key ;
2007-08-17 09:28:39 +04:00
return NT_STATUS_OK ;
2004-12-06 20:48:51 +03:00
} else if ( NT_STATUS_EQUAL ( status , NT_STATUS_MORE_PROCESSING_REQUIRED ) ) {
dce_conn - > auth_state . auth_info - > auth_pad_length = 0 ;
dce_conn - > auth_state . auth_info - > auth_reserved = 0 ;
2007-08-17 09:28:39 +04:00
return NT_STATUS_OK ;
2004-12-06 20:48:51 +03:00
}
2005-12-29 01:47:22 +03:00
DEBUG ( 2 , ( " Failed to finish dcesrv auth alter_ack: %s \n " , nt_errstr ( status ) ) ) ;
2007-08-17 09:28:39 +04:00
return status ;
2004-12-06 20:48:51 +03:00
}
2004-09-25 11:25:51 +04:00
2003-12-14 13:45:50 +03:00
/*
check credentials on a request
*/
2007-10-07 02:25:41 +04:00
bool dcesrv_auth_request ( struct dcesrv_call_state * call , DATA_BLOB * full_packet )
2003-12-14 13:45:50 +03:00
{
2005-06-06 03:05:37 +04:00
struct ncacn_packet * pkt = & call - > pkt ;
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
struct dcesrv_connection * dce_conn = call - > conn ;
2003-12-14 13:45:50 +03:00
struct dcerpc_auth auth ;
NTSTATUS status ;
2010-02-13 07:32:23 +03:00
uint32_t auth_length ;
2008-09-30 07:01:19 +04:00
size_t hdr_size = DCERPC_REQUEST_LENGTH ;
2003-12-14 13:45:50 +03:00
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
if ( ! dce_conn - > auth_state . auth_info | |
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
! dce_conn - > auth_state . gensec_security ) {
2007-10-07 02:25:41 +04:00
return true ;
2003-12-14 13:45:50 +03:00
}
2010-02-13 07:32:23 +03:00
if ( pkt - > pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID ) {
hdr_size + = 16 ;
}
2008-09-12 17:47:02 +04:00
switch ( dce_conn - > auth_state . auth_info - > auth_level ) {
case DCERPC_AUTH_LEVEL_PRIVACY :
case DCERPC_AUTH_LEVEL_INTEGRITY :
break ;
case DCERPC_AUTH_LEVEL_CONNECT :
if ( pkt - > auth_length ! = 0 ) {
break ;
}
return true ;
case DCERPC_AUTH_LEVEL_NONE :
if ( pkt - > auth_length ! = 0 ) {
return false ;
}
return true ;
default :
return false ;
}
2010-02-13 07:32:23 +03:00
status = dcerpc_pull_auth_trailer ( pkt , call ,
& pkt - > u . request . stub_and_verifier ,
& auth , & auth_length , false ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2010-02-13 07:32:23 +03:00
pkt - > u . request . stub_and_verifier . length - = auth_length ;
2003-12-14 13:45:50 +03:00
/* check signature or unseal the packet */
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
switch ( dce_conn - > auth_state . auth_info - > auth_level ) {
2003-12-14 13:45:50 +03:00
case DCERPC_AUTH_LEVEL_PRIVACY :
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
status = gensec_unseal_packet ( dce_conn - > auth_state . gensec_security ,
2004-09-25 15:24:10 +04:00
call ,
2008-09-30 07:01:19 +04:00
full_packet - > data + hdr_size ,
2003-12-14 13:45:50 +03:00
pkt - > u . request . stub_and_verifier . length ,
2004-09-11 19:11:36 +04:00
full_packet - > data ,
full_packet - > length - auth . credentials . length ,
2003-12-14 13:45:50 +03:00
& auth . credentials ) ;
2004-09-12 10:38:00 +04:00
memcpy ( pkt - > u . request . stub_and_verifier . data ,
2008-09-30 07:01:19 +04:00
full_packet - > data + hdr_size ,
2004-09-12 10:38:00 +04:00
pkt - > u . request . stub_and_verifier . length ) ;
2003-12-14 13:45:50 +03:00
break ;
2004-06-04 03:15:16 +04:00
case DCERPC_AUTH_LEVEL_INTEGRITY :
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
status = gensec_check_packet ( dce_conn - > auth_state . gensec_security ,
2004-09-25 15:24:10 +04:00
call ,
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
pkt - > u . request . stub_and_verifier . data ,
pkt - > u . request . stub_and_verifier . length ,
2004-09-11 19:11:36 +04:00
full_packet - > data ,
full_packet - > length - auth . credentials . length ,
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
& auth . credentials ) ;
2004-06-04 03:15:16 +04:00
break ;
2004-09-25 11:25:51 +04:00
case DCERPC_AUTH_LEVEL_CONNECT :
2008-09-12 17:47:02 +04:00
/* for now we ignore possible signatures here */
status = NT_STATUS_OK ;
2004-09-25 11:25:51 +04:00
break ;
2003-12-14 13:45:50 +03:00
default :
status = NT_STATUS_INVALID_LEVEL ;
break ;
}
2004-09-11 19:11:36 +04:00
/* remove the indicated amount of padding */
2003-12-14 13:45:50 +03:00
if ( pkt - > u . request . stub_and_verifier . length < auth . auth_pad_length ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
pkt - > u . request . stub_and_verifier . length - = auth . auth_pad_length ;
return NT_STATUS_IS_OK ( status ) ;
}
/*
push a signed or sealed dcerpc request packet into a blob
*/
2007-10-07 02:25:41 +04:00
bool dcesrv_auth_response ( struct dcesrv_call_state * call ,
2008-08-11 20:12:54 +04:00
DATA_BLOB * blob , size_t sig_size ,
struct ncacn_packet * pkt )
2003-12-14 13:45:50 +03:00
{
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
struct dcesrv_connection * dce_conn = call - > conn ;
2003-12-14 13:45:50 +03:00
NTSTATUS status ;
2007-11-09 21:24:51 +03:00
enum ndr_err_code ndr_err ;
2003-12-14 13:45:50 +03:00
struct ndr_push * ndr ;
2010-02-16 12:21:29 +03:00
uint32_t payload_length ;
2006-10-23 10:08:25 +04:00
DATA_BLOB creds2 ;
2003-12-14 13:45:50 +03:00
/* non-signed packets are simple */
2008-09-12 17:47:02 +04:00
if ( sig_size = = 0 ) {
2010-05-09 19:20:01 +04:00
status = ncacn_push_auth ( blob , call , pkt , NULL ) ;
2008-09-12 17:47:02 +04:00
return NT_STATUS_IS_OK ( status ) ;
}
switch ( dce_conn - > auth_state . auth_info - > auth_level ) {
case DCERPC_AUTH_LEVEL_PRIVACY :
case DCERPC_AUTH_LEVEL_INTEGRITY :
break ;
case DCERPC_AUTH_LEVEL_CONNECT :
/*
* TODO : let the gensec mech decide if it wants to generate a signature
* that might be needed for schannel . . .
*/
2010-05-09 19:20:01 +04:00
status = ncacn_push_auth ( blob , call , pkt , NULL ) ;
2003-12-14 13:45:50 +03:00
return NT_STATUS_IS_OK ( status ) ;
2008-09-12 17:47:02 +04:00
case DCERPC_AUTH_LEVEL_NONE :
2010-05-09 19:20:01 +04:00
status = ncacn_push_auth ( blob , call , pkt , NULL ) ;
2008-09-12 17:47:02 +04:00
return NT_STATUS_IS_OK ( status ) ;
default :
return false ;
2003-12-14 13:45:50 +03:00
}
2010-05-09 19:20:01 +04:00
ndr = ndr_push_init_ctx ( call ) ;
2003-12-14 13:45:50 +03:00
if ( ! ndr ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2004-06-16 16:44:15 +04:00
if ( ! ( pkt - > drep [ 0 ] & DCERPC_DREP_LE ) ) {
2003-12-17 05:06:44 +03:00
ndr - > flags | = LIBNDR_FLAG_BIGENDIAN ;
}
2007-11-09 21:24:51 +03:00
ndr_err = ndr_push_ncacn_packet ( ndr , NDR_SCALARS | NDR_BUFFERS , pkt ) ;
if ( ! NDR_ERR_CODE_IS_SUCCESS ( ndr_err ) ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2010-02-16 12:21:29 +03:00
/* pad to 16 byte multiple in the payload portion of the
packet . This matches what w2k3 does . Note that we can ' t use
ndr_push_align ( ) as that is relative to the start of the
whole packet , whereas w2k8 wants it relative to the start
of the stub */
dce_conn - > auth_state . auth_info - > auth_pad_length =
( 16 - ( pkt - > u . response . stub_and_verifier . length & 15 ) ) & 15 ;
ndr_err = ndr_push_zero ( ndr , dce_conn - > auth_state . auth_info - > auth_pad_length ) ;
2008-09-13 12:22:39 +04:00
if ( ! NDR_ERR_CODE_IS_SUCCESS ( ndr_err ) ) {
return false ;
}
2003-12-14 13:45:50 +03:00
2008-09-13 12:22:39 +04:00
payload_length = pkt - > u . response . stub_and_verifier . length +
dce_conn - > auth_state . auth_info - > auth_pad_length ;
2004-09-25 12:04:54 +04:00
2008-09-12 17:47:02 +04:00
/* we start without signature, it will appended later */
dce_conn - > auth_state . auth_info - > credentials = data_blob ( NULL , 0 ) ;
2004-09-11 19:11:36 +04:00
/* add the auth verifier */
2007-11-09 21:24:51 +03:00
ndr_err = ndr_push_dcerpc_auth ( ndr , NDR_SCALARS | NDR_BUFFERS ,
2006-10-23 10:08:25 +04:00
dce_conn - > auth_state . auth_info ) ;
2007-11-09 21:24:51 +03:00
if ( ! NDR_ERR_CODE_IS_SUCCESS ( ndr_err ) ) {
2007-10-07 02:25:41 +04:00
return false ;
2004-09-11 19:11:36 +04:00
}
/* extract the whole packet as a blob */
* blob = ndr_push_blob ( ndr ) ;
2008-09-12 17:47:02 +04:00
/*
* Setup the frag and auth length in the packet buffer .
* This is needed if the GENSEC mech does AEAD signing
* of the packet headers . The signature itself will be
* appended later .
*/
dcerpc_set_frag_length ( blob , blob - > length + sig_size ) ;
dcerpc_set_auth_length ( blob , sig_size ) ;
2004-09-11 19:11:36 +04:00
2003-12-14 13:45:50 +03:00
/* sign or seal the packet */
This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context
2.) each endpoint server can register at context creation time as much interfaces as it wants
(multiple interfaces on one endpoint are supported!)
(NOTE: there's a difference between 'endpoint server' and 'endpoint'!
for details look at rpc_server/dcesrv_server.h)
3.) one endpoint can have a security descriptor registered to it self
this will be checked in the future when a client wants to connect
to an smb pipe endpoint.
4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
it takes this options in the [globals] section:
dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
dcerpc remote:binding = ...
dcerpc remote:user = ...
dcerpc remote:password = ...
5.) we currently have tree endpoint servers: epmapper, rpcecho and remote
the default for the 'dcerpc endpiont servers = epmapper, rpcecho'
for testing you can also do
dcerpc endpoint servers = rpcecho, remote, epmapper
dcerpc remote:interfaces = srvsvc, samr, netlogon
6,) please notice the the epmapper now only returns NO_ENTRIES
(but I think we'll find a solution for this too:-)
7.) also there're some other stuff left, but step by step :-)
This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration
metze
(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd5be4c2cd90ff425b8d6f8403122349)
2004-01-09 01:55:27 +03:00
switch ( dce_conn - > auth_state . auth_info - > auth_level ) {
2003-12-14 13:45:50 +03:00
case DCERPC_AUTH_LEVEL_PRIVACY :
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
status = gensec_seal_packet ( dce_conn - > auth_state . gensec_security ,
2004-09-25 15:24:10 +04:00
call ,
2004-09-11 19:11:36 +04:00
ndr - > data + DCERPC_REQUEST_LENGTH ,
2004-09-12 10:04:03 +04:00
payload_length ,
2004-09-11 19:11:36 +04:00
blob - > data ,
2008-09-12 17:47:02 +04:00
blob - > length ,
2006-10-23 10:08:25 +04:00
& creds2 ) ;
2003-12-14 13:45:50 +03:00
break ;
case DCERPC_AUTH_LEVEL_INTEGRITY :
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 13:40:10 +04:00
status = gensec_sign_packet ( dce_conn - > auth_state . gensec_security ,
2004-09-25 15:24:10 +04:00
call ,
2004-06-04 03:15:16 +04:00
ndr - > data + DCERPC_REQUEST_LENGTH ,
2004-09-12 10:04:03 +04:00
payload_length ,
2004-09-11 19:11:36 +04:00
blob - > data ,
2008-09-12 17:47:02 +04:00
blob - > length ,
2006-10-23 10:08:25 +04:00
& creds2 ) ;
2004-09-25 11:25:51 +04:00
break ;
2003-12-14 13:45:50 +03:00
default :
status = NT_STATUS_INVALID_LEVEL ;
break ;
}
if ( ! NT_STATUS_IS_OK ( status ) ) {
2007-10-07 02:25:41 +04:00
return false ;
2003-12-14 13:45:50 +03:00
}
2010-02-14 09:09:55 +03:00
if ( creds2 . length ! = sig_size ) {
DEBUG ( 3 , ( " dcesrv_auth_response: creds2.length[%u] != sig_size[%u] pad[%u] stub[%u] \n " ,
( unsigned ) creds2 . length , ( uint32_t ) sig_size ,
( unsigned ) dce_conn - > auth_state . auth_info - > auth_pad_length ,
( unsigned ) pkt - > u . response . stub_and_verifier . length ) ) ;
dcerpc_set_frag_length ( blob , blob - > length + creds2 . length ) ;
dcerpc_set_auth_length ( blob , creds2 . length ) ;
}
if ( ! data_blob_append ( call , blob , creds2 . data , creds2 . length ) ) {
status = NT_STATUS_NO_MEMORY ;
2010-02-16 12:21:29 +03:00
return false ;
2010-02-14 09:09:55 +03:00
}
data_blob_free ( & creds2 ) ;
2007-10-07 02:25:41 +04:00
return true ;
2003-12-14 04:09:10 +03:00
}