Make cli_send_mailslot() static. Preparing to do away with unexpected.tdb....
[ira/wip.git] / source3 / include / proto.h
index 22659339a980180d695ce7becbe068f87920041f..695e14b53c7af6989246247a2cc0d97c089e3273 100644 (file)
@@ -231,7 +231,8 @@ NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
                                  const DOM_SID *alias, const DOM_SID *member);
 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
-                                  const DOM_SID *alias, DOM_SID **pp_members,
+                                  const DOM_SID *alias, TALLOC_CTX *mem_ctx,
+                                  DOM_SID **pp_members,
                                   size_t *p_num_members);
 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
                                       TALLOC_CTX *mem_ctx,
@@ -289,16 +290,16 @@ bool check_access(int sock, const char **allow_list, const char **deny_list);
 /* The following definitions come from lib/account_pol.c  */
 
 void account_policy_names_list(const char ***names, int *num_names);
-const char *decode_account_policy_name(int field);
-const char *get_account_policy_attr(int field);
-const char *account_policy_get_desc(int field);
-int account_policy_name_to_fieldnum(const char *name);
-bool account_policy_get_default(int account_policy, uint32 *val);
+const char *decode_account_policy_name(enum pdb_policy_type type);
+const char *get_account_policy_attr(enum pdb_policy_type type);
+const char *account_policy_get_desc(enum pdb_policy_type type);
+enum pdb_policy_type account_policy_name_to_typenum(const char *name);
+bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
 bool init_account_policy(void);
-bool account_policy_get(int field, uint32 *value);
-bool account_policy_set(int field, uint32 value);
-bool cache_account_policy_set(int field, uint32 value);
-bool cache_account_policy_get(int field, uint32 *value);
+bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
+bool account_policy_set(enum pdb_policy_type type, uint32_t value);
+bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
+bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
 struct db_context *get_account_pol_db( void );
 
 /* The following definitions come from lib/adt_tree.c  */
@@ -453,6 +454,14 @@ NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
                                     TDB_DATA data, int flags);
 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
+NTSTATUS dbwrap_trans_do(struct db_context *db,
+                        NTSTATUS (*action)(struct db_context *, void *),
+                        void *private_data);
+NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
+NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
+                                    TDB_DATA data, int flags);
+TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
+                                    const char *key);
 
 /* The following definitions come from lib/debug.c  */
 
@@ -465,6 +474,7 @@ void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32
 void debug_init(void);
 void debug_register_msgs(struct messaging_context *msg_ctx);
 void setup_logging(const char *pname, bool interactive);
+void setup_logging_stdout( void );
 void debug_set_logfile(const char *name);
 bool reopen_logs( void );
 void force_check_log_size( void );
@@ -513,17 +523,15 @@ void pull_file_id_24(char *buf, struct file_id *id);
 
 /* The following definitions come from lib/gencache.c  */
 
-bool gencache_init(void);
-bool gencache_shutdown(void);
 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, bool *expired);
+bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
+                           time_t *timeout);
+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),
                       void* data, const char* keystr_pattern);
-int gencache_lock_entry( const char *key );
-void gencache_unlock_entry( const char *key );
 
 /* The following definitions come from lib/interface.c  */
 
@@ -552,7 +560,7 @@ void init_ldap_debugging(void);
 
 /* The following definitions come from lib/ldap_escape.c  */
 
-char *escape_ldap_string_alloc(const char *s);
+char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
 char *escape_rdn_val_string_alloc(const char *s);
 
 /* The following definitions come from lib/module.c  */
@@ -582,6 +590,7 @@ int nt_status_to_pam(NTSTATUS nt_status);
 
 pid_t pidfile_pid(const char *name);
 void pidfile_create(const char *program_name);
+void pidfile_unlink(void);
 
 /* The following definitions come from lib/popt_common.c  */
 
@@ -908,6 +917,7 @@ ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
 int sys_fcntl_ptr(int fd, int cmd, void *arg);
 int sys_fcntl_long(int fd, int cmd, long arg);
+void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
 int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
 int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
@@ -1198,8 +1208,6 @@ void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const c
 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
 void *talloc_zeronull(const void *context, size_t size, const char *name);
-NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
-                               char **pbase, char **pstream);
 bool is_valid_policy_hnd(const struct policy_handle *hnd);
 bool policy_hnd_equal(const struct policy_handle *hnd1,
                      const struct policy_handle *hnd2);
@@ -1416,6 +1424,16 @@ struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
                                    const char *service,
                                    const struct addrinfo *hints);
 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
+struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
+                                           struct tevent_context *ev,
+                                           struct tstream_context *stream,
+                                           size_t initial,
+                                           ssize_t (*more)(uint8_t *buf,
+                                                           size_t buflen,
+                                                           void *private_data),
+                                           void *private_data);
+ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                                uint8_t **pbuf, int *perrno);
 
 /* The following definitions come from lib/util_str.c  */
 
@@ -1666,13 +1684,6 @@ ADS_STRUCT *ads_init(const char *realm,
                     const char *ldap_server);
 void ads_destroy(ADS_STRUCT **ads);
 
-/* The following definitions come from libads/ads_utils.c  */
-
-uint32 ads_acb2uf(uint32 acb);
-uint32 ads_uf2acb(uint32 uf);
-uint32 ads_uf2atype(uint32 uf);
-uint32 ads_gtype2atype(uint32 gtype);
-enum lsa_SidType ads_atype_map(uint32 atype);
 const char *ads_get_ldap_server_name(ADS_STRUCT *ads);
 
 /* The following definitions come from libads/authdata.c  */
@@ -2113,6 +2124,7 @@ void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct fil
 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
 const char *ndr_errstr(enum ndr_err_code err);
+extern const struct ndr_syntax_id null_ndr_syntax_id;
 
 /* The following definitions come from librpc/ndr/sid.c  */
 
@@ -2247,7 +2259,7 @@ bool cli_dfs_get_referral(TALLOC_CTX *ctx,
                        const char *path,
                        CLIENT_DFS_REFERRAL**refs,
                        size_t *num_refs,
-                       uint16 *consumed);
+                       size_t *consumed);
 bool cli_resolve_path(TALLOC_CTX *ctx,
                        const char *mountpt,
                        const struct user_auth_info *dfs_auth_info,
@@ -2258,13 +2270,6 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
 
 /* The following definitions come from libsmb/clidgram.c  */
 
-bool cli_send_mailslot(struct messaging_context *msg_ctx,
-                      bool unique, const char *mailslot,
-                      uint16 priority,
-                      char *buf, int len,
-                      const char *srcname, int src_type,
-                      const char *dstname, int dest_type,
-                      const struct sockaddr_storage *dest_ss);
 bool send_getdc_request(TALLOC_CTX *mem_ctx,
                        struct messaging_context *msg_ctx,
                        struct sockaddr_storage *dc_ss,
@@ -2494,21 +2499,56 @@ struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
                                  struct cli_state *cli, uint16_t fnum);
 NTSTATUS cli_close_recv(struct tevent_req *req);
 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
-bool cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
+struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       struct cli_state *cli,
+                                       uint16_t fnum,
+                                       uint64_t size);
+NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
+NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
                      uint32_t offset, uint32_t len,
                      int timeout, unsigned char locktype);
 bool cli_lock(struct cli_state *cli, uint16_t fnum,
              uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
-bool cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
+struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
+                                struct event_context *ev,
+                                struct cli_state *cli,
+                                uint16_t fnum,
+                                uint64_t offset,
+                                uint64_t len);
+NTSTATUS cli_unlock_recv(struct tevent_req *req);
+NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
                uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
-bool cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
-bool cli_posix_lock(struct cli_state *cli, uint16_t fnum,
+struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
+                                struct event_context *ev,
+                                struct cli_state *cli,
+                                uint16_t fnum,
+                                uint64_t offset,
+                                uint64_t len);
+NTSTATUS cli_unlock64_recv(struct tevent_req *req);
+NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
+struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev,
+                                        struct cli_state *cli,
+                                        uint16_t fnum,
+                                        uint64_t offset,
+                                        uint64_t len,
+                                        bool wait_lock,
+                                        enum brl_type lock_type);
+NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
+NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
                        uint64_t offset, uint64_t len,
                        bool wait_lock, enum brl_type lock_type);
