s3-groupdb: move groupdb headers to groupdb/proto.h.
[samba.git] / source3 / include / proto.h
index 581c423fa6505fcf47f1f18e4fcf9c169cf4a8dd..46197c2e1797980230046f1645bedbb69cb5e74f 100644 (file)
@@ -159,6 +159,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
                                const char *domain,
                                struct auth_serversupplied_info **server_info,
                                struct netr_SamInfo3 *info3);
+struct wbcAuthUserInfo;
 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
                                          const char *sent_nt_username,
                                          const char *domain,
@@ -249,8 +250,6 @@ bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
 struct security_token *get_root_nt_token( void );
 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
                     struct security_token *token);
-NTSTATUS create_builtin_users(const struct dom_sid *sid);
-NTSTATUS create_builtin_administrators(const struct dom_sid *sid);
 struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
                                            const struct dom_sid *user_sid,
                                            bool is_guest,
@@ -264,80 +263,6 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
                           int n_groups, gid_t *groups);
 
-/* The following definitions come from groupdb/mapping.c  */
-
-NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
-bool get_domain_group_from_sid(struct dom_sid sid, GROUP_MAP *map);
-int smb_create_group(const char *unix_group, gid_t *new_gid);
-int smb_delete_group(const char *unix_group);
-int smb_set_primary_group(const char *unix_group, const char* unix_user);
-int smb_add_user_group(const char *unix_group, const char *unix_user);
-int smb_delete_user_group(const char *unix_group, const char *unix_user);
-NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
-                                struct dom_sid sid);
-NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
-                                gid_t gid);
-NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
-                                const char *name);
-NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
-                                               GROUP_MAP *map);
-NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
-                                                  GROUP_MAP *map);
-NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
-                                                  struct dom_sid sid);
-NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
-                                          const struct dom_sid *sid, enum lsa_SidType sid_name_use,
-                                          GROUP_MAP **pp_rmap, size_t *p_num_entries,
-                                          bool unix_only);
-NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
-                                 const char *name, uint32 *rid);
-NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
-                                 const struct dom_sid *sid);
-NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
-                                  const struct dom_sid *sid,
-                                  struct acct_info *info);
-NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
-                                  const struct dom_sid *sid,
-                                  struct acct_info *info);
-NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
-                                 const struct dom_sid *alias, const struct dom_sid *member);
-NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
-                                 const struct dom_sid *alias, const struct dom_sid *member);
-NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
-                                  const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
-                                  struct dom_sid **pp_members,
-                                  size_t *p_num_members);
-NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
-                                      TALLOC_CTX *mem_ctx,
-                                      const struct dom_sid *domain_sid,
-                                      const struct dom_sid *members,
-                                      size_t num_members,
-                                      uint32 **pp_alias_rids,
-                                      size_t *p_num_alias_rids);
-NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
-                                struct dom_sid sid);
-NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
-                                gid_t gid);
-NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
-                                const char *name);
-NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
-                                               GROUP_MAP *map);
-NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
-                                                  GROUP_MAP *map);
-NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
-                                                  struct dom_sid sid);
-NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
-                                          enum lsa_SidType sid_name_use,
-                                          GROUP_MAP **rmap, size_t *num_entries,
-                                          bool unix_only);
-bool pdb_get_dom_grp_info(const struct dom_sid *sid, struct acct_info *info);
-bool pdb_set_dom_grp_info(const struct dom_sid *sid, const struct acct_info *info);
-NTSTATUS pdb_create_builtin_alias(uint32 rid);
-
-/* The following definitions come from groupdb/mapping_tdb.c  */
-
-const struct mapping_backend *groupdb_tdb_init(void);
-
 /* The following definitions come from intl/lang_tdb.c  */
 
 bool lang_tdb_init(const char *lang);
@@ -409,13 +334,16 @@ int bitmap_find(struct bitmap *bm, unsigned ofs);
 
 /* The following definitions come from lib/charcnv.c  */
 
-char lp_failed_convert_char(void);
 void lazy_initialize_conv(void);
 void gfree_charcnv(void);
 void init_iconv(void);
 size_t convert_string(charset_t from, charset_t to,
                      void const *src, size_t srclen, 
-                     void *dest, size_t destlen, bool allow_bad_conv);
+                     void *dest, size_t destlen);
+size_t convert_string_error(charset_t from, charset_t to,
+                           void const *src, size_t srclen,
+                           void *dest, size_t destlen,
+                           size_t *converted_size);
 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
@@ -434,12 +362,6 @@ size_t push_utf8_fstring(void *dest, const char *src);
 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
                      size_t *converted_size);
 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
