s3: Add access_mask to the flock VFS call
[samba.git] / source3 / include / proto.h
index 5d0fa18192d8934c6e26266507cc0d7415c87669..d31483a02e27b1c700a72e9ebcea3c5a71b24e1a 100644 (file)
@@ -440,10 +440,18 @@ int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
                         uint32_t *val);
 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
-uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
+NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
                                     uint32_t *oldval, uint32_t change_val);
-int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
-                                int32 *oldval, int32 change_val);
+NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
+                                          const char *keystr,
+                                          uint32_t *oldval,
+                                          uint32_t change_val);
+NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
+                                   int32_t *oldval, int32_t change_val);
+NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db,
+                                         const char *keystr,
+                                         int32_t *oldval,
+                                         int32_t change_val);
 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
                            int flag);
 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
@@ -527,7 +535,7 @@ bool gencache_set(const char *keystr, const char *value, time_t timeout);
 bool gencache_del(const char *keystr);
 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
-                           time_t *timeout);
+                           time_t *timeout, bool *was_expired);
 bool gencache_stabilize(void);
 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
@@ -713,6 +721,7 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
 
 /* The following definitions come from lib/sharesec.c  */
 
+bool share_info_db_init(void);
 SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
 SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
                              size_t *psize);
@@ -928,7 +937,7 @@ SMB_OFF_T sys_ftell(FILE *fp);
 int sys_creat(const char *path, mode_t mode);
 int sys_open(const char *path, int oflag, mode_t mode);
 FILE *sys_fopen(const char *path, const char *type);
-void kernel_flock(int fd, uint32 share_mode);
+void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
 SMB_STRUCT_DIR *sys_opendir(const char *name);
 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
@@ -1020,7 +1029,8 @@ char *current_timestring(TALLOC_CTX *ctx, bool hires);
 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
-void put_long_date_timespec(char *p, struct timespec ts);
+void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
+void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
 void put_long_date(char *p, time_t t);
 void dos_filetime_timespec(struct timespec *tsp);
 time_t make_unix_date2(const void *date_ptr, int zone_offset);
@@ -1036,6 +1046,8 @@ struct timespec timespec_current(void);
 struct timespec timespec_min(const struct timespec *ts1,
                           const struct timespec *ts2);
 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
+void round_timespec_to_sec(struct timespec *ts);
+void round_timespec_to_usec(struct timespec *ts);
 struct timespec interpret_long_date(const char *p);
 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
@@ -1078,6 +1090,9 @@ struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
                                    const char *username);
+const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
+void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
+                                 const char *domain);
 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
                                    const char *password);
 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
@@ -1244,6 +1259,10 @@ struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
 const char *reg_type_lookup(enum winreg_Type type);
 WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
                         uint32 *num_values, char ***values);
+bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
+bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
+bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
+bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
 
 /* The following definitions come from lib/util_reg_api.c  */
 
@@ -1327,17 +1346,11 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
 
 /* The following definitions come from lib/util_sock.c  */
 
-bool interpret_string_addr_internal(struct addrinfo **ppres,
-                                       const char *str, int flags);
 bool is_broadcast_addr(const struct sockaddr *pss);
-bool interpret_string_addr(struct sockaddr_storage *pss,
-               const char *str,
-               int flags);
 bool is_loopback_ip_v4(struct in_addr ip);
 bool is_loopback_addr(const struct sockaddr *pss);
 bool is_zero_addr(const struct sockaddr *pss);
 void zero_ip_v4(struct in_addr *ip);