-bool cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
-bool cli_posix_getlock(struct cli_state *cli, uint16_t fnum, uint64_t *poffset, uint64_t *plen);
+struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev,
+                                        struct cli_state *cli,
+                                        uint16_t fnum,
+                                        uint64_t offset,
+                                        uint64_t len);
+NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
+NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
                                struct event_context *ev,
                                struct cli_state *cli,
@@ -2575,7 +2615,19 @@ struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
                          int *avail);
 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
-int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path);
+struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
+                               struct event_context *ev,
+                               struct cli_state *cli,
+                               const char *path);
+NTSTATUS cli_ctemp_recv(struct tevent_req *req,
+                       TALLOC_CTX *ctx,
+                       uint16_t *pfnum,
+                       char **outfile);
+NTSTATUS cli_ctemp(struct cli_state *cli,
+                       TALLOC_CTX *ctx,
+                       const char *path,
+                       uint16_t *pfnum,
+                       char **out_path);
 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
 bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
@@ -2799,14 +2851,14 @@ bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 sty
 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
 int cli_NetPrintQEnum(struct cli_state *cli,
                void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
-               void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*));
+               void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
        void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
-       void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*));
+       void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
-int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint, uint, uint, char *));
+int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, char *));
 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
-               void (*fn)(const char *, const char *, uint16, uint16, uint16, uint, uint, uint, const char *));
+               void (*fn)(const char *, const char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, const char *));
 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
                        void (*fn)(uint16_t conid, uint16_t contype,
@@ -3412,16 +3464,14 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
                                            const struct file_id id,
                                            const char *servicepath,
-                                           const char *fname,
+                                           const struct smb_filename *smb_fname,
                                            const struct timespec *old_write_time);
 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
-                                                 const struct file_id id,
-                                                 const char *servicepath,
-                                                 const char *fname);
+                                                 const struct file_id id);
 bool rename_share_filename(struct messaging_context *msg_ctx,
                        struct share_mode_lock *lck,
                        const char *servicepath,
-                       const char *newname);
+                       const struct smb_filename *smb_fname);
 void get_file_infos(struct file_id id,
                    bool *delete_on_close,
                    struct timespec *write_time);
@@ -3488,7 +3538,6 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
 
 /* The following definitions come from modules/vfs_default.c  */
 
-int vfswrap_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf);
 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
 NTSTATUS vfs_default_init(void);
@@ -4501,6 +4550,7 @@ NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function in
 struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
 struct event_context *pdb_get_event_context(void);
 NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected);
+struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx);
 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ;
 bool guest_user_info( struct samu *user );
 bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) ;
@@ -4541,7 +4591,7 @@ NTSTATUS pdb_get_aliasinfo(const DOM_SID *sid, struct acct_info *info);
 NTSTATUS pdb_set_aliasinfo(const DOM_SID *sid, struct acct_info *info);
 NTSTATUS pdb_add_aliasmem(const DOM_SID *alias, const DOM_SID *member);
 NTSTATUS pdb_del_aliasmem(const DOM_SID *alias, const DOM_SID *member);
-NTSTATUS pdb_enum_aliasmem(const DOM_SID *alias,
+NTSTATUS pdb_enum_aliasmem(const DOM_SID *alias, TALLOC_CTX *mem_ctx,
                           DOM_SID **pp_members, size_t *p_num_members);
 NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx,
                                    const DOM_SID *domain_sid,
@@ -4558,15 +4608,15 @@ NTSTATUS pdb_lookup_names(const DOM_SID *domain_sid,
                          const char **names,
                          uint32 *rids,
                          enum lsa_SidType *attrs);
-bool pdb_get_account_policy(int policy_index, uint32 *value);
-bool pdb_set_account_policy(int policy_index, uint32 value);
+bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
+bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
 bool pdb_get_seq_num(time_t *seq_num);
 bool pdb_uid_to_rid(uid_t uid, uint32 *rid);
 bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid);
 bool pdb_gid_to_sid(gid_t gid, DOM_SID *sid);
 bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
                   enum lsa_SidType *type);