-size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
-                       const void *base_ptr,
-                       char **ppdest,
-                       const void *src,
-                       size_t src_len,
-                       int flags);
 size_t pull_ucs2_fstring(char *dest, const void *src);
 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
                      size_t *converted_size);
@@ -449,25 +371,19 @@ bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
                      size_t *converted_size);
 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
                       size_t *converted_size);
-size_t push_string_check_fn(const char *function, unsigned int line,
-                           void *dest, const char *src,
+size_t push_string_check_fn(void *dest, const char *src,
                            size_t dest_len, int flags);
-size_t push_string_base(const char *function, unsigned int line,
-                       const char *base, uint16 flags2, 
+size_t push_string_base(const char *base, uint16 flags2,
                        void *dest, const char *src,
                        size_t dest_len, int flags);
-size_t pull_string_fn(const char *function,
-                       unsigned int line,
-                       const void *base_ptr,
+size_t pull_string_fn(const void *base_ptr,
                        uint16 smb_flags2,
                        char *dest,
                        const void *src,
                        size_t dest_len,
                        size_t src_len,
                        int flags);
-size_t pull_string_talloc_fn(const char *function,
-                       unsigned int line,
-                       TALLOC_CTX *ctx,
+size_t pull_string_talloc(TALLOC_CTX *ctx,
                        const void *base_ptr,
                        uint16 smb_flags2,
                        char **ppdest,
@@ -475,13 +391,6 @@ size_t pull_string_talloc_fn(const char *function,
                        size_t src_len,
                        int flags);
 size_t align_string(const void *base_ptr, const char *p, int flags);
-codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
-                              size_t *bytes_consumed);
-codepoint_t next_codepoint(const char *str, size_t *size);
-
-/* The following definitions come from lib/clobber.c  */
-
-void clobber_region(const char *fn, unsigned int line, char *dest, size_t len);
 
 /* The following definitions come from lib/conn_tdb.c  */
 
@@ -502,16 +411,6 @@ int connections_forall_read(int (*fn)(const struct connections_key *key,
                            void *private_data);
 bool connections_init(bool rw);
 
-/* The following definitions come from lib/display_sec.c  */
-
-char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
-void display_sec_access(uint32_t *info);
-void display_sec_ace_flags(uint8_t flags);
-void display_sec_ace(struct security_ace *ace);
-void display_sec_acl(struct security_acl *sec_acl);
-void display_acl_type(uint16 type);
-void display_sec_desc(struct security_descriptor *sec);
-
 /* The following definitions come from lib/dmallocmsg.c  */
 
 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
@@ -525,10 +424,6 @@ void display_set_stderr(void);
 NTSTATUS map_nt_error_from_unix(int unix_error);
 int map_errno_from_nt_status(NTSTATUS status);
 
-/* The following definitions come from lib/fault.c  */
-void fault_setup(void (*fn)(void *));
-void dump_core_setup(const char *progname);
-
 /* The following definitions come from lib/file_id.c  */
 
 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
@@ -623,9 +518,6 @@ bool revoke_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *se
 bool revoke_privilege_by_name(const struct dom_sid *sid, const char *name);
 NTSTATUS privilege_create_account(const struct 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);
 bool is_privileged_sid( const struct dom_sid *sid );
 bool grant_all_privileges( const struct dom_sid *sid );
 
@@ -901,13 +793,6 @@ void sys_srandom(unsigned int seed);
 int groups_max(void);
 int sys_getgroups(int setlen, gid_t *gidset);
 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
-void sys_setpwent(void);
-struct passwd *sys_getpwent(void);
-void sys_endpwent(void);
-struct passwd *sys_getpwnam(const char *name);
-struct passwd *sys_getpwuid(uid_t uid);
-struct group *sys_getgrnam(const char *name);
-struct group *sys_getgrgid(gid_t gid);
 int sys_popen(const char *command);
 int sys_pclose(int fd);
 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
@@ -963,9 +848,6 @@ void register_msg_pool_usage(struct messaging_context *msg_ctx);
 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
-time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
-time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
-time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
 uint32_t convert_time_t_to_uint32_t(time_t t);
 time_t convert_uint32_t_to_time_t(uint32_t u);
 bool nt_time_is_zero(const NTTIME *nt);
@@ -987,7 +869,6 @@ time_t make_unix_date3(const void *date_ptr, int zone_offset);
 time_t srv_make_unix_date(const void *date_ptr);
 time_t srv_make_unix_date2(const void *date_ptr);
 time_t srv_make_unix_date3(const void *date_ptr);
-time_t convert_timespec_to_time_t(struct timespec ts);
 struct timespec convert_time_t_to_timespec(time_t t);
 struct timespec convert_timeval_to_timespec(const struct timeval tv);
 struct timeval convert_timespec_to_timeval(const struct timespec ts);
@@ -1011,9 +892,7 @@ bool nt_time_is_set(const NTTIME *nt);
 
 /* The following definitions come from lib/username.c  */
 
-struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
 void flush_pwnam_cache(void);
-struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
 
@@ -1105,7 +984,7 @@ const char *uidtoname(uid_t uid);
 char *gidtoname(gid_t gid);
 uid_t nametouid(const char *name);
 gid_t nametogid(const char *name);
-void smb_panic(const char *const why);
+void smb_panic_s3(const char *why);
 void log_stack_trace(void);
 const char *readdirname(SMB_STRUCT_DIR *p);
 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
@@ -1201,15 +1080,6 @@ NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
                        struct security_token **token_out);
 bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
 
-/* The following definitions come from ..libcli/registry/util_reg.c  */
-
-const char *str_regtype(int type);
-int regtype_by_string(const char *str);
-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_sec.c  */
 
 void sec_init(void);
@@ -1334,6 +1204,7 @@ struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
                                    const struct addrinfo *hints);
 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
 int poll_one_fd(int fd, int events, int timeout, int *revents);
+int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
                                            struct tstream_context *stream,
@@ -1348,14 +1219,6 @@ ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 /* The following definitions come from lib/util_str.c  */
 
 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
-bool next_token_talloc(TALLOC_CTX *ctx,
-                       const char **ptr,
-                       char **pp_buff,
-                       const char *sep);
-bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
-                       const char **ptr,
-                       char **pp_buff,
-                       const char *sep);
 int StrCaseCmp(const char *s, const char *t);
 int StrnCaseCmp(const char *s, const char *t, size_t len);
 bool strnequal(const char *s1,const char *s2,size_t n);
@@ -1369,23 +1232,17 @@ size_t str_ascii_charnum(const char *s);
 bool trim_char(char *s,char cfront,char cback);
 bool strhasupper(const char *s);
 bool strhaslower(const char *s);
-char *safe_strcpy_fn(const char *fn,
-               int line,
-               char *dest,
+char *safe_strcpy_fn(char *dest,
                const char *src,
                size_t maxlength);
-char *safe_strcat_fn(const char *fn,
-               int line,
-               char *dest,
+char *safe_strcat_fn(char *dest,
                const char *src,
                size_t maxlength);
-char *alpha_strcpy_fn(const char *fn,
-               int line,
-               char *dest,
+char *alpha_strcpy(char *dest,
                const char *src,
                const char *other_safe_chars,
                size_t maxlength);
-char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
+char *StrnCpy(char *dest,const char *src,size_t n);
 bool in_list(const char *s, const char *list, bool casesensitive);
 void string_free(char **s);
 bool string_set(char **dest,const char *src);
@@ -1427,28 +1284,19 @@ char *strnrchr_m(const char *s, char c, unsigned int n);
 char *strstr_m(const char *src, const char *findstr);
 void strlower_m(char *s);
 void strupper_m(char *s);
-size_t strlen_m_ext(const char *s, const charset_t src_charset,
-                   const charset_t dst_charset);
-size_t strlen_m_ext_term(const char *s, const charset_t src_charset,
-                        const charset_t dst_charset);
 size_t strlen_m(const char *s);
 size_t strlen_m_term(const char *s);
 size_t strlen_m_term_null(const char *s);
-char *binary_string_rfc2254(TALLOC_CTX *mem_ctx, const uint8_t *buf, int len);
-char *binary_string(char *buf, int len);
 int fstr_sprintf(fstring s, const char *fmt, ...);
 bool str_list_sub_basic( char **list, const char *smb_name,
                         const char *domain_name );
 bool str_list_substitute(char **list, const char *pattern, const char *insert);
-bool str_list_check(const char **list, const char *s);
-bool str_list_check_ci(const char **list, const char *s);
 
 char *ipstr_list_make(char **ipstr_list,
                        const struct ip_service *ip_list,
                        int ip_count);
 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
 void ipstr_list_free(char* ipstr_list);
-void rfc1738_unescape(char *buf);
 DATA_BLOB base64_decode_data_blob(const char *s);
 void base64_decode_inplace(char *s);
 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
@@ -1517,40 +1365,6 @@ int islower_ascii(int c);
 
 const char *samba_version_string(void);
 
-/* The following definitions come from lib/winbind_util.c  */
-
-bool winbind_lookup_name(const char *dom_name, const char *name, struct dom_sid *sid,
-                         enum lsa_SidType *name_type);
-bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
-                       const char **domain, const char **name,
-                        enum lsa_SidType *name_type);
-bool winbind_ping(void);
-bool winbind_sid_to_uid(uid_t *puid, const struct dom_sid *sid);
-bool winbind_uid_to_sid(struct dom_sid *sid, uid_t uid);
-bool winbind_sid_to_gid(gid_t *pgid, const struct dom_sid *sid);
-bool winbind_gid_to_sid(struct dom_sid *sid, gid_t gid);
-struct passwd * winbind_getpwnam(const char * sname);
-struct passwd * winbind_getpwsid(const struct dom_sid *sid);
-wbcErr wb_is_trusted_domain(const char *domain);
-bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
-                        const struct dom_sid *domain_sid,
-                        int num_rids, uint32 *rids,
-                        const char **domain_name,
-                        const char ***names, enum lsa_SidType **types);
-bool winbind_allocate_uid(uid_t *uid);
-bool winbind_allocate_gid(gid_t *gid);
-bool winbind_get_groups(TALLOC_CTX *mem_ctx,
-                       const char *account,
-                       uint32_t *num_groups,
-                       gid_t ** _groups);
-bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
-                            const struct dom_sid *dom_sid,
-                            const struct dom_sid *members,
-                            size_t num_members,
-                            uint32_t **pp_alias_rids,
-                            size_t *p_num_alias_rids);
-
-
 /* The following definitions come from lib/wins_srv.c  */
 
 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
@@ -1605,7 +1419,6 @@ struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
                                  struct cli_state *cli);
 NTSTATUS cli_tdis_recv(struct tevent_req *req);
 NTSTATUS cli_tdis(struct cli_state *cli);
-void cli_negprot_sendsync(struct cli_state *cli);
 NTSTATUS cli_negprot(struct cli_state *cli);
 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
                                    struct event_context *ev,
@@ -1663,6 +1476,7 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                int port,
                                int name_type);
 void cli_cm_display(const struct cli_state *c);