-void zero_sockaddr(struct sockaddr_storage *pss);
 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
                struct in_addr ip);
 bool same_net(const struct sockaddr *ip1,
@@ -1368,7 +1381,7 @@ ssize_t read_udp_v4_socket(int fd,
                        char *buf,
                        size_t len,
                        struct sockaddr_storage *psa);
-NTSTATUS read_socket_with_timeout(int fd, char *buf,
+NTSTATUS read_fd_with_timeout(int fd, char *buf,
                                  size_t mincnt, size_t maxcnt,
                                  unsigned int time_out,
                                  size_t *size_ret);
@@ -1563,12 +1576,6 @@ void load_case_tables(void);
 void init_valid_table(void);
 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
 char *skip_unibuf(char *src, size_t len);
-int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags);
-int rpcstr_pull_talloc(TALLOC_CTX *ctx,
-                       char **dest,
-                       void *src,
-                       int src_len,
-                       int flags);
 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
 smb_ucs2_t toupper_w(smb_ucs2_t val);
@@ -1791,23 +1798,6 @@ bool create_local_private_krb5_conf_for_domain(const char *realm,
                                                const char *sitename,
                                                struct sockaddr_storage *pss);
 
-
-/* The following definitions come from libsmb/credentials.c  */
-
-char *credstr(const unsigned char *cred);
-void creds_server_init(uint32 neg_flags,
-                       struct dcinfo *dc,
-                       struct netr_Credential *clnt_chal,
-                       struct netr_Credential *srv_chal,
-                       const unsigned char mach_pw[16],
-                       struct netr_Credential *init_chal_out);
-bool netlogon_creds_server_check(const struct dcinfo *dc,
-                                const struct netr_Credential *rcv_cli_chal_in);
-bool netlogon_creds_server_step(struct dcinfo *dc,
-                               const struct netr_Authenticator *received_cred,
-                               struct netr_Authenticator *cred_out);
-void cred_hash3(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw);
-
 /* The following definitions come from libads/kerberos_keytab.c  */
 
 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
@@ -3050,7 +3040,7 @@ void debug_dsdcinfo_flags(int lvl, uint32_t flags);
 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
                     struct messaging_context *msg_ctx,
                     const char *domain_name,
-                    struct GUID *domain_guid,
+                    const struct GUID *domain_guid,
                     const char *site_name,
                     uint32_t flags,
                     struct netr_DsRGetDCNameInfo **info);
@@ -3112,10 +3102,6 @@ struct sockaddr_storage *name_query(int fd,
                        int *count,
                        int *flags,
                        bool *timed_out);
-XFILE *startlmhosts(const char *fname);
-bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type,
-               struct sockaddr_storage *pss);
-void endlmhosts(XFILE *fp);
 NTSTATUS name_resolve_bcast(const char *name,
                        int name_type,
                        struct ip_service **return_iplist,
@@ -3132,7 +3118,8 @@ NTSTATUS internal_resolve_name(const char *name,
                                const char *resolve_order);
 bool resolve_name(const char *name,
                struct sockaddr_storage *return_ss,
-               int name_type);
+               int name_type,
+               bool prefer_ipv4);
 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
                const char *name,
                int name_type,
@@ -3304,12 +3291,6 @@ const char *smb_dos_err_class(uint8 e_class);
 char *smb_dos_errstr(char *inbuf);
 WERROR map_werror_from_unix(int error);
 
-/* The following definitions come from libsmb/spnego.c  */
-
-ssize_t read_spnego_data(DATA_BLOB data, SPNEGO_DATA *token);
-ssize_t write_spnego_data(DATA_BLOB *blob, SPNEGO_DATA *spnego);
-bool free_spnego_data(SPNEGO_DATA *spnego);
-
 /* The following definitions come from libsmb/trustdom_cache.c  */
 
 bool trustdom_cache_enable(void);
@@ -3983,6 +3964,7 @@ bool lp_winbind_refresh_tickets(void);
 bool lp_winbind_offline_logon(void);
 bool lp_winbind_normalize_names(void);
 bool lp_winbind_rpc_only(void);
+bool lp_create_krb5_conf(void);
 const char **lp_idmap_domains(void);
 const char *lp_idmap_backend(void);
 char *lp_idmap_alloc_backend(void);
@@ -4175,6 +4157,7 @@ bool lp_administrative_share(int );
 bool lp_print_ok(int );
 bool lp_map_hidden(int );
 bool lp_map_archive(int );
+bool lp_store_create_time(int );
 bool lp_store_dos_attributes(int );
 bool lp_dmapi_support(int );
 bool lp_locking(const struct share_params *p );
@@ -4714,17 +4697,20 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
 bool secrets_store_afs_keyfile(const char *cell, const struct afs_keyfile *keyfile);
 bool secrets_fetch_afs_key(const char *cell, struct afs_key *result);
 void secrets_fetch_ipc_userpass(char **username, char **domain, char **password);
