v3-4-test: Pull in tevent_req_poll_ntstatus from master
[samba.git] / source3 / include / proto.h
index 614a30d28478261b8df931175e177bc69f045106..35ac19b38b79ffef329c0c9b10009b7fcb8344cb 100644 (file)
@@ -150,6 +150,10 @@ bool is_trusted_domain(const char* dom_name);
 
 NTSTATUS auth_winbind_init(void);
 
+/* The following definitions come from auth/auth_wbc.c  */
+
+NTSTATUS auth_wbc_init(void);
+
 /* The following definitions come from auth/pampass.c  */
 
 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
@@ -583,6 +587,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  */
 
@@ -600,6 +605,7 @@ bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
 bool revoke_all_privileges( DOM_SID *sid );
 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
 NTSTATUS privilege_create_account(const DOM_SID *sid );
+NTSTATUS privilege_delete_account(const struct dom_sid *sid);
 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
 void privilege_set_free(PRIVILEGE_SET *priv_set);
@@ -742,7 +748,6 @@ void smbldap_free_struct(struct smbldap_state **ldap_state) ;
 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
                      const char *location,
                      struct smbldap_state **smbldap_state);
-char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry);
 bool smbldap_has_control(LDAP *ld, const char *control);
 bool smbldap_has_extension(LDAP *ld, const char *extension);
 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
@@ -1012,7 +1017,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);
 struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs);
 struct timespec get_atimespec(const SMB_STRUCT_STAT *pst);
@@ -1033,6 +1039,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);
@@ -1072,27 +1080,31 @@ const char *my_netbios_names(int i);
 bool set_netbios_aliases(const char **str_array);
 bool init_names(void);
 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
-const char *get_cmdline_auth_info_username(struct user_auth_info *auth_info);
+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);
 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
                                    const char *password);
-const char *get_cmdline_auth_info_password(struct user_auth_info *auth_info);
+const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
                                         const char *arg);
-int get_cmdline_auth_info_signing_state(struct user_auth_info *auth_info);
+int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
                                        bool b);
-bool get_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
+void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
+                                       bool b);
+bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
-bool get_cmdline_auth_info_got_pass(struct user_auth_info *auth_info);
-bool get_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
-bool get_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
-                                                struct user_auth_info *info);
+                                                const struct user_auth_info *info);
 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
 bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
                             gid_t **gids, size_t *num_gids);
 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
@@ -1111,7 +1123,7 @@ char *clean_name(TALLOC_CTX *ctx, const char *s);
 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
 int set_blocking(int fd, bool set);
 void smb_msleep(unsigned int t);
-bool reinit_after_fork(struct messaging_context *msg_ctx,
+NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
                       struct event_context *ev_ctx,
                       bool parent_longlived);
 bool yesno(const char *p);
@@ -1205,10 +1217,13 @@ void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned coun
 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 POLICY_HND *hnd);
+bool is_valid_policy_hnd(const struct policy_handle *hnd);
 bool policy_hnd_equal(const struct policy_handle *hnd1,
                      const struct policy_handle *hnd2);
 const char *strip_hostname(const char *s);
+bool tevent_req_poll_ntstatus(struct tevent_req *req,
+                             struct tevent_context *ev,
+                             NTSTATUS *status);
 
 /* The following definitions come from lib/util_file.c  */
 
@@ -1241,6 +1256,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  */
 
@@ -1364,7 +1383,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);
@@ -1548,14 +1567,8 @@ int rpcstr_pull_talloc(TALLOC_CTX *ctx,
                        void *src,
                        int src_len,
                        int flags);
-int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src);
-char *rpcstr_pull_unistr2_talloc(TALLOC_CTX *ctx, const UNISTR2 *src);
 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);