+struct client_dfs_referral;
 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
                        struct cli_state *cli,
                        const char *path,
@@ -1697,7 +1511,6 @@ bool cli_state_seqnum_persistent(struct cli_state *cli,
 bool cli_state_seqnum_remove(struct cli_state *cli,
                             uint16_t mid);
 bool cli_receive_smb(struct cli_state *cli);
-bool cli_receive_smb_readX_header(struct cli_state *cli);
 bool cli_send_smb(struct cli_state *cli);
 bool cli_send_smb_direct_writeX(struct cli_state *cli,
                                const char *p,
@@ -2233,186 +2046,6 @@ NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
                               SMB_NTQUOTA_STRUCT *pqt);
 
-/* The following definitions come from libsmb/clirap.c  */
-
-bool cli_api(struct cli_state *cli,
-            char *param, int prcnt, int mprcnt,
-            char *data, int drcnt, int mdrcnt,
-            char **rparam, unsigned int *rprcnt,
-            char **rdata, unsigned int *rdrcnt);
-bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
-int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
-bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
-                      void (*fn)(const char *, uint32, const char *, void *),
-                      void *state);
-bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
-                             const char *old_password);
-struct tevent_req *cli_qpathinfo1_send(TALLOC_CTX *mem_ctx,
-                                      struct event_context *ev,
-                                      struct cli_state *cli,
-                                      const char *fname);
-NTSTATUS cli_qpathinfo1_recv(struct tevent_req *req,
-                            time_t *change_time,
-                            time_t *access_time,
-                            time_t *write_time,
-                            SMB_OFF_T *size,
-                            uint16 *mode);
-NTSTATUS cli_qpathinfo1(struct cli_state *cli,
-                       const char *fname,
-                       time_t *change_time,
-                       time_t *access_time,
-                       time_t *write_time,
-                       SMB_OFF_T *size,
-                       uint16 *mode);
-NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
-                              time_t create_time,
-                              time_t access_time,
-                              time_t write_time,
-                              time_t change_time,
-                              uint16 mode);
-struct tevent_req *cli_qpathinfo2_send(TALLOC_CTX *mem_ctx,
-                                      struct event_context *ev,
-                                      struct cli_state *cli,
-                                      const char *fname);
-NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req,
-                            struct timespec *create_time,
-                            struct timespec *access_time,
-                            struct timespec *write_time,
-                            struct timespec *change_time,
-                            SMB_OFF_T *size, uint16 *mode,
-                            SMB_INO_T *ino);
-NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname,
-                       struct timespec *create_time,
-                       struct timespec *access_time,
-                       struct timespec *write_time,
-                       struct timespec *change_time,
-                       SMB_OFF_T *size, uint16 *mode,
-                       SMB_INO_T *ino);
-struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
-                                             struct tevent_context *ev,
-                                             struct cli_state *cli,
-                                             const char *fname);
-NTSTATUS cli_qpathinfo_streams_recv(struct tevent_req *req,
-                                   TALLOC_CTX *mem_ctx,
-                                   unsigned int *pnum_streams,
-                                   struct stream_struct **pstreams);
-NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
-                              TALLOC_CTX *mem_ctx,
-                              unsigned int *pnum_streams,
-                              struct stream_struct **pstreams);
-NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name,
-                      size_t namelen);
-NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
-                            uint16 *mode, SMB_OFF_T *size,
-                            struct timespec *create_time,
-                            struct timespec *access_time,
-                            struct timespec *write_time,
-                            struct timespec *change_time,
-                            SMB_INO_T *ino);
-struct tevent_req *cli_qpathinfo_basic_send(TALLOC_CTX *mem_ctx,
-                                           struct event_context *ev,
-                                           struct cli_state *cli,
-                                           const char *fname);
-NTSTATUS cli_qpathinfo_basic_recv(struct tevent_req *req,
-                                 SMB_STRUCT_STAT *sbuf, uint32 *attributes);
-NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
-                            SMB_STRUCT_STAT *sbuf, uint32 *attributes);
-NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
-struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx,
-                                     struct tevent_context *ev,
-                                     struct cli_state *cli, const char *fname,
-                                     uint16_t level, uint32_t min_rdata,
-                                     uint32_t max_rdata);
-NTSTATUS cli_qpathinfo_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-                           uint8_t **rdata, uint32_t *num_rdata);
-NTSTATUS cli_qpathinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                      const char *fname, uint16_t level, uint32_t min_rdata,
-                      uint32_t max_rdata,
-                      uint8_t **rdata, uint32_t *num_rdata);
-
-struct tevent_req *cli_qfileinfo_send(TALLOC_CTX *mem_ctx,
-                                     struct tevent_context *ev,
-                                     struct cli_state *cli, uint16_t fnum,
-                                     uint16_t level, uint32_t min_rdata,
-                                     uint32_t max_rdata);
-NTSTATUS cli_qfileinfo_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-                           uint8_t **rdata, uint32_t *num_rdata);
-NTSTATUS cli_qfileinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                      uint16_t fnum, uint16_t level, uint32_t min_rdata,
-                      uint32_t max_rdata,
-                      uint8_t **rdata, uint32_t *num_rdata);
-
-struct tevent_req *cli_flush_send(TALLOC_CTX *mem_ctx,
-                                 struct event_context *ev,
-                                 struct cli_state *cli,
-                                 uint16_t fnum);
-NTSTATUS cli_flush_recv(struct tevent_req *req);
-NTSTATUS cli_flush(TALLOC_CTX *mem_ctx, struct cli_state *cli, uint16_t fnum);
-
-struct tevent_req *cli_shadow_copy_data_send(TALLOC_CTX *mem_ctx,
-                                            struct tevent_context *ev,
-                                            struct cli_state *cli,
-                                            uint16_t fnum,
-                                            bool get_names);
-NTSTATUS cli_shadow_copy_data_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-                                  char ***pnames, int *pnum_names);
-NTSTATUS cli_shadow_copy_data(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                             uint16_t fnum, bool get_names,
-                             char ***pnames, int *pnum_names);
-
-/* The following definitions come from libsmb/clirap2.c  */
-struct rap_group_info_1;
-struct rap_user_info_1;
-struct rap_share_info_2;
-
-int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
-int cli_NetGroupAdd(struct cli_state *cli, struct rap_group_info_1 *grinfo);
-int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
-int cli_RNetGroupEnum0(struct cli_state *cli,
-                      void (*fn)(const char *, void *),
-                      void *state);
-int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
-int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
-int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
-int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
-int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
-int cli_NetUserAdd(struct cli_state *cli, struct rap_user_info_1 * userinfo );
-int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
-int cli_RNetUserEnum0(struct cli_state *cli,
-                     void (*fn)(const char *, void *),
-                     void *state);
-int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
-int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
-int cli_NetFileEnum(struct cli_state *cli, const char * user,
-                   const char * base_path,
-                   void (*fn)(const char *, const char *, uint16, uint16,
-                              uint32));
-int cli_NetShareAdd(struct cli_state *cli, struct rap_share_info_2 * sinfo );
-int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
-bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
-bool cli_get_server_domain(struct cli_state *cli);
-bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
-bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                        char **servername);
-bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
-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*,unsigned int,unsigned int,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*,unsigned int,unsigned int,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, unsigned int, unsigned int, unsigned int, char *));
-int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
-               void (*fn)(const char *, const char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, 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,
-                               uint16_t numopens, uint16_t numusers,
-                               uint32_t contime, const char *username,
-                               const char *netname));
-
 /* The following definitions come from libsmb/clireadwrite.c  */
 
 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