-bool secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx,
-                                        const char *remote_machine,
-                                        const struct dcinfo *pdc);
-bool secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
-                                          const char *remote_machine,
-                                          struct dcinfo **ppdc);
+TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx);
 bool secrets_store_generic(const char *owner, const char *key, const char *secret);
 char *secrets_fetch_generic(const char *owner, const char *key);
 bool secrets_store_local_schannel_key(uint8_t schannel_key[16]);
 bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16]);
 
+/* The following definitions come from passdb/secrets_schannel.c  */
+
+NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
+                                   const char *computer_name,
+                                   struct netlogon_creds_CredentialState **pcreds);
+NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
+                                   struct netlogon_creds_CredentialState *creds);
+
 /* The following definitions come from passdb/util_builtin.c  */
 
 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
@@ -5127,12 +5113,14 @@ struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name,
                                   const char *data_p, size_t size);
 int regval_ctr_addvalue(struct regval_ctr *ctr, const char *name, uint16 type,
                        const char *data_p, size_t size);
+int regval_ctr_addvalue_sz(struct regval_ctr *ctr, const char *name, const char *data);
+int regval_ctr_addvalue_multi_sz(struct regval_ctr *ctr, const char *name, const char **data);
 int regval_ctr_copyvalue(struct regval_ctr *ctr, struct regval_blob *val);
 int regval_ctr_delvalue(struct regval_ctr *ctr, const char *name);
 struct regval_blob* regval_ctr_getvalue(struct regval_ctr *ctr,
                                        const char *name);
 uint32 regval_dword(struct regval_blob *val);
-char *regval_sz(struct regval_blob *val);
+const char *regval_sz(struct regval_blob *val);
 
 /* The following definitions come from registry/reg_perfcount.c  */
 
@@ -5142,20 +5130,6 @@ uint32 reg_perfcount_get_last_counter(uint32 base_index);
 uint32 reg_perfcount_get_last_help(uint32 last_counter);
 uint32 reg_perfcount_get_counter_help(uint32 base_index, char **retbuf);
 uint32 reg_perfcount_get_counter_names(uint32 base_index, char **retbuf);
-bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data);
-bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst,
-                                     prs_struct *ps,
-                                     int instId,
-                                     PERF_OBJECT_TYPE *obj,
-                                     TDB_CONTEXT *names);
-bool _reg_perfcount_add_instance(PERF_OBJECT_TYPE *obj,
-                                prs_struct *ps,
-                                int instInd,
-                                TDB_CONTEXT *names);
-uint32 reg_perfcount_get_perf_data_block(uint32 base_index, 
-                                        prs_struct *ps, 
-                                        PERF_DATA_BLOCK *block,
-                                        const char *object_ids);
 WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbuf_len, const char *object_ids);
 
 /* The following definitions come from registry/reg_util.c  */
@@ -5165,8 +5139,6 @@ bool reg_split_key(char *path, char **base, char **key);
 char *normalize_reg_path(TALLOC_CTX *ctx, const char *keyname );
 void normalize_dbkey(char *key);
 char *reg_remaining_path(TALLOC_CTX *ctx, const char *key);
-int regval_convert_multi_sz( uint16 *multi_string, size_t byte_len, char ***values );
-size_t regval_build_multi_sz( char **values, uint16 **buffer );
 
 /* The following definitions come from registry/reg_util_legacy.c  */
 
@@ -5196,6 +5168,14 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
                                char ***pdomains,
                                char ***pnames,
                                enum lsa_SidType **ptypes);
+NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *pol,
+                                int num_sids,
+                                const DOM_SID *sids,
+                                char ***pdomains,
+                                char ***pnames,
+                                enum lsa_SidType **ptypes);
 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx,
                                 struct policy_handle *pol, int num_names,
@@ -5204,6 +5184,15 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
                                 int level,
                                 DOM_SID **sids,
                                 enum lsa_SidType **types);
+NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *pol, int num_names,
+                                 const char **names,
+                                 const char ***dom_names,
+                                 int level,
+                                 DOM_SID **sids,
+                                 enum lsa_SidType **types);
+
 bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid);
 
 /* The following definitions come from rpc_client/cli_netlogon.c  */