-bool pdb_rid_algorithm(void);
+uint32_t pdb_capabilities(void);
 bool pdb_new_rid(uint32 *rid);
 bool initialize_password_db(bool reload, struct event_context *event_ctx);
 struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
@@ -5054,6 +5104,7 @@ WERROR registry_init_smbconf(const char *keyname);
 /* The following definitions come from registry/reg_objects.c  */
 
 WERROR regsubkey_ctr_init(TALLOC_CTX *mem_ctx, struct regsubkey_ctr **ctr);
+WERROR regsubkey_ctr_reinit(struct regsubkey_ctr *ctr);
 WERROR regsubkey_ctr_set_seqnum(struct regsubkey_ctr *ctr, int seqnum);
 int regsubkey_ctr_get_seqnum(struct regsubkey_ctr *ctr);
 WERROR regsubkey_ctr_addkey( struct regsubkey_ctr *ctr, const char *keyname );
@@ -5403,6 +5454,13 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
                                     const char *printername,
                                     uint32_t access_desired,
                                     struct policy_handle *handle);
+WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle,
+                                      const char *architecture,
+                                      uint32_t level,
+                                      uint32_t offered,
+                                      union spoolss_DriverInfo *info);
 WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli,
                                        TALLOC_CTX *mem_ctx,
                                        struct policy_handle *handle,
@@ -5534,88 +5592,14 @@ void init_lsa_AsciiStringLarge(struct lsa_AsciiStringLarge *name, const char *s)
 
 /* The following definitions come from rpc_client/init_netlogon.c  */
 
-void init_netr_SamBaseInfo(struct netr_SamBaseInfo *r,
-                          NTTIME last_logon,
-                          NTTIME last_logoff,
-                          NTTIME acct_expiry,
-                          NTTIME last_password_change,
-                          NTTIME allow_password_change,
-                          NTTIME force_password_change,
-                          const char *account_name,
-                          const char *full_name,
-                          const char *logon_script,
-                          const char *profile_path,
-                          const char *home_directory,
-                          const char *home_drive,
-                          uint16_t logon_count,
-                          uint16_t bad_password_count,
-                          uint32_t rid,
-                          uint32_t primary_gid,
-                          struct samr_RidWithAttributeArray groups,
-                          uint32_t user_flags,
-                          struct netr_UserSessionKey key,
-                          const char *logon_server,
-                          const char *domain,
-                          struct dom_sid2 *domain_sid,
-                          struct netr_LMSessionKey LMSessKey,
-                          uint32_t acct_flags);
-void init_netr_SamInfo3(struct netr_SamInfo3 *r,
-                       NTTIME last_logon,
-                       NTTIME last_logoff,
-                       NTTIME acct_expiry,
-                       NTTIME last_password_change,
-                       NTTIME allow_password_change,
-                       NTTIME force_password_change,
-                       const char *account_name,
-                       const char *full_name,
-                       const char *logon_script,
-                       const char *profile_path,
-                       const char *home_directory,
-                       const char *home_drive,
-                       uint16_t logon_count,
-                       uint16_t bad_password_count,
-                       uint32_t rid,
-                       uint32_t primary_gid,
-                       struct samr_RidWithAttributeArray groups,
-                       uint32_t user_flags,
-                       struct netr_UserSessionKey key,
-                       const char *logon_server,
-                       const char *domain,
-                       struct dom_sid2 *domain_sid,
-                       struct netr_LMSessionKey LMSessKey,
-                       uint32_t acct_flags,
-                       uint32_t sidcount,
-                       struct netr_SidAttr *sids);
+NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
+                               uint8_t *pipe_session_key,
+                               size_t pipe_session_key_len,
+                               struct netr_SamInfo2 *sam2);
 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);