@@ -2441,12 +2074,11 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
                  void *priv, SMB_OFF_T *received);
 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
                 off_t offset, size_t size);
-ssize_t cli_readraw(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size);
 ssize_t cli_write(struct cli_state *cli,
                 uint16_t fnum, uint16 write_mode,
                 const char *buf, off_t offset, size_t size);
-ssize_t cli_smbwrite(struct cli_state *cli,
-                    uint16_t fnum, char *buf, off_t offset, size_t size1);
+NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
+                     off_t offset, size_t size1, size_t *ptotal);
 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
                                         struct event_context *ev,
                                         struct cli_state *cli, uint16_t fnum,
@@ -2488,6 +2120,10 @@ DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
                                  const char *OIDs[],
                                  DATA_BLOB *psecblob,
                                  const char *principal);
+
+#ifndef ASN1_MAX_OIDS
+#define ASN1_MAX_OIDS 20
+#endif
 bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
                               DATA_BLOB blob,
                               char *OIDs[ASN1_MAX_OIDS],
@@ -2523,30 +2159,24 @@ bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
 
 /* The following definitions come from libsmb/clistr.c  */
 
-size_t clistr_push_fn(const char *function,
-                       unsigned int line,
-                       struct cli_state *cli,
+size_t clistr_push_fn(struct cli_state *cli,
                        void *dest,
                        const char *src,
                        int dest_len,
                        int flags);
-size_t clistr_pull_fn(const char *function,
-                       unsigned int line,
-                       const char *inbuf,
+size_t clistr_pull_fn(const char *inbuf,
                        char *dest,
                        const void *src,
                        int dest_len,
                        int src_len,
                        int flags);
-size_t clistr_pull_talloc_fn(const char *function,
-                               unsigned int line,
-                               TALLOC_CTX *ctx,
-                               const char *base,
-                               uint16_t flags2,
-                               char **pp_dest,
-                               const void *src,
-                               int src_len,
-                               int flags);
+size_t clistr_pull_talloc(TALLOC_CTX *ctx,
+                         const char *base,
+                         uint16_t flags2,
+                         char **pp_dest,
+                         const void *src,
+                         int src_len,
+                         int flags);
 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
 
 /* The following definitions come from libsmb/clitrans.c  */
@@ -2580,7 +2210,6 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
 
 /* The following definitions come from libsmb/conncache.c  */
 
-NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
 void flush_negative_conn_cache_for_domain(const char *domain);
@@ -2608,7 +2237,6 @@ NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
 
 /* The following definitions come from libsmb/namecache.c  */
 
-bool namecache_enable(void);
 bool namecache_store(const char *name,
                        int name_type,
                        int num_names,
@@ -2726,7 +2354,6 @@ void make_nmb_name( struct nmb_name *n, const char *name, int type);
 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
 bool send_packet(struct packet_struct *p);
-struct packet_struct *receive_packet(int fd,enum packet_type type,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);
@@ -2743,7 +2370,7 @@ NTSTATUS nt_status_string_to_code(const char *nt_status_str);
 NTSTATUS nt_status_squash(NTSTATUS nt_status);
 
 /* The following definitions come from libsmb/ntlmssp.c  */
-
+struct ntlmssp_state;
 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
                            const uint8_t lm_hash[16],
@@ -2754,7 +2381,6 @@ void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *featur
 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
                        const DATA_BLOB in, DATA_BLOB *out) ;
-DATA_BLOB ntlmssp_weaken_keys(struct ntlmssp_state *ntlmssp_state, TALLOC_CTX *mem_ctx);
 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
                              bool is_standalone,
                              const char *netbios_name,
@@ -3040,12 +2666,12 @@ void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
-const UNIX_USER_TOKEN *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
+const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
 void set_delete_on_close_lck(files_struct *fsp,
                        struct share_mode_lock *lck,
                        bool delete_on_close,
-                       const UNIX_USER_TOKEN *tok);
-bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USER_TOKEN *tok);
+                       const struct security_unix_token *tok);
+bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
 bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
 bool set_write_time(struct file_id fileid, struct timespec write_time);