@@ -5262,10 +5251,6 @@ struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
                                         prs_struct *req_data);
 NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                               prs_struct *reply_pdu);
-NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli,
-                       uint8 op_num,
-                       prs_struct *in_data,
-                       prs_struct *out_data);
 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
                                      struct event_context *ev,
                                      struct rpc_pipe_client *cli,
@@ -5280,17 +5265,17 @@ NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
                               struct cli_pipe_auth_data **presult);
 NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
                                  enum pipe_auth_type auth_type,
-                                 enum pipe_auth_level auth_level,
+                                 enum dcerpc_AuthLevel auth_level,
                                  const char *domain,
                                  const char *username,
                                  const char *password,
                                  struct cli_pipe_auth_data **presult);
 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
-                                  enum pipe_auth_level auth_level,
-                                  const uint8_t sess_key[16],
+                                  enum dcerpc_AuthLevel auth_level,
+                                  struct netlogon_creds_CredentialState *creds,
                                   struct cli_pipe_auth_data **presult);
 NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
-                                  enum pipe_auth_level auth_level,
+                                  enum dcerpc_AuthLevel auth_level,
                                   const char *service_princ,
                                   const char *username,
                                   const char *password,
@@ -5308,16 +5293,22 @@ NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id
 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
                                  const struct ndr_syntax_id *interface,
                                  struct rpc_pipe_client **presult);
+NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
+                                           enum dcerpc_transport_t transport,
+                                           const struct ndr_syntax_id *interface,
+                                           struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
                                   const struct ndr_syntax_id *interface,
-                                  enum pipe_auth_level auth_level,
+                                  enum dcerpc_transport_t transport,
+                                  enum dcerpc_AuthLevel auth_level,
                                   const char *domain,
                                   const char *username,
                                   const char *password,
                                   struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
                                          const struct ndr_syntax_id *interface,
-                                         enum pipe_auth_level auth_level,
+                                         enum dcerpc_transport_t transport,
+                                         enum dcerpc_AuthLevel auth_level,
                                          const char *domain,
                                          const char *username,
                                          const char *password,
@@ -5328,25 +5319,28 @@ NTSTATUS get_schannel_session_key(struct cli_state *cli,
                                  struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
                                             const struct ndr_syntax_id *interface,
-                                            enum pipe_auth_level auth_level,
+                                            enum dcerpc_transport_t transport,
+                                            enum dcerpc_AuthLevel auth_level,
                                             const char *domain,
                                             struct netlogon_creds_CredentialState **pdc,
                                             struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
                                                 const struct ndr_syntax_id *interface,
-                                                enum pipe_auth_level auth_level,
+                                                enum dcerpc_transport_t transport,
+                                                enum dcerpc_AuthLevel auth_level,
                                                 const char *domain,
                                                 const char *username,
                                                 const char *password,
                                                 struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
                                    const struct ndr_syntax_id *interface,
-                                   enum pipe_auth_level auth_level,
+                                   enum dcerpc_transport_t transport,
+                                   enum dcerpc_AuthLevel auth_level,
                                    const char *domain,
                                    struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
                                const struct ndr_syntax_id *interface,
-                               enum pipe_auth_level auth_level,
+                               enum dcerpc_AuthLevel auth_level,
                                const char *service_princ,
                                const char *username,
                                const char *password,
@@ -5408,12 +5402,6 @@ NTSTATUS rpc_transport_smbd_init(TALLOC_CTX *mem_ctx,
 NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
                                 struct rpc_cli_transport **presult);
 
-/* The following definitions come from rpc_client/cli_reg.c  */
-
-NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                         uint32 reg_type, uint32 access_mask,
-                         struct policy_handle *reg_hnd);
-
 /* The following definitions come from rpc_client/cli_samr.c  */
 
 NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
@@ -5600,6 +5588,10 @@ NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info,
                                uint8_t *pipe_session_key,
                                size_t pipe_session_key_len,
                                struct netr_SamInfo3 *sam3);
+NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
+                               uint8_t *pipe_session_key,
+                               size_t pipe_session_key_len,
+                               struct netr_SamInfo6 *sam6);
 void init_netr_CryptPassword(const char *pwd,
                             unsigned char session_key[16],
                             struct netr_CryptPassword *pwd_buf);
@@ -5615,6 +5607,13 @@ void init_samr_CryptPassword(const char *pwd,
 
 /* The following definitions come from rpc_client/ndr.c  */
 
+struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
+                                      struct tevent_context *ev,
+                                      struct rpc_pipe_client *cli,
+                                      const struct ndr_interface_table *table,
+                                      uint32_t opnum,
+                                      void *r);
+NTSTATUS cli_do_rpc_ndr_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
 NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
                        TALLOC_CTX *mem_ctx,
                        const struct ndr_interface_table *table,
@@ -5623,11 +5622,8 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
 /* 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_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
-bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
 bool smb_io_uuid(const char *desc, struct GUID *uuid, 
                 prs_struct *ps, int depth);
-void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags);
 
 /* The following definitions come from rpc_parse/parse_prs.c  */
 
@@ -5678,21 +5674,13 @@ bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint
 bool prs_uint16s(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_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str);
-bool prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size);
-void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level,
-                  enum schannel_direction direction,
-                  RPC_AUTH_SCHANNEL_CHK * verf,
-                  char *data, size_t data_len);
-bool schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level,
-                  enum schannel_direction direction, 
-                  RPC_AUTH_SCHANNEL_CHK * verf, char *data, size_t data_len);
 bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
 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 *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,
+void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_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);
 void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
@@ -5718,19 +5706,6 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai,
                                uint8 auth_pad_len,
                                uint32 auth_context_id);
 bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
-bool rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav,
-                               const char *signature, uint32 msg_type);
-void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav,
-                               const char *signature, uint32 msg_type);
-bool smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth);
-bool smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth);
-void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg,
-                             const char *domain, const char *myname);
-bool smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg,
-                               prs_struct *ps, int depth);
-bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, 
-                                RPC_AUTH_SCHANNEL_CHK * chk,
-                               prs_struct *ps, int depth);
 
 /* The following definitions come from lib/eventlog/eventlog.c  */
 
@@ -6129,9 +6104,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn);
 bool conn_close_all(struct smbd_server_connection *sconn);
 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