-void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen);
-void unistr3_to_ascii(char *dest, const UNISTR3 *str, size_t maxlen);
-char *unistr2_to_ascii_talloc(TALLOC_CTX *ctx, const UNISTR2 *str);
-const char *unistr2_static(const UNISTR2 *str);
 smb_ucs2_t toupper_w(smb_ucs2_t val);
 smb_ucs2_t tolower_w( smb_ucs2_t val );
 bool islower_w(smb_ucs2_t c);
@@ -1589,9 +1602,6 @@ int strcmp_wa(const smb_ucs2_t *a, const char *b);
 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
-int unistrlen(uint16 *s);
-int unistrcpy(uint16 *dst, uint16 *src);
-UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src);
 int toupper_ascii(int c);
 int tolower_ascii(int c);
 int isupper_ascii(int c);
@@ -1783,7 +1793,8 @@ int kerberos_kinit_password(const char *principal,
 bool create_local_private_krb5_conf_for_domain(const char *realm,
                                                const char *domain,
                                                const char *sitename,
-                                               struct sockaddr_storage *pss);
+                                               struct sockaddr_storage *pss,
+                                               const char *kdc_name);
 
 /* The following definitions come from libads/kerberos_keytab.c  */
 
@@ -2359,29 +2370,22 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                struct cli_state *referring_cli,
                                const char *server,
                                const char *share,
+                               const struct user_auth_info *auth_info,
                                bool show_hdr,
                                bool force_encrypt,
                                int max_protocol,
                                int port,
                                int name_type);
 void cli_cm_display(const struct cli_state *c);
-void cli_cm_set_credentials(struct user_auth_info *auth_info);
-void cli_cm_set_port(int port_number);
-void cli_cm_set_dest_name_type(int type);
-void cli_cm_set_signing_state(int state);
-void cli_cm_set_username(const char *username);
-void cli_cm_set_password(const char *newpass);
-void cli_cm_set_use_kerberos(void);
-void cli_cm_set_fallback_after_kerberos(void);
-void cli_cm_set_dest_ss(struct sockaddr_storage *pss);
 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
                        struct cli_state *cli,
                        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,
                        struct cli_state *rootcli,
                        const char *path,
                        struct cli_state **targetcli,
@@ -2456,6 +2460,7 @@ bool cli_is_dos_error(struct cli_state *cli);
 NTSTATUS cli_get_nt_error(struct cli_state *cli);
 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
 void cli_reset_error(struct cli_state *cli);
+bool cli_state_is_connected(struct cli_state *cli);
 
 /* The following definitions come from libsmb/clifile.c  */
 
@@ -2600,10 +2605,6 @@ bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
                           DATA_BLOB *edata, 
                           DATA_BLOB *edata_out);
 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
-int cli_krb5_get_ticket(const char *principal, time_t time_offset, 
-                       DATA_BLOB *ticket, DATA_BLOB *session_key_krb5, 
-                       uint32 extra_ap_opts, const char *ccname, 
-                       time_t *tgs_expire);
 
 /* The following definitions come from libsmb/clilist.c  */
 
@@ -2736,14 +2737,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,
@@ -3076,7 +3077,7 @@ struct packet_struct *receive_dgram_packet(int fd, int t,
 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
 void sort_query_replies(char *data, int n, struct in_addr ip);
-char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type);
+char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
 int name_extract(char *buf,int ofs, fstring name);
 int name_len(char *s1);
 
@@ -3297,7 +3298,7 @@ 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 read_spnego_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, SPNEGO_DATA *token);
 ssize_t write_spnego_data(DATA_BLOB *blob, SPNEGO_DATA *spnego);
 bool free_spnego_data(SPNEGO_DATA *spnego);
 
@@ -4265,6 +4266,8 @@ bool lp_string_is_valid_boolean(const char *parm_value);
 bool lp_invert_boolean(const char *str, const char **inverse_str);
 bool lp_canonicalize_boolean(const char *str, const char**canon_str);
 bool service_ok(int iService);