-void init_netr_IdentityInfo(struct netr_IdentityInfo *r,
-                           const char *domain_name,
-                           uint32_t parameter_control,
-                           uint32_t logon_id_low,
-                           uint32_t logon_id_high,
-                           const char *account_name,
-                           const char *workstation);
-void init_netr_NetworkInfo(struct netr_NetworkInfo *r,
-                          const char *domain_name,
-                          uint32_t parameter_control,
-                          uint32_t logon_id_low,
-                          uint32_t logon_id_high,
-                          const char *account_name,
-                          const char *workstation,
-                          uint8_t challenge[8],
-                          struct netr_ChallengeResponse nt,
-                          struct netr_ChallengeResponse lm);
-void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
-                           const char *domain_name,
-                           uint32_t parameter_control,
-                           uint32_t logon_id_low,
-                           uint32_t logon_id_high,
-                           const char *account_name,
-                           const char *workstation,
-                           struct samr_Password lmpassword,
-                           struct samr_Password ntpassword);
 void init_netr_CryptPassword(const char *pwd,
                             unsigned char session_key[16],
                             struct netr_CryptPassword *pwd_buf);
@@ -5685,32 +5669,16 @@ void prs_switch_type(prs_struct *ps, bool io);
 void prs_force_dynamic(prs_struct *ps);
 void prs_set_session_key(prs_struct *ps, const char sess_key[16]);
 bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8);
-bool prs_pointer( const char *name, prs_struct *ps, int depth, 
-                 void *dta, size_t data_size,
-                 bool (*prs_fn)(const char*, prs_struct*, int, void*) );
 bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16);
 bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32);
 bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32);
 bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64);
-bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
 bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
-bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status);
 bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len);
 bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
-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_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);
-bool prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str);
-bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset);
-bool prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16,
-                               uint32 ptr_uint16, uint32 start_offset);
-bool prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset);
-bool prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32,
-                               uint32 ptr_uint32, uint32 data_size);
-int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps);
-int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx);
-bool prs_hash1(prs_struct *ps, uint32 offset, int len);
 void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level,
                   enum schannel_direction direction,
                   RPC_AUTH_SCHANNEL_CHK * verf,
@@ -5728,7 +5696,8 @@ 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);
 void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
-                     const RPC_IFACE *abstract, const RPC_IFACE *transfer);
+                     const struct ndr_syntax_id *abstract,
+                     const struct ndr_syntax_id *transfer);
 void init_rpc_hdr_rb(RPC_HDR_RB *rpc, 
                                uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
                                RPC_CONTEXT *context);
@@ -5738,7 +5707,7 @@ void init_rpc_hdr_ba(RPC_HDR_BA *rpc,
                                uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
                                const char *pipe_addr,
                                uint8 num_results, uint16 result, uint16 reason,
-                               RPC_IFACE *transfer);
+                               const struct ndr_syntax_id *transfer);
 bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth);
 void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum);
 bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth);
@@ -5835,8 +5804,6 @@ bool create_next_pdu(pipes_struct *p);
 bool api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p);
 bool setup_fault_pdu(pipes_struct *p, NTSTATUS status);
 bool setup_cancel_ack_reply(pipes_struct *p, prs_struct *rpc_in_p);
-bool check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract,
-                    RPC_IFACE* transfer, uint32 context_id);
 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
                                    const char *srv,
                                    const struct ndr_syntax_id *interface,
@@ -5916,7 +5883,6 @@ void copy_id26_to_sam_passwd(struct samu *to,
 
 /* The following definitions come from rpc_server/srv_spoolss_nt.c  */
 
-WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *sharename );
 void do_drv_upgrade_printer(struct messaging_context *msg,
                            void *private_data,
                            uint32_t msg_type,
@@ -6005,9 +5971,7 @@ void construct_info_data(struct spoolss_Notify *info_data,
                         int id);
 struct spoolss_DeviceMode *construct_dev_mode(TALLOC_CTX *mem_ctx,
                                              const char *servicename);
-WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname, const char *uri );
 bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer);
-WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines );
 
 /* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
 
@@ -6156,16 +6120,18 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
 
 /* The following definitions come from smbd/conn.c  */
 
-void conn_init(void);
-int conn_num_open(void);
+void conn_init(struct smbd_server_connection *sconn);
+int conn_num_open(struct smbd_server_connection *sconn);
 bool conn_snum_used(int snum);
