2010-01-12 19:05:16 +03:00
/*
2003-08-13 05:53:07 +04:00
Unix SMB / CIFS implementation .
Standardised Authentication types
2005-01-09 15:55:25 +03:00
Copyright ( C ) Andrew Bartlett 2001
Copyright ( C ) Stefan Metzmacher 2005
2010-01-12 19:05:16 +03:00
2003-08-13 05:53:07 +04: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-08-13 05:53:07 +04:00
( at your option ) any later version .
2010-01-12 19:05:16 +03:00
2003-08-13 05:53:07 +04:00
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 .
2010-01-12 19:05:16 +03:00
2003-08-13 05:53:07 +04:00
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-08-13 05:53:07 +04:00
*/
2004-02-03 14:10:56 +03:00
# ifndef _SAMBA_AUTH_H
# define _SAMBA_AUTH_H
2008-08-28 10:28:47 +04:00
# include "librpc/gen_ndr/ndr_krb5pac.h"
2011-02-08 08:39:34 +03:00
# include "librpc/gen_ndr/auth.h"
2010-05-04 10:44:08 +04:00
# include "../auth/common_auth.h"
2008-08-28 10:28:47 +04:00
2009-07-16 11:37:36 +04:00
extern const char * krbtgt_attrs [ ] ;
extern const char * server_attrs [ ] ;
2007-07-27 10:31:12 +04:00
extern const char * user_attrs [ ] ;
2006-11-07 03:48:36 +03:00
union netr_Validation ;
2006-11-07 15:42:51 +03:00
struct netr_SamBaseInfo ;
struct netr_SamInfo3 ;
2007-12-02 18:20:18 +03:00
struct loadparm_context ;
2004-11-02 05:57:18 +03:00
2004-02-03 14:10:56 +03:00
/* modules can use the following to determine if the interface has changed
* please increment the version number after each interface change
* with a comment and maybe update struct auth_critical_sizes .
*/
/* version 1 - version from samba 3.0 - metze */
/* version 2 - initial samba4 version - metze */
2004-05-02 12:45:00 +04:00
/* version 3 - subsequent samba4 version - abartlet */
2005-01-09 15:55:25 +03:00
/* version 4 - subsequent samba4 version - metze */
2006-07-27 15:24:18 +04:00
/* version 0 - till samba4 is stable - metze */
2011-05-07 10:14:06 +04:00
# define AUTH4_INTERFACE_VERSION 0
2003-08-13 05:53:07 +04:00
2005-01-09 15:55:25 +03:00
struct auth_method_context ;
2011-05-07 10:14:06 +04:00
struct auth4_context ;
2010-04-13 06:00:06 +04:00
struct auth_session_info ;
2010-04-15 05:58:05 +04:00
struct ldb_dn ;
2011-12-28 10:48:45 +04:00
struct smb_krb5_context ;
2003-08-13 05:53:07 +04:00
2005-01-09 15:55:25 +03:00
struct auth_operations {
const char * name ;
2003-12-14 13:45:50 +03:00
2006-07-27 15:24:18 +04:00
/* Given the user supplied info, check if this backend want to handle the password checking */
NTSTATUS ( * want_check ) ( struct auth_method_context * ctx , TALLOC_CTX * mem_ctx ,
const struct auth_usersupplied_info * user_info ) ;
2005-04-27 04:48:39 +04:00
/* Given the user supplied info, check a password */
2017-06-17 01:05:22 +03:00
struct tevent_req * ( * check_password_send ) ( TALLOC_CTX * mem_ctx ,
struct tevent_context * ev ,
struct auth_method_context * ctx ,
const struct auth_usersupplied_info * user_info ) ;
NTSTATUS ( * check_password_recv ) ( struct tevent_req * subreq ,
TALLOC_CTX * mem_ctx ,
struct auth_user_info_dc * * interim_info ,
2023-06-16 01:21:59 +03:00
const struct authn_audit_info * * client_audit_info ,
const struct authn_audit_info * * server_audit_info ,
2017-06-17 01:05:22 +03:00
bool * authoritative ) ;
2003-08-13 05:53:07 +04:00
} ;
2005-01-09 15:55:25 +03:00
struct auth_method_context {
struct auth_method_context * prev , * next ;
2011-05-07 10:14:06 +04:00
struct auth4_context * auth_ctx ;
2005-01-09 15:55:25 +03:00
const struct auth_operations * ops ;
int depth ;
2003-08-13 05:53:07 +04:00
void * private_data ;
2005-01-09 15:55:25 +03:00
} ;
2003-08-13 05:53:07 +04:00
2004-02-03 14:10:56 +03:00
/* this structure is used by backends to determine the size of some critical types */
struct auth_critical_sizes {
int interface_version ;
int sizeof_auth_operations ;
int sizeof_auth_methods ;
int sizeof_auth_context ;
int sizeof_auth_usersupplied_info ;
2011-02-08 08:53:13 +03:00
int sizeof_auth_user_info_dc ;
2004-02-03 14:10:56 +03:00
} ;
2011-05-07 10:14:06 +04:00
NTSTATUS encrypt_user_info ( TALLOC_CTX * mem_ctx , struct auth4_context * auth_context ,
2005-07-22 08:10:07 +04:00
enum auth_password_state to_state ,
const struct auth_usersupplied_info * user_info_in ,
const struct auth_usersupplied_info * * user_info_encrypted ) ;
2007-11-26 04:25:20 +03:00
# include "auth/session.h"
2011-07-21 11:06:17 +04:00
# include "auth/unix_token_proto.h"
2007-11-26 04:25:20 +03:00
# include "auth/system_session_proto.h"
2011-03-14 18:01:47 +03:00
# include "libcli/security/security.h"
2008-04-02 06:53:27 +04:00
struct ldb_message ;
struct ldb_context ;
2009-02-13 02:24:16 +03:00
struct gensec_security ;
2011-02-10 12:21:11 +03:00
struct cli_credentials ;
2009-02-13 02:24:16 +03:00
2011-05-07 10:14:06 +04:00
NTSTATUS auth_get_challenge ( struct auth4_context * auth_ctx , uint8_t chal [ 8 ] ) ;
2008-04-02 06:53:27 +04:00
NTSTATUS authsam_account_ok ( TALLOC_CTX * mem_ctx ,
struct ldb_context * sam_ctx ,
2024-05-29 05:51:01 +03:00
NTTIME now ,
2008-04-02 06:53:27 +04:00
uint32_t logon_parameters ,
2009-05-26 06:31:39 +04:00
struct ldb_dn * domain_dn ,
2008-04-02 06:53:27 +04:00
struct ldb_message * msg ,
const char * logon_workstation ,
2008-12-04 17:09:21 +03:00
const char * name_for_logs ,
2009-06-18 05:08:46 +04:00
bool allow_domain_trust ,
bool password_change ) ;
2011-05-06 18:49:38 +04:00
2010-04-13 16:11:26 +04:00
struct auth_session_info * system_session ( struct loadparm_context * lp_ctx ) ;
2011-02-08 08:53:13 +03:00
NTSTATUS authsam_make_user_info_dc ( TALLOC_CTX * mem_ctx , struct ldb_context * sam_ctx ,
2008-04-02 06:53:27 +04:00
const char * netbios_name ,
2009-05-26 06:31:39 +04:00
const char * domain_name ,
2016-01-07 16:55:07 +03:00
const char * dns_domain_name ,
2010-01-12 19:05:16 +03:00
struct ldb_dn * domain_dn ,
2022-11-07 04:14:18 +03:00
const struct ldb_message * msg ,
2008-04-02 06:53:27 +04:00
DATA_BLOB user_sess_key , DATA_BLOB lm_sess_key ,
2011-02-08 08:53:13 +03:00
struct auth_user_info_dc * * _user_info_dc ) ;
2018-02-02 01:12:36 +03:00
NTSTATUS authsam_update_user_info_dc ( TALLOC_CTX * mem_ctx ,
struct ldb_context * sam_ctx ,
struct auth_user_info_dc * user_info_dc ) ;
2023-05-16 02:18:38 +03:00
NTSTATUS authsam_shallow_copy_user_info_dc ( TALLOC_CTX * mem_ctx ,
const struct auth_user_info_dc * user_info_dc_in ,
struct auth_user_info_dc * * user_info_dc_out ) ;
2010-01-12 19:05:16 +03:00
NTSTATUS auth_system_session_info ( TALLOC_CTX * parent_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_context * lp_ctx ,
struct auth_session_info * * _session_info ) ;
2014-05-16 06:29:43 +04:00
NTSTATUS auth_context_create_methods ( TALLOC_CTX * mem_ctx , const char * const * methods ,
2008-12-29 22:24:57 +03:00
struct tevent_context * ev ,
2011-05-03 04:40:33 +04:00
struct imessaging_context * msg ,
2008-04-02 06:53:27 +04:00
struct loadparm_context * lp_ctx ,
2010-04-15 05:58:05 +04:00
struct ldb_context * sam_ctx ,
2011-05-07 10:14:06 +04:00
struct auth4_context * * auth_ctx ) ;
2011-01-18 11:13:19 +03:00
const char * * auth_methods_from_lp ( TALLOC_CTX * mem_ctx , struct loadparm_context * lp_ctx ) ;
2008-04-02 06:53:27 +04:00
2010-01-12 19:05:16 +03:00
NTSTATUS auth_context_create ( TALLOC_CTX * mem_ctx ,
2008-12-29 22:24:57 +03:00
struct tevent_context * ev ,
2011-05-03 04:40:33 +04:00
struct imessaging_context * msg ,
2008-04-02 06:53:27 +04:00
struct loadparm_context * lp_ctx ,
2011-05-07 10:14:06 +04:00
struct auth4_context * * auth_ctx ) ;
2017-03-17 14:08:59 +03:00
NTSTATUS auth_context_create_for_netlogon ( TALLOC_CTX * mem_ctx ,
struct tevent_context * ev ,
struct imessaging_context * msg ,
struct loadparm_context * lp_ctx ,
struct auth4_context * * auth_ctx ) ;
2008-04-02 06:53:27 +04:00
2011-05-07 10:14:06 +04:00
NTSTATUS auth_check_password ( struct auth4_context * auth_ctx ,
2008-04-02 06:53:27 +04:00
TALLOC_CTX * mem_ctx ,
2012-01-30 04:17:44 +04:00
const struct auth_usersupplied_info * user_info ,
2017-03-17 13:16:36 +03:00
struct auth_user_info_dc * * user_info_dc ,
uint8_t * pauthoritative ) ;
2011-02-15 08:30:35 +03:00
NTSTATUS auth4_init ( void ) ;
2017-05-09 22:39:14 +03:00
NTSTATUS auth_register ( TALLOC_CTX * mem_ctx , const struct auth_operations * ops ) ;
2017-04-20 22:24:43 +03:00
NTSTATUS server_service_auth_init ( TALLOC_CTX * ctx ) ;
2017-05-11 18:05:02 +03:00
struct tevent_req * authenticate_ldap_simple_bind_send ( TALLOC_CTX * mem_ctx ,
struct tevent_context * ev ,
struct imessaging_context * msg ,
struct loadparm_context * lp_ctx ,
struct tsocket_address * remote_address ,
struct tsocket_address * local_address ,
bool using_tls ,
const char * dn ,
const char * password ) ;
NTSTATUS authenticate_ldap_simple_bind_recv ( struct tevent_req * req ,
TALLOC_CTX * mem_ctx ,
struct auth_session_info * * session_info ) ;
2017-02-20 05:57:03 +03:00
NTSTATUS authenticate_ldap_simple_bind ( TALLOC_CTX * mem_ctx ,
struct tevent_context * ev ,
struct imessaging_context * msg ,
struct loadparm_context * lp_ctx ,
struct tsocket_address * remote_address ,
struct tsocket_address * local_address ,
2017-03-06 04:10:17 +03:00
bool using_tls ,
2017-02-20 05:57:03 +03:00
const char * dn ,
const char * password ,
struct auth_session_info * * session_info ) ;
2009-12-23 11:09:37 +03:00
struct tevent_req * auth_check_password_send ( TALLOC_CTX * mem_ctx ,
struct tevent_context * ev ,
2011-05-07 10:14:06 +04:00
struct auth4_context * auth_ctx ,
2009-12-23 11:09:37 +03:00
const struct auth_usersupplied_info * user_info ) ;
NTSTATUS auth_check_password_recv ( struct tevent_req * req ,
2008-04-02 06:53:27 +04:00
TALLOC_CTX * mem_ctx ,
2017-03-17 13:16:36 +03:00
struct auth_user_info_dc * * user_info_dc ,
uint8_t * pauthoritative ) ;
2008-04-02 06:53:27 +04:00
2011-05-07 10:14:06 +04:00
NTSTATUS auth_context_set_challenge ( struct auth4_context * auth_ctx , const uint8_t chal [ 8 ] , const char * set_by ) ;
2005-07-22 08:10:07 +04:00
2009-02-13 02:24:16 +03:00
NTSTATUS samba_server_gensec_start ( TALLOC_CTX * mem_ctx ,
struct tevent_context * event_ctx ,
2011-05-03 04:40:33 +04:00
struct imessaging_context * msg_ctx ,
2009-02-13 02:24:16 +03:00
struct loadparm_context * lp_ctx ,
struct cli_credentials * server_credentials ,
const char * target_service ,
struct gensec_security * * gensec_context ) ;
2017-05-15 08:17:30 +03:00
NTSTATUS samba_server_gensec_krb5_start ( TALLOC_CTX * mem_ctx ,
struct tevent_context * event_ctx ,
struct imessaging_context * msg_ctx ,
struct loadparm_context * lp_ctx ,
struct cli_credentials * server_credentials ,
const char * target_service ,
struct gensec_security * * gensec_context ) ;
2009-02-13 02:24:16 +03:00
2004-05-02 12:45:00 +04:00
# endif /* _SMBAUTH_H_ */