+bool process_registry_service(const char *service_name);
+bool process_registry_shares(void);
 bool lp_config_backend_is_registry(void);
 bool lp_config_backend_is_file(void);
 bool lp_file_list_changed(void);
@@ -4359,14 +4362,8 @@ enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
 int lp_min_receive_file_size(void);
 char* lp_perfcount_module(void);
-
-
-/* The following definitions come from param/params.c  */
-
-bool pm_process( const char *FileName,
-               bool (*sfunc)(const char *, void *),
-               bool (*pfunc)(const char *, const char *, void *),
-               void *userdata);
+void lp_set_passdb_backend(const char *backend);
+void widelinks_warning(int snum);
 
 /* The following definitions come from param/util.c  */
 
@@ -4453,6 +4450,10 @@ bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
                       const char **account_name, uint32 *channel);
 struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
                                                struct samu *pw);
+NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
+                        uint32_t acct_flags,
+                        const char *account,
+                        struct passwd **passwd_p);
 
 /* The following definitions come from passdb/pdb_compat.c  */
 
@@ -4760,6 +4761,7 @@ void load_printers(void);
 bool parse_lpq_entry(enum printing_types printing_type,char *line,
                     print_queue_struct *buf,
                     print_status_struct *status,bool first);
+uint32_t print_parse_jobid(const char *fname);
 
 /* The following definitions come from printing/notify.c  */
 
@@ -4810,7 +4812,6 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen);
 uint32 del_a_printer(const char *sharename);
 NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename);
-NT_DEVICEMODE *dup_nt_devicemode(NT_DEVICEMODE *nt_devicemode);
 void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr);
 int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen);
 int add_new_printer_key( NT_PRINTER_DATA *data, const char *name );
@@ -4832,7 +4833,7 @@ WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const cha
 REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
 WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
 bool set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
-bool del_driver_init(char *drivername);
+bool del_driver_init(const char *drivername);
 WERROR save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, uint8 *data, uint32 data_len);
 WERROR get_a_printer( Printer_entry *print_hnd,
                        NT_PRINTER_INFO_LEVEL **pp_printer,
@@ -4844,8 +4845,8 @@ WERROR get_a_printer_search( Printer_entry *print_hnd,
                        const char *sharename);
 uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
 uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level);
-WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level,
-                            fstring drivername, const char *architecture, uint32 version);
+WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32_t level,
+                           const char *drivername, const char *architecture, uint32_t version);
 uint32 free_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level);
 bool printer_driver_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3 );
 bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info );
@@ -4934,12 +4935,9 @@ bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type);
 int print_queue_status(int snum, 
                       print_queue_struct **ppqueue,
                       print_status_struct *status);
-bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum,
-                      WERROR *errcode);
-bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum,
-                       WERROR *errcode);
-bool print_queue_purge(struct auth_serversupplied_info *server_info, int snum,
-                      WERROR *errcode);
+WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum);
+WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum);
+WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum);
 
 /* The following definitions come from printing/printing_db.c  */
 
@@ -5174,26 +5172,43 @@ WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey,
 NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
                                TALLOC_CTX *mem_ctx,
                                bool sec_qos, uint32 des_access,
-                               POLICY_HND *pol);
+                               struct policy_handle *pol);
 NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx, bool sec_qos,
-                                uint32 des_access, POLICY_HND *pol);
+                                uint32 des_access, struct policy_handle *pol);
 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
                                TALLOC_CTX *mem_ctx,
-                               POLICY_HND *pol,
+                               struct policy_handle *pol,
                                int num_sids,
                                const DOM_SID *sids,
                                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,
-                                POLICY_HND *pol, int num_names,
+                                struct policy_handle *pol, int num_names,
                                 const char **names,
                                 const char ***dom_names,
                                 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  */
@@ -5265,6 +5280,7 @@ NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
                       struct cli_pipe_auth_data *auth);
 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
                                unsigned int timeout);
+bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
                               struct cli_pipe_auth_data **presult);
@@ -5298,8 +5314,13 @@ 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 dcerpc_transport_t transport,
                                   enum pipe_auth_level auth_level,
                                   const char *domain,
                                   const char *username,
@@ -5307,6 +5328,7 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
                                   struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
                                          const struct ndr_syntax_id *interface,
+                                         enum dcerpc_transport_t transport,
                                          enum pipe_auth_level auth_level,
                                          const char *domain,
                                          const char *username,
@@ -5318,12 +5340,14 @@ 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 dcerpc_transport_t transport,
                                             enum pipe_auth_level auth_level,
                                             const char *domain,
                                             const struct dcinfo *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 dcerpc_transport_t transport,
                                                 enum pipe_auth_level auth_level,
                                                 const char *domain,
                                                 const char *username,
@@ -5331,6 +5355,7 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
                                                 struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
                                    const struct ndr_syntax_id *interface,
+                                   enum dcerpc_transport_t transport,
                                    enum pipe_auth_level auth_level,
                                    const char *domain,
                                    struct rpc_pipe_client **presult);
@@ -5402,7 +5427,7 @@ NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
 
 NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                          uint32 reg_type, uint32 access_mask,
-                         POLICY_HND *reg_hnd);
+                         struct policy_handle *reg_hnd);
 
 /* The following definitions come from rpc_client/cli_samr.c  */
 
@@ -5435,7 +5460,7 @@ void get_query_dispinfo_params(int loop_count, uint32 *max_entries,
 NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
                                  TALLOC_CTX *mem_ctx,
                                  uint32_t access_mask,
-                                 POLICY_HND *connect_pol);
+                                 struct policy_handle *connect_pol);
 
 /* The following definitions come from rpc_client/cli_spoolss.c  */
 
@@ -5539,25 +5564,21 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
                                     const char *value_name,
                                     uint32_t offered,
                                     enum winreg_Type *type,
-                                    union spoolss_PrinterData *data);
-#if 0
-WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                 POLICY_HND *hnd, const char *valuename, 
-                                 REGISTRY_VALUE *value);
-#endif
-WERROR rpccli_spoolss_setprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                 POLICY_HND *hnd, REGISTRY_VALUE *value);
-WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                  POLICY_HND *hnd, uint32 ndx,
-                                  uint32 value_offered, uint32 data_offered,
-                                  uint32 *value_needed, uint32 *data_needed,
-                                  REGISTRY_VALUE *value);
-WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                    POLICY_HND *hnd, const char *keyname, 
-                                    REGVAL_CTR *ctr);
-WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                 POLICY_HND *hnd, const char *keyname,
-                                 uint16 **keylist, uint32 *len);
+                                    uint32_t *needed_p,
+                                    uint8_t **data_p);
+WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    const char *key_name,
+                                    const char ***key_buffer,
+                                    uint32_t offered);
+WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       const char *key_name,
+                                       uint32_t offered,
+                                       uint32_t *count,
+                                       struct spoolss_PrinterEnumValues **info);
 
 /* The following definitions come from rpc_client/init_spoolss.c  */
 
@@ -5682,44 +5703,14 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
                        const struct ndr_interface_table *table,
                        uint32 opnum, void *r);
 
-/* The following definitions come from rpc_parse/parse_buffer.c  */
-
-bool rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx);
-bool prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buffer);
-bool prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **buffer);
-bool rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size);
-void rpcbuf_move(RPC_BUFFER *src, RPC_BUFFER **dest);
-uint32 rpcbuf_get_size(RPC_BUFFER *buffer);
-bool smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string);
-bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 **string);
-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_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);
-bool smb_io_dom_sid(const char *desc, DOM_SID *sid, 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_unistr(UNISTR *str, const char *buf);
-bool smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth);
-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_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags);
-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 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);
-uint32 str_len_uni(UNISTR *source);
-bool policy_handle_is_valid(const POLICY_HND *hnd);
 
 /* The following definitions come from rpc_parse/parse_prs.c  */
 