-connection_struct *conn_find(unsigned cnum);
-connection_struct *conn_new(void);
-bool conn_close_all(void);
-bool conn_idle_all(time_t t);
-void conn_clear_vuid_caches(uint16 vuid);
+connection_struct *conn_find(struct smbd_server_connection *sconn,
+                            unsigned cnum);
+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(connection_struct *conn);
+void conn_free(struct smbd_server_connection *sconn,
+              connection_struct *conn);
 void msg_force_tdis(struct messaging_context *msg,
                    void *private_data,
                    uint32_t msg_type,
@@ -6267,20 +6233,20 @@ bool smbd_setup_mdns_registration(struct tevent_context *ev,
 
 /* The following definitions come from smbd/dosmode.c  */
 
-mode_t unix_mode(connection_struct *conn, int dosmode, const char *fname,
+mode_t unix_mode(connection_struct *conn, int dosmode,
+                const struct smb_filename *smb_fname,
                 const char *inherit_from_dir);
-uint32 dos_mode_msdfs(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf);
+uint32 dos_mode_msdfs(connection_struct *conn,
+                     const struct smb_filename *smb_fname);
 int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
-uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf);
-int file_set_dosmode(connection_struct *conn, const char *fname,
-                    uint32 dosmode, SMB_STRUCT_STAT *st,
-                    const char *parent_dir,
-                    bool newfile);
-int file_ntimes(connection_struct *conn, const char *fname,
+uint32 dos_mode(connection_struct *conn, const struct smb_filename *smb_fname);
+int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
+                    uint32 dosmode, const char *parent_dir, bool newfile);
+int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
                struct smb_file_time *ft);
-bool set_sticky_write_time_path(connection_struct *conn, const char *fname,
-                        struct file_id fileid, const struct timespec mtime);
-bool set_sticky_write_time_fsp(struct files_struct *fsp, const struct timespec mtime);
+bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
+bool set_sticky_write_time_fsp(struct files_struct *fsp,
+                              struct timespec mtime);
 bool update_write_time(struct files_struct *fsp);
 
 /* The following definitions come from smbd/error.c  */
@@ -6297,8 +6263,6 @@ void reply_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
                      NTSTATUS status, int line, const char *file);
 void reply_openerror(struct smb_request *req, NTSTATUS status);
-void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
-                       NTSTATUS defstatus, int line, const char *file);
 
 /* The following definitions come from smbd/fake_file.c  */
 
@@ -6314,11 +6278,15 @@ NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
 /* The following definitions come from smbd/file_access.c  */
 
 bool can_access_file_acl(struct connection_struct *conn,
-                               const char * fname,
-                               uint32_t access_mask);
-bool can_delete_file_in_directory(connection_struct *conn, const char *fname);
-bool can_access_file_data(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf, uint32 access_mask);
-bool can_write_to_file(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf);
+                        const struct smb_filename *smb_fname,
+                        uint32_t access_mask);
+bool can_delete_file_in_directory(connection_struct *conn,
+                                 struct smb_filename *smb_fname);
+bool can_access_file_data(connection_struct *conn,
+                         const struct smb_filename *smb_fname,
+                         uint32 access_mask);
+bool can_write_to_file(connection_struct *conn,
+                      const struct smb_filename *smb_fname);
 bool directory_has_default_acl(connection_struct *conn, const char *fname);
 
 /* The following definitions come from smbd/fileio.c  */
@@ -6341,6 +6309,22 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst);
 
 NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
                              char **full_name);
+NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
+                                   const char *stream_name,
+                                   const SMB_STRUCT_STAT *psbuf,
+                                   struct smb_filename **smb_fname_out);
+NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
+                                         const char *fname,
+                                         const SMB_STRUCT_STAT *psbuf,
+                                         struct smb_filename **smb_fname_out);
+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);
+const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
+NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
+                          const struct smb_filename *smb_fname_in,
+                          struct smb_filename **smb_fname_out);
 NTSTATUS unix_convert(TALLOC_CTX *ctx,
                      connection_struct *conn,
                      const char *orig_path,
@@ -6350,6 +6334,12 @@ NTSTATUS check_name(connection_struct *conn, const char *name);
 int get_real_filename(connection_struct *conn, const char *path,
                      const char *name, TALLOC_CTX *mem_ctx,
                      char **found_name);
+NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
+                       connection_struct *conn,
+                       bool dfs_path,
+                       const char *name_in,
+                       struct smb_filename **pp_smb_fname,
+                       char **pp_name);
 
 /* The following definitions come from smbd/files.c  */
 