@@ -3186,7 +2812,6 @@ bool lp_winbind_rpc_only(void);
 bool lp_create_krb5_conf(void);
 int lp_winbind_max_domain_connections(void);
 const char *lp_idmap_backend(void);
-bool lp_idmap_read_only(void);
 int lp_idmap_cache_time(void);
 int lp_idmap_negative_cache_time(void);
 int lp_keepalive(void);
@@ -3386,6 +3011,7 @@ bool lp_guest_ok(int );
 bool lp_guest_only(int );
 bool lp_administrative_share(int );
 bool lp_print_ok(int );
+bool lp_print_notify_backchannel(int );
 bool lp_map_hidden(int );
 bool lp_map_archive(int );
 bool lp_store_dos_attributes(int );
@@ -3917,9 +3543,13 @@ NTSTATUS pdb_wbc_sam_init(void);
 
 /* The following definitions come from passdb/pdb_tdb.c  */
 
-bool init_sam_from_buffer_v2(struct samu *sampass, uint8_t *buf, uint32_t buflen);
 NTSTATUS pdb_tdbsam_init(void);
 
+/* The following definitions come from passdb/pdb_util.c  */
+
+NTSTATUS create_builtin_users(const struct dom_sid *sid);
+NTSTATUS create_builtin_administrators(const struct dom_sid *sid);
+
 /* The following definitions come from passdb/util_builtin.c  */
 
 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
