diff options
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/async_sock.h | 51 | ||||
-rw-r--r-- | source3/include/idmap.h | 5 | ||||
-rw-r--r-- | source3/include/includes.h | 39 | ||||
-rw-r--r-- | source3/include/ntdomain.h | 3 | ||||
-rw-r--r-- | source3/include/proto.h | 265 | ||||
-rw-r--r-- | source3/include/rpc_eventlog.h | 100 | ||||
-rw-r--r-- | source3/include/rpc_lsa.h | 60 | ||||
-rw-r--r-- | source3/include/rpc_misc.h | 201 | ||||
-rw-r--r-- | source3/include/smb.h | 26 | ||||
-rw-r--r-- | source3/include/smb_macros.h | 2 | ||||
-rw-r--r-- | source3/include/smbprofile.h | 4 | ||||
-rw-r--r-- | source3/include/util_tdb.h | 38 | ||||
-rw-r--r-- | source3/include/vfs.h | 4 | ||||
-rw-r--r-- | source3/include/vfs_macros.h | 3 |
14 files changed, 180 insertions, 621 deletions
diff --git a/source3/include/async_sock.h b/source3/include/async_sock.h deleted file mode 100644 index c6f95d64d5..0000000000 --- a/source3/include/async_sock.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Unix SMB/CIFS implementation. - async socket operations - Copyright (C) Volker Lendecke 2008 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __ASYNC_SOCK_H__ -#define __ASYNC_SOCK_H__ - -#include "includes.h" - -ssize_t async_syscall_result_ssize_t(struct async_req *req, int *perrno); -size_t async_syscall_result_size_t(struct async_req *req, int *perrno); -int async_syscall_result_int(struct async_req *req, int *perrno); - -struct async_req *async_send(TALLOC_CTX *mem_ctx, struct event_context *ev, - int fd, const void *buffer, size_t length, - int flags); -struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct event_context *ev, - int fd, void *buffer, size_t length, - int flags); -struct async_req *async_connect_send(TALLOC_CTX *mem_ctx, - struct event_context *ev, - int fd, const struct sockaddr *address, - socklen_t address_len); -NTSTATUS async_connect_recv(struct async_req *req, int *perrno); - -struct async_req *sendall_send(TALLOC_CTX *mem_ctx, struct event_context *ev, - int fd, const void *buffer, size_t length, - int flags); -NTSTATUS sendall_recv(struct async_req *req); - -struct async_req *recvall_send(TALLOC_CTX *mem_ctx, struct event_context *ev, - int fd, void *buffer, size_t length, - int flags); -NTSTATUS recvall_recv(struct async_req *req); - -#endif diff --git a/source3/include/idmap.h b/source3/include/idmap.h index 4322192155..672e373108 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -22,11 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* idmap version determines auto-conversion - this is the database - structure version specifier. */ - -#define IDMAP_VERSION 2 - /* The interface version specifier. Updated to 3 for enum types by JRA. */ diff --git a/source3/include/includes.h b/source3/include/includes.h index 9c7f15b9cb..4aa3c07343 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -619,11 +619,9 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx); #include "ntlmssp.h" #include "auth.h" #include "ntdomain.h" -#include "rpc_lsa.h" #include "reg_objects.h" #include "reg_db.h" #include "rpc_spoolss.h" -#include "rpc_eventlog.h" #include "rpc_perfcount.h" #include "rpc_perfcount_defs.h" #include "librpc/gen_ndr/notify.h" @@ -647,9 +645,9 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx); #include "ctdbd_conn.h" #include "../lib/util/talloc_stack.h" #include "memcache.h" -#include "async_req.h" +#include "../lib/async_req/async_req_ntstatus.h" #include "async_smb.h" -#include "async_sock.h" +#include "../lib/async_req/async_sock.h" #include "services.h" #include "eventlog.h" @@ -678,20 +676,6 @@ struct printjob; #include "smb_ldap.h" -struct dns_reg_state; - -void dns_register_smbd(struct dns_reg_state ** dns_state_ptr, - unsigned port, - int *maxfd, - fd_set *listen_set, - struct timeval *timeout); - -void dns_register_close(struct dns_reg_state ** dns_state_ptr); - - -bool dns_register_smbd_reply(struct dns_reg_state *dns_state, - fd_set *lfds, struct timeval *timeout); - /* * Reasons for cache flush. */ @@ -893,8 +877,25 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ #endif -#if defined(HAVE_KRB5) +/* + * This should be under the HAVE_KRB5 flag but since they're used + * in lp_kerberos_method(), they ned to be always available + */ +#define KERBEROS_VERIFY_SECRETS 0 +#define KERBEROS_VERIFY_SYSTEM_KEYTAB 1 +#define KERBEROS_VERIFY_DEDICATED_KEYTAB 2 +#define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3 + +/* + * If you add any entries to the above, please modify the below expressions + * so they remain accurate. + */ +#define USE_KERBEROS_KEYTAB (KERBEROS_VERIFY_SECRETS != lp_kerberos_method()) +#define USE_SYSTEM_KEYTAB \ + ((KERBEROS_VERIFY_SECRETS_AND_KEYTAB == lp_kerberos_method()) || \ + (KERBEROS_VERIFY_SYSTEM_KEYTAB == lp_kerberos_method())) +#if defined(HAVE_KRB5) krb5_error_code smb_krb5_parse_name(krb5_context context, const char *name, /* in unix charset */ krb5_principal *principal); diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 3f501550da..2d6a358391 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -214,8 +214,7 @@ typedef struct pipes_struct { struct auth_serversupplied_info *server_info; - fstring name; - fstring pipe_srv_name; + struct ndr_syntax_id syntax; /* linked list of rpc dispatch tables associated with the open rpc contexts */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 8838419705..267ee74482 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1128,6 +1128,7 @@ bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf); bool socket_exist(const char *fname); bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st); +uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf); SMB_OFF_T get_file_size(char *file_name); char *attrib_string(uint16 mode); void show_msg(char *buf); @@ -1674,8 +1675,6 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, int num_rids, uint32 *rids, const char **domain_name, const char ***names, enum lsa_SidType **types); -bool winbind_allocate_uid(uid_t *uid); -bool winbind_allocate_gid(gid_t *gid); /* The following definitions come from lib/wins_srv.c */ @@ -2324,9 +2323,19 @@ NTSTATUS cli_session_setup(struct cli_state *cli, const char *pass, int passlen, const char *ntpass, int ntpasslen, const char *workgroup); +struct async_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli); +NTSTATUS cli_session_setup_guest_recv(struct async_req *req); bool cli_ulogoff(struct cli_state *cli); -bool cli_send_tconX(struct cli_state *cli, - const char *share, const char *dev, const char *pass, int passlen); +struct async_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, + const char *share, const char *dev, + const char *pass, int passlen); +NTSTATUS cli_tcon_andx_recv(struct async_req *req); +NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share, + const char *dev, const char *pass, int passlen); bool cli_tdis(struct cli_state *cli); void cli_negprot_sendsync(struct cli_state *cli); NTSTATUS cli_negprot(struct cli_state *cli); @@ -2462,6 +2471,8 @@ struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev, DATA_BLOB data); NTSTATUS cli_echo_recv(struct async_req *req); NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data); +bool cli_ucs2(struct cli_state *cli); +bool is_andx_req(uint8_t cmd); /* The following definitions come from libsmb/clierror.c */ @@ -2499,8 +2510,31 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 FileAttributes, uint32 ShareAccess, uint32 CreateDisposition, uint32 CreateOptions, uint8 SecuityFlags); +struct async_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, + const char *fname, + uint32_t CreatFlags, + uint32_t DesiredAccess, + uint32_t FileAttributes, + uint32_t ShareAccess, + uint32_t CreateDisposition, + uint32_t CreateOptions, + uint8_t SecurityFlags); +NTSTATUS cli_ntcreate_recv(struct async_req *req, uint16_t *pfnum); +NTSTATUS cli_ntcreate(struct cli_state *cli, + const char *fname, + uint32_t CreatFlags, + uint32_t DesiredAccess, + uint32_t FileAttributes, + uint32_t ShareAccess, + uint32_t CreateDisposition, + uint32_t CreateOptions, + uint8_t SecurityFlags, + uint16_t *pfid); int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess); -uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str); +uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str, + size_t str_len, size_t *pconverted_size); struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct cli_state *cli, const char *fname, int flags, int share_mode); @@ -2944,7 +2978,6 @@ NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor); /* The following definitions come from libsmb/namecache.c */ bool namecache_enable(void); -bool namecache_shutdown(void); bool namecache_store(const char *name, int name_type, int num_names, @@ -3952,6 +3985,7 @@ bool lp_passdb_expand_explicit(void); char *lp_ldap_suffix(void); char *lp_ldap_admin_dn(void); int lp_ldap_ssl(void); +bool lp_ldap_ssl_ads(void); int lp_ldap_passwd_sync(void); bool lp_ldap_delete_dn(void); int lp_ldap_replication_sleep(void); @@ -4027,7 +4061,8 @@ bool lp_client_use_spnego(void); bool lp_hostname_lookups(void); bool lp_change_notify(const struct share_params *p ); bool lp_kernel_change_notify(const struct share_params *p ); -bool lp_use_kerberos_keytab(void); +char * lp_dedicated_keytab_file(void); +int lp_kerberos_method(void); bool lp_defer_sharing_violations(void); bool lp_enable_privileges(void); bool lp_enable_asu_support(void); @@ -5294,14 +5329,55 @@ NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli, NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, DATA_BLOB *session_key); +NTSTATUS rpc_pipe_open_local(TALLOC_CTX *mem_ctx, + struct rpc_cli_smbd_conn *conn, + const struct ndr_syntax_id *syntax, + struct rpc_pipe_client **presult); /* The following definitions come from rpc_client/rpc_transport_np.c */ +struct async_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, + const struct ndr_syntax_id *abstract_syntax); +NTSTATUS rpc_transport_np_init_recv(struct async_req *req, + TALLOC_CTX *mem_ctx, + struct rpc_cli_transport **presult); NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli, const struct ndr_syntax_id *abstract_syntax, struct rpc_cli_transport **presult); struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p); +/* The following definitions come from rpc_client/rpc_transport_smbd.c */ + +struct async_req *rpc_cli_smbd_conn_init_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + void (*stdout_callback)(char *buf, + size_t len, + void *priv), + void *priv); +NTSTATUS rpc_cli_smbd_conn_init_recv(struct async_req *req, + TALLOC_CTX *mem_ctx, + struct rpc_cli_smbd_conn **pconn); +NTSTATUS rpc_cli_smbd_conn_init(TALLOC_CTX *mem_ctx, + struct rpc_cli_smbd_conn **pconn, + void (*stdout_callback)(char *buf, + size_t len, + void *priv), + void *priv); + +struct async_req *rpc_transport_smbd_init_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct rpc_cli_smbd_conn *conn, + const struct ndr_syntax_id *abstract_syntax); +NTSTATUS rpc_transport_smbd_init_recv(struct async_req *req, + TALLOC_CTX *mem_ctx, + struct rpc_cli_transport **presult); +NTSTATUS rpc_transport_smbd_init(TALLOC_CTX *mem_ctx, + struct rpc_cli_smbd_conn *conn, + const struct ndr_syntax_id *abstract_syntax, + struct rpc_cli_transport **presult); + /* The following definitions come from rpc_client/rpc_transport_sock.c */ NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd, @@ -5600,100 +5676,29 @@ bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC **secdesc); uint32 size_of_relative_string(UNISTR *string); -/* The following definitions come from rpc_parse/parse_eventlog.c */ - -bool eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, - prs_struct *ps, int depth); -bool eventlog_io_r_read_eventlog(const char *desc, - EVENTLOG_Q_READ_EVENTLOG *q_u, - EVENTLOG_R_READ_EVENTLOG *r_u, - prs_struct *ps, - int depth); - /* The following definitions come from rpc_parse/parse_misc.c */ bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth); bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime); -uint32 get_enum_hnd(ENUM_HND *enh); -void init_enum_hnd(ENUM_HND *enh, uint32 hnd); -bool smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth); bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth); -void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid); -bool smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **sid2); -bool smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth); bool smb_io_uuid(const char *desc, struct GUID *uuid, prs_struct *ps, int depth); -void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer); -bool smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth); -void init_uni_hdr(UNIHDR *hdr, UNISTR2 *str2); -bool smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth); -void init_buf_hdr(BUFHDR *hdr, int max_len, int len); -bool smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset); -bool smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, - uint32 ptr_hdrbuf, uint32 max_len, uint32 len); -bool smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth); void init_unistr(UNISTR *str, const char *buf); bool smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth); -void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val); -void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len); -void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf); -void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len); bool smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth); void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf); void copy_unistr2(UNISTR2 *str, const UNISTR2 *from); -void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len); -bool smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth); void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags); -void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags); -void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ); void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf); void init_unistr2_from_unistr(TALLOC_CTX *ctx, UNISTR2 *to, const UNISTR *from); void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) ; bool prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni2); bool prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ); bool smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth); -bool prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4); -bool prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4); -bool prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4); -bool prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array ); -bool init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **strings ); -void init_dom_rid(DOM_RID *prid, uint32 rid, uint16 type, uint32 idx); -bool smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth); -bool smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth); -void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type); -bool smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth); -void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid); -void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, - const char *comp_name); -bool smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth); -void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name); -bool smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth); -bool smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth); -bool smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth); -void init_clnt_info2(DOM_CLNT_INFO2 *clnt, - const char *logon_srv, const char *comp_name, - const DOM_CRED *clnt_cred); -bool smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth); -void init_clnt_info(DOM_CLNT_INFO *clnt, - const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name, - const DOM_CRED *cred); -bool smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth); -void init_logon_id(DOM_LOGON_ID *logonid, uint32 log_id_low, uint32 log_id_high); -bool smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth); -void init_owf_info(OWF_INFO *hash, const uint8 data[16]); -bool smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth); -bool smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth); bool smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth); void init_unistr3(UNISTR3 *str, const char *buf); bool smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth); bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64); -bool smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth); -bool smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth); -bool smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth); -bool make_uni_hdr(UNIHDR *hdr, int len); -bool make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer); uint32 str_len_uni(UNISTR *source); bool policy_handle_is_valid(const POLICY_HND *hnd); @@ -5751,7 +5756,6 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len); bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len); bool prs_buffer5(bool charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str); -bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STRING2 *str); bool prs_unistr2(bool charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str); bool prs_unistr3(bool charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth); bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str); @@ -5778,8 +5782,7 @@ bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx); /* The following definitions come from rpc_parse/parse_rpc.c */ -const char *cli_get_pipe_name_from_iface(TALLOC_CTX *mem_ctx, - const struct ndr_syntax_id *interface); +const char *get_pipe_name_from_iface(const struct ndr_syntax_id *interface); void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, uint32 call_id, int data_len, int auth_len); bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth); @@ -6172,33 +6175,43 @@ bool spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_st bool make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ); bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) ; -/* The following definitions come from rpc_server/srv_eventlog.c */ - -NTSTATUS rpc_eventlog2_init(void); -void eventlog2_get_pipe_fns(struct api_struct **fns, int *n_fns); - /* The following definitions come from rpc_server/srv_eventlog_lib.c */ TDB_CONTEXT *elog_init_tdb( char *tdbfilename ); char *elog_tdbname(TALLOC_CTX *ctx, const char *name ); int elog_tdb_size( TDB_CONTEXT * tdb, int *MaxSize, int *Retention ); bool prune_eventlog( TDB_CONTEXT * tdb ); -bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32 needed ); -ELOG_TDB *elog_open_tdb( char *logname, bool force_clear ); +ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only ); int elog_close_tdb( ELOG_TDB *etdb, bool force_close ); -int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ); -void fixup_eventlog_entry( Eventlog_entry * ee ); -bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor ); +bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, struct eventlog_Record_tdb *entry, bool * eor ); +size_t fixup_eventlog_record_tdb(struct eventlog_Record_tdb *r); +struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + uint32_t record_number); +NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + struct eventlog_Record_tdb *r, + uint32_t *record_number); +NTSTATUS evlog_push_record(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + struct EVENTLOGRECORD *r, + uint32_t *record_number); +struct EVENTLOGRECORD *evlog_pull_record(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + uint32_t record_number); +NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx, + const struct EVENTLOGRECORD *e, + struct eventlog_Record_tdb *t); +NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx, + const struct eventlog_Record_tdb *t, + struct EVENTLOGRECORD *e); /* The following definitions come from rpc_server/srv_eventlog_nt.c */ -NTSTATUS _eventlog_read_eventlog( pipes_struct * p, - EVENTLOG_Q_READ_EVENTLOG * q_u, - EVENTLOG_R_READ_EVENTLOG * r_u ); - /* The following definitions come from rpc_server/srv_lsa_hnd.c */ -bool init_pipe_handle_list(pipes_struct *p, const char *pipe_name); +bool init_pipe_handle_list(pipes_struct *p, + const struct ndr_syntax_id *syntax); bool create_policy_hnd(pipes_struct *p, POLICY_HND *hnd, void *data_ptr); bool find_policy_by_hnd(pipes_struct *p, POLICY_HND *hnd, void **data_p); bool close_policy_hnd(pipes_struct *p, POLICY_HND *hnd); @@ -6221,7 +6234,7 @@ NTSTATUS rpc_srv_register(int version, const char *clnt, const char *srv, const struct ndr_interface_table *iface, const struct api_struct *cmds, int size); -bool is_known_pipename(const char *cli_filename); +bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax); bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p); bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p); bool api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in, @@ -6240,10 +6253,15 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, const char *client_address, struct auth_serversupplied_info *server_info, struct fake_file_handle **phandle); -NTSTATUS np_write(struct fake_file_handle *handle, const uint8_t *data, - size_t len, ssize_t *nwritten); -NTSTATUS np_read(struct fake_file_handle *handle, uint8_t *data, size_t len, - ssize_t *nread, bool *is_data_outstanding); +struct async_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct fake_file_handle *handle, + const uint8_t *data, size_t len); +NTSTATUS np_write_recv(struct async_req *req, ssize_t *nwritten); +struct async_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct fake_file_handle *handle, + uint8_t *data, size_t len); +NTSTATUS np_read_recv(struct async_req *req, ssize_t *nread, + bool *is_data_outstanding); /* The following definitions come from rpc_server/srv_samr_util.c */ @@ -6476,8 +6494,6 @@ REGVAL_CTR *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token ); /* The following definitions come from smbd/aio.c */ -void aio_request_done(uint16_t mid); -bool aio_finished(void); void initialize_async_io_handler(void); bool schedule_aio_read_and_X(connection_struct *conn, struct smb_request *req, @@ -6488,23 +6504,9 @@ bool schedule_aio_write_and_X(connection_struct *conn, files_struct *fsp, char *data, SMB_OFF_T startpos, size_t numtowrite); -int process_aio_queue(void); int wait_for_aio_completion(files_struct *fsp); void cancel_aio_by_fsp(files_struct *fsp); -bool aio_finished(void); -void initialize_async_io_handler(void); -int process_aio_queue(void); -bool schedule_aio_read_and_X(connection_struct *conn, - struct smb_request *req, - files_struct *fsp, SMB_OFF_T startpos, - size_t smb_maxcnt); -bool schedule_aio_write_and_X(connection_struct *conn, - struct smb_request *req, - files_struct *fsp, char *data, - SMB_OFF_T startpos, - size_t numtowrite); -void cancel_aio_by_fsp(files_struct *fsp); -int wait_for_aio_completion(files_struct *fsp); +void smbd_aio_complete_mid(unsigned int mid); /* The following definitions come from smbd/blocking.c */ @@ -6668,14 +6670,9 @@ uint32 dmapi_file_flags(const char * const path); /* The following definitions come from smbd/dnsregister.c */ -void dns_register_close(struct dns_reg_state **dns_state_ptr); -void dns_register_smbd(struct dns_reg_state ** dns_state_ptr, - unsigned port, - int *maxfd, - fd_set *listen_set, - struct timeval *timeout); -bool dns_register_smbd_reply(struct dns_reg_state *dns_state, - fd_set *lfds, struct timeval *timeout); +bool smbd_setup_mdns_registration(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + uint16_t port); /* The following definitions come from smbd/dosmode.c */ @@ -7035,13 +7032,11 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn, /* The following definitions come from smbd/oplock.c */ int32 get_number_of_exclusive_open_oplocks(void); -bool oplock_message_waiting(void); -void process_kernel_oplocks(struct messaging_context *msg_ctx); +void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp); bool set_file_oplock(files_struct *fsp, int oplock_type); void release_file_oplock(files_struct *fsp); bool remove_oplock(files_struct *fsp); bool downgrade_oplock(files_struct *fsp); -int oplock_notify_fd(void); void reply_to_oplock_break_requests(files_struct *fsp); void release_level_2_oplocks_on_change(files_struct *fsp); void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e); @@ -7116,6 +7111,8 @@ SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname); /* The following definitions come from smbd/process.c */ +void smbd_setup_sig_term_handler(void); +void smbd_setup_sig_hup_handler(void); bool srv_send_smb(int fd, char *buffer, bool do_encrypt); int srv_set_message(char *buf, int num_words, @@ -7141,7 +7138,6 @@ struct idle_event *event_add_idle(struct event_context *event_ctx, void *private_data), void *private_data); NTSTATUS allow_new_trans(struct trans_state *list, int mid); -void respond_to_all_remaining_local_messages(void); void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes); const char *smb_fn_name(int type); void add_to_common_flags2(uint32 v); @@ -7149,6 +7145,7 @@ void remove_from_common_flags2(uint32 v); void construct_reply_common_req(struct smb_request *req, char *outbuf); size_t req_wct_ofs(struct smb_request *req); void chain_reply(struct smb_request *req); +bool req_is_in_chain(struct smb_request *req); void check_reload(time_t t); void smbd_process(void); @@ -7222,11 +7219,6 @@ void reply_ctemp(struct smb_request *req); NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, uint32 dirtype, const char *name_in, bool has_wild); void reply_unlink(struct smb_request *req); -void send_file_readbraw(connection_struct *conn, - files_struct *fsp, - SMB_OFF_T startpos, - size_t nread, - ssize_t mincount); void reply_readbraw(struct smb_request *req); void reply_lockread(struct smb_request *req); void reply_read(struct smb_request *req); @@ -7400,7 +7392,6 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf); /* The following definitions come from smbd/trans2.c */ uint64_t smb_roundup(connection_struct *conn, uint64_t val); -uint64_t get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf); NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp, const char *fname, const char *ea_name, struct ea_struct *pea); @@ -7618,7 +7609,7 @@ NTSTATUS nss_info_template_init( void ); /* Misc protos */ -struct async_req *wb_trans_send(TALLOC_CTX *mem_ctx, struct event_context *ev, +struct async_req *wb_trans_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct wb_context *wb_ctx, bool need_priv, const struct winbindd_request *wb_req); NTSTATUS wb_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx, diff --git a/source3/include/rpc_eventlog.h b/source3/include/rpc_eventlog.h deleted file mode 100644 index f17e448d9e..0000000000 --- a/source3/include/rpc_eventlog.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Marcin Krzysztof Porwit 2005. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _RPC_EVENTLOG_H /* _RPC_EVENTLOG_H */ -#define _RPC_EVENTLOG_H - -/* opcodes */ - -#define EVENTLOG_CLEAREVENTLOG 0x00 -#define EVENTLOG_CLOSEEVENTLOG 0x02 -#define EVENTLOG_GETNUMRECORDS 0x04 -#define EVENTLOG_GETOLDESTENTRY 0x05 -#define EVENTLOG_OPENEVENTLOG 0x07 -#define EVENTLOG_READEVENTLOG 0x0a - -/* Eventlog read flags */ -/* defined in librpc/gen_ndr/eventlog.h */ - -/* Event types */ -/* defined in librpc/gen_ndr/eventlog.h */ - -/***********************************/ - -typedef struct -{ - POLICY_HND handle; - uint32 flags; - uint32 offset; - uint32 max_read_size; -} EVENTLOG_Q_READ_EVENTLOG; - -typedef struct { - uint32 length; - uint32 reserved1; - uint32 record_number; - uint32 time_generated; - uint32 time_written; - uint32 event_id; - uint16 event_type; - uint16 num_strings; - uint16 event_category; - uint16 reserved2; - uint32 closing_record_number; - uint32 string_offset; - uint32 user_sid_length; - uint32 user_sid_offset; - uint32 data_length; - uint32 data_offset; -} Eventlog_record; - -typedef struct { - uint32 source_name_len; - smb_ucs2_t *source_name; - uint32 computer_name_len; - smb_ucs2_t *computer_name; - uint32 sid_padding; - smb_ucs2_t *sid; - uint32 strings_len; - smb_ucs2_t *strings; - uint32 user_data_len; - char *user_data; - uint32 data_padding; -} Eventlog_data_record; - -typedef struct eventlog_entry { - Eventlog_record record; - Eventlog_data_record data_record; - uint8 *data; - uint8 *end_of_data_padding; - struct eventlog_entry *next; -} Eventlog_entry; - -typedef struct { - uint32 num_bytes_in_resp; - uint32 bytes_in_next_record; - uint32 num_records; - Eventlog_entry *entry; - uint8 *end_of_entries_padding; - uint32 sent_size; - uint32 real_size; - NTSTATUS status; -} EVENTLOG_R_READ_EVENTLOG; - -#endif /* _RPC_EVENTLOG_H */ diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h deleted file mode 100644 index 1dc5ba4a7b..0000000000 --- a/source3/include/rpc_lsa.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 - Copyright (C) Gerald (Jerry) Carter 2005 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _RPC_LSA_H /* _RPC_LSA_H */ -#define _RPC_LSA_H - -#define LSA_POLICY_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED_ACCESS |\ - LSA_POLICY_VIEW_LOCAL_INFORMATION |\ - LSA_POLICY_VIEW_AUDIT_INFORMATION |\ - LSA_POLICY_GET_PRIVATE_INFORMATION |\ - LSA_POLICY_TRUST_ADMIN |\ - LSA_POLICY_CREATE_ACCOUNT |\ - LSA_POLICY_CREATE_SECRET |\ - LSA_POLICY_CREATE_PRIVILEGE |\ - LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS |\ - LSA_POLICY_SET_AUDIT_REQUIREMENTS |\ - LSA_POLICY_AUDIT_LOG_ADMIN |\ - LSA_POLICY_SERVER_ADMIN |\ - LSA_POLICY_LOOKUP_NAMES ) - - -#define LSA_POLICY_READ ( STANDARD_RIGHTS_READ_ACCESS |\ - LSA_POLICY_VIEW_LOCAL_INFORMATION |\ - LSA_POLICY_VIEW_AUDIT_INFORMATION |\ - LSA_POLICY_GET_PRIVATE_INFORMATION) - -#define LSA_POLICY_WRITE ( STD_RIGHT_READ_CONTROL_ACCESS |\ - LSA_POLICY_TRUST_ADMIN |\ - LSA_POLICY_CREATE_ACCOUNT |\ - LSA_POLICY_CREATE_SECRET |\ - LSA_POLICY_CREATE_PRIVILEGE |\ - LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS |\ - LSA_POLICY_SET_AUDIT_REQUIREMENTS |\ - LSA_POLICY_AUDIT_LOG_ADMIN |\ - LSA_POLICY_SERVER_ADMIN) - -#define LSA_POLICY_EXECUTE ( STANDARD_RIGHTS_EXECUTE_ACCESS |\ - LSA_POLICY_VIEW_LOCAL_INFORMATION |\ - LSA_POLICY_LOOKUP_NAMES ) - -#endif /* _RPC_LSA_H */ diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index 3a3c61ecec..1e9d43bfa0 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -92,10 +92,6 @@ enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_ **********************************************************************/ typedef struct policy_handle POLICY_HND; -typedef struct { - uint32 ptr_hnd; /* pointer to enumeration handle */ - uint32 handle; /* enumeration handle */ -} ENUM_HND; #define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\ ( IVAL((hnd)->uuid.node,2) == (uint32)sys_getpid() ? "OURS" : \ @@ -104,53 +100,6 @@ typedef struct { /********************************************************************** - * Buffer Headers -- use by SEC_DESC_BUF in winreg and netlogon code - **********************************************************************/ - -/* TODO: replace this with an encompassing buffer structure */ -typedef struct { - uint32 buf_max_len; - uint32 buf_len; -} BUFHDR; - -/* this is a BUFHDR + a pointer to a buffer */ -typedef struct { - uint32 info_level; - uint32 length; /* uint8 chars */ - uint32 buffer; -} BUFHDR2; - -/* generic buffer ? wrapped around void*? */ -typedef struct { - uint32 size; - uint32 buffer; -} BUFHDR4; - - -/********************************************************************** - * Buffers - **********************************************************************/ - -/* buffer used by \winreg\ calls to fill in arbitrary REG_XXX values. - It *may* look like a UNISTR2 but it is *not*. This is not a goof - by the winreg developers. It is a generic buffer. buffer length - is stored in bytes (not # of uint16's) */ - -typedef struct { - uint32 buf_max_len; - uint32 offset; - uint32 buf_len; - uint16 *buffer; -} REGVAL_BUFFER; - -/* generic rpc version of the DATA_BLOB. Just a length and uint8 array */ - -typedef struct { - uint32 buf_len; - uint8 *buffer; -} RPC_DATA_BLOB; - -/********************************************************************** * Buffers use by spoolss (i might be able to replace it with * an RPC_DATA_BLOB) **********************************************************************/ @@ -162,22 +111,6 @@ typedef struct { /********************************************************************** - * Unicode and basic string headers - **********************************************************************/ - -typedef struct { - uint16 str_str_len; - uint16 str_max_len; - uint32 buffer; /* non-zero */ -} STRHDR; - -typedef struct { - uint16 uni_str_len; - uint16 uni_max_len; - uint32 buffer; -} UNIHDR; - -/********************************************************************** * UNICODE string variations **********************************************************************/ @@ -205,138 +138,4 @@ typedef struct { /* UNISTR3 - XXXX not sure about this structure */ UNISTR str; } UNISTR3; -typedef struct { /* Buffer wrapped around a UNISTR2 */ - uint16 length; /* number of bytes not counting NULL terminatation */ - uint16 size; /* number of bytes including NULL terminatation */ - UNISTR2 *string; -} UNISTR4; - -typedef struct { - uint32 count; - UNISTR4 *strings; -} UNISTR4_ARRAY; - - -/********************************************************************** - * String variations - **********************************************************************/ - -typedef struct { /* STRING2 - string size (in uint8 chars) and buffer */ - uint32 str_max_len; - uint32 offset; - uint32 str_str_len; - uint8 *buffer; /* uint8 characters. **NOT** necessarily null-terminated */ -} STRING2; - - - - -/********************************************************************** - * Domain SID structures - **********************************************************************/ - -typedef struct { - uint32 num_auths; /* length, bytes, including length of len :-) */ - DOM_SID sid; -} DOM_SID2; - - -/********************************************************************** - * Domain SID structures - **********************************************************************/ - -/* DOM_RID - domain RID structure for ntlsa pipe */ -typedef struct { - uint16 type; /* value is SID_NAME_USE enum */ - uint32 rid; - uint32 rid_idx; /* referenced domain index */ -} DOM_RID; - -/* DOM_RID2 - second domain RID structure for ntlsa pipe */ -typedef struct { - uint16 type; /* value is SID_NAME_USE enum */ - uint32 rid; - uint32 rid_idx; /* referenced domain index */ - uint32 unknown; -} DOM_RID2; - -typedef struct { /* DOM_RID3 - domain RID structure for samr pipe */ - uint32 rid; /* domain-relative (to a SID) id */ - uint32 type1; /* value is 0x1 */ - uint32 ptr_type; /* undocumented pointer */ - uint32 type2; /* value is 0x1 */ - uint32 unk; /* value is 0x2 */ -} DOM_RID3; - -/* DOM_RID4 - rid + user attributes */ -typedef struct domrid4_info -{ - uint32 unknown; - uint16 attr; - uint32 rid; /* user RID */ -} DOM_RID4; - -/* DOM_GID - group id + user attributes */ -typedef struct { - uint32 g_rid; /* a group RID */ - uint32 attr; -} DOM_GID; - -/********************************************************************** - * ???? - **********************************************************************/ - -/* DOM_CLNT_SRV - client / server names */ -typedef struct clnt_srv_info { - uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ - UNISTR2 uni_logon_srv; /* logon server name */ - uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */ - UNISTR2 uni_comp_name; /* client machine name */ -} DOM_CLNT_SRV; - -/* DOM_LOG_INFO - login info */ -typedef struct log_info { - uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ - UNISTR2 uni_logon_srv; /* logon server name */ - UNISTR2 uni_acct_name; /* account name */ - uint16 sec_chan; /* secure channel type */ - UNISTR2 uni_comp_name; /* client machine name */ -} DOM_LOG_INFO; - -/* DOM_CHAL - challenge info */ -typedef struct chal_info { - unsigned char data[8]; /* credentials */ -} DOM_CHAL; - -/* DOM_CREDs - timestamped client or server credentials */ -typedef struct cred_info { - DOM_CHAL challenge; /* credentials */ - UTIME timestamp; /* credential time-stamp */ -} DOM_CRED; - -/* DOM_CLNT_INFO - client info */ -typedef struct clnt_info { - DOM_LOG_INFO login; - DOM_CRED cred; -} DOM_CLNT_INFO; - -/* DOM_CLNT_INFO2 - client info */ -typedef struct clnt_info2 { - DOM_CLNT_SRV login; - uint32 ptr_cred; - DOM_CRED cred; -} DOM_CLNT_INFO2; - -/* DOM_LOGON_ID - logon id */ -typedef struct logon_info { - uint32 low; - uint32 high; -} DOM_LOGON_ID; - -/* OWF INFO */ -typedef struct owf_info { - uint8 data[16]; -} OWF_INFO; - - #endif /* _RPC_MISC_H */ diff --git a/source3/include/smb.h b/source3/include/smb.h index aa2db693a3..b441b3476a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -367,6 +367,7 @@ struct uuid; struct named_mutex; struct pcap_cache; struct wb_context; +struct rpc_cli_smbd_conn; struct vfs_fsp_data { struct vfs_fsp_data *next; @@ -623,7 +624,18 @@ struct smb_request { uint16_t buflen; const uint8_t *buf; const uint8 *inbuf; + + /* + * Async handling in the main smb processing loop is directed by + * outbuf: reply_xxx routines indicate sync behaviour by putting their + * reply into "outbuf". If they leave it as NULL, they take of it + * themselves, possibly later. + * + * If async handling is wanted, the reply_xxx routine must make sure + * that it talloc_move()s the smb_req somewhere else. + */ uint8 *outbuf; + size_t unread_bytes; bool encrypted; connection_struct *conn; @@ -637,6 +649,11 @@ struct smb_request { * Here we collect the outbufs from the chain handlers */ uint8_t *chain_outbuf; + + /* + * state information for async smb handling + */ + void *async_priv; }; /* Defines for the sent_oplock_break field above. */ @@ -1242,7 +1259,7 @@ struct bitmap { /* Mapping of access rights to UNIX perms. for a UNIX directory. */ #define UNIX_DIRECTORY_ACCESS_RWX FILE_GENERIC_ALL #define UNIX_DIRECTORY_ACCESS_R FILE_GENERIC_READ -#define UNIX_DIRECTORY_ACCESS_W FILE_GENERIC_WRITE +#define UNIX_DIRECTORY_ACCESS_W (FILE_GENERIC_WRITE|FILE_DELETE_CHILD) #define UNIX_DIRECTORY_ACCESS_X FILE_GENERIC_EXECUTE #if 0 @@ -1549,11 +1566,6 @@ enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K}; #define COPYBUF_SIZE (8*1024) /* - * Used in chaining code. - */ -extern int chain_size; - -/* * Map the Core and Extended Oplock requesst bits down * to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK). */ @@ -1680,12 +1692,10 @@ struct kernel_oplocks { /* if a kernel does support oplocks then a structure of the following typee is used to describe how to interact with the kernel */ struct kernel_oplocks_ops { - files_struct * (*receive_message)(struct kernel_oplocks *ctx); bool (*set_oplock)(struct kernel_oplocks *ctx, files_struct *fsp, int oplock_type); void (*release_oplock)(struct kernel_oplocks *ctx, files_struct *fsp); - bool (*msg_waiting)(struct kernel_oplocks *ctx); }; #include "smb_macros.h" diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 92c60a7530..fd1bba16a7 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -135,7 +135,7 @@ /* Note that chain_size must be available as an extern int to this macro. */ -#define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size) +#define smb_offset(p,buf) (PTR_DIFF(p,buf+4)) #define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|((PVAL(buf,1)&1)<<16)) #define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = ((len)&0x10000)>>16; \ diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index 8945708ca3..131416b685 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -127,6 +127,10 @@ enum profile_stats_values #define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count) #define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time) + PR_VALUE_SYSCALL_GET_ALLOC_SIZE, +#define syscall_get_alloc_size_count __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, count) +#define syscall_get_alloc_size_time __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, time) + PR_VALUE_SYSCALL_UNLINK, #define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count) #define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time) diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h index 127176b887..c79436434f 100644 --- a/source3/include/util_tdb.h +++ b/source3/include/util_tdb.h @@ -24,6 +24,7 @@ #include "talloc.h" /* for tdb_wrap_open() */ #include "../libcli/util/ntstatus.h" /* for map_nt_error_from_tdb() */ +#include "../../lib/util/util_tdb.h" struct tdb_wrap { struct tdb_context *tdb; @@ -31,47 +32,15 @@ struct tdb_wrap { struct tdb_wrap *next, *prev; }; -struct tdb_validation_status { - bool tdb_error; - bool bad_freelist; - bool bad_entry; - bool unknown_key; - bool success; -}; - -typedef int (*tdb_validate_data_func)(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state); - -TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize); -TDB_DATA string_tdb_data(const char *string); -TDB_DATA string_term_tdb_data(const char *string); - int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key, unsigned int timeout); -int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval); int tdb_lock_bystring_with_timeout(struct tdb_context *tdb, const char *keyval, int timeout); -void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval); int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout); -void tdb_read_unlock_bystring(struct tdb_context *tdb, const char *keyval); - -int32_t tdb_fetch_int32_byblob(struct tdb_context *tdb, TDB_DATA key); -int32_t tdb_fetch_int32(struct tdb_context *tdb, const char *keystr); -bool tdb_store_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t value); -bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value); -int tdb_store_int32_byblob(struct tdb_context *tdb, TDB_DATA key, int32_t v); -int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32_t v); -bool tdb_fetch_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t *value); -bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value); -int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32_t *oldval, int32_t change_val); -bool tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr, - uint32_t *oldval, uint32_t change_val); -int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags); int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr, TDB_DATA data, int flags); -TDB_DATA tdb_fetch_bystring(struct tdb_context *tdb, const char *keystr); -int tdb_delete_bystring(struct tdb_context *tdb, const char *keystr); int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key); @@ -90,9 +59,4 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err); -int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn); -int tdb_validate_open(const char *tdb_path, tdb_validate_data_func validate_fn); -int tdb_validate_and_backup(const char *tdb_path, - tdb_validate_data_func validate_fn); - #endif /* __TDBUTIL_H__ */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 5df71da905..e9115ab807 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -112,6 +112,7 @@ /* Changed to version 25 - Jelmer's change from SMB_BIG_UINT to uint64_t. */ /* Leave at 25 - not yet released. Add create_file call. -- tprouty. */ /* Leave at 25 - not yet released. Add create time to ntimes. -- tstecher. */ +/* Leave at 25 - not yet released. Add get_alloc_size call. -- tprouty. */ #define SMB_VFS_INTERFACE_VERSION 25 @@ -189,6 +190,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_STAT, SMB_VFS_OP_FSTAT, SMB_VFS_OP_LSTAT, + SMB_VFS_OP_GET_ALLOC_SIZE, SMB_VFS_OP_UNLINK, SMB_VFS_OP_CHMOD, SMB_VFS_OP_FCHMOD, @@ -342,6 +344,7 @@ struct vfs_ops { int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf); int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); + uint64_t (*get_alloc_size)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf); int (*unlink)(struct vfs_handle_struct *handle, const char *path); int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode); int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); @@ -496,6 +499,7 @@ struct vfs_ops { struct vfs_handle_struct *stat; struct vfs_handle_struct *fstat; struct vfs_handle_struct *lstat; + struct vfs_handle_struct *get_alloc_size; struct vfs_handle_struct *unlink; struct vfs_handle_struct *chmod; struct vfs_handle_struct *fchmod; diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index c6ccd4912a..e7a9cfdc76 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -62,6 +62,7 @@ #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf))) #define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf))) #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf))) +#define SMB_VFS_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs.ops.get_alloc_size((conn)->vfs.handles.get_alloc_size, (fsp), (sbuf))) #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path))) #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode))) #define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode))) @@ -189,6 +190,7 @@ #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf))) #define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf))) #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf))) +#define SMB_VFS_OPAQUE_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_opaque.ops.get_alloc_size((conn)->vfs_opaque.handles.get_alloc_size, (fsp), (sbuf))) #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path))) #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode))) #define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode))) @@ -317,6 +319,7 @@ #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf))) #define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf))) #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf))) +#define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_next.ops.get_alloc_size((conn)->vfs_next.handles.get_alloc_size, (fsp), (sbuf))) #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path))) #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode))) #define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode))) |