@@ -6482,14 +6472,22 @@ void reply_negprot(struct smb_request *req);
 /* The following definitions come from smbd/notify.c  */
 
 void change_notify_reply(connection_struct *conn,
-                        struct smb_request *req, uint32 max_param,
-                        struct notify_change_buf *notify_buf);
+                        struct smb_request *req,
+                        NTSTATUS error_code,
+                        uint32_t max_param,
+                        struct notify_change_buf *notify_buf,
+                        void (*reply_fn)(struct smb_request *req,
+                               NTSTATUS error_code,
+                               uint8_t *buf, size_t len));
 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
                              bool recursive);
 NTSTATUS change_notify_add_request(struct smb_request *req,
                                uint32 max_param,
                                uint32 filter, bool recursive,
-                               struct files_struct *fsp);
+                               struct files_struct *fsp,
+                               void (*reply_fn)(struct smb_request *req,
+                                       NTSTATUS error_code,
+                                       uint8_t *buf, size_t len));
 void remove_pending_change_notify_requests_by_mid(uint16 mid);
 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
                                                  NTSTATUS status);
@@ -6547,7 +6545,8 @@ void send_nt_replies(connection_struct *conn,
                        struct smb_request *req, NTSTATUS nt_error,
                     char *params, int paramsize,
                     char *pdata, int datasize);
-bool is_ntfs_stream_name(const char *fname);
+bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
+bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
 void reply_ntcreate_and_X(struct smb_request *req);
 void reply_ntcancel(struct smb_request *req);
 void reply_ntrename(struct smb_request *req);
@@ -6573,7 +6572,6 @@ bool is_stat_open(uint32 access_mask);
 bool request_timed_out(struct timeval request_time,
                       struct timeval timeout);
 bool open_match_attributes(connection_struct *conn,
-                          const char *path,
                           uint32 old_dos_attr,
                           uint32 new_dos_attr,
                           mode_t existing_unx_mode,
@@ -6582,7 +6580,7 @@ bool open_match_attributes(connection_struct *conn,
 NTSTATUS fcb_or_dos_open(struct smb_request *req,
                         connection_struct *conn,
                         files_struct *fsp_to_dup_into,
-                        const char *fname,
+                        const struct smb_filename *smb_fname,
                         struct file_id id,
                         uint16 file_pid,
                         uint16 vuid,
@@ -6595,10 +6593,11 @@ bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func
                                 uint32 *pcreate_disposition,
                                 uint32 *pcreate_options);
 NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
-                         const char *fname,
-                         SMB_STRUCT_STAT *psbuf, files_struct **result);
+                         struct smb_filename *smb_fname,
+                         files_struct **result);
 NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp);
-NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, const char *directory);
+NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
+                         struct smb_filename *smb_dname);
 void msg_file_was_renamed(struct messaging_context *msg,
                          void *private_data,
                          uint32_t msg_type,
@@ -6612,8 +6611,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn,
 NTSTATUS create_file_default(connection_struct *conn,
                             struct smb_request *req,
                             uint16_t root_dir_fid,
-                            const char *fname,
-                            uint32_t create_file_flags,
+                            struct smb_filename * smb_fname,
                             uint32_t access_mask,
                             uint32_t share_access,
                             uint32_t create_disposition,
@@ -6625,12 +6623,11 @@ NTSTATUS create_file_default(connection_struct *conn,
                             struct ea_list *ea_list,
 
                             files_struct **result,
-                            int *pinfo,
-                            SMB_STRUCT_STAT *psbuf);
+                            int *pinfo);
 NTSTATUS get_relative_fid_filename(connection_struct *conn,
                                   struct smb_request *req,
                                   uint16_t root_dir_fid,
-                                  const char *fname, char **new_fname);
+                                  struct smb_filename *smb_fname);
 
 /* The following definitions come from smbd/oplock.c  */
 
@@ -6718,7 +6715,8 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
                           SEC_DESC **ppdesc);
 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
                          uint32_t security_info, SEC_DESC **ppdesc);
-int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid);
+int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
+             uid_t uid, gid_t gid);
 NTSTATUS append_parent_acl(files_struct *fsp,
                                const SEC_DESC *pcsd,
                                SEC_DESC **pp_new_sd);