@@ -3955,44 +3585,16 @@ bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
 void set_profile_level(int level, struct server_id src);
 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
 
-/* The following definitions come from rpc_client/cli_pipe.c  */
+/* The following definitions come from librpc/rpc/rpc_common.c  */
+
 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
 const struct ndr_interface_table *get_iface_from_syntax(
        const struct ndr_syntax_id *syntax);
 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
                                      const struct ndr_syntax_id *syntax);
 
-struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
-                                        struct event_context *ev,
-                                        struct rpc_pipe_client *cli,
-                                        uint8_t op_num,
-                                        DATA_BLOB *req_data);
-NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-                              DATA_BLOB *reply_pdu);
-struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
-                                     struct event_context *ev,
-                                     struct rpc_pipe_client *cli,
-                                     struct pipe_auth_data *auth);
-NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
-NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
-                      struct 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 pipe_auth_data **presult);
-NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
-                                  enum dcerpc_AuthLevel auth_level,
-                                  struct netlogon_creds_CredentialState *creds,
-                                  struct pipe_auth_data **presult);
-NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
-                          const struct ndr_syntax_id *abstract_syntax,
-                          struct rpc_pipe_client **presult);
-NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
-                              const struct ndr_syntax_id *abstract_syntax,
-                              struct rpc_pipe_client **presult);
-struct dcerpc_binding_handle *rpccli_bh_create(struct rpc_pipe_client *c);
+/* The following definitions come from rpc_server/rpc_ncacn_np.c  */
+
 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
                                              const struct ndr_syntax_id *syntax,
                                              struct client_address *client_id,