@@ -5767,6 +5758,7 @@ bool prs_pointer( const char *name, prs_struct *ps, int depth,
 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);
@@ -5774,9 +5766,6 @@ 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_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_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);
 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);
@@ -5841,44 +5830,7 @@ 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 rpc_parse/parse_sec.c  */
-
-bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth);
-bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth);
-
-/* The following definitions come from rpc_parse/parse_spoolss.c  */
-
-bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
-bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
-bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode);
-bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
-                                  const POLICY_HND *handle,
-                                  const char *valuename, uint32 size);
-bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth);
-uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
-bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
-bool spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth);
-bool spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth);
-bool make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u,
-               const POLICY_HND *hnd,
-               uint32 idx, uint32 valuelen, uint32 datalen);
-bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u,
-                                     const POLICY_HND *hnd, const char *key,
-                                     uint32 size);
-bool make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd,
-                                  char* value, uint32 data_type, char* data, uint32 data_size);
-bool spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth);
-bool make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, 
-                                  POLICY_HND *hnd, const char *key, 
-                                  uint32 size);
-bool spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth);
-bool spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth);
-
-/* The following definitions come from rpc_server/srv_eventlog_lib.c  */
+/* The following definitions come from lib/eventlog/eventlog.c  */
 
 TDB_CONTEXT *elog_init_tdb( char *tdbfilename );
 char *elog_tdbname(TALLOC_CTX *ctx, const char *name );
@@ -5908,6 +5860,10 @@ NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx,
 NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
                                      const struct eventlog_Record_tdb *t,
                                      struct EVENTLOGRECORD *e);
+NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx,
+                                 ELOG_TDB *etdb,
+                                 DATA_BLOB *blob_p,
+                                 uint32_t *num_records_p);
 
 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
 
@@ -5915,9 +5871,9 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
 
 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);
+bool create_policy_hnd(pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
+bool find_policy_by_hnd(pipes_struct *p, struct policy_handle *hnd, void **data_p);
+bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd);
 void close_policy_by_pipe(pipes_struct *p);
 bool pipe_access_check(pipes_struct *p);
 
@@ -5956,18 +5912,42 @@ 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);
-struct async_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
+struct tevent_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 tevent_req *req, ssize_t *pnwritten);
+struct tevent_req *np_read_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,
+                               uint8_t *data, size_t len);
+NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
                      bool *is_data_outstanding);
 
 /* The following definitions come from rpc_server/srv_samr_util.c  */
 
+void copy_id2_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo2 *from);
+void copy_id4_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo4 *from);
+void copy_id6_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo6 *from);
+void copy_id8_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo8 *from);
+void copy_id10_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo10 *from);
+void copy_id11_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo11 *from);
+void copy_id12_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo12 *from);
+void copy_id13_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo13 *from);
+void copy_id14_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo14 *from);
+void copy_id16_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo16 *from);
+void copy_id17_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo17 *from);
+void copy_id18_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo18 *from);
 void copy_id20_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo20 *from);
 void copy_id21_to_sam_passwd(const char *log_prefix,
@@ -5975,13 +5955,12 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
                             struct samr_UserInfo21 *from);
 void copy_id23_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo23 *from);
+void copy_id24_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo24 *from);
 void copy_id25_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo25 *from);
-
-/* The following definitions come from rpc_server/srv_spoolss.c  */
-
-void spoolss2_get_pipe_fns( struct api_struct **fns, int *n_fns );
-NTSTATUS rpc_spoolss2_init(void);
+void copy_id26_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo26 *from);
 
 /* The following definitions come from rpc_server/srv_spoolss_nt.c  */
 
@@ -5997,11 +5976,12 @@ void reset_all_printerdata(struct messaging_context *msg,
                           uint32_t msg_type,
                           struct server_id server_id,
                           DATA_BLOB *data);
