From 1c798aba40fb0e389c7a54ad3d8f7d45876f2809 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 3 Feb 2004 11:10:56 +0000 Subject: - port AUTH and PASSDB subsystems to new SMB_SUBSYSTEM() scheme - some const fixes in ntvfs metze (This used to be commit af89a78123068767b1d134969c5651a0fd978b0d) --- source4/include/auth.h | 157 --------------------------------------------- source4/include/context.h | 4 +- source4/include/includes.h | 4 +- source4/include/passdb.h | 115 --------------------------------- 4 files changed, 4 insertions(+), 276 deletions(-) delete mode 100644 source4/include/auth.h delete mode 100644 source4/include/passdb.h (limited to 'source4/include') diff --git a/source4/include/auth.h b/source4/include/auth.h deleted file mode 100644 index 84faba2b0d..0000000000 --- a/source4/include/auth.h +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef _SMBAUTH_H_ -#define _SMBAUTH_H_ -/* - Unix SMB/CIFS implementation. - Standardised Authentication types - Copyright (C) Andrew Bartlett 2001 - - 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. -*/ - -/* AUTH_STR - string */ -typedef struct normal_string -{ - int len; - char *str; -} AUTH_STR; - -/* AUTH_UNISTR - unicode string or buffer */ -typedef struct unicode_string -{ - int len; - uchar *unistr; -} AUTH_UNISTR; - -#define AUTH_FLAG_NONE 0x000000 -#define AUTH_FLAG_PLAINTEXT 0x000001 -#define AUTH_FLAG_LM_RESP 0x000002 -#define AUTH_FLAG_NTLM_RESP 0x000004 -#define AUTH_FLAG_NTLMv2_RESP 0x000008 - -typedef struct auth_usersupplied_info -{ - - DATA_BLOB lm_resp; - DATA_BLOB nt_resp; - DATA_BLOB plaintext_password; - - BOOL encrypted; - - uint32 auth_flags; - - AUTH_STR client_domain; /* domain name string */ - AUTH_STR domain; /* domain name after mapping */ - AUTH_STR internal_username; /* username after mapping */ - AUTH_STR smb_name; /* username before mapping */ - AUTH_STR wksta_name; /* workstation name (netbios calling name) unicode string */ - -} auth_usersupplied_info; - -#define SAM_FILL_NAME 0x01 -#define SAM_FILL_INFO3 0x02 -#define SAM_FILL_SAM 0x04 -#define SAM_FILL_UNIX 0x08 -#define SAM_FILL_ALL (SAM_FILL_NAME | SAM_FILL_INFO3 | SAM_FILL_SAM | SAM_FILL_UNIX) - -typedef struct auth_serversupplied_info -{ - BOOL guest; - - /* This groups info is needed for when we become_user() for this uid */ - int n_groups; - gid_t *groups; - - /* NT group information taken from the info3 structure */ - - NT_USER_TOKEN *ptok; - - uint8 session_key[16]; - uint8 first_8_lm_hash[8]; - DATA_BLOB nt_session_key; - DATA_BLOB lm_session_key; - - uint32 sam_fill_level; /* How far is this structure filled? */ - - SAM_ACCOUNT *sam_account; - - void *pam_handle; - -} auth_serversupplied_info; - -struct auth_context { - DATA_BLOB challenge; - - /* Who set this up in the first place? */ - const char *challenge_set_by; - - BOOL challenge_may_be_modified; - - struct auth_methods *challenge_set_method; - /* What order are the various methods in? Try to stop it changing under us */ - struct auth_methods *auth_method_list; - - TALLOC_CTX *mem_ctx; - const uint8 *(*get_ntlm_challenge)(struct auth_context *auth_context); - NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context, - const struct auth_usersupplied_info *user_info, - struct auth_serversupplied_info **server_info); - NTSTATUS (*nt_status_squash)(NTSTATUS nt_status); - void (*free)(struct auth_context **auth_context); -}; - -typedef struct auth_methods -{ - struct auth_methods *prev, *next; - const char *name; /* What name got this module */ - - NTSTATUS (*auth)(const struct auth_context *auth_context, - void *my_private_data, - TALLOC_CTX *mem_ctx, - const struct auth_usersupplied_info *user_info, - auth_serversupplied_info **server_info); - - DATA_BLOB (*get_chal)(const struct auth_context *auth_context, - void **my_private_data, - TALLOC_CTX *mem_ctx); - - /* Used to keep tabs on things like the cli for SMB server authentication */ - void *private_data; - - /* Function to clean up the above arbitary structure */ - void (*free_private_data)(void **private_data); - - /* Function to send a keepalive message on the above structure */ - void (*send_keepalive)(void **private_data); - -} auth_methods; - -typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **); - -struct auth_init_function_entry { - const char *name; - /* Function to create a member of the authmethods list */ - - auth_init_function init; -}; - -typedef struct auth_ntlmssp_state -{ - TALLOC_CTX *mem_ctx; - struct auth_context *auth_context; - struct auth_serversupplied_info *server_info; - struct ntlmssp_state *ntlmssp_state; -} AUTH_NTLMSSP_STATE; - -#endif /* _SMBAUTH_H_ */ diff --git a/source4/include/context.h b/source4/include/context.h index 7b156ed382..5c7d117050 100644 --- a/source4/include/context.h +++ b/source4/include/context.h @@ -71,7 +71,7 @@ struct tcon_context { BOOL admin_user; /* the NTVFS operations - see source/ntvfs/ and include/ntvfs.h for details */ - struct ntvfs_ops *ntvfs_ops; + const struct ntvfs_ops *ntvfs_ops; /* the reported filesystem type */ char *fs_type; @@ -359,7 +359,7 @@ struct server_context { struct event_context *events; /* process model specific operations */ - struct model_ops *model_ops; + const struct model_ops *model_ops; }; diff --git a/source4/include/includes.h b/source4/include/includes.h index 2391a59b67..351f7e1ad8 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -742,8 +742,8 @@ extern int errno; #include "libcli/auth/ntlmssp.h" -#include "auth.h" -#include "passdb.h" +#include "auth/auth.h" +#include "passdb/passdb.h" #include "module.h" diff --git a/source4/include/passdb.h b/source4/include/passdb.h deleted file mode 100644 index 25fe5d5300..0000000000 --- a/source4/include/passdb.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Unix SMB/CIFS implementation. - passdb structures and parameters - Copyright (C) Gerald Carter 2001 - Copyright (C) Luke Kenneth Casson Leighton 1998 - 2000 - - 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. -*/ - -#ifndef _PASSDB_H -#define _PASSDB_H - - -/***************************************************************** - Functions to be implemented by the new (v2) passdb API -****************************************************************/ - -/* - * This next constant specifies the version number of the PASSDB interface - * this SAMBA will load. Increment this if *ANY* changes are made to the interface. - */ - -#define PASSDB_INTERFACE_VERSION 4 - -typedef struct pdb_context -{ - struct pdb_methods *pdb_methods; - struct pdb_methods *pwent_methods; - - /* These functions are wrappers for the functions listed above. - They may do extra things like re-reading a SAM_ACCOUNT on update */ - - NTSTATUS (*pdb_setsampwent)(struct pdb_context *, BOOL update); - - void (*pdb_endsampwent)(struct pdb_context *); - - NTSTATUS (*pdb_getsampwent)(struct pdb_context *, SAM_ACCOUNT *user); - - NTSTATUS (*pdb_getsampwnam)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const char *username); - - NTSTATUS (*pdb_getsampwsid)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const DOM_SID *sid); - - NTSTATUS (*pdb_add_sam_account)(struct pdb_context *, SAM_ACCOUNT *sampass); - - NTSTATUS (*pdb_update_sam_account)(struct pdb_context *, SAM_ACCOUNT *sampass); - - NTSTATUS (*pdb_delete_sam_account)(struct pdb_context *, SAM_ACCOUNT *username); - - NTSTATUS (*pdb_delete_group_mapping_entry)(struct pdb_context *context, - DOM_SID sid); - - void (*free_fn)(struct pdb_context **); - - TALLOC_CTX *mem_ctx; - -} PDB_CONTEXT; - -typedef struct pdb_methods -{ - const char *name; /* What name got this module */ - struct pdb_context *parent; - - /* Use macros from dlinklist.h on these two */ - struct pdb_methods *next; - struct pdb_methods *prev; - - NTSTATUS (*setsampwent)(struct pdb_methods *, BOOL update); - - void (*endsampwent)(struct pdb_methods *); - - NTSTATUS (*getsampwent)(struct pdb_methods *, SAM_ACCOUNT *user); - - NTSTATUS (*getsampwnam)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const char *username); - - NTSTATUS (*getsampwsid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const DOM_SID *Sid); - - NTSTATUS (*add_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass); - - NTSTATUS (*update_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass); - - NTSTATUS (*delete_sam_account)(struct pdb_methods *, SAM_ACCOUNT *username); - - NTSTATUS (*delete_group_mapping_entry)(struct pdb_methods *methods, - DOM_SID sid); - - void *private_data; /* Private data of some kind */ - - void (*free_private_data)(void **); - -} PDB_METHODS; - -typedef NTSTATUS (*pdb_init_function)(struct pdb_context *, - struct pdb_methods **, - const char *); - -struct pdb_init_function_entry { - const char *name; - /* Function to create a member of the pdb_methods list */ - pdb_init_function init; - struct pdb_init_function_entry *prev, *next; -}; - -#endif /* _PASSDB_H */ -- cgit