@@ -4016,73 +3618,13 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
                                 struct client_address *client_id,
                                 struct messaging_context *msg_ctx,
                                 struct rpc_pipe_client **cli_pipe);
-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 dcerpc_AuthLevel auth_level,
-                                  const char *domain,
-                                  const char *username,
-                                  const char *password,
-                                  struct rpc_pipe_client **presult);
-NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
-                                         const struct ndr_syntax_id *interface,
-                                         enum dcerpc_transport_t transport,
-                                         enum dcerpc_AuthLevel auth_level,
-                                         const char *domain,
-                                         const char *username,
-                                         const char *password,
-                                         struct rpc_pipe_client **presult);
+
+/* The following definitions come from rpc_client/cli_pipe_schannel.c  */
+
 NTSTATUS get_schannel_session_key(struct cli_state *cli,
                                  const char *domain,
                                  uint32 *pneg_flags,
                                  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 dcerpc_AuthLevel auth_level,
-                                            const char *domain,
-                                            struct netlogon_creds_CredentialState **pdc,
-                                            struct rpc_pipe_client **presult);
-NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
-                                                const struct ndr_syntax_id *interface,
-                                                enum dcerpc_transport_t transport,
-                                                enum dcerpc_AuthLevel auth_level,
-                                                const char *domain,
-                                                const char *username,
-                                                const char *password,
-                                                struct rpc_pipe_client **presult);
-NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
-                                   const struct ndr_syntax_id *interface,
-                                   enum dcerpc_transport_t transport,
-                                   enum dcerpc_AuthLevel auth_level,
-                                   const char *domain,
-                                   struct rpc_pipe_client **presult);
-NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
-                               const struct ndr_syntax_id *interface,
-                               enum dcerpc_transport_t transport,
-                               enum dcerpc_AuthLevel auth_level,
-                               const char *service_princ,
-                               const char *username,
-                               const char *password,
-                               struct rpc_pipe_client **presult);
-NTSTATUS cli_rpc_pipe_open_spnego_krb5(struct cli_state *cli,
-                                       const struct ndr_syntax_id *interface,
-                                       enum dcerpc_transport_t transport,
-                                       enum dcerpc_AuthLevel auth_level,
-                                       const char *server,
-                                       const char *username,
-                                       const char *password,
-                                       struct rpc_pipe_client **presult);
-NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
-                            struct rpc_pipe_client *cli,
-                            DATA_BLOB *session_key);
 
 /* The following definitions come from rpc_client/rpc_transport_np.c  */
 