-void conn_free_internal(connection_struct *conn);
-void conn_free(struct smbd_server_connection *sconn,
-              connection_struct *conn);
+void conn_free(connection_struct *conn);
 void msg_force_tdis(struct messaging_context *msg,
                    void *private_data,
                    uint32_t msg_type,
@@ -6168,14 +6141,15 @@ bool make_dir_struct(TALLOC_CTX *ctx,
                        uint32 mode,
                        time_t date,
                        bool uc);
-void init_dptrs(void);
-char *dptr_path(int key);
-char *dptr_wcard(int key);
-uint16 dptr_attr(int key);
-void dptr_close(int *key);
+bool init_dptrs(struct smbd_server_connection *sconn);
+char *dptr_path(struct smbd_server_connection *sconn, int key);
+char *dptr_wcard(struct smbd_server_connection *sconn, int key);
+uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
+void dptr_close(struct smbd_server_connection *sconn, int *key);
 void dptr_closecnum(connection_struct *conn);
 void dptr_idlecnum(connection_struct *conn);
-void dptr_closepath(char *path,uint16 spid);
+void dptr_closepath(struct smbd_server_connection *sconn,
+                   char *path,uint16 spid);
 NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, bool expect_close,uint16 spid,
                const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
 int dptr_CloseDir(struct dptr_struct *dptr);
@@ -6190,12 +6164,15 @@ char *dptr_ReadDirName(TALLOC_CTX *ctx,
 bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
 void dptr_init_search_op(struct dptr_struct *dptr);
-bool dptr_fill(char *buf1,unsigned int key);
-struct dptr_struct *dptr_fetch(char *buf,int *num);
-struct dptr_struct *dptr_fetch_lanman2(int dptr_num);
+bool dptr_fill(struct smbd_server_connection *sconn,
+              char *buf1,unsigned int key);
+struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
+                              char *buf,int *num);
+struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
+                                      int dptr_num);
 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
 bool get_dir_entry(TALLOC_CTX *ctx,
-               connection_struct *conn,
+               struct dptr_struct *dirptr,
                const char *mask,
                uint32 dirtype,
                char **pp_fname_out,
@@ -6207,7 +6184,7 @@ bool get_dir_entry(TALLOC_CTX *ctx,
 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
 struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
                        const char *name, const char *mask, uint32 attr);
-const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
+char *ReadDirName(struct smb_Dir *dirp, long *poffset,
                        SMB_STRUCT_STAT *sbuf);
 void RewindDir(struct smb_Dir *dirp, long *poffset);
 void SeekDir(struct smb_Dir *dirp, long offset);
@@ -6249,6 +6226,19 @@ bool set_sticky_write_time_fsp(struct files_struct *fsp,
                               struct timespec mtime);
 bool update_write_time(struct files_struct *fsp);
 
+NTSTATUS set_create_timespec_ea(connection_struct *conn,
+                               struct files_struct *fsp,
+                               const struct smb_filename *smb_fname,
+                               struct timespec create_time);
+
+struct timespec get_create_timespec(connection_struct *conn,
+                               struct files_struct *fsp,
+                               const struct smb_filename *smb_fname);
+
+struct timespec get_change_timespec(connection_struct *conn,
+                               struct files_struct *fsp,
+                               const struct smb_filename *smb_fname);
+
 /* The following definitions come from smbd/error.c  */
 
 bool use_nt_status(void);
@@ -6266,6 +6256,7 @@ void reply_openerror(struct smb_request *req, NTSTATUS status);
 
 /* The following definitions come from smbd/fake_file.c  */
 
+enum FAKE_FILE_TYPE is_fake_file_path(const char *path);
 enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
 NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
                                uint16_t current_vuid,
@@ -6551,6 +6542,7 @@ void send_nt_replies(connection_struct *conn,
                     char *params, int paramsize,
                     char *pdata, int datasize);
 void reply_ntcreate_and_X(struct smb_request *req);
+struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
 void reply_ntcancel(struct smb_request *req);
 void reply_ntrename(struct smb_request *req);
 void reply_nttrans(struct smb_request *req);
@@ -6730,7 +6722,8 @@ int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
 int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
                       const char *name, mode_t mode);
 int fchmod_acl(files_struct *fsp, mode_t mode);
-bool set_unix_posix_default_acl(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf,
+bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
+                               const SMB_STRUCT_STAT *psbuf,
                                uint16 num_def_acls, const char *pdata);
 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
 SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
@@ -6846,7 +6839,8 @@ void reply_ulogoffX(struct smb_request *req);
 void reply_mknew(struct smb_request *req);
 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);
+                         uint32 dirtype, struct smb_filename *smb_fname,
+                         bool has_wild);
 void reply_unlink(struct smb_request *req);
 void reply_readbraw(struct smb_request *req);
 void reply_lockread(struct smb_request *req);
@@ -6884,8 +6878,8 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 NTSTATUS rename_internals(TALLOC_CTX *ctx,
                        connection_struct *conn,
                        struct smb_request *req,
-                       const char *name_in,
-                       const char *newname_in,
+                       struct smb_filename *smb_fname_src,
+                       struct smb_filename *smb_fname_dst,
                        uint32 attrs,
                        bool replace_if_exists,
                        bool src_has_wild,
@@ -6967,8 +6961,7 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
                                   const char *service_in, DATA_BLOB password,
                                   const char *pdev, uint16 vuid,
                                   NTSTATUS *status);
-void close_cnum(struct smbd_server_connection *sconn,
-               connection_struct *conn, uint16 vuid);
+void close_cnum(connection_struct *conn, uint16 vuid);
 
 /* The following definitions come from smbd/session.c  */
 
@@ -7123,6 +7116,7 @@ int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
                       SMB_STRUCT_STAT *psbuf);
 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
                        SMB_STRUCT_STAT *psbuf);
+NTSTATUS vfs_stat_fsp(files_struct *fsp);
 
 /* The following definitions come from torture/denytest.c  */