@@ -6872,12 +6870,11 @@ void reply_printwrite(struct smb_request *req);
 void reply_mkdir(struct smb_request *req);
 NTSTATUS rmdir_internals(TALLOC_CTX *ctx,
                        connection_struct *conn,
-                       const char *directory);
+                       struct smb_filename *smb_dname);
 void reply_rmdir(struct smb_request *req);
 NTSTATUS rename_internals_fsp(connection_struct *conn,
                        files_struct *fsp,
-                       char *newname,
-                       const char *newname_last_component,
+                       const struct smb_filename *smb_fname_dst_in,
                        uint32 attrs,
                        bool replace_if_exists);
 NTSTATUS rename_internals(TALLOC_CTX *ctx,
@@ -6893,8 +6890,8 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
 void reply_mv(struct smb_request *req);
 NTSTATUS copy_file(TALLOC_CTX *ctx,
                        connection_struct *conn,
-                       const char *src,
-                       const char *dest1,
+                       struct smb_filename *smb_fname_src,
+                       struct smb_filename *smb_fname_dst,
                        int ofun,
                        int count,
                        bool target_is_directory);
@@ -6957,11 +6954,17 @@ bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
 void load_registry_shares(void);
 int add_home_service(const char *service, const char *username, const char *homedir);
 int find_service(fstring service);
+connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
+                                       int snum, user_struct *vuser,
+                                       DATA_BLOB password,
+                                       const char *pdev,
+                                       NTSTATUS *pstatus);
 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(connection_struct *conn, uint16 vuid);
+void close_cnum(struct smbd_server_connection *sconn,
+               connection_struct *conn, uint16 vuid);
 
 /* The following definitions come from smbd/session.c  */
 
@@ -7026,7 +7029,8 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
 NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
                                files_struct *fsp, const char *fname,
                                char ***pnames, size_t *pnum_names);
-NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, struct ea_list *ea_list);
+NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
+               const struct smb_filename *smb_fname, struct ea_list *ea_list);
 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
 void send_trans2_replies(connection_struct *conn,
                        struct smb_request *req,
@@ -7038,12 +7042,11 @@ void send_trans2_replies(connection_struct *conn,
 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
                connection_struct *conn,
-               const char *oldname_in,
-               const char *newname_in);
+               const struct smb_filename *smb_fname_old,
+               const struct smb_filename *smb_fname_new);
 NTSTATUS smb_set_file_time(connection_struct *conn,
                           files_struct *fsp,
-                          const char *fname,
-                          const SMB_STRUCT_STAT *psbuf,
+                          const struct smb_filename *smb_fname,
                           struct smb_file_time *ft,
                           bool setting_write_time);
 void reply_findclose(struct smb_request *req);
@@ -7090,9 +7093,7 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
 bool smbd_vfs_init(connection_struct *conn);
-bool vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_STAT *st);
-bool vfs_object_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT *sbuf);
-bool vfs_file_exist(connection_struct *conn, const char *fname,SMB_STRUCT_STAT *sbuf);
+NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
                 size_t byte_count, SMB_OFF_T offset);
@@ -7262,6 +7263,16 @@ NTSTATUS access_check_object( SEC_DESC *psd, NT_USER_TOKEN *token,
                                SE_PRIV *rights, uint32 rights_mask,
                                uint32 des_access, uint32 *acc_granted,
                                const char *debug);
-void map_max_allowed_access(const NT_USER_TOKEN *token,
-                               uint32_t *pacc_requested);
+void map_max_allowed_access(const NT_USER_TOKEN *nt_token,
+                           const struct unix_user_token *unix_token,
+                           uint32_t *pacc_requested);
+
+/* The following definitions come from ../libds/common/flag_mapping.c  */
+
+uint32_t ds_acb2uf(uint32_t acb);
+uint32_t ds_uf2acb(uint32_t uf);
+uint32_t ds_uf2atype(uint32_t uf);
+uint32_t ds_gtype2atype(uint32_t gtype);
+enum lsa_SidType ds_atype_map(uint32_t atype);
+
 #endif /*  _PROTO_H_  */