@@ -4096,7 +3638,6 @@ NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
 NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
                               const struct ndr_syntax_id *abstract_syntax,
                               struct rpc_cli_transport **presult);
-struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
 
 /* The following definitions come from rpc_client/rpc_transport_sock.c  */
 
@@ -4104,9 +3645,11 @@ NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
                                 struct rpc_cli_transport **presult);
 
 /* The following definitions come from rpc_client/rpc_transport_tstream.c  */
+
 NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
                                struct tstream_context **stream,
                                struct rpc_cli_transport **presult);
+struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
 
 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
 
@@ -4689,6 +4232,7 @@ void reply_sendend(struct smb_request *req);
 bool is_msdfs_link(connection_struct *conn,
                const char *path,
                SMB_STRUCT_STAT *sbufp);
+struct junction_map;
 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                        const char *dfs_path,
                        struct junction_map *jucn,
@@ -4972,7 +4516,6 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
 void reply_pipe_write(struct smb_request *req);
 void reply_pipe_write_and_X(struct smb_request *req);
 void reply_pipe_read_and_X(struct smb_request *req);
-void reply_pipe_close(connection_struct *conn, struct smb_request *req);
 
 /* The following definitions come from smbd/posix_acls.c  */
 
@@ -5206,7 +4749,7 @@ void server_encryption_shutdown(void);
 
 /* The following definitions come from smbd/sec_ctx.c  */
 
-bool unix_token_equal(const UNIX_USER_TOKEN *t1, const UNIX_USER_TOKEN *t2);
+bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
 bool push_sec_ctx(void);
 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct security_token *token);
 void set_root_sec_ctx(void);
@@ -5237,6 +4780,7 @@ void exit_server_fault(void);
 /* The following definitions come from smbd/service.c  */
 
 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
+NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
 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);
@@ -5253,7 +4797,7 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
 void close_cnum(connection_struct *conn, uint16 vuid);
 
 /* The following definitions come from smbd/session.c  */
-
+struct sessionid;
 bool session_init(void);
 bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser);
 void session_yield(user_struct *vuser);
@@ -5300,8 +4844,7 @@ bool is_share_read_only_for_token(const char *username,
 
 /* The following definitions come from smbd/srvstr.c  */
 
-size_t srvstr_push_fn(const char *function, unsigned int line,
-                     const char *base_ptr, uint16 smb_flags2, void *dest,
+size_t srvstr_push_fn(const char *base_ptr, uint16 smb_flags2, void *dest,
                      const char *src, int dest_len, int flags);
 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
 
@@ -5376,7 +4919,7 @@ bool become_user(connection_struct *conn, uint16 vuid);
 bool unbecome_user(void);
 uid_t get_current_uid(connection_struct *conn);
 gid_t get_current_gid(connection_struct *conn);
-const UNIX_USER_TOKEN *get_current_utok(connection_struct *conn);
+const struct security_unix_token *get_current_utok(connection_struct *conn);
 const struct security_token *get_current_nttok(connection_struct *conn);
 uint16_t get_current_vuid(connection_struct *conn);
 
@@ -5463,7 +5006,7 @@ void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 
 void msg_idmap_register_msgs(struct messaging_context *ctx);
 
-/* Misc protos */
+/* The following definitions come from lib/fncall.c */
 
 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
                                           int max_threads);
@@ -5473,6 +5016,8 @@ struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                               void *private_data);
 int fncall_recv(struct tevent_req *req, int *perr);
 
+/* The following definitions come from libsmb/smbsock_connect.c */
+
 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        const struct sockaddr_storage *addr,
@@ -5515,16 +5060,7 @@ NTSTATUS access_check_object( struct security_descriptor *psd, struct security_t
                              uint32 des_access, uint32 *acc_granted,
                              const char *debug );
 void map_max_allowed_access(const struct security_token *nt_token,
-                           const struct unix_user_token *unix_token,
+                           const struct security_unix_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);
-uint32_t ds_uf2prim_group_rid(uint32_t uf);
-
 #endif /*  _PROTO_H_  */