-bool convert_devicemode(const char *printername, const DEVICEMODE *devmode,
-                               NT_DEVICEMODE **pp_nt_devmode);
-WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, const char *value,
-                                  uint32 type, uint8 *data, int real_len  );
-WERROR _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPOOL_R_GETPRINTERDATA *r_u);
+bool convert_devicemode(const char *printername,
+                       const struct spoolss_DeviceMode *devmode,
+                       NT_DEVICEMODE **pp_nt_devmode);
+WERROR set_printer_dataex(NT_PRINTER_INFO_LEVEL *printer,
+                         const char *key, const char *value,
+                         uint32_t type, uint8_t *data, int real_len);
 void spoolss_notify_server_name(int snum,
                                       struct spoolss_Notify *data,
                                       print_queue_struct *queue,
@@ -6069,18 +6049,13 @@ void spoolss_notify_cjobs(int snum,
                                 TALLOC_CTX *mem_ctx);
 void construct_info_data(struct spoolss_Notify *info_data,
                         enum spoolss_NotifyType type,
-                        enum spoolss_Field field,
+                        uint16_t field,
                         int id);
-DEVICEMODE *construct_dev_mode(const char *servicename);
-struct spoolss_DeviceMode *construct_dev_mode_new(TALLOC_CTX *mem_ctx,
-                                                 const char *servicename);
+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 );
-WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u);
-WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u);
-WERROR _spoolss_enumprinterkey(pipes_struct *p, SPOOL_Q_ENUMPRINTERKEY *q_u, SPOOL_R_ENUMPRINTERKEY *r_u);
-WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_u, SPOOL_R_ENUMPRINTERDATAEX *r_u);
 
 /* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
 
@@ -6290,7 +6265,7 @@ void dptr_SeekDir(struct dptr_struct *dptr, long offset);
 long dptr_TellDir(struct dptr_struct *dptr);
 bool dptr_has_wild(struct dptr_struct *dptr);
 int dptr_dnum(struct dptr_struct *dptr);
-const char *dptr_ReadDirName(TALLOC_CTX *ctx,
+char *dptr_ReadDirName(TALLOC_CTX *ctx,
                        struct dptr_struct *dptr,
                        long *poffset,
                        SMB_STRUCT_STAT *pst);
@@ -6433,6 +6408,10 @@ void file_close_pid(uint16 smbpid, int vuid);
 void file_init(void);
 void file_close_user(int vuid);
 void file_dump_open_table(void);
+struct files_struct *file_walk_table(
+       struct files_struct *(*fn)(struct files_struct *fsp,
+                                  void *private_data),
+       void *private_data);
 files_struct *file_find_fd(int fd);
 files_struct *file_find_dif(struct file_id id, unsigned long gen_id);
 files_struct *file_find_fsp(files_struct *orig_fsp);
@@ -6705,6 +6684,7 @@ void release_file_oplock(files_struct *fsp);
 bool remove_oplock(files_struct *fsp);
 bool downgrade_oplock(files_struct *fsp);
 bool should_notify_deferred_opens(void);
+void break_level2_to_none_async(files_struct *fsp);
 void reply_to_oplock_break_requests(files_struct *fsp);
 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
                                                      void *private_data,
@@ -7290,6 +7270,23 @@ NTSTATUS idmap_sid_to_gid(const char *domname, DOM_SID *sid, gid_t *gid);
 
 NTSTATUS nss_info_template_init( void );
 
+/* The following definitions come from lib/avahi.c */
+
+struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
+                                   struct tevent_context *ev);
+
+/* The following definitions come from smbd/avahi_register.c */
+
+void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+                          uint16_t port);
+
 /* Misc protos */
 
+/* The following definitions come from rpc_server/srv_samr_nt.c */
+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);
 #endif /*  _PROTO_H_  */