Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/include/proto.h

    r597 r740  
    2424#define _PROTO_H_
    2525
    26 
    27 /* The following definitions come from auth/auth.c  */
    28 
    29 NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init);
    30 bool load_auth_module(struct auth_context *auth_context,
    31                       const char *module, auth_methods **ret) ;
    32 NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) ;
    33 NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) ;
    34 
    35 /* The following definitions come from auth/auth_builtin.c  */
    36 
    37 NTSTATUS auth_builtin_init(void);
    38 
    39 /* The following definitions come from auth/auth_compat.c  */
    40 
    41 NTSTATUS check_plaintext_password(const char *smb_name, DATA_BLOB plaintext_password, auth_serversupplied_info **server_info);
    42 bool password_ok(struct auth_context *actx, bool global_encrypted,
    43                  const char *session_workgroup,
    44                  const char *smb_name, DATA_BLOB password_blob);
    45 
    46 /* The following definitions come from auth/auth_domain.c  */
    47 
    48 void attempt_machine_password_change(void);
    49 NTSTATUS auth_domain_init(void);
    50 
    51 NTSTATUS auth_netlogond_init(void);
    52 
    53 /* The following definitions come from auth/auth_ntlmssp.c  */
    54 
    55 NTSTATUS auth_ntlmssp_start(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
    56 void auth_ntlmssp_end(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
    57 NTSTATUS auth_ntlmssp_update(AUTH_NTLMSSP_STATE *auth_ntlmssp_state,
    58                              const DATA_BLOB request, DATA_BLOB *reply) ;
    59 
    60 /* The following definitions come from auth/auth_sam.c  */
    61 
    62 NTSTATUS auth_sam_init(void);
    63 
    64 /* The following definitions come from auth/auth_server.c  */
    65 
    66 NTSTATUS auth_server_init(void);
    67 
    68 /* The following definitions come from auth/auth_unix.c  */
    69 
    70 NTSTATUS auth_unix_init(void);
    71 
    72 /* The following definitions come from auth/auth_util.c  */
    73 
    74 NTSTATUS make_user_info_map(auth_usersupplied_info **user_info,
    75                             const char *smb_name,
    76                             const char *client_domain,
    77                             const char *wksta_name,
    78                             DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd,
    79                             DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd,
    80                             DATA_BLOB *plaintext,
    81                             bool encrypted);
    82 bool make_user_info_netlogon_network(auth_usersupplied_info **user_info,
    83                                      const char *smb_name,
    84                                      const char *client_domain,
    85                                      const char *wksta_name,
    86                                      uint32 logon_parameters,
    87                                      const uchar *lm_network_pwd,
    88                                      int lm_pwd_len,
    89                                      const uchar *nt_network_pwd,
    90                                      int nt_pwd_len);
    91 bool make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
    92                                          const char *smb_name,
    93                                          const char *client_domain,
    94                                          const char *wksta_name,
    95                                          uint32 logon_parameters,
    96                                          const uchar chal[8],
    97                                          const uchar lm_interactive_pwd[16],
    98                                          const uchar nt_interactive_pwd[16],
    99                                          const uchar *dc_sess_key);
    100 bool make_user_info_for_reply(auth_usersupplied_info **user_info,
    101                               const char *smb_name,
    102                               const char *client_domain,
    103                               const uint8 chal[8],
    104                               DATA_BLOB plaintext_password);
    105 NTSTATUS make_user_info_for_reply_enc(auth_usersupplied_info **user_info,
    106                                       const char *smb_name,
    107                                       const char *client_domain,
    108                                       DATA_BLOB lm_resp, DATA_BLOB nt_resp);
    109 bool make_user_info_guest(auth_usersupplied_info **user_info) ;
    110 NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
    111                               struct samu *sampass);
    112 NTSTATUS create_local_token(auth_serversupplied_info *server_info);
    113 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
    114                                     bool is_guest,
    115                                     uid_t *uid, gid_t *gid,
    116                                     char **found_username,
    117                                     struct nt_user_token **token);
    118 bool user_in_group_sid(const char *username, const DOM_SID *group_sid);
    119 bool user_in_group(const char *username, const char *groupname);
    120 NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
    121                              char *unix_username,
    122                              struct passwd *pwd);
    123 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
    124                                        const char *username,
    125                                        bool is_guest,
    126                                        struct auth_serversupplied_info **presult);
    127 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
    128                                                  const auth_serversupplied_info *src);
    129 bool init_guest_info(void);
    130 bool server_info_set_session_key(struct auth_serversupplied_info *info,
    131                                  DATA_BLOB session_key);
    132 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
    133                                 auth_serversupplied_info **server_info);
    134 bool copy_current_user(struct current_user *dst, struct current_user *src);
    135 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
    136                              fstring save_username, bool create );
    137 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
    138                                 const char *sent_nt_username,
    139                                 const char *domain,
    140                                 auth_serversupplied_info **server_info,
    141                                 struct netr_SamInfo3 *info3);
    142 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
    143                                           const char *sent_nt_username,
    144                                           const char *domain,
    145                                           const struct wbcAuthUserInfo *info,
    146                                           auth_serversupplied_info **server_info);
    147 void free_user_info(auth_usersupplied_info **user_info);
    148 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
    149 bool is_trusted_domain(const char* dom_name);
    150 
    151 /* The following definitions come from auth/auth_winbind.c  */
    152 
    153 NTSTATUS auth_winbind_init(void);
    154 
    155 /* The following definitions come from auth/auth_wbc.c  */
    156 
    157 NTSTATUS auth_wbc_init(void);
    158 
    159 /* The following definitions come from auth/pampass.c  */
    160 
    161 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
    162 bool smb_pam_close_session(char *user, char *tty, char *rhost);
    163 NTSTATUS smb_pam_accountcheck(const char * user);
    164 NTSTATUS smb_pam_passcheck(const char * user, const char * password);
    165 bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword);
    166 NTSTATUS smb_pam_accountcheck(const char * user);
    167 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
    168 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
    169 
    170 /* The following definitions come from auth/pass_check.c  */
    171 
    172 void dfs_unlogin(void);
    173 NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password,
    174                     int pwlen, bool (*fn) (const char *, const char *), bool run_cracker);
    175 
    176 /* The following definitions come from auth/token_util.c  */
    177 
    178 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
    179 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
    180 NT_USER_TOKEN *get_root_nt_token( void );
    181 NTSTATUS add_aliases(const DOM_SID *domain_sid,
    182                      struct nt_user_token *token);
    183 NTSTATUS create_builtin_users(const DOM_SID *sid);
    184 NTSTATUS create_builtin_administrators(const DOM_SID *sid);
    185 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
    186                                             const DOM_SID *user_sid,
    187                                             bool is_guest,
    188                                             int num_groupsids,
    189                                             const DOM_SID *groupsids);
    190 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
    191 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
    192                            int n_groups, gid_t *groups);
    193 
    194 /* The following definitions come from groupdb/mapping.c  */
    195 
    196 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
    197 bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map);
    198 int smb_create_group(const char *unix_group, gid_t *new_gid);
    199 int smb_delete_group(const char *unix_group);
    200 int smb_set_primary_group(const char *unix_group, const char* unix_user);
    201 int smb_add_user_group(const char *unix_group, const char *unix_user);
    202 int smb_delete_user_group(const char *unix_group, const char *unix_user);
    203 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
    204                                  DOM_SID sid);
    205 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
    206                                  gid_t gid);
    207 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
    208                                  const char *name);
    209 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
    210                                                 GROUP_MAP *map);
    211 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
    212                                                    GROUP_MAP *map);
    213 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
    214                                                    DOM_SID sid);
    215 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
    216                                            const DOM_SID *sid, enum lsa_SidType sid_name_use,
    217                                            GROUP_MAP **pp_rmap, size_t *p_num_entries,
    218                                            bool unix_only);
    219 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
    220                                   const char *name, uint32 *rid);
    221 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
    222                                   const DOM_SID *sid);
    223 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
    224                                    const DOM_SID *sid,
    225                                    struct acct_info *info);
    226 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
    227                                    const DOM_SID *sid,
    228                                    struct acct_info *info);
    229 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
    230                                   const DOM_SID *alias, const DOM_SID *member);
    231 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
    232                                   const DOM_SID *alias, const DOM_SID *member);
    233 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
    234                                    const DOM_SID *alias, TALLOC_CTX *mem_ctx,
    235                                    DOM_SID **pp_members,
    236                                    size_t *p_num_members);
    237 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
    238                                        TALLOC_CTX *mem_ctx,
    239                                        const DOM_SID *domain_sid,
    240                                        const DOM_SID *members,
    241                                        size_t num_members,
    242                                        uint32 **pp_alias_rids,
    243                                        size_t *p_num_alias_rids);
    244 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
    245                                  DOM_SID sid);
    246 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
    247                                  gid_t gid);
    248 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
    249                                  const char *name);
    250 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
    251                                                 GROUP_MAP *map);
    252 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
    253                                                    GROUP_MAP *map);
    254 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
    255                                                    DOM_SID sid);
    256 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
    257                                            enum lsa_SidType sid_name_use,
    258                                            GROUP_MAP **rmap, size_t *num_entries,
    259                                            bool unix_only);
    260 bool pdb_get_dom_grp_info(const DOM_SID *sid, struct acct_info *info);
    261 bool pdb_set_dom_grp_info(const DOM_SID *sid, const struct acct_info *info);
    262 NTSTATUS pdb_create_builtin_alias(uint32 rid);
    263 
    264 /* The following definitions come from groupdb/mapping_ldb.c  */
    265 
    266 const struct mapping_backend *groupdb_ldb_init(void);
    267 
    268 /* The following definitions come from groupdb/mapping_tdb.c  */
    269 
    270 const struct mapping_backend *groupdb_tdb_init(void);
    271 
    272 /* The following definitions come from intl/lang_tdb.c  */
    273 
    274 bool lang_tdb_init(const char *lang);
    275 const char *lang_msg(const char *msgid);
    276 void lang_msg_free(const char *msgstr);
    277 char *lang_tdb_current(void);
    278 
    27926/* The following definitions come from lib/access.c  */
    28027
     
    28633                const char *cname,
    28734                const char *caddr);
    288 bool check_access(int sock, const char **allow_list, const char **deny_list);
    289 
    290 /* The following definitions come from lib/account_pol.c  */
    291 
    292 void account_policy_names_list(const char ***names, int *num_names);
    293 const char *decode_account_policy_name(enum pdb_policy_type type);
    294 const char *get_account_policy_attr(enum pdb_policy_type type);
    295 const char *account_policy_get_desc(enum pdb_policy_type type);
    296 enum pdb_policy_type account_policy_name_to_typenum(const char *name);
    297 bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
    298 bool init_account_policy(void);
    299 bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
    300 bool account_policy_set(enum pdb_policy_type type, uint32_t value);
    301 bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
    302 bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
    303 struct db_context *get_account_pol_db( void );
    30435
    30536/* The following definitions come from lib/adt_tree.c  */
     
    33364/* The following definitions come from lib/bitmap.c  */
    33465
    335 struct bitmap *bitmap_allocate(int n);
    336 void bitmap_free(struct bitmap *bm);
    33766struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
    33867int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
     
    34473/* The following definitions come from lib/charcnv.c  */
    34574
    346 NTSTATUS smb_register_charset(struct charset_functions *funcs);
    34775char lp_failed_convert_char(void);
    34876void lazy_initialize_conv(void);
     
    411139                        int flags);
    412140size_t align_string(const void *base_ptr, const char *p, int flags);
    413 codepoint_t next_codepoint(const char *str, size_t *size);
    414141
    415142/* The following definitions come from lib/clobber.c  */
     
    419146/* The following definitions come from lib/conn_tdb.c  */
    420147
    421 struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx,
    422                                            TDB_DATA key);
    423148struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
    424149                                          connection_struct *conn,
     
    432157                                 void *private_data),
    433158                       void *private_data);
     159int connections_forall_read(int (*fn)(const struct connections_key *key,
     160                                      const struct connections_data *data,
     161                                      void *private_data),
     162                            void *private_data);
    434163bool connections_init(bool rw);
    435 
    436 /* The following definitions come from lib/dbwrap_util.c  */
    437 
    438 int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
    439 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
    440 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
    441                          uint32_t *val);
    442 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
    443 NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
    444                                      uint32_t *oldval, uint32_t change_val);
    445 NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
    446                                            const char *keystr,
    447                                            uint32_t *oldval,
    448                                            uint32_t change_val);
    449 NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
    450                                     int32_t *oldval, int32_t change_val);
    451 NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db,
    452                                           const char *keystr,
    453                                           int32_t *oldval,
    454                                           int32_t change_val);
    455 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
    456                             int flag);
    457 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
    458 NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
    459                                   int32_t v);
    460 NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
    461                                    uint32_t v);
    462 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
    463                                      TDB_DATA data, int flags);
    464 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
    465 NTSTATUS dbwrap_trans_do(struct db_context *db,
    466                          NTSTATUS (*action)(struct db_context *, void *),
    467                          void *private_data);
    468 NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
    469 NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
    470                                      TDB_DATA data, int flags);
    471 TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
    472                                      const char *key);
    473 
    474 /* The following definitions come from lib/debug.c  */
    475 
    476 void gfree_debugsyms(void);
    477 const char *debug_classname_from_index(int ndx);
    478 int debug_add_class(const char *classname);
    479 int debug_lookup_classname(const char *classname);
    480 bool debug_parse_levels(const char *params_str);
    481 void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
    482 void debug_init(void);
    483 void debug_register_msgs(struct messaging_context *msg_ctx);
    484 void setup_logging(const char *pname, bool interactive);
    485 void setup_logging_stdout( void );
    486 void debug_set_logfile(const char *name);
    487 bool reopen_logs( void );
    488 void force_check_log_size( void );
    489 bool need_to_check_log_size( void );
    490 void check_log_size( void );
    491 void dbgflush( void );
    492 bool dbghdrclass(int level, int cls, const char *location, const char *func);
    493 bool dbghdr(int level, const char *location, const char *func);
    494 
    495 /* The following definitions come from lib/display_sec.c  */
    496 
    497 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
    498 void display_sec_access(uint32_t *info);
    499 void display_sec_ace_flags(uint8_t flags);
    500 void display_sec_ace(SEC_ACE *ace);
    501 void display_sec_acl(SEC_ACL *sec_acl);
    502 void display_acl_type(uint16 type);
    503 void display_sec_desc(SEC_DESC *sec);
    504164
    505165/* The following definitions come from lib/dmallocmsg.c  */
     
    534194bool gencache_del(const char *keystr);
    535195bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
     196bool gencache_parse(const char *keystr,
     197                    void (*parser)(time_t timeout, DATA_BLOB blob,
     198                                   void *private_data),
     199                    void *private_data);
    536200bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
    537201                            time_t *timeout, bool *was_expired);
    538202bool gencache_stabilize(void);
    539203bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
     204void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
     205                                       time_t timeout, void *private_data),
     206                            void *private_data, const char *pattern);
    540207void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
    541208                      void* data, const char* keystr_pattern);
     
    587254int gen_fnmatch(const char *pattern, const char *string);
    588255
    589 /* The following definitions come from lib/pam_errors.c  */
    590 
    591 NTSTATUS pam_to_nt_status(int pam_error);
    592 int nt_status_to_pam(NTSTATUS nt_status);
    593 NTSTATUS pam_to_nt_status(int pam_error);
    594 int nt_status_to_pam(NTSTATUS nt_status);
    595 
    596256/* The following definitions come from lib/pidfile.c  */
    597257
     
    599259void pidfile_create(const char *program_name);
    600260void pidfile_unlink(void);
    601 
    602 /* The following definitions come from lib/popt_common.c  */
    603 
    604 void popt_common_set_auth_info(struct user_auth_info *auth_info);
    605 
    606 /* The following definitions come from lib/privileges.c  */
    607 
    608 bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount);
    609 NTSTATUS privilege_enumerate_accounts(DOM_SID **sids, int *num_sids);
    610 NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx,
    611                              DOM_SID **sids, int *num_sids);
    612 bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
    613 bool grant_privilege_by_name(DOM_SID *sid, const char *name);
    614 bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
    615 bool revoke_all_privileges( DOM_SID *sid );
    616 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
    617 NTSTATUS privilege_create_account(const DOM_SID *sid );
    618 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
    619 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
    620 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
    621 void privilege_set_free(PRIVILEGE_SET *priv_set);
    622 NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count);
    623 bool is_privileged_sid( const DOM_SID *sid );
    624 bool grant_all_privileges( const DOM_SID *sid );
    625 
    626 /* The following definitions come from lib/privileges_basic.c  */
    627 
    628 bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src );
    629 bool se_priv_put_all_privileges(SE_PRIV *mask);
    630 void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv );
    631 void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv );
    632 bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 );
    633 bool se_priv_from_name( const char *name, SE_PRIV *mask );
    634 void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask );
    635 bool is_privilege_assigned(const SE_PRIV *privileges,
    636                            const SE_PRIV *check);
    637 const char* get_privilege_dispname( const char *name );
    638 bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege);
    639 bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege);
    640 int count_all_privileges( void );
    641 LUID_ATTR get_privilege_luid( SE_PRIV *mask );
    642 const char *luid_to_privilege_name(const LUID *set);
    643 bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask );
    644 bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset );
    645 
    646 /* The following definitions come from lib/readline.c  */
    647 
    648 void smb_readline_done(void);
    649 char *smb_readline(const char *prompt, void (*callback)(void),
    650                    char **(completion_fn)(const char *text, int start, int end));
    651 const char *smb_readline_get_line_buffer(void);
    652 void smb_readline_ca_char(char c);
    653 int cmd_history(void);
    654261
    655262/* The following definitions come from lib/recvfile.c  */
     
    667274/* The following definitions come from lib/secdesc.c  */
    668275
    669 uint32_t get_sec_info(const SEC_DESC *sd);
    670 SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
    671 SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
     276uint32_t get_sec_info(const struct security_descriptor *sd);
     277struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
     278struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
     279struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
    672280                        enum security_descriptor_revision revision,
    673281                        uint16 type,
    674                         const DOM_SID *owner_sid, const DOM_SID *grp_sid,
    675                         SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size);
    676 SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src);
     282                        const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
     283                        struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
     284struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
    677285NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
    678286                           struct security_descriptor *secdesc,
     
    685293NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
    686294                                 struct sec_desc_buf **psecdesc_buf);
    687 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
    688                                  SEC_ACL *dacl, size_t *sd_size);
    689 SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc);
    690 SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src);
    691 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size);
    692 NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask);
    693 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size);
    694 bool sd_has_inheritable_components(const SEC_DESC *parent_ctr, bool container);
     295struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
     296                                 struct security_acl *dacl, size_t *sd_size);
     297struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
     298struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
     299NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
     300NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
     301NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
     302bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
    695303NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
    696                                         SEC_DESC **ppsd,
     304                                        struct security_descriptor **ppsd,
    697305                                        size_t *psize,
    698                                         const SEC_DESC *parent_ctr,
    699                                         const DOM_SID *owner_sid,
    700                                         const DOM_SID *group_sid,
     306                                        const struct security_descriptor *parent_ctr,
     307                                        const struct dom_sid *owner_sid,
     308                                        const struct dom_sid *group_sid,
    701309                                        bool container);
    702310NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
    703                                         SEC_DESC_BUF **ppsdb,
    704                                         const SEC_DESC *parent_ctr,
     311                                        struct sec_desc_buf **ppsdb,
     312                                        const struct security_descriptor *parent_ctr,
    705313                                        bool container);
    706 
    707 /* The following definitions come from lib/select.c  */
    708 
    709 void sys_select_signal(char c);
    710 int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
    711 int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
    712314
    713315/* The following definitions come from lib/sendfile.c  */
     
    723325
    724326bool share_info_db_init(void);
    725 SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
    726 SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
     327struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
     328struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
    727329                              size_t *psize);
    728 bool set_share_security(const char *share_name, SEC_DESC *psd);
     330bool set_share_security(const char *share_name, struct security_descriptor *psd);
    729331bool delete_share_security(const char *servicename);
    730 bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
    731                         uint32 desired_access);
    732 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd);
    733 
    734 /* The following definitions come from lib/smbldap.c  */
    735 
    736 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
    737 int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri);
    738 int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ;
    739 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
    740 int smbldap_search(struct smbldap_state *ldap_state,
    741                    const char *base, int scope, const char *filter,
    742                    const char *attrs[], int attrsonly,
    743                    LDAPMessage **res);
    744 int smbldap_search_paged(struct smbldap_state *ldap_state,
    745                          const char *base, int scope, const char *filter,
    746                          const char **attrs, int attrsonly, int pagesize,
    747                          LDAPMessage **res, void **cookie);
    748 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
    749 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
    750 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
    751 int smbldap_extended_operation(struct smbldap_state *ldap_state,
    752                                LDAP_CONST char *reqoid, struct berval *reqdata,
    753                                LDAPControl **serverctrls, LDAPControl **clientctrls,
    754                                char **retoidp, struct berval **retdatap);
    755 int smbldap_search_suffix (struct smbldap_state *ldap_state,
    756                            const char *filter, const char **search_attr,
    757                            LDAPMessage ** result);
    758 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
    759 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
    760                       const char *location,
    761                       struct smbldap_state **smbldap_state);
    762 bool smbldap_has_control(LDAP *ld, const char *control);
    763 bool smbldap_has_extension(LDAP *ld, const char *extension);
    764 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
    765 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
    766 
    767 /* The following definitions come from lib/smbldap_util.c  */
    768 
    769 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
    770                                     LDAPMessage ** result, const char *domain_name,
    771                                     bool try_add);
     332bool share_access_check(const struct security_token *token,
     333                        const char *sharename,
     334                        uint32 desired_access,
     335                        uint32_t *pgranted);
     336bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
    772337
    773338/* The following definitions come from lib/smbrun.c  */
     
    791356void set_current_user_info(const char *smb_name, const char *unix_name,
    792357                           const char *domain);
     358void sub_set_socket_ids(const char *peeraddr, const char *peername,
     359                        const char *sockaddr);
    793360const char *get_current_username(void);
    794361void standard_sub_basic(const char *smb_name, const char *domain_name,
     
    796363char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
    797364                       const char *domain_name, const char *str);
    798 char *alloc_sub_basic(const char *smb_name, const char *domain_name,
    799                       const char *str);
    800365char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
    801366                        const char *input_string,
     
    843408int sys_acl_delete_def_file(vfs_handle_struct *handle,
    844409                            const char *path);
    845 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    846                            const char *path_p, SMB_ACL_TYPE_T type);
    847 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    848 int sys_acl_set_file(vfs_handle_struct *handle,
    849                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    850 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    851                    SMB_ACL_T acl_d);
    852 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    853                             const char *path);
    854 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    855                            const char *path_p, SMB_ACL_TYPE_T type);
    856 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    857 int sys_acl_set_file(vfs_handle_struct *handle,
    858                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    859 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    860                    SMB_ACL_T acl_d);
    861 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    862                             const char *path);
    863 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    864                            const char *path_p, SMB_ACL_TYPE_T type);
    865 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    866 int sys_acl_set_file(vfs_handle_struct *handle,
    867                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    868 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    869                    SMB_ACL_T acl_d);
    870 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    871                             const char *path);
    872 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    873                            const char *path_p, SMB_ACL_TYPE_T type);
    874 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    875 int sys_acl_set_file(vfs_handle_struct *handle,
    876                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    877 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    878                    SMB_ACL_T acl_d);
    879 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    880                             const char *path);
    881 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    882                            const char *path_p, SMB_ACL_TYPE_T type);
    883 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    884 int sys_acl_set_file(vfs_handle_struct *handle,
    885                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    886 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    887                    SMB_ACL_T acl_d);
    888 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    889                             const char *path);
    890 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    891                            const char *path_p, SMB_ACL_TYPE_T type);
    892 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    893 int sys_acl_set_file(vfs_handle_struct *handle,
    894                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    895 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    896                    SMB_ACL_T acl_d);
    897 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    898                             const char *path);
    899410int no_acl_syscall_error(int err);
    900411
     
    911422int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
    912423int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
     424
     425int sys_get_nfs_quota(const char *path, const char *bdev,
     426                      enum SMB_QUOTA_TYPE qtype,
     427                      unid_t id, SMB_DISK_QUOTA *dp);
     428int sys_set_nfs_quota(const char *path, const char *bdev,
     429                      enum SMB_QUOTA_TYPE qtype,
     430                      unid_t id, SMB_DISK_QUOTA *dp);
    913431
    914432/* The following definitions come from lib/system.c  */
     
    937455int sys_ftruncate(int fd, SMB_OFF_T offset);
    938456int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
     457int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
    939458SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
    940459int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
     
    945464void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
    946465SMB_STRUCT_DIR *sys_opendir(const char *name);
     466SMB_STRUCT_DIR *sys_fdopendir(int fd);
    947467SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
    948468void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
     
    960480int sys_getgroups(int setlen, gid_t *gidset);
    961481int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
    962 void sys_setpwent(void);
    963 struct passwd *sys_getpwent(void);
    964 void sys_endpwent(void);
    965 struct passwd *sys_getpwnam(const char *name);
    966 struct passwd *sys_getpwuid(uid_t uid);
    967 struct group *sys_getgrnam(const char *name);
    968 struct group *sys_getgrgid(gid_t gid);
    969482int sys_popen(const char *command);
    970483int sys_pclose(int fd);
     
    997510int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
    998511int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
    999 int sys_getpeereid( int s, uid_t *uid);
    1000 int sys_getnameinfo(const struct sockaddr *psa,
    1001                         socklen_t salen,
    1002                         char *host,
    1003                         size_t hostlen,
    1004                         char *service,
    1005                         size_t servlen,
    1006                         int flags);
    1007 int sys_connect(int fd, const struct sockaddr * addr);
    1008 
    1009512/* The following definitions come from lib/system_smbd.c  */
    1010513
    1011514bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
    1012515                         gid_t primary_gid,
    1013                          gid_t **ret_groups, size_t *p_ngroups);
     516                         gid_t **ret_groups, uint32_t *p_ngroups);
    1014517
    1015518/* The following definitions come from lib/tallocmsg.c  */
     
    1022525void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
    1023526void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
    1024 time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
    1025 time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
    1026 time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
    1027 uint32 convert_time_t_to_uint32(time_t t);
    1028 time_t convert_uint32_to_time_t(uint32 u);
     527uint32_t convert_time_t_to_uint32_t(time_t t);
     528time_t convert_uint32_t_to_time_t(uint32_t u);
    1029529bool nt_time_is_zero(const NTTIME *nt);
    1030530time_t generalized_to_unix_time(const char *str);
     
    1040540void put_long_date(char *p, time_t t);
    1041541void dos_filetime_timespec(struct timespec *tsp);
     542time_t make_unix_date(const void *date_ptr, int zone_offset);
    1042543time_t make_unix_date2(const void *date_ptr, int zone_offset);
    1043544time_t make_unix_date3(const void *date_ptr, int zone_offset);
     
    1045546time_t srv_make_unix_date2(const void *date_ptr);
    1046547time_t srv_make_unix_date3(const void *date_ptr);
    1047 time_t convert_timespec_to_time_t(struct timespec ts);
    1048548struct timespec convert_time_t_to_timespec(time_t t);
    1049549struct timespec convert_timeval_to_timespec(const struct timeval tv);
     
    1056556void round_timespec_to_usec(struct timespec *ts);
    1057557struct timespec interpret_long_date(const char *p);
    1058 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
    1059 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
    1060 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate);
    1061 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
    1062 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
    1063 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
    1064 bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2);
    1065558void TimeInit(void);
    1066559void get_process_uptime(struct timeval *ret_time);
     560void get_startup_time(struct timeval *ret_time);
    1067561time_t nt_time_to_unix_abs(const NTTIME *nt);
    1068562time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
    1069563void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
    1070564void unix_to_nt_time_abs(NTTIME *nt, time_t t);
    1071 bool null_mtime(time_t mtime);
    1072565const char *time_to_asc(const time_t t);
    1073566const char *display_time(NTTIME nttime);
     
    1076569/* The following definitions come from lib/username.c  */
    1077570
     571void flush_pwnam_cache(void);
    1078572char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
    1079573struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
    1080574
    1081 /* The following definitions come from lib/util.c  */
    1082 
    1083 enum protocol_types get_Protocol(void);
    1084 void set_Protocol(enum protocol_types  p);
    1085 bool all_zero(const uint8_t *ptr, size_t size);
     575/* The following definitions come from lib/util_names.c  */
     576void gfree_netbios_names(void);
    1086577bool set_global_myname(const char *myname);
    1087578const char *global_myname(void);
    1088579bool set_global_myworkgroup(const char *myworkgroup);
    1089580const char *lp_workgroup(void);
     581const char *get_global_sam_name(void);
     582
     583/* The following definitions come from lib/util.c  */
     584
     585enum protocol_types get_Protocol(void);
     586void set_Protocol(enum protocol_types  p);
     587bool all_zero(const uint8_t *ptr, size_t size);
    1090588bool set_global_scope(const char *scope);
    1091589const char *global_scope(void);
     
    1095593bool set_netbios_aliases(const char **str_array);
    1096594bool init_names(void);
    1097 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
    1098 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
    1099 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
    1100                                     const char *username);
    1101 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
    1102 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
    1103                                   const char *domain);
    1104 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
    1105                                     const char *password);
    1106 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
    1107 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
    1108                                          const char *arg);
    1109 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
    1110 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
    1111                                       bool b);
    1112 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
    1113 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
    1114                                         bool b);
    1115 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
    1116 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
    1117                                         bool b);
    1118 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
    1119 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
    1120 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
    1121 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
    1122 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
    1123 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
    1124 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
    1125 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
    1126                                                  const struct user_auth_info *info);
    1127 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
    1128 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
    1129595bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
    1130596                     bool fake_dir_create_times);
     
    1142608ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
    1143609int set_blocking(int fd, bool set);
    1144 void smb_msleep(unsigned int t);
    1145610NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
    1146                        struct event_context *ev_ctx,
    1147                        bool parent_longlived);
    1148 bool yesno(const char *p);
     611                           struct event_context *ev_ctx,
     612                           struct server_id id,
     613                           bool parent_longlived);
    1149614void *malloc_(size_t size);
    1150615void *memalign_array(size_t el_size, size_t align, unsigned int count);
     
    1180645const char *tab_depth(int level, int depth);
    1181646int str_checksum(const char *s);
    1182 unsigned int jenkins_hash(TDB_DATA *key);
    1183647void zero_free(void *p, size_t size);
    1184648int set_maxfiles(int requested_max);
     
    1208672void set_my_vnn(uint32 vnn);
    1209673uint32 get_my_vnn(void);
     674void set_my_unique_id(uint64_t unique_id);
    1210675struct server_id pid_to_procid(pid_t pid);
    1211676struct server_id procid_self(void);
    1212 struct server_id server_id_self(void);
    1213677bool procid_equal(const struct server_id *p1, const struct server_id *p2);
    1214678bool cluster_id_equal(const struct server_id *id1,
     
    1220684bool procid_valid(const struct server_id *pid);
    1221685bool procid_is_local(const struct server_id *pid);
    1222 int this_is_smp(void);
    1223686bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
    1224687bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
     
    1236699void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
    1237700void *talloc_zeronull(const void *context, size_t size, const char *name);
    1238 bool is_valid_policy_hnd(const struct policy_handle *hnd);
    1239 bool policy_hnd_equal(const struct policy_handle *hnd1,
    1240                       const struct policy_handle *hnd2);
    1241701const char *strip_hostname(const char *s);
    1242702bool tevent_req_poll_ntstatus(struct tevent_req *req,
    1243703                              struct tevent_context *ev,
    1244704                              NTSTATUS *status);
     705bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
     706int timeval_to_msec(struct timeval t);
     707char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
     708
     709/* The following definitions come from lib/util_cmdline.c  */
     710
     711struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
     712const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
     713void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
     714                                    const char *username);
     715const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
     716void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
     717                                  const char *domain);
     718void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
     719                                    const char *password);
     720const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
     721bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
     722                                         const char *arg);
     723int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
     724void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
     725                                      bool b);
     726bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
     727void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
     728                                        bool b);
     729bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
     730void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
     731                                        bool b);
     732bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
     733void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
     734void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
     735void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
     736bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
     737bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
     738bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
     739struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
     740                                                 const struct user_auth_info *info);
     741bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
     742void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
     743
     744/* The following definitions come from lib/util_builtin.c  */
     745
     746bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
     747bool lookup_builtin_name(const char *name, uint32 *rid);
     748const char *builtin_domain_name(void);
     749bool sid_check_is_builtin(const struct dom_sid *sid);
     750bool sid_check_is_in_builtin(const struct dom_sid *sid);
    1245751
    1246752/* The following definitions come from lib/util_file.c  */
     
    1256762/* The following definitions come from lib/util_nttoken.c  */
    1257763
    1258 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken);
     764struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken);
    1259765NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
    1260                         const struct nt_user_token *token_1,
    1261                         const struct nt_user_token *token_2,
    1262                         struct nt_user_token **token_out);
    1263 bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace);
    1264 
    1265 /* The following definitions come from lib/util_pw.c  */
    1266 
    1267 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
    1268 void flush_pwnam_cache(void);
    1269 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
    1270 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
    1271 
    1272 /* The following definitions come from lib/util_reg.c  */
    1273 
    1274 const char *reg_type_lookup(enum winreg_Type type);
    1275 bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
    1276 bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
    1277 bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
    1278 bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
    1279 
    1280 /* The following definitions come from lib/util_reg_api.c  */
    1281 
    1282 WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
    1283                            struct registry_value **pvalue,
    1284                            enum winreg_Type type, uint8 *data,
    1285                            uint32 size, uint32 length);
    1286 WERROR registry_push_value(TALLOC_CTX *mem_ctx,
    1287                            const struct registry_value *value,
    1288                            DATA_BLOB *presult);
    1289 
    1290 /* The following definitions come from lib/util_seaccess.c  */
    1291 
    1292 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
    1293 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
    1294 void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
    1295 NTSTATUS se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
    1296                      uint32 acc_desired, uint32 *acc_granted);
    1297 NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size);
     766                        const struct security_token *token_1,
     767                        const struct security_token *token_2,
     768                        struct security_token **token_out);
     769bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
    1298770
    1299771/* The following definitions come from lib/util_sec.c  */
     
    1318790/* The following definitions come from lib/util_sid.c  */
    1319791
    1320 const char *sid_type_lookup(uint32 sid_type) ;
    1321 NT_USER_TOKEN *get_system_token(void) ;
    1322 const char *get_global_sam_name(void) ;
    1323 char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid);
    1324 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
    1325 char *sid_string_dbg(const DOM_SID *sid);
    1326 char *sid_string_tos(const DOM_SID *sid);
    1327 bool string_to_sid(DOM_SID *sidout, const char *sidstr);
    1328 DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
    1329 bool sid_append_rid(DOM_SID *sid, uint32 rid);
    1330 bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid);
    1331 bool sid_split_rid(DOM_SID *sid, uint32 *rid);
    1332 bool sid_peek_rid(const DOM_SID *sid, uint32 *rid);
    1333 bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid);
    1334 void sid_copy(DOM_SID *dst, const DOM_SID *src);
    1335 bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid);
    1336 bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid);
    1337 int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
    1338 int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2);
    1339 bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
    1340 bool non_mappable_sid(DOM_SID *sid);
    1341 char *sid_binstring(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
    1342 char *sid_binstring_hex(const DOM_SID *sid);
    1343 DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src);
    1344 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    1345                           DOM_SID **sids, size_t *num);
    1346 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    1347                                  DOM_SID **sids, size_t *num_sids);
    1348 void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num);
    1349 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
    1350                                     uint32 rid, uint32 **pp_rids, size_t *p_num);
    1351 bool is_null_sid(const DOM_SID *sid);
    1352 bool is_sid_in_token(const NT_USER_TOKEN *token, const DOM_SID *sid);
     792char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
     793char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
     794char *sid_string_dbg(const struct dom_sid *sid);
     795char *sid_string_tos(const struct dom_sid *sid);
     796bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
     797bool non_mappable_sid(struct dom_sid *sid);
     798char *sid_binstring_hex(const struct dom_sid *sid);
     799struct netr_SamInfo3;
    1353800NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
    1354801                              const struct netr_SamInfo3 *info3,
    1355                               DOM_SID **user_sids,
    1356                               size_t *num_user_sids,
     802                              struct dom_sid **user_sids,
     803                              uint32_t *num_user_sids,
    1357804                              bool include_user_group_rid,
    1358805                              bool skip_ressource_groups);
     
    1363810bool is_loopback_ip_v4(struct in_addr ip);
    1364811bool is_loopback_addr(const struct sockaddr *pss);
    1365 bool is_zero_addr(const struct sockaddr *pss);
     812bool is_zero_addr(const struct sockaddr_storage *pss);
    1366813void zero_ip_v4(struct in_addr *ip);
    1367814void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
     
    1379826char *print_canonical_sockaddr(TALLOC_CTX *ctx,
    1380827                        const struct sockaddr_storage *pss);
    1381 void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
    1382828const char *client_name(int fd);
    1383829int get_socket_port(int fd);
     
    1406852                                          unsigned int timeout,
    1407853                                          size_t *len);
    1408 NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
    1409                          size_t *len);
    1410854NTSTATUS receive_smb_raw(int fd,
    1411855                        char *buffer,
     
    1434878                                              int timeout);
    1435879NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
    1436 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
    1437                          int timeout, int *fd_index, int *fd);
    1438880int open_udp_socket(const char *host, int port);
    1439881const char *get_peer_name(int fd, bool force_lookup);
     
    1451893                                    const struct addrinfo *hints);
    1452894int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
     895int poll_one_fd(int fd, int events, int timeout, int *revents);
     896int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
     897struct tstream_context;
    1453898struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
    1454899                                            struct tevent_context *ev,
     
    1465910
    1466911bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
    1467 bool next_token_talloc(TALLOC_CTX *ctx,
    1468                         const char **ptr,
    1469                         char **pp_buff,
    1470                         const char *sep);
    1471 bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
    1472                         const char **ptr,
    1473                         char **pp_buff,
    1474                         const char *sep);
    1475912int StrCaseCmp(const char *s, const char *t);
    1476913int StrnCaseCmp(const char *s, const char *t, size_t len);
     
    1544981void strlower_m(char *s);
    1545982void strupper_m(char *s);
    1546 size_t strlen_m_ext(const char *s, const charset_t dst_charset);
    1547 size_t strlen_m_ext_term(const char *s, const charset_t dst_charset);
    1548983size_t strlen_m(const char *s);
    1549984size_t strlen_m_term(const char *s);
    1550985size_t strlen_m_term_null(const char *s);
    1551 char *binary_string_rfc2254(TALLOC_CTX *mem_ctx, const uint8_t *buf, int len);
    1552 char *binary_string(char *buf, int len);
    1553986int fstr_sprintf(fstring s, const char *fmt, ...);
    1554987bool str_list_sub_basic( char **list, const char *smb_name,
    1555988                         const char *domain_name );
    1556989bool str_list_substitute(char **list, const char *pattern, const char *insert);
    1557 bool str_list_check(const char **list, const char *s);
    1558 bool str_list_check_ci(const char **list, const char *s);
    1559990
    1560991char *ipstr_list_make(char **ipstr_list,
     
    1563994int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
    1564995void ipstr_list_free(char* ipstr_list);
    1565 void rfc1738_unescape(char *buf);
    1566996DATA_BLOB base64_decode_data_blob(const char *s);
    1567997void base64_decode_inplace(char *s);
     
    15841014char *escape_shell_string(const char *src);
    15851015char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
     1016char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
    15861017
    15871018/* The following definitions come from lib/util_unistr.c  */
     
    15891020void gfree_case_tables(void);
    15901021void load_case_tables(void);
    1591 void init_valid_table(void);
    15921022size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
    1593 char *skip_unibuf(char *src, size_t len);
    15941023int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
    15951024int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
    1596 smb_ucs2_t toupper_w(smb_ucs2_t val);
    1597 smb_ucs2_t tolower_w( smb_ucs2_t val );
    1598 bool islower_w(smb_ucs2_t c);
    1599 bool isupper_w(smb_ucs2_t c);
    16001025bool isvalid83_w(smb_ucs2_t c);
    16011026size_t strlen_w(const smb_ucs2_t *src);
     
    16271052smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
    16281053smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
    1629 int toupper_ascii(int c);
    1630 int tolower_ascii(int c);
    1631 int isupper_ascii(int c);
    1632 int islower_ascii(int c);
    1633 
    1634 /* The following definitions come from lib/util_uuid.c  */
    1635 
    1636 void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
    1637 void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
    1638 char *guid_binstring(TALLOC_CTX *mem_ctx, const struct GUID *guid);
     1054smb_ucs2_t toupper_w(smb_ucs2_t v);
     1055bool isupper_w(smb_ucs2_t v);
     1056smb_ucs2_t tolower_w(smb_ucs2_t v);
     1057bool islower_w(smb_ucs2_t v);
    16391058
    16401059/* The following definitions come from lib/version.c  */
    16411060
    16421061const char *samba_version_string(void);
    1643 
    1644 /* The following definitions come from lib/winbind_util.c  */
    1645 
    1646 bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid,
    1647                          enum lsa_SidType *name_type);
    1648 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    1649                         const char **domain, const char **name,
    1650                         enum lsa_SidType *name_type);
    1651 bool winbind_ping(void);
    1652 bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid);
    1653 bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid);
    1654 bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid);
    1655 bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid);
    1656 struct passwd * winbind_getpwnam(const char * sname);
    1657 struct passwd * winbind_getpwsid(const DOM_SID *sid);
    1658 wbcErr wb_is_trusted_domain(const char *domain);
    1659 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
    1660                          const DOM_SID *domain_sid,
    1661                          int num_rids, uint32 *rids,
    1662                          const char **domain_name,
    1663                          const char ***names, enum lsa_SidType **types);
    1664 bool winbind_allocate_uid(uid_t *uid);
    1665 bool winbind_allocate_gid(gid_t *gid);
    1666 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
    1667                         const char *account,
    1668                         uint32_t *num_groups,
    1669                         gid_t ** _groups);
    1670 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
    1671                              const DOM_SID *dom_sid,
    1672                              const DOM_SID *members,
    1673                              size_t num_members,
    1674                              uint32_t **pp_alias_rids,
    1675                              size_t *p_num_alias_rids);
    1676 
    16771062
    16781063/* The following definitions come from lib/wins_srv.c  */
     
    16871072unsigned wins_srv_count_tag(const char *tag);
    16881073
    1689 /* The following definitions come from libads/ads_status.c  */
    1690 
    1691 ADS_STATUS ads_build_error(enum ads_error_type etype,
    1692                            int rc, int minor_status);
    1693 ADS_STATUS ads_build_nt_error(enum ads_error_type etype,
    1694                            NTSTATUS nt_status);
    1695 NTSTATUS ads_ntstatus(ADS_STATUS status);
    1696 const char *ads_errstr(ADS_STATUS status);
    1697 NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
    1698 
    1699 /* The following definitions come from libads/ads_struct.c  */
    1700 
    1701 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
    1702 char *ads_build_dn(const char *realm);
    1703 char *ads_build_domain(const char *dn);
    1704 ADS_STRUCT *ads_init(const char *realm,
    1705                      const char *workgroup,
    1706                      const char *ldap_server);
    1707 void ads_destroy(ADS_STRUCT **ads);
    1708 
    1709 const char *ads_get_ldap_server_name(ADS_STRUCT *ads);
    1710 
    1711 /* The following definitions come from libads/authdata.c  */
    1712 
    1713 struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data);
    1714 NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
    1715                              const char *name,
    1716                              const char *pass,
    1717                              time_t time_offset,
    1718                              time_t *expire_time,
    1719                              time_t *renew_till_time,
    1720                              const char *cache_name,
    1721                              bool request_pac,
    1722                              bool add_netbios_addr,
    1723                              time_t renewable_time,
    1724                              const char *impersonate_princ_s,
    1725                              struct PAC_DATA **pac_ret);
    1726 NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
    1727                                         const char *name,
    1728                                         const char *pass,
    1729                                         time_t time_offset,
    1730                                         time_t *expire_time,
    1731                                         time_t *renew_till_time,
    1732                                         const char *cache_name,
    1733                                         bool request_pac,
    1734                                         bool add_netbios_addr,
    1735                                         time_t renewable_time,
    1736                                         const char *impersonate_princ_s,
    1737                                         struct netr_SamInfo3 **info3);
    1738 
    1739 /* The following definitions come from libads/cldap.c  */
    1740 bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
    1741                         const char *server,
    1742                         const char *realm,
    1743                         uint32_t nt_version,
    1744                         struct netlogon_samlogon_response **reply);
    1745 bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
    1746                           const char *server,
    1747                           const char *realm,
    1748                           struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
    1749 
    1750 /* The following definitions come from libads/disp_sec.c  */
    1751 
    1752 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, SEC_DESC *sd);
    1753 
    1754 /* The following definitions come from libads/dns.c  */
    1755 
    1756 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
    1757                                 const char *dnsdomain,
    1758                                 struct dns_rr_ns **nslist,
    1759                                 int *numns);
    1760 bool sitename_store(const char *realm, const char *sitename);
    1761 char *sitename_fetch(const char *realm);
    1762 bool stored_sitename_changed(const char *realm, const char *sitename);
    1763 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
    1764                            const char *realm,
    1765                            const char *sitename,
    1766                            struct dns_rr_srv **dclist,
    1767                            int *numdcs );
    1768 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
    1769                            const char *realm,
    1770                            const char *sitename,
    1771                            struct dns_rr_srv **dclist,
    1772                            int *numdcs );
    1773 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
    1774                             const char *dns_forest_name,
    1775                             const char *sitename,
    1776                             struct dns_rr_srv **dclist,
    1777                             int *numdcs );
    1778 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
    1779                            const char *dns_domain_name,
    1780                            struct dns_rr_srv **dclist,
    1781                            int *numdcs );
    1782 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
    1783                                 const char *dns_forest_name,
    1784                                 const struct GUID *domain_guid,
    1785                                 struct dns_rr_srv **dclist,
    1786                                 int *numdcs );
    1787 
    1788 /* The following definitions come from libads/kerberos.c  */
    1789 
    1790 int kerberos_kinit_password_ext(const char *principal,
    1791                                 const char *password,
    1792                                 int time_offset,
    1793                                 time_t *expire_time,
    1794                                 time_t *renew_till_time,
    1795                                 const char *cache_name,
    1796                                 bool request_pac,
    1797                                 bool add_netbios_addr,
    1798                                 time_t renewable_time,
    1799                                 NTSTATUS *ntstatus);
    1800 int ads_kinit_password(ADS_STRUCT *ads);
    1801 int ads_kdestroy(const char *cc_name);
    1802 char* kerberos_standard_des_salt( void );
    1803 bool kerberos_secrets_store_des_salt( const char* salt );
    1804 char* kerberos_secrets_fetch_des_salt( void );
    1805 char *kerberos_get_default_realm_from_ccache( void );
    1806 char *kerberos_get_realm_from_hostname(const char *hostname);
    1807 
    1808 bool kerberos_secrets_store_salting_principal(const char *service,
    1809                                               int enctype,
    1810                                               const char *principal);
    1811 int kerberos_kinit_password(const char *principal,
    1812                             const char *password,
    1813                             int time_offset,
    1814                             const char *cache_name);
    1815 bool create_local_private_krb5_conf_for_domain(const char *realm,
    1816                                                 const char *domain,
    1817                                                 const char *sitename,
    1818                                                 struct sockaddr_storage *pss,
    1819                                                 const char *kdc_name);
    1820 
    1821 /* The following definitions come from libads/kerberos_keytab.c  */
    1822 
    1823 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
    1824 int ads_keytab_flush(ADS_STRUCT *ads);
    1825 int ads_keytab_create_default(ADS_STRUCT *ads);
    1826 int ads_keytab_list(const char *keytab_name);
    1827 
    1828 /* The following definitions come from libads/kerberos_verify.c  */
    1829 
    1830 NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
    1831                            const char *realm,
    1832                            time_t time_offset,
    1833                            const DATA_BLOB *ticket,
    1834                            char **principal,
    1835                            struct PAC_DATA **pac_data,
    1836                            DATA_BLOB *ap_rep,
    1837                            DATA_BLOB *session_key,
    1838                            bool use_replay_cache);
    1839 
    1840 /* The following definitions come from libads/krb5_errs.c  */
    1841 
    1842 
    1843 /* The following definitions come from libads/krb5_setpw.c  */
    1844 
    1845 ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ,
    1846                                  const char *newpw, int time_offset);
    1847 ADS_STATUS kerberos_set_password(const char *kpasswd_server,
    1848                                  const char *auth_principal, const char *auth_password,
    1849                                  const char *target_principal, const char *new_password,
    1850                                  int time_offset);
    1851 ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads,
    1852                                     const char *machine_account,
    1853                                     const char *password);
    1854 
    1855 /* The following definitions come from libads/ldap.c  */
    1856 
    1857 bool ads_sitename_match(ADS_STRUCT *ads);
    1858 bool ads_closest_dc(ADS_STRUCT *ads);
    1859 ADS_STATUS ads_connect(ADS_STRUCT *ads);
    1860 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
    1861 ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
    1862 void ads_disconnect(ADS_STRUCT *ads);
    1863 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
    1864                                 int scope, const char *expr, const char **attrs,
    1865                                 bool (*fn)(ADS_STRUCT *, char *, void **, void *),
    1866                                 void *data_area);
    1867 char *ads_parent_dn(const char *dn);
    1868 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
    1869 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
    1870                        const char *name, const char *val);
    1871 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
    1872                            const char *name, const char **vals);
    1873 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
    1874 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
    1875 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
    1876 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
    1877 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
    1878 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
    1879                                 const char *name, const char **vals);
    1880 uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
    1881 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
    1882 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
    1883 ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name,
    1884                                           const char *my_fqdn, const char *spn);
    1885 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name,
    1886                                    const char *org_unit);
    1887 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
    1888                                  const char *org_unit, bool *moved);
    1889 int ads_count_replies(ADS_STRUCT *ads, void *res);
    1890 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn);
    1891 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
    1892 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val);
    1893 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid);
    1894 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
    1895 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
    1896 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
    1897 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
    1898                                 TALLOC_CTX *mem_ctx,
    1899                                 char ***ous,
    1900                                 size_t *num_ous);
    1901 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
    1902                                         const char *extended_dn,
    1903                                         enum ads_extended_dn_flags flags,
    1904                                         DOM_SID *sid);
    1905 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
    1906 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
    1907 char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
    1908 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
    1909                         uint32 account_type, const char *org_unit);
    1910 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
    1911 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
    1912                                TALLOC_CTX *mem_ctx,
    1913                                const char *samaccountname,
    1914                                uint32 *uac_ret,
    1915                                const char **dn_ret);
    1916 ADS_STATUS ads_config_path(ADS_STRUCT *ads,
    1917                            TALLOC_CTX *mem_ctx,
    1918                            char **config_path);
    1919 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
    1920                                                 const char *config_path,
    1921                                                 TALLOC_CTX *mem_ctx,
    1922                                                 const struct GUID *rights_guid);
    1923 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
    1924                            ADS_STRUCT *ads,
    1925                            const char **account_ou);
    1926 
    1927 /* The following definitions come from libads/ldap_printer.c  */
    1928 
    1929 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
    1930                                  TALLOC_CTX *ctx, const ADS_MODLIST *mods);
    1931 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
    1932                                         TALLOC_CTX *ctx, ADS_MODLIST *mods);
    1933 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
    1934                                           TALLOC_CTX *mem_ctx,
    1935                                           ADS_MODLIST *mods,
    1936                                           const char *printer);
    1937 bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
    1938                                        ADS_MODLIST *mods,
    1939                                        NT_PRINTER_DATA *data);
    1940 
    1941 /* The following definitions come from libads/ldap_schema.c  */
    1942 
    1943 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
    1944                                      const char *schema_path,
    1945                                      const char **OIDs, size_t num_OIDs,
    1946                                      char ***OIDs_out, char ***names, size_t *count);
    1947 const char *ads_get_attrname_by_guid(ADS_STRUCT *ads,
    1948                                      const char *schema_path,
    1949                                      TALLOC_CTX *mem_ctx,
    1950                                      const struct GUID *schema_guid);
    1951 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID);
    1952 ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path);
    1953 ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
    1954                                           ADS_STRUCT *ads,
    1955                                           enum wb_posix_mapping map_type,
    1956                                           struct posix_schema **s ) ;
    1957 
    1958 /* The following definitions come from libads/ldap_user.c  */
    1959 
    1960 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
    1961                              const char *container, const char *fullname);
    1962 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
    1963                               const char *container, const char *comment);
    1964 
    1965 /* The following definitions come from libads/ldap_utils.c  */
    1966 
    1967 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
    1968                              TALLOC_CTX *mem_ctx,
    1969                              int scope,
    1970                              const char *base,
    1971                              const char *filter,
    1972                              void *args,
    1973                              const char *range_attr,
    1974                              char ***strings,
    1975                              size_t *num_strings);
    1976 ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads,
    1977                                       TALLOC_CTX *mem_ctx,
    1978                                       int scope,
    1979                                       const char *base,
    1980                                       const char *filter,
    1981                                       const char **attrs,
    1982                                       void *args,
    1983                                       const char *range_attr,
    1984                                       char ***strings,
    1985                                       size_t *num_strings,
    1986                                       uint32 *first_usn,
    1987                                       int *num_retries,
    1988                                       bool *more_values);
    1989 
    1990 /* The following definitions come from libads/ndr.c  */
    1991 
    1992 void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r);
    1993 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
    1994 
    1995 /* The following definitions come from libads/sasl.c  */
    1996 
    1997 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
    1998 
    1999 /* The following definitions come from libads/sasl_wrapping.c  */
    2000 
    2001 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
    2002                                    const struct ads_saslwrap_ops *ops,
    2003                                    void *private_data);
    2004 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
    2005                                    const struct ads_saslwrap_ops *ops,
    2006                                    void *private_data);
    2007 
    2008 /* The following definitions come from libads/util.c  */
    2009 
    2010 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
    2011 ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
    2012                                        char **returned_principal);
    2013 
    2014 /* The following definitions come from libgpo/gpo_filesync.c  */
    2015 
    2016 NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
    2017                        struct cli_state *cli,
    2018                        const char *nt_path,
    2019                        const char *unix_path);
    2020 NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
    2021                               struct cli_state *cli,
    2022                               const char *nt_path,
    2023                               const char *local_path);
    2024 
    2025 /* The following definitions come from libgpo/gpo_ini.c  */
    2026 
    2027 NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
    2028                        const char *filename,
    2029                        uint32_t *version,
    2030                        char **display_name);
    2031 
    2032 /* The following definitions come from libgpo/gpo_reg.c  */
    2033 
    2034 struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx);
    2035 WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
    2036                        const char *initial_path,
    2037                        uint32_t desired_access,
    2038                        const struct nt_user_token *token,
    2039                        struct gp_registry_context **reg_ctx);
    2040 void gp_free_reg_ctx(struct gp_registry_context *reg_ctx);
    2041 WERROR gp_store_reg_subkey(TALLOC_CTX *mem_ctx,
    2042                            const char *subkeyname,
    2043                            struct registry_key *curr_key,
    2044                            struct registry_key **new_key);
    2045 WERROR gp_read_reg_subkey(TALLOC_CTX *mem_ctx,
    2046                           struct gp_registry_context *reg_ctx,
    2047                           const char *subkeyname,
    2048                           struct registry_key **key);
    2049 WERROR gp_store_reg_val_sz(TALLOC_CTX *mem_ctx,
    2050                            struct registry_key *key,
    2051                            const char *val_name,
    2052                            const char *val);
    2053 WERROR gp_read_reg_val_sz(TALLOC_CTX *mem_ctx,
    2054                           struct registry_key *key,
    2055                           const char *val_name,
    2056                           const char **val);
    2057 WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
    2058                           uint32_t flags,
    2059                           const char *dn,
    2060                           const struct nt_user_token *token,
    2061                           struct GROUP_POLICY_OBJECT *gpo_list);
    2062 WERROR gp_reg_state_read(TALLOC_CTX *mem_ctx,
    2063                          uint32_t flags,
    2064                          const DOM_SID *sid,
    2065                          struct GROUP_POLICY_OBJECT **gpo_list);
    2066 WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
    2067                      uint32_t flags,
    2068                      struct registry_key *key,
    2069                      const DOM_SID *sid);
    2070 void dump_reg_val(int lvl, const char *direction,
    2071                   const char *key, const char *subkey,
    2072                   struct registry_value *val);
    2073 void dump_reg_entry(uint32_t flags,
    2074                     const char *dir,
    2075                     struct gp_registry_entry *entry);
    2076 void dump_reg_entries(uint32_t flags,
    2077                       const char *dir,
    2078                       struct gp_registry_entry *entries,
    2079                       size_t num_entries);
    2080 bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx,
    2081                                     struct gp_registry_entry *entry,
    2082                                     struct gp_registry_entry **entries,
    2083                                     size_t *num);
    2084 WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
    2085                                 struct registry_key *root_key,
    2086                                 struct gp_registry_context *reg_ctx,
    2087                                 struct gp_registry_entry *entry,
    2088                                 const struct nt_user_token *token,
    2089                                 uint32_t flags);
    2090 
    2091 
    2092 #include "librpc/gen_ndr/ndr_dfs.h"
    2093 #include "librpc/gen_ndr/ndr_dssetup.h"
    2094 #include "librpc/gen_ndr/ndr_echo.h"
    2095 #include "librpc/gen_ndr/ndr_eventlog.h"
    2096 #include "librpc/gen_ndr/ndr_krb5pac.h"
    2097 #include "librpc/gen_ndr/ndr_lsa.h"
    2098 #include "librpc/gen_ndr/ndr_misc.h"
    2099 #include "librpc/gen_ndr/ndr_netlogon.h"
    2100 #include "librpc/gen_ndr/ndr_notify.h"
    2101 #include "librpc/gen_ndr/ndr_ntsvcs.h"
    2102 #include "librpc/gen_ndr/ndr_samr.h"
    2103 #include "librpc/gen_ndr/ndr_security.h"
    2104 #include "librpc/gen_ndr/ndr_srvsvc.h"
    2105 #include "librpc/gen_ndr/ndr_svcctl.h"
    2106 #include "librpc/gen_ndr/ndr_winreg.h"
    2107 #include "librpc/gen_ndr/ndr_wkssvc.h"
    2108 #include "librpc/gen_ndr/ndr_drsuapi.h"
    2109 #include "librpc/gen_ndr/ndr_spoolss.h"
    2110 #include "librpc/gen_ndr/ndr_initshutdown.h"
    2111 
    2112 #include "librpc/ndr/libndr.h"
    2113 
    2114 /* The following definitions come from librpc/ndr/util.c  */
    2115 
    2116 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
    2117 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
    2118 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
    2119 enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
    2120 enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
    2121 void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
    2122 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
    2123 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
    2124 const char *ndr_errstr(enum ndr_err_code err);
    2125 extern const struct ndr_syntax_id null_ndr_syntax_id;
    2126 
    2127 /* The following definitions come from librpc/ndr/sid.c  */
    2128 
    2129 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
    2130 
    2131 /* The following definitions come from librpc/rpc/binding.c  */
    2132 
    2133 const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
    2134 _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
    2135 _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
    2136 _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
    2137                                             struct ndr_syntax_id *syntax);
    2138 const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
    2139 enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
    2140 _PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
    2141 _PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
    2142 _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
    2143                                    struct epm_tower *tower,
    2144                                    struct dcerpc_binding **b_out);
    2145 _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
    2146                                              const struct dcerpc_binding *binding,
    2147                                              struct epm_tower *tower);
    2148 
    2149 /* The following definitions come from librpc/rpc/dcerpc.c  */
    2150 
    2151 struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object,
    2152                                             const struct ndr_interface_table *table, uint32_t opnum,
    2153                                             TALLOC_CTX *mem_ctx, void *r);
    2154 NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
    2155 _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp,
    2156                                       const char *binding_string, const struct ndr_interface_table *table,
    2157                                       struct cli_credentials *credentials, struct event_context *ev,
    2158                                       struct loadparm_context *lp_ctx);
    2159 
    2160 /* The following definitions come from libsmb/cliconnect.c  */
    2161 
    2162 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
    2163                               const char *pass, const char *user_domain,
    2164                                     const char * dest_realm);
    2165 
    2166 NTSTATUS cli_session_setup(struct cli_state *cli,
    2167                            const char *user,
    2168                            const char *pass, int passlen,
    2169                            const char *ntpass, int ntpasslen,
    2170                            const char *workgroup);
    2171 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
    2172                                                   struct event_context *ev,
    2173                                                   struct cli_state *cli,
    2174                                                   struct tevent_req **psmbreq);
    2175 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
    2176                                                 struct event_context *ev,
    2177                                                 struct cli_state *cli);
    2178 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
    2179 bool cli_ulogoff(struct cli_state *cli);
    2180 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
    2181                                         struct event_context *ev,
    2182                                         struct cli_state *cli,
    2183                                         const char *share, const char *dev,
    2184                                         const char *pass, int passlen,
    2185                                         struct tevent_req **psmbreq);
    2186 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
    2187                                       struct event_context *ev,
    2188                                       struct cli_state *cli,
    2189                                       const char *share, const char *dev,
    2190                                       const char *pass, int passlen);
    2191 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
    2192 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
    2193                        const char *dev, const char *pass, int passlen);
    2194 bool cli_tdis(struct cli_state *cli);
    2195 void cli_negprot_sendsync(struct cli_state *cli);
    2196 NTSTATUS cli_negprot(struct cli_state *cli);
    2197 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
    2198                                     struct event_context *ev,
    2199                                     struct cli_state *cli);
    2200 NTSTATUS cli_negprot_recv(struct tevent_req *req);
    2201 bool cli_session_request(struct cli_state *cli,
    2202                          struct nmb_name *calling, struct nmb_name *called);
    2203 NTSTATUS cli_connect(struct cli_state *cli,
    2204                 const char *host,
    2205                 struct sockaddr_storage *dest_ss);
    2206 NTSTATUS cli_start_connection(struct cli_state **output_cli,
    2207                               const char *my_name,
    2208                               const char *dest_host,
    2209                               struct sockaddr_storage *dest_ss, int port,
    2210                               int signing_state, int flags,
    2211                               bool *retry) ;
    2212 NTSTATUS cli_full_connection(struct cli_state **output_cli,
    2213                              const char *my_name,
    2214                              const char *dest_host,
    2215                              struct sockaddr_storage *dest_ss, int port,
    2216                              const char *service, const char *service_type,
    2217                              const char *user, const char *domain,
    2218                              const char *password, int flags,
    2219                              int signing_state,
    2220                              bool *retry) ;
    2221 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
    2222                                      struct sockaddr_storage *pdest_ss);
    2223 NTSTATUS cli_raw_tcon(struct cli_state *cli,
    2224                       const char *service, const char *pass, const char *dev,
    2225                       uint16 *max_xmit, uint16 *tid);
    2226 struct cli_state *get_ipc_connect(char *server,
    2227                                 struct sockaddr_storage *server_ss,
    2228                                 const struct user_auth_info *user_info);
    2229 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
    2230                                 struct ip_service *mb_ip,
    2231                                 const struct user_auth_info *user_info,
    2232                                 char **pp_workgroup_out);
    2233 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
    2234                                         const struct user_auth_info *user_info,
    2235                                         char **pp_workgroup_out);
    2236 
    2237 /* The following definitions come from libsmb/clidfs.c  */
    2238 
    2239 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
    2240                         const char *username,
    2241                         const char *password,
    2242                         const char *domain,
    2243                         const char *sharename);
    2244 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
    2245                                 struct cli_state *referring_cli,
    2246                                 const char *server,
    2247                                 const char *share,
    2248                                 const struct user_auth_info *auth_info,
    2249                                 bool show_hdr,
    2250                                 bool force_encrypt,
    2251                                 int max_protocol,
    2252                                 int port,
    2253                                 int name_type);
    2254 void cli_cm_display(const struct cli_state *c);
    2255 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
    2256                         struct cli_state *cli,
    2257                         const char *path,
    2258                         CLIENT_DFS_REFERRAL**refs,
    2259                         size_t *num_refs,
    2260                         size_t *consumed);
    2261 bool cli_resolve_path(TALLOC_CTX *ctx,
    2262                         const char *mountpt,
    2263                         const struct user_auth_info *dfs_auth_info,
    2264                         struct cli_state *rootcli,
    2265                         const char *path,
    2266                         struct cli_state **targetcli,
    2267                         char **pp_targetpath);
    2268 
    2269 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
    2270                         struct cli_state *cli,
    2271                         const char *sharename,
    2272                         char **pp_newserver,
    2273                         char **pp_newshare,
    2274                         bool force_encrypt,
    2275                         const char *username,
    2276                         const char *password,
    2277                         const char *domain);
    2278 /* The following definitions come from libsmb/clidgram.c  */
    2279 
    2280 bool send_getdc_request(TALLOC_CTX *mem_ctx,
    2281                         struct messaging_context *msg_ctx,
    2282                         struct sockaddr_storage *dc_ss,
    2283                         const char *domain_name,
    2284                         const DOM_SID *sid,
    2285                         uint32_t nt_version);
    2286 bool receive_getdc_response(TALLOC_CTX *mem_ctx,
    2287                             struct sockaddr_storage *dc_ss,
    2288                             const char *domain_name,
    2289                             uint32_t *nt_version,
    2290                             const char **dc_name,
    2291                             struct netlogon_samlogon_response **reply);
    2292 
    2293 /* The following definitions come from libsmb/clientgen.c  */
    2294 
    2295 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
    2296 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
    2297 void cli_set_port(struct cli_state *cli, int port);
    2298 bool cli_state_seqnum_persistent(struct cli_state *cli,
    2299                                  uint16_t mid);
    2300 bool cli_state_seqnum_remove(struct cli_state *cli,
    2301                              uint16_t mid);
    2302 bool cli_receive_smb(struct cli_state *cli);
    2303 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
    2304 bool cli_receive_smb_readX_header(struct cli_state *cli);
    2305 bool cli_send_smb(struct cli_state *cli);
    2306 bool cli_send_smb_direct_writeX(struct cli_state *cli,
    2307                                 const char *p,
    2308                                 size_t extradata);
    2309 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
    2310 void cli_setup_packet(struct cli_state *cli);
    2311 void cli_setup_bcc(struct cli_state *cli, void *p);
    2312 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
    2313 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
    2314 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
    2315 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
    2316 struct cli_state *cli_initialise(void);
    2317 struct cli_state *cli_initialise_ex(int signing_state);
    2318 void cli_nt_pipes_close(struct cli_state *cli);
    2319 void cli_shutdown(struct cli_state *cli);
    2320 void cli_sockopt(struct cli_state *cli, const char *options);
    2321 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
    2322 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
    2323 bool cli_send_keepalive(struct cli_state *cli);
    2324 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    2325                                  struct cli_state *cli, uint16_t num_echos,
    2326                                  DATA_BLOB data);
    2327 NTSTATUS cli_echo_recv(struct tevent_req *req);
    2328 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
    2329 bool cli_ucs2(struct cli_state *cli);
    2330 bool is_andx_req(uint8_t cmd);
    2331 
    2332 /* The following definitions come from libsmb/clierror.c  */
    2333 
    2334 const char *cli_errstr(struct cli_state *cli);
    2335 NTSTATUS cli_nt_error(struct cli_state *cli);
    2336 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
    2337 int cli_errno(struct cli_state *cli);
    2338 bool cli_is_error(struct cli_state *cli);
    2339 bool cli_is_nt_error(struct cli_state *cli);
    2340 bool cli_is_dos_error(struct cli_state *cli);
    2341 NTSTATUS cli_get_nt_error(struct cli_state *cli);
    2342 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
    2343 void cli_reset_error(struct cli_state *cli);
    2344 bool cli_state_is_connected(struct cli_state *cli);
    2345 
    2346 /* The following definitions come from libsmb/clifile.c  */
    2347 
    2348 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
    2349                                         struct event_context *ev,
    2350                                         struct cli_state *cli,
    2351                                         const char *oldname,
    2352                                         const char *newname);
    2353 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
    2354 NTSTATUS cli_posix_symlink(struct cli_state *cli,
    2355                         const char *oldname,
    2356                         const char *newname);
    2357 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
    2358                                         struct event_context *ev,
    2359                                         struct cli_state *cli,
    2360                                         const char *fname,
    2361                                         size_t len);
    2362 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
    2363                                 char *retpath, size_t len);
    2364 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
    2365                         char *linkpath, size_t len);
    2366 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
    2367                                         struct event_context *ev,
    2368                                         struct cli_state *cli,
    2369                                         const char *oldname,
    2370                                         const char *newname);
    2371 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
    2372 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
    2373                         const char *oldname,
    2374                         const char *newname);
    2375 uint32_t unix_perms_to_wire(mode_t perms);
    2376 mode_t wire_perms_to_unix(uint32_t perms);
    2377 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
    2378                                         struct event_context *ev,
    2379                                         struct cli_state *cli,
    2380                                         const char *fname);
    2381 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
    2382                                 TALLOC_CTX *mem_ctx,
    2383                                 size_t *prb_size,
    2384                                 char **retbuf);
    2385 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
    2386                         const char *fname,
    2387                         TALLOC_CTX *mem_ctx,
    2388                         size_t *prb_size,
    2389                         char **retbuf);
    2390 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
    2391                                         struct event_context *ev,
    2392                                         struct cli_state *cli,
    2393                                         const char *fname);
    2394 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
    2395                                 SMB_STRUCT_STAT *sbuf);
    2396 NTSTATUS cli_posix_stat(struct cli_state *cli,
    2397                         const char *fname,
    2398                         SMB_STRUCT_STAT *sbuf);
    2399 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
    2400                                         struct event_context *ev,
    2401                                         struct cli_state *cli,
    2402                                         const char *fname,
    2403                                         mode_t mode);
    2404 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
    2405 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
    2406 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
    2407                                         struct event_context *ev,
    2408                                         struct cli_state *cli,
    2409                                         const char *fname,
    2410                                         uid_t uid,
    2411                                         gid_t gid);
    2412 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
    2413 NTSTATUS cli_posix_chown(struct cli_state *cli,
    2414                         const char *fname,
    2415                         uid_t uid,
    2416                         gid_t gid);
    2417 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
    2418                                 struct event_context *ev,
    2419                                 struct cli_state *cli,
    2420                                 const char *fname_src,
    2421                                 const char *fname_dst);
    2422 NTSTATUS cli_rename_recv(struct tevent_req *req);
    2423 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
    2424 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
    2425                                 struct event_context *ev,
    2426                                 struct cli_state *cli,
    2427                                 const char *fname_src,
    2428                                 const char *fname_dst);
    2429 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
    2430 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
    2431 
    2432 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
    2433                                 struct event_context *ev,
    2434                                 struct cli_state *cli,
    2435                                 const char *fname_src,
    2436                                 const char *fname_dst);
    2437 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
    2438 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
    2439 
    2440 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
    2441                                 struct event_context *ev,
    2442                                 struct cli_state *cli,
    2443                                 const char *fname,
    2444                                 uint16_t mayhave_attrs);
    2445 NTSTATUS cli_unlink_recv(struct tevent_req *req);
    2446 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
    2447 
    2448 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
    2449                                   struct event_context *ev,
    2450                                   struct cli_state *cli,
    2451                                   const char *dname);
    2452 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
    2453 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
    2454 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
    2455                                   struct event_context *ev,
    2456                                   struct cli_state *cli,
    2457                                   const char *dname);
    2458 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
    2459 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
    2460 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
    2461                                         struct event_context *ev,
    2462                                         struct cli_state *cli,
    2463                                         uint16_t fnum,
    2464                                         bool flag);
    2465 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
    2466 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
    2467 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
    2468                                      struct event_context *ev,
    2469                                      struct cli_state *cli,
    2470                                      const char *fname,
    2471                                      uint32_t CreatFlags,
    2472                                      uint32_t DesiredAccess,
    2473                                      uint32_t FileAttributes,
    2474                                      uint32_t ShareAccess,
    2475                                      uint32_t CreateDisposition,
    2476                                      uint32_t CreateOptions,
    2477                                      uint8_t SecurityFlags);
    2478 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
    2479 NTSTATUS cli_ntcreate(struct cli_state *cli,
    2480                       const char *fname,
    2481                       uint32_t CreatFlags,
    2482                       uint32_t DesiredAccess,
    2483                       uint32_t FileAttributes,
    2484                       uint32_t ShareAccess,
    2485                       uint32_t CreateDisposition,
    2486                       uint32_t CreateOptions,
    2487                       uint8_t SecurityFlags,
    2488                       uint16_t *pfid);
    2489 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
    2490                             size_t str_len, size_t *pconverted_size);
    2491 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
    2492                                    struct event_context *ev,
    2493                                    struct cli_state *cli, const char *fname,
    2494                                    int flags, int share_mode,
    2495                                    struct tevent_req **psmbreq);
    2496 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    2497                                  struct cli_state *cli, const char *fname,
    2498                                  int flags, int share_mode);
    2499 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
    2500 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
    2501 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
    2502                                     struct event_context *ev,
    2503                                     struct cli_state *cli, uint16_t fnum,
    2504                                     struct tevent_req **psubreq);
    2505 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
    2506                                   struct event_context *ev,
    2507                                   struct cli_state *cli, uint16_t fnum);
    2508 NTSTATUS cli_close_recv(struct tevent_req *req);
    2509 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
    2510 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
    2511                                         struct event_context *ev,
    2512                                         struct cli_state *cli,
    2513                                         uint16_t fnum,
    2514                                         uint64_t size);
    2515 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
    2516 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
    2517 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
    2518                       uint32_t offset, uint32_t len,
    2519                       int timeout, unsigned char locktype);
    2520 bool cli_lock(struct cli_state *cli, uint16_t fnum,
    2521               uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
    2522 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
    2523                                 struct event_context *ev,
    2524                                 struct cli_state *cli,
    2525                                 uint16_t fnum,
    2526                                 uint64_t offset,
    2527                                 uint64_t len);
    2528 NTSTATUS cli_unlock_recv(struct tevent_req *req);
    2529 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
    2530 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
    2531                 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
    2532 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
    2533                                 struct event_context *ev,
    2534                                 struct cli_state *cli,
    2535                                 uint16_t fnum,
    2536                                 uint64_t offset,
    2537                                 uint64_t len);
    2538 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
    2539 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
    2540 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
    2541                                         struct event_context *ev,
    2542                                         struct cli_state *cli,
    2543                                         uint16_t fnum,
    2544                                         uint64_t offset,
    2545                                         uint64_t len,
    2546                                         bool wait_lock,
    2547                                         enum brl_type lock_type);
    2548 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
    2549 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
    2550                         uint64_t offset, uint64_t len,
    2551                         bool wait_lock, enum brl_type lock_type);
    2552 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
    2553                                         struct event_context *ev,
    2554                                         struct cli_state *cli,
    2555                                         uint16_t fnum,
    2556                                         uint64_t offset,
    2557                                         uint64_t len);
    2558 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
    2559 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
    2560 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
    2561                                 struct event_context *ev,
    2562                                 struct cli_state *cli,
    2563                                 uint16_t fnum);
    2564 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
    2565                         uint16_t *attr,
    2566                         SMB_OFF_T *size,
    2567                         time_t *change_time,
    2568                         time_t *access_time,
    2569                         time_t *write_time);
    2570 NTSTATUS cli_getattrE(struct cli_state *cli,
    2571                         uint16_t fnum,
    2572                         uint16_t *attr,
    2573                         SMB_OFF_T *size,
    2574                         time_t *change_time,
    2575                         time_t *access_time,
    2576                         time_t *write_time);
    2577 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
    2578                                 struct event_context *ev,
    2579                                 struct cli_state *cli,
    2580                                 uint16_t fnum,
    2581                                 time_t change_time,
    2582                                 time_t access_time,
    2583                                 time_t write_time);
    2584 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
    2585 NTSTATUS cli_setattrE(struct cli_state *cli,
    2586                         uint16_t fnum,
    2587                         time_t change_time,
    2588                         time_t access_time,
    2589                         time_t write_time);
    2590 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
    2591                                 struct event_context *ev,
    2592                                 struct cli_state *cli,
    2593                                 const char *fname);
    2594 NTSTATUS cli_getatr_recv(struct tevent_req *req,
    2595                                 uint16_t *attr,
    2596                                 SMB_OFF_T *size,
    2597                                 time_t *write_time);
    2598 NTSTATUS cli_getatr(struct cli_state *cli,
    2599                         const char *fname,
    2600                         uint16_t *attr,
    2601                         SMB_OFF_T *size,
    2602                         time_t *write_time);
    2603 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
    2604                                 struct event_context *ev,
    2605                                 struct cli_state *cli,
    2606                                 const char *fname,
    2607                                 uint16_t attr,
    2608                                 time_t mtime);
    2609 NTSTATUS cli_setatr_recv(struct tevent_req *req);
    2610 NTSTATUS cli_setatr(struct cli_state *cli,
    2611                 const char *fname,
    2612                 uint16_t attr,
    2613                 time_t mtime);
    2614 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
    2615                                   struct event_context *ev,
    2616                                   struct cli_state *cli,
    2617                                   const char *fname);
    2618 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
    2619 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
    2620 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
    2621                                   struct event_context *ev,
    2622                                   struct cli_state *cli);
    2623 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
    2624                           int *avail);
    2625 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
    2626 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
    2627                                 struct event_context *ev,
    2628                                 struct cli_state *cli,
    2629                                 const char *path);
    2630 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
    2631                         TALLOC_CTX *ctx,
    2632                         uint16_t *pfnum,
    2633                         char **outfile);
    2634 NTSTATUS cli_ctemp(struct cli_state *cli,
    2635                         TALLOC_CTX *ctx,
    2636                         const char *path,
    2637                         uint16_t *pfnum,
    2638                         char **out_path);
    2639 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
    2640 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
    2641 bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
    2642 bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
    2643                 TALLOC_CTX *ctx,
    2644                 size_t *pnum_eas,
    2645                 struct ea_struct **pea_list);
    2646 bool cli_get_ea_list_fnum(struct cli_state *cli, uint16_t fnum,
    2647                 TALLOC_CTX *ctx,
    2648                 size_t *pnum_eas,
    2649                 struct ea_struct **pea_list);
    2650 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
    2651                                         struct event_context *ev,
    2652                                         struct cli_state *cli,
    2653                                         const char *fname,
    2654                                         int flags,
    2655                                         mode_t mode);
    2656 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
    2657 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
    2658                         int flags, mode_t mode, uint16_t *fnum);
    2659 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
    2660                                         struct event_context *ev,
    2661                                         struct cli_state *cli,
    2662                                         const char *fname,
    2663                                         mode_t mode);
    2664 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
    2665 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
    2666 
    2667 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
    2668                                         struct event_context *ev,
    2669                                         struct cli_state *cli,
    2670                                         const char *fname);
    2671 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
    2672 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
    2673 
    2674 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
    2675                                         struct event_context *ev,
    2676                                         struct cli_state *cli,
    2677                                         const char *fname);
    2678 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
    2679 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
    2680 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
    2681                                    struct tevent_context *ev,
    2682                                    struct cli_state *cli, uint16_t fnum,
    2683                                    uint32_t buffer_size,
    2684                                    uint32_t completion_filter, bool recursive);
    2685 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    2686                          uint32_t *pnum_changes,
    2687                          struct notify_change **pchanges);
    2688 
    2689 /* The following definitions come from libsmb/clifsinfo.c  */
    2690 
    2691 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
    2692                                                     struct tevent_context *ev,
    2693                                                     struct cli_state *cli);
    2694 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
    2695                                           uint16_t *pmajor, uint16_t *pminor,
    2696                                           uint32_t *pcaplow,
    2697                                           uint32_t *pcaphigh);
    2698 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
    2699                                      uint16 *pminor, uint32 *pcaplow,
    2700                                      uint32 *pcaphigh);
    2701 bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, uint16 minor,
    2702                                         uint32 caplow, uint32 caphigh);
    2703 bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr);
    2704 bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
    2705 bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
    2706 bool cli_get_fs_full_size_info(struct cli_state *cli,
    2707                                uint64_t *total_allocation_units,
    2708                                uint64_t *caller_allocation_units,
    2709                                uint64_t *actual_allocation_units,
    2710                                uint64_t *sectors_per_allocation_unit,
    2711                                uint64_t *bytes_per_sector);
    2712 bool cli_get_posix_fs_info(struct cli_state *cli,
    2713                            uint32 *optimal_transfer_size,
    2714                            uint32 *block_size,
    2715                            uint64_t *total_blocks,
    2716                            uint64_t *blocks_available,
    2717                            uint64_t *user_blocks_available,
    2718                            uint64_t *total_file_nodes,
    2719                            uint64_t *free_file_nodes,
    2720                            uint64_t *fs_identifier);
    2721 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
    2722                                 const char *user,
    2723                                 const char *pass,
    2724                                 const char *domain);
    2725 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
    2726 NTSTATUS cli_force_encryption(struct cli_state *c,
    2727                         const char *username,
    2728                         const char *password,
    2729                         const char *domain);
    2730 
    2731 /* The following definitions come from libsmb/clikrb5.c  */
    2732 
    2733 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
    2734                            DATA_BLOB *edata,
    2735                            DATA_BLOB *edata_out);
    2736 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
    2737 
    2738 /* The following definitions come from libsmb/clilist.c  */
    2739 
    2740 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
    2741                  void (*fn)(const char *, file_info *, const char *, void *), void *state);
    2742 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
    2743                  void (*fn)(const char *, file_info *, const char *, void *), void *state);
    2744 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
    2745              void (*fn)(const char *, file_info *, const char *, void *), void *state);
    2746 
    2747 /* The following definitions come from libsmb/climessage.c  */
    2748 
    2749 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
    2750                                     struct tevent_context *ev,
    2751                                     struct cli_state *cli,
    2752                                     const char *host, const char *username,
    2753                                     const char *message);
    2754 NTSTATUS cli_message_recv(struct tevent_req *req);
    2755 NTSTATUS cli_message(struct cli_state *cli, const char *host,
    2756                      const char *username, const char *message);
    2757 
    2758 /* The following definitions come from libsmb/clioplock.c  */
    2759 
    2760 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
    2761                                        struct tevent_context *ev,
    2762                                        struct cli_state *cli,
    2763                                        uint16_t fnum, uint8_t level);
    2764 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
    2765 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
    2766 void cli_oplock_handler(struct cli_state *cli,
    2767                         NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
    2768 
    2769 /* The following definitions come from libsmb/cliprint.c  */
    2770 
    2771 int cli_print_queue(struct cli_state *cli,
    2772                     void (*fn)(struct print_job_info *));
    2773 int cli_printjob_del(struct cli_state *cli, int job);
    2774 int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
    2775 bool cli_spl_close(struct cli_state *cli, uint16_t fnum);
    2776 
    2777 /* The following definitions come from libsmb/cliquota.c  */
    2778 
    2779 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
    2780 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
    2781 bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2782 bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2783 bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
    2784 bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2785 bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2786 void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
    2787 void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
    2788 
    2789 /* The following definitions come from libsmb/clirap.c  */
    2790 
    2791 bool cli_api(struct cli_state *cli,
    2792              char *param, int prcnt, int mprcnt,
    2793              char *data, int drcnt, int mdrcnt,
    2794              char **rparam, unsigned int *rprcnt,
    2795              char **rdata, unsigned int *rdrcnt);
    2796 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
    2797 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
    2798 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
    2799                        void (*fn)(const char *, uint32, const char *, void *),
    2800                        void *state);
    2801 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
    2802                              const char *old_password);
    2803 bool cli_qpathinfo(struct cli_state *cli,
    2804                         const char *fname,
    2805                         time_t *change_time,
    2806                         time_t *access_time,
    2807                         time_t *write_time,
    2808                         SMB_OFF_T *size,
    2809                         uint16 *mode);
    2810 bool cli_setpathinfo(struct cli_state *cli, const char *fname,
    2811                      time_t create_time,
    2812                      time_t access_time,
    2813                      time_t write_time,
    2814                      time_t change_time,
    2815                      uint16 mode);
    2816 bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
    2817                     struct timespec *create_time,
    2818                     struct timespec *access_time,
    2819                     struct timespec *write_time,
    2820                     struct timespec *change_time,
    2821                     SMB_OFF_T *size, uint16 *mode,
    2822                     SMB_INO_T *ino);
    2823 bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
    2824                            TALLOC_CTX *mem_ctx,
    2825                            unsigned int *pnum_streams,
    2826                            struct stream_struct **pstreams);
    2827 bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen);
    2828 bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum,
    2829                    uint16 *mode, SMB_OFF_T *size,
    2830                    struct timespec *create_time,
    2831                    struct timespec *access_time,
    2832                    struct timespec *write_time,
    2833                    struct timespec *change_time,
    2834                    SMB_INO_T *ino);
    2835 bool cli_qpathinfo_basic( struct cli_state *cli, const char *name,
    2836                           SMB_STRUCT_STAT *sbuf, uint32 *attributes );
    2837 bool cli_qfileinfo_test(struct cli_state *cli, uint16_t fnum, int level, char **poutdata, uint32 *poutlen);
    2838 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
    2839 
    2840 /* The following definitions come from libsmb/clirap2.c  */
    2841 
    2842 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
    2843 int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo);
    2844 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
    2845 int cli_RNetGroupEnum0(struct cli_state *cli,
    2846                        void (*fn)(const char *, void *),
    2847                        void *state);
    2848 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
    2849 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
    2850 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
    2851 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
    2852 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
    2853 int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo );
    2854 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
    2855 int cli_RNetUserEnum0(struct cli_state *cli,
    2856                       void (*fn)(const char *, void *),
    2857                       void *state);
    2858 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
    2859 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
    2860 int cli_NetFileEnum(struct cli_state *cli, const char * user,
    2861                     const char * base_path,
    2862                     void (*fn)(const char *, const char *, uint16, uint16,
    2863                                uint32));
    2864 int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo );
    2865 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
    2866 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
    2867 bool cli_get_server_domain(struct cli_state *cli);
    2868 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
    2869 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
    2870                          char **servername);
    2871 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
    2872 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
    2873 int cli_NetPrintQEnum(struct cli_state *cli,
    2874                 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
    2875                 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
    2876 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
    2877         void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
    2878         void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
    2879 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
    2880 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, char *));
    2881 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
    2882                 void (*fn)(const char *, const char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, const char *));
    2883 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
    2884 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
    2885                         void (*fn)(uint16_t conid, uint16_t contype,
    2886                                 uint16_t numopens, uint16_t numusers,
    2887                                 uint32_t contime, const char *username,
    2888                                 const char *netname));
    2889 
    2890 /* The following definitions come from libsmb/clireadwrite.c  */
    2891 
    2892 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
    2893                                         struct event_context *ev,
    2894                                         struct cli_state *cli, uint16_t fnum,
    2895                                         off_t offset, size_t size,
    2896                                         struct tevent_req **psmbreq);
    2897 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
    2898                                       struct event_context *ev,
    2899                                       struct cli_state *cli, uint16_t fnum,
    2900                                       off_t offset, size_t size);
    2901 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
    2902                             uint8_t **rcvbuf);
    2903 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
    2904                                  struct event_context *ev,
    2905                                  struct cli_state *cli,
    2906                                  uint16_t fnum, off_t start_offset,
    2907                                  SMB_OFF_T size, size_t window_size,
    2908                                  NTSTATUS (*sink)(char *buf, size_t n,
    2909                                                   void *priv),
    2910                                  void *priv);
    2911 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
    2912 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
    2913                   off_t start_offset, SMB_OFF_T size, size_t window_size,
    2914                   NTSTATUS (*sink)(char *buf, size_t n, void *priv),
    2915                   void *priv, SMB_OFF_T *received);
    2916 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
    2917                  off_t offset, size_t size);
    2918 ssize_t cli_readraw(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size);
    2919 ssize_t cli_write(struct cli_state *cli,
    2920                  uint16_t fnum, uint16 write_mode,
    2921                  const char *buf, off_t offset, size_t size);
    2922 ssize_t cli_smbwrite(struct cli_state *cli,
    2923                      uint16_t fnum, char *buf, off_t offset, size_t size1);
    2924 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
    2925                                          struct event_context *ev,
    2926                                          struct cli_state *cli, uint16_t fnum,
    2927                                          uint16_t mode, const uint8_t *buf,
    2928                                          off_t offset, size_t size,
    2929                                          struct tevent_req **reqs_before,
    2930                                          int num_reqs_before,
    2931                                          struct tevent_req **psmbreq);
    2932 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
    2933                                        struct event_context *ev,
    2934                                        struct cli_state *cli, uint16_t fnum,
    2935                                        uint16_t mode, const uint8_t *buf,
    2936                                        off_t offset, size_t size);
    2937 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
    2938 
    2939 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    2940                                  struct cli_state *cli,
    2941                                  uint16_t fnum, uint16_t mode,
    2942                                  off_t start_offset, size_t window_size,
    2943                                  size_t (*source)(uint8_t *buf, size_t n,
    2944                                                   void *priv),
    2945                                  void *priv);
    2946 NTSTATUS cli_push_recv(struct tevent_req *req);
    2947 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
    2948                   off_t start_offset, size_t window_size,
    2949                   size_t (*source)(uint8_t *buf, size_t n, void *priv),
    2950                   void *priv);
    2951 
    2952 /* The following definitions come from libsmb/clisecdesc.c  */
    2953 
    2954 SEC_DESC *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
    2955                             TALLOC_CTX *mem_ctx);
    2956 bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, SEC_DESC *sd);
    2957 
    29581074/* The following definitions come from libsmb/clispnego.c  */
    29591075
    2960 DATA_BLOB spnego_gen_negTokenInit(char guid[16],
    2961                                   const char *OIDs[],
     1076DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
     1077                                  const char *OIDs[],
     1078                                  DATA_BLOB *psecblob,
    29621079                                  const char *principal);
    2963 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
    2964 bool spnego_parse_negTokenInit(DATA_BLOB blob,
     1080
     1081#ifndef ASN1_MAX_OIDS
     1082#define ASN1_MAX_OIDS 20
     1083#endif
     1084bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
     1085                               DATA_BLOB blob,
    29651086                               char *OIDs[ASN1_MAX_OIDS],
    2966                                char **principal);
    2967 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
    2968 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
    2969 DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
    2970 bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
    2971 int spnego_gen_negTokenTarg(const char *principal, int time_offset,
    2972                             DATA_BLOB *targ, 
     1087                               char **principal,
     1088                               DATA_BLOB *secblob);
     1089DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
     1090bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
     1091int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
     1092                            const char *principal, int time_offset,
     1093                            DATA_BLOB *targ,
    29731094                            DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
    29741095                            time_t *expire_time);
    2975 bool spnego_parse_challenge(const DATA_BLOB blob,
     1096bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
    29761097                            DATA_BLOB *chal1, DATA_BLOB *chal2);
    2977 DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
    2978 bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
    2979 DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
     1098DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
     1099bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
     1100DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
    29801101                                   const char *mechOID);
    2981 bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
     1102bool spnego_parse_auth_response(TALLOC_CTX *ctx,
     1103                                DATA_BLOB blob, NTSTATUS nt_status,
    29821104                                const char *mechOID,
    29831105                                DATA_BLOB *auth);
    29841106
    2985 /* The following definitions come from libsmb/clistr.c  */
    2986 
    2987 size_t clistr_push_fn(const char *function,
    2988                         unsigned int line,
    2989                         struct cli_state *cli,
    2990                         void *dest,
    2991                         const char *src,
    2992                         int dest_len,
    2993                         int flags);
    2994 size_t clistr_pull_fn(const char *function,
    2995                         unsigned int line,
    2996                         const char *inbuf,
    2997                         char *dest,
    2998                         const void *src,
    2999                         int dest_len,
    3000                         int src_len,
    3001                         int flags);
    3002 size_t clistr_pull_talloc_fn(const char *function,
    3003                                 unsigned int line,
    3004                                 TALLOC_CTX *ctx,
    3005                                 const char *inbuf,
    3006                                 char **pp_dest,
    3007                                 const void *src,
    3008                                 int src_len,
    3009                                 int flags);
    3010 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
    3011 size_t clistr_align_in(struct cli_state *cli, const void *p, int flags);
    3012 
    3013 /* The following definitions come from libsmb/clitrans.c  */
    3014 
    3015 bool cli_send_trans(struct cli_state *cli, int trans,
    3016                     const char *pipe_name,
    3017                     int fid, int flags,
    3018                     uint16 *setup, unsigned int lsetup, unsigned int msetup,
    3019                     const char *param, unsigned int lparam, unsigned int mparam,
    3020                     const char *data, unsigned int ldata, unsigned int mdata);
    3021 bool cli_receive_trans(struct cli_state *cli,int trans,
    3022                               char **param, unsigned int *param_len,
    3023                               char **data, unsigned int *data_len);
    3024 bool cli_send_nt_trans(struct cli_state *cli,
    3025                        int function,
    3026                        int flags,
    3027                        uint16 *setup, unsigned int lsetup, unsigned int msetup,
    3028                        char *param, unsigned int lparam, unsigned int mparam,
    3029                        char *data, unsigned int ldata, unsigned int mdata);
    3030 bool cli_receive_nt_trans(struct cli_state *cli,
    3031                           char **param, unsigned int *param_len,
    3032                           char **data, unsigned int *data_len);
    3033 struct tevent_req *cli_trans_send(
    3034         TALLOC_CTX *mem_ctx, struct event_context *ev,
    3035         struct cli_state *cli, uint8_t cmd,
    3036         const char *pipe_name, uint16_t fid, uint16_t function, int flags,
    3037         uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
    3038         uint8_t *param, uint32_t num_param, uint32_t max_param,
    3039         uint8_t *data, uint32_t num_data, uint32_t max_data);
    3040 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    3041                         uint16_t **setup, uint8_t *num_setup,
    3042                         uint8_t **param, uint32_t *num_param,
    3043                         uint8_t **data, uint32_t *num_data);
    3044 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
    3045                    uint8_t trans_cmd,
    3046                    const char *pipe_name, uint16_t fid, uint16_t function,
    3047                    int flags,
    3048                    uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
    3049                    uint8_t *param, uint32_t num_param, uint32_t max_param,
    3050                    uint8_t *data, uint32_t num_data, uint32_t max_data,
    3051                    uint16_t **rsetup, uint8_t *num_rsetup,
    3052                    uint8_t **rparam, uint32_t *num_rparam,
    3053                    uint8_t **rdata, uint32_t *num_rdata);
     1107bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
     1108                                DATA_BLOB *auth, DATA_BLOB *signature);
     1109DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
     1110                                           NTSTATUS nt_status,
     1111                                           const char *mechOID,
     1112                                           DATA_BLOB *reply,
     1113                                           DATA_BLOB *mechlistMIC);
     1114bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
     1115                           char **oid_list, DATA_BLOB *data);
    30541116
    30551117/* The following definitions come from libsmb/conncache.c  */
    30561118
    3057 NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
    30581119NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
    30591120void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
    30601121void flush_negative_conn_cache_for_domain(const char *domain);
    30611122
    3062 /* The following definitions come from ../librpc/rpc/dcerpc_error.c  */
    3063 
    3064 const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
    3065 
    30661123/* The following definitions come from libsmb/dsgetdcname.c  */
     1124
     1125struct netr_DsRGetDCNameInfo;
    30671126
    30681127void debug_dsdcinfo_flags(int lvl, uint32_t flags);
     
    30811140NTSTATUS werror_to_ntstatus(WERROR error);
    30821141WERROR ntstatus_to_werror(NTSTATUS error);
    3083 NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err);
    30841142NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
    30851143
    30861144/* The following definitions come from libsmb/namecache.c  */
    30871145
    3088 bool namecache_enable(void);
    30891146bool namecache_store(const char *name,
    30901147                        int name_type,
     
    31121169bool saf_delete( const char *domain );
    31131170char *saf_fetch( const char *domain );
    3114 NODE_STATUS_STRUCT *node_status_query(int fd,
    3115                                         struct nmb_name *name,
    3116                                         const struct sockaddr_storage *to_ss,
    3117                                         int *num_names,
    3118                                         struct node_status_extra *extra);
     1171struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
     1172                                          struct tevent_context *ev,
     1173                                          struct nmb_name *name,
     1174                                          const struct sockaddr_storage *addr);
     1175NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     1176                                struct node_status **pnode_status,
     1177                                int *pnum_names,
     1178                                struct node_status_extra *extra);
     1179NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
     1180                           const struct sockaddr_storage *addr,
     1181                           struct node_status **pnode_status,
     1182                           int *pnum_names,
     1183                           struct node_status_extra *extra);
    31191184bool name_status_find(const char *q_name,
    31201185                        int q_type,
     
    31231188                        fstring name);
    31241189int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
    3125 struct sockaddr_storage *name_query(int fd,
    3126                         const char *name,
    3127                         int name_type,
    3128                         bool bcast,
    3129                         bool recurse,
    3130                         const struct sockaddr_storage *to_ss,
    3131                         int *count,
    3132                         int *flags,
    3133                         bool *timed_out);
     1190struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
     1191                                   struct tevent_context *ev,
     1192                                   const char *name, int name_type,
     1193                                   bool bcast, bool recurse,
     1194                                   const struct sockaddr_storage *addr);
     1195NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     1196                         struct sockaddr_storage **addrs, int *num_addrs,
     1197                         uint8_t *flags);
     1198NTSTATUS name_query(const char *name, int name_type,
     1199                    bool bcast, bool recurse,
     1200                    const struct sockaddr_storage *to_ss,
     1201                    TALLOC_CTX *mem_ctx,
     1202                    struct sockaddr_storage **addrs,
     1203                    int *num_addrs, uint8_t *flags);
    31341204NTSTATUS name_resolve_bcast(const char *name,
    31351205                        int name_type,
    3136                         struct ip_service **return_iplist,
     1206                        TALLOC_CTX *mem_ctx,
     1207                        struct sockaddr_storage **return_iplist,
    31371208                        int *return_count);
    31381209NTSTATUS resolve_wins(const char *name,
     
    31741245                struct sockaddr_storage *ss_out);
    31751246
    3176 /* The following definitions come from libsmb/nmblib.c  */
    3177 
    3178 void debug_nmb_packet(struct packet_struct *p);
    3179 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
    3180 char *nmb_namestr(const struct nmb_name *n);
    3181 struct packet_struct *copy_packet(struct packet_struct *packet);
    3182 void free_packet(struct packet_struct *packet);
    3183 struct packet_struct *parse_packet(char *buf,int length,
    3184                                    enum packet_type packet_type,
    3185                                    struct in_addr ip,
    3186                                    int port);
    3187 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
    3188 void make_nmb_name( struct nmb_name *n, const char *name, int type);
    3189 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
    3190 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
    3191 bool send_packet(struct packet_struct *p);
    3192 struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
    3193 struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
    3194 struct packet_struct *receive_dgram_packet(int fd, int t,
    3195                 const char *mailslot_name);
    3196 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
    3197 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
    3198 void sort_query_replies(char *data, int n, struct in_addr ip);
    3199 char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
    3200 int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
    3201 int name_len(unsigned char *s1, size_t buf_len);
    3202 
    32031247/* The following definitions come from libsmb/nterr.c  */
    32041248
     
    32101254
    32111255/* The following definitions come from libsmb/ntlmssp.c  */
    3212 
    3213 void debug_ntlmssp_flags(uint32 neg_flags);
    3214 NTSTATUS ntlmssp_set_username(NTLMSSP_STATE *ntlmssp_state, const char *user) ;
    3215 NTSTATUS ntlmssp_set_hashes(NTLMSSP_STATE *ntlmssp_state,
    3216                 const unsigned char lm_hash[16],
    3217                 const unsigned char nt_hash[16]) ;
    3218 NTSTATUS ntlmssp_set_password(NTLMSSP_STATE *ntlmssp_state, const char *password) ;
    3219 NTSTATUS ntlmssp_set_domain(NTLMSSP_STATE *ntlmssp_state, const char *domain) ;
    3220 NTSTATUS ntlmssp_set_workstation(NTLMSSP_STATE *ntlmssp_state, const char *workstation) ;
    3221 NTSTATUS ntlmssp_store_response(NTLMSSP_STATE *ntlmssp_state,
    3222                                 DATA_BLOB response) ;
    3223 void ntlmssp_want_feature_list(NTLMSSP_STATE *ntlmssp_state, char *feature_list);
    3224 void ntlmssp_want_feature(NTLMSSP_STATE *ntlmssp_state, uint32 feature);
    3225 NTSTATUS ntlmssp_update(NTLMSSP_STATE *ntlmssp_state,
     1256struct ntlmssp_state;
     1257NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
     1258NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
     1259                            const uint8_t lm_hash[16],
     1260                            const uint8_t nt_hash[16]) ;
     1261NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
     1262NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
     1263void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
     1264void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
     1265NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
    32261266                        const DATA_BLOB in, DATA_BLOB *out) ;
    3227 void ntlmssp_end(NTLMSSP_STATE **ntlmssp_state);
    3228 DATA_BLOB ntlmssp_weaken_keys(NTLMSSP_STATE *ntlmssp_state, TALLOC_CTX *mem_ctx);
    3229 NTSTATUS ntlmssp_server_start(NTLMSSP_STATE **ntlmssp_state);
    3230 NTSTATUS ntlmssp_client_start(NTLMSSP_STATE **ntlmssp_state);
    3231 
    3232 /* The following definitions come from libsmb/ntlmssp_sign.c  */
    3233 
    3234 NTSTATUS ntlmssp_sign_packet(NTLMSSP_STATE *ntlmssp_state,
    3235                                     const uchar *data, size_t length,
    3236                                     const uchar *whole_pdu, size_t pdu_length,
    3237                                     DATA_BLOB *sig) ;
    3238 NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state,
    3239                                 const uchar *data, size_t length,
    3240                                 const uchar *whole_pdu, size_t pdu_length,
    3241                                 const DATA_BLOB *sig) ;
    3242 NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
    3243                              uchar *data, size_t length,
    3244                              uchar *whole_pdu, size_t pdu_length,
    3245                              DATA_BLOB *sig);
    3246 NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state,
    3247                                 uchar *data, size_t length,
    3248                                 uchar *whole_pdu, size_t pdu_length,
    3249                                 DATA_BLOB *sig);
    3250 NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state);
     1267NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
     1268                              bool is_standalone,
     1269                              const char *netbios_name,
     1270                              const char *netbios_domain,
     1271                              const char *dns_name,
     1272                              const char *dns_domain,
     1273                              struct ntlmssp_state **ntlmssp_state);
     1274NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
     1275                              const char *netbios_name,
     1276                              const char *netbios_domain,
     1277                              bool use_ntlmv2,
     1278                              struct ntlmssp_state **_ntlmssp_state);
    32511279
    32521280/* The following definitions come from libsmb/passchange.c  */
     
    32601288bool netsamlogon_cache_init(void);
    32611289bool netsamlogon_cache_shutdown(void);
    3262 void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3);
     1290void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
    32631291bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
    3264 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const DOM_SID *user_sid);
    3265 bool netsamlogon_cache_have(const DOM_SID *user_sid);
    3266 
    3267 /* The following definitions come from libsmb/smb_seal.c  */
    3268 
    3269 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
    3270 bool common_encryption_on(struct smb_trans_enc_state *es);
    3271 NTSTATUS common_ntlm_decrypt_buffer(NTLMSSP_STATE *ntlmssp_state, char *buf);
    3272 NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state,
    3273                                 uint16 enc_ctx_num,
    3274                                 char *buf,
    3275                                 char **ppbuf_out);
    3276 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
    3277 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
    3278 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
    3279 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
    3280 bool cli_encryption_on(struct cli_state *cli);
    3281 void cli_free_encryption_context(struct cli_state *cli);
    3282 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
    3283 NTSTATUS cli_decrypt_message(struct cli_state *cli);
    3284 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
    3285 
    3286 /* The following definitions come from libsmb/clisigning.c  */
    3287 
    3288 bool cli_simple_set_signing(struct cli_state *cli,
    3289                             const DATA_BLOB user_session_key,
    3290                             const DATA_BLOB response);
    3291 bool cli_temp_set_signing(struct cli_state *cli);
    3292 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
    3293 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
    3294 bool client_is_signing_on(struct cli_state *cli);
    3295 bool client_is_signing_allowed(struct cli_state *cli);
    3296 bool client_is_signing_mandatory(struct cli_state *cli);
    3297 void cli_set_signing_negotiated(struct cli_state *cli);
    3298 
    3299 /* The following definitions come from smbd/signing.c  */
    3300 
    3301 struct smbd_server_connection;
    3302 bool srv_check_sign_mac(struct smbd_server_connection *conn,
    3303                         const char *inbuf, uint32_t *seqnum);
    3304 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
    3305                             char *outbuf, uint32_t seqnum);
    3306 void srv_cancel_sign_response(struct smbd_server_connection *conn);
    3307 bool srv_init_signing(struct smbd_server_connection *conn);
    3308 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
    3309 bool srv_is_signing_active(struct smbd_server_connection *conn);
    3310 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
    3311 void srv_set_signing(struct smbd_server_connection *conn,
    3312                      const DATA_BLOB user_session_key,
    3313                      const DATA_BLOB response);
     1292struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
     1293bool netsamlogon_cache_have(const struct dom_sid *user_sid);
    33141294
    33151295/* The following definitions come from libsmb/smberr.c  */
     
    33251305bool trustdom_cache_enable(void);
    33261306bool trustdom_cache_shutdown(void);
    3327 bool trustdom_cache_store(char* name, char* alt_name, const DOM_SID *sid,
     1307bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
    33281308                          time_t timeout);
    3329 bool trustdom_cache_fetch(const char* name, DOM_SID* sid);
     1309bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
    33301310uint32 trustdom_cache_fetch_timestamp( void );
    33311311bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
     
    33451325bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
    33461326                                     char ***domain_names, uint32 *num_domains,
    3347                                      DOM_SID **sids );
    3348 
    3349 /* The following definitions come from libsmb/unexpected.c  */
    3350 
    3351 void unexpected_packet(struct packet_struct *p);
    3352 void clear_unexpected(time_t t);
    3353 struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
    3354                                          const char *mailslot_name);
    3355 
    3356 /* The following definitions come from locking/brlock.c  */
    3357 
    3358 bool brl_same_context(const struct lock_context *ctx1,
    3359                              const struct lock_context *ctx2);
    3360 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
    3361 void brl_init(bool read_only);
    3362 void brl_shutdown(void);
    3363 
    3364 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
    3365                 struct lock_struct *plock,
    3366                 bool blocking_lock);
    3367 
    3368 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
    3369                 struct byte_range_lock *br_lck,
    3370                 uint32 smbpid,
    3371                 struct server_id pid,
    3372                 br_off start,
    3373                 br_off size,
    3374                 enum brl_type lock_type,
    3375                 enum brl_flavour lock_flav,
    3376                 bool blocking_lock,
    3377                 uint32 *psmbpid,
    3378                 struct blocking_lock_record *blr);
    3379 bool brl_unlock(struct messaging_context *msg_ctx,
    3380                 struct byte_range_lock *br_lck,
    3381                 uint32 smbpid,
    3382                 struct server_id pid,
    3383                 br_off start,
    3384                 br_off size,
    3385                 enum brl_flavour lock_flav);
    3386 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
    3387                                struct byte_range_lock *br_lck,
    3388                                const struct lock_struct *plock);
    3389 bool brl_locktest(struct byte_range_lock *br_lck,
    3390                 uint32 smbpid,
    3391                 struct server_id pid,
    3392                 br_off start,
    3393                 br_off size,
    3394                 enum brl_type lock_type,
    3395                 enum brl_flavour lock_flav);
    3396 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
    3397                 uint32 *psmbpid,
    3398                 struct server_id pid,
    3399                 br_off *pstart,
    3400                 br_off *psize,
    3401                 enum brl_type *plock_type,
    3402                 enum brl_flavour lock_flav);
    3403 bool brl_lock_cancel(struct byte_range_lock *br_lck,
    3404                 uint32 smbpid,
    3405                 struct server_id pid,
    3406                 br_off start,
    3407                 br_off size,
    3408                 enum brl_flavour lock_flav,
    3409                 struct blocking_lock_record *blr);
    3410 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
    3411                 struct lock_struct *plock);
    3412 void brl_close_fnum(struct messaging_context *msg_ctx,
    3413                     struct byte_range_lock *br_lck);
    3414 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
    3415                           enum brl_type lock_type,
    3416                           enum brl_flavour lock_flav,
    3417                           br_off start, br_off size,
    3418                           void *private_data),
    3419                void *private_data);
    3420 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
    3421                                         files_struct *fsp);
    3422 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
    3423 void brl_register_msgs(struct messaging_context *msg_ctx);
    3424 
    3425 /* The following definitions come from locking/locking.c  */
    3426 
    3427 const char *lock_type_name(enum brl_type lock_type);
    3428 const char *lock_flav_name(enum brl_flavour lock_flav);
    3429 void init_strict_lock_struct(files_struct *fsp,
    3430                                 uint32 smbpid,
    3431                                 br_off start,
    3432                                 br_off size,
    3433                                 enum brl_type lock_type,
    3434                                 struct lock_struct *plock);
    3435 bool strict_lock_default(files_struct *fsp,
    3436                                 struct lock_struct *plock);
    3437 void strict_unlock_default(files_struct *fsp,
    3438                                 struct lock_struct *plock);
    3439 NTSTATUS query_lock(files_struct *fsp,
    3440                         uint32 *psmbpid,
    3441                         uint64_t *pcount,
    3442                         uint64_t *poffset,
    3443                         enum brl_type *plock_type,
    3444                         enum brl_flavour lock_flav);
    3445 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
    3446                         files_struct *fsp,
    3447                         uint32 lock_pid,
    3448                         uint64_t count,
    3449                         uint64_t offset,
    3450                         enum brl_type lock_type,
    3451                         enum brl_flavour lock_flav,
    3452                         bool blocking_lock,
    3453                         NTSTATUS *perr,
    3454                         uint32 *plock_pid,
    3455                         struct blocking_lock_record *blr);
    3456 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
    3457                         files_struct *fsp,
    3458                         uint32 lock_pid,
    3459                         uint64_t count,
    3460                         uint64_t offset,
    3461                         enum brl_flavour lock_flav);
    3462 NTSTATUS do_lock_cancel(files_struct *fsp,
    3463                         uint32 lock_pid,
    3464                         uint64_t count,
    3465                         uint64_t offset,
    3466                         enum brl_flavour lock_flav,
    3467                         struct blocking_lock_record *blr);
    3468 void locking_close_file(struct messaging_context *msg_ctx,
    3469                         files_struct *fsp);
    3470 bool locking_init(void);
    3471 bool locking_init_readonly(void);
    3472 bool locking_end(void);
    3473 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
    3474 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
    3475                                             const struct file_id id,
    3476                                             const char *servicepath,
    3477                                             const struct smb_filename *smb_fname,
    3478                                             const struct timespec *old_write_time);
    3479 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
    3480                                                   const struct file_id id);
    3481 bool rename_share_filename(struct messaging_context *msg_ctx,
    3482                         struct share_mode_lock *lck,
    3483                         const char *servicepath,
    3484                         const struct smb_filename *smb_fname);
    3485 void get_file_infos(struct file_id id,
    3486                     bool *delete_on_close,
    3487                     struct timespec *write_time);
    3488 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
    3489 bool is_deferred_open_entry(const struct share_mode_entry *e);
    3490 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
    3491 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
    3492                     uid_t uid, uint16 mid, uint16 op_type);
    3493 void add_deferred_open(struct share_mode_lock *lck, uint16 mid,
    3494                        struct timeval request_time,
    3495                        struct file_id id);
    3496 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
    3497 void del_deferred_open_entry(struct share_mode_lock *lck, uint16 mid);
    3498 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
    3499 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
    3500 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
    3501 void set_delete_on_close_token(struct share_mode_lock *lck, const UNIX_USER_TOKEN *tok);
    3502 void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, const UNIX_USER_TOKEN *tok);
    3503 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USER_TOKEN *tok);
    3504 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
    3505 bool set_write_time(struct file_id fileid, struct timespec write_time);
    3506 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
    3507                                  const char *, void *),
    3508                       void *private_data);
    3509 
    3510 /* The following definitions come from locking/posix.c  */
    3511 
    3512 bool is_posix_locked(files_struct *fsp,
    3513                         uint64_t *pu_offset,
    3514                         uint64_t *pu_count,
    3515                         enum brl_type *plock_type,
    3516                         enum brl_flavour lock_flav);
    3517 bool posix_locking_init(bool read_only);
    3518 bool posix_locking_end(void);
    3519 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
    3520 int fd_close_posix(struct files_struct *fsp);
    3521 bool set_posix_lock_windows_flavour(files_struct *fsp,
    3522                         uint64_t u_offset,
    3523                         uint64_t u_count,
    3524                         enum brl_type lock_type,
    3525                         const struct lock_context *lock_ctx,
    3526                         const struct lock_struct *plocks,
    3527                         int num_locks,
    3528                         int *errno_ret);
    3529 bool release_posix_lock_windows_flavour(files_struct *fsp,
    3530                                 uint64_t u_offset,
    3531                                 uint64_t u_count,
    3532                                 enum brl_type deleted_lock_type,
    3533                                 const struct lock_context *lock_ctx,
    3534                                 const struct lock_struct *plocks,
    3535                                 int num_locks);
    3536 bool set_posix_lock_posix_flavour(files_struct *fsp,
    3537                         uint64_t u_offset,
    3538                         uint64_t u_count,
    3539                         enum brl_type lock_type,
    3540                         int *errno_ret);
    3541 bool release_posix_lock_posix_flavour(files_struct *fsp,
    3542                                 uint64_t u_offset,
    3543                                 uint64_t u_count,
    3544                                 const struct lock_context *lock_ctx,
    3545                                 const struct lock_struct *plocks,
    3546                                 int num_locks);
    3547 
    3548 /* The following definitions come from modules/vfs_default.c  */
    3549 
    3550 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
    3551 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
    3552 NTSTATUS vfs_default_init(void);
    3553 
    3554 /* The following definitions come from nmbd/asyncdns.c  */
    3555 
    3556 int asyncdns_fd(void);
    3557 void kill_async_dns_child(void);
    3558 void start_async_dns(void);
    3559 void run_dns_queue(void);
    3560 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
    3561 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
    3562 void kill_async_dns_child(void);
    3563 
    3564 /* The following definitions come from nmbd/nmbd.c  */
    3565 
    3566 struct event_context *nmbd_event_context(void);
    3567 struct messaging_context *nmbd_messaging_context(void);
    3568 
    3569 /* The following definitions come from nmbd/nmbd_become_dmb.c  */
    3570 
    3571 void add_domain_names(time_t t);
    3572 
    3573 /* The following definitions come from nmbd/nmbd_become_lmb.c  */
    3574 
    3575 void insert_permanent_name_into_unicast( struct subnet_record *subrec,
    3576                                                 struct nmb_name *nmbname, uint16 nb_type );
    3577 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
    3578                                    bool force_new_election);
    3579 void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
    3580 void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
    3581 
    3582 /* The following definitions come from nmbd/nmbd_browserdb.c  */
    3583 
    3584 void update_browser_death_time( struct browse_cache_record *browc );
    3585 struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
    3586                                                          const char *browser_name,
    3587                                                          struct in_addr ip );
    3588 struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
    3589 void expire_lmb_browsers( time_t t );
    3590 
    3591 /* The following definitions come from nmbd/nmbd_browsesync.c  */
    3592 
    3593 void dmb_expire_and_sync_browser_lists(time_t t);
    3594 void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
    3595                                                    struct work_record *work);
    3596 void collect_all_workgroup_names_from_wins_server(time_t t);
    3597 void sync_all_dmbs(time_t t);
    3598 
    3599 /* The following definitions come from nmbd/nmbd_elections.c  */
    3600 
    3601 void check_master_browser_exists(time_t t);
    3602 void run_elections(time_t t);
    3603 void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3604 bool check_elections(void);
    3605 void nmbd_message_election(struct messaging_context *msg,
    3606                            void *private_data,
    3607                            uint32_t msg_type,
    3608                            struct server_id server_id,
    3609                            DATA_BLOB *data);
    3610 
    3611 /* The following definitions come from nmbd/nmbd_incomingdgrams.c  */
    3612 
    3613 void tell_become_backup(void);
    3614 void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3615 void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3616 void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3617 void process_master_browser_announce(struct subnet_record *subrec,
    3618                                      struct packet_struct *p,char *buf);
    3619 void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
    3620 void process_get_backup_list_request(struct subnet_record *subrec,
    3621                                      struct packet_struct *p,char *buf);
    3622 void process_reset_browser(struct subnet_record *subrec,
    3623                                   struct packet_struct *p,char *buf);
    3624 void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3625 void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
    3626 
    3627 /* The following definitions come from nmbd/nmbd_incomingrequests.c  */
    3628 
    3629 void process_name_release_request(struct subnet_record *subrec,
    3630                                   struct packet_struct *p);
    3631 void process_name_refresh_request(struct subnet_record *subrec,
    3632                                   struct packet_struct *p);
    3633 void process_name_registration_request(struct subnet_record *subrec,
    3634                                        struct packet_struct *p);
    3635 void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
    3636 void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
    3637 
    3638 /* The following definitions come from nmbd/nmbd_lmhosts.c  */
    3639 
    3640 void load_lmhosts_file(const char *fname);
    3641 bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
    3642 
    3643 /* The following definitions come from nmbd/nmbd_logonnames.c  */
    3644 
    3645 void add_logon_names(void);
    3646 
    3647 /* The following definitions come from nmbd/nmbd_mynames.c  */
    3648 
    3649 void register_my_workgroup_one_subnet(struct subnet_record *subrec);
    3650 bool register_my_workgroup_and_names(void);
    3651 void release_wins_names(void);
    3652 void refresh_my_names(time_t t);
    3653 
    3654 /* The following definitions come from nmbd/nmbd_namelistdb.c  */
    3655 
    3656 void set_samba_nb_type(void);
    3657 void remove_name_from_namelist(struct subnet_record *subrec,
    3658                                 struct name_record *namerec );
    3659 struct name_record *find_name_on_subnet(struct subnet_record *subrec,
    3660                                 const struct nmb_name *nmbname,
    3661                                 bool self_only);
    3662 struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
    3663                                                 bool self_only);
    3664 void update_name_ttl( struct name_record *namerec, int ttl );
    3665 bool add_name_to_subnet( struct subnet_record *subrec,
    3666                         const char *name,
    3667                         int type,
    3668                         uint16 nb_flags,
    3669                         int ttl,
    3670                         enum name_source source,
    3671                         int num_ips,
    3672                         struct in_addr *iplist);
    3673 void standard_success_register(struct subnet_record *subrec,
    3674                              struct userdata_struct *userdata,
    3675                              struct nmb_name *nmbname, uint16 nb_flags, int ttl,
    3676                              struct in_addr registered_ip);
    3677 void standard_fail_register( struct subnet_record   *subrec,
    3678                              struct nmb_name        *nmbname );
    3679 bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
    3680 void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
    3681 void remove_ip_from_name_record( struct name_record *namerec,
    3682                                  struct in_addr      remove_ip );
    3683 void standard_success_release( struct subnet_record   *subrec,
    3684                                struct userdata_struct *userdata,
    3685                                struct nmb_name        *nmbname,
    3686                                struct in_addr          released_ip );
    3687 void expire_names(time_t t);
    3688 void add_samba_names_to_subnet( struct subnet_record *subrec );
    3689 void dump_name_record( struct name_record *namerec, XFILE *fp);
    3690 void dump_all_namelists(void);
    3691 
    3692 /* The following definitions come from nmbd/nmbd_namequery.c  */
    3693 
    3694 bool query_name(struct subnet_record *subrec, const char *name, int type,
    3695                    query_name_success_function success_fn,
    3696                    query_name_fail_function fail_fn,
    3697                    struct userdata_struct *userdata);
    3698 bool query_name_from_wins_server(struct in_addr ip_to,
    3699                    const char *name, int type,
    3700                    query_name_success_function success_fn,
    3701                    query_name_fail_function fail_fn,
    3702                    struct userdata_struct *userdata);
    3703 
    3704 /* The following definitions come from nmbd/nmbd_nameregister.c  */
    3705 
    3706 void register_name(struct subnet_record *subrec,
    3707                    const char *name, int type, uint16 nb_flags,
    3708                    register_name_success_function success_fn,
    3709                    register_name_fail_function fail_fn,
    3710                    struct userdata_struct *userdata);
    3711 void wins_refresh_name(struct name_record *namerec);
    3712 
    3713 /* The following definitions come from nmbd/nmbd_namerelease.c  */
    3714 
    3715 void release_name(struct subnet_record *subrec, struct name_record *namerec,
    3716                   release_name_success_function success_fn,
    3717                   release_name_fail_function fail_fn,
    3718                   struct userdata_struct *userdata);
    3719 
    3720 /* The following definitions come from nmbd/nmbd_nodestatus.c  */
    3721 
    3722 bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
    3723                  struct in_addr send_ip, node_status_success_function success_fn,
    3724                  node_status_fail_function fail_fn, struct userdata_struct *userdata);
    3725 
    3726 /* The following definitions come from nmbd/nmbd_packets.c  */
    3727 
    3728 uint16 get_nb_flags(char *buf);
    3729 void set_nb_flags(char *buf, uint16 nb_flags);
    3730 struct response_record *queue_register_name( struct subnet_record *subrec,
    3731                           response_function resp_fn,
    3732                           timeout_response_function timeout_fn,
    3733                           register_name_success_function success_fn,
    3734                           register_name_fail_function fail_fn,
    3735                           struct userdata_struct *userdata,
    3736                           struct nmb_name *nmbname,
    3737                           uint16 nb_flags);
    3738 void queue_wins_refresh(struct nmb_name *nmbname,
    3739                         response_function resp_fn,
    3740                         timeout_response_function timeout_fn,
    3741                         uint16 nb_flags,
    3742                         struct in_addr refresh_ip,
    3743                         const char *tag);
    3744 struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
    3745                                                         response_function resp_fn,
    3746                                                         timeout_response_function timeout_fn,
    3747                                                         register_name_success_function success_fn,
    3748                                                         register_name_fail_function fail_fn,
    3749                                                         struct userdata_struct *userdata,
    3750                                                         struct nmb_name *nmbname,
    3751                                                         uint16 nb_flags,
    3752                                                         struct in_addr register_ip,
    3753                                                         struct in_addr wins_ip);
    3754 struct response_record *queue_release_name( struct subnet_record *subrec,
    3755                                             response_function resp_fn,
    3756                                             timeout_response_function timeout_fn,
    3757                                             release_name_success_function success_fn,
    3758                                             release_name_fail_function fail_fn,
    3759                                             struct userdata_struct *userdata,
    3760                                             struct nmb_name *nmbname,
    3761                                             uint16 nb_flags,
    3762                                             struct in_addr release_ip,
    3763                                             struct in_addr dest_ip);
    3764 struct response_record *queue_query_name( struct subnet_record *subrec,
    3765                           response_function resp_fn,
    3766                           timeout_response_function timeout_fn,
    3767                           query_name_success_function success_fn,
    3768                           query_name_fail_function fail_fn,
    3769                           struct userdata_struct *userdata,
    3770                           struct nmb_name *nmbname);
    3771 struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
    3772                           response_function resp_fn,
    3773                           timeout_response_function timeout_fn,
    3774                           query_name_success_function success_fn,
    3775                           query_name_fail_function fail_fn,
    3776                           struct userdata_struct *userdata,
    3777                           struct nmb_name *nmbname);
    3778 struct response_record *queue_node_status( struct subnet_record *subrec,
    3779                           response_function resp_fn,
    3780                           timeout_response_function timeout_fn,
    3781                           node_status_success_function success_fn,
    3782                           node_status_fail_function fail_fn,
    3783                           struct userdata_struct *userdata,
    3784                           struct nmb_name *nmbname,
    3785                           struct in_addr send_ip);
    3786 void reply_netbios_packet(struct packet_struct *orig_packet,
    3787                           int rcode, enum netbios_reply_type_code rcv_code, int opcode,
    3788                           int ttl, char *data,int len);
    3789 void queue_packet(struct packet_struct *packet);
    3790 void run_packet_queue(void);
    3791 void retransmit_or_expire_response_records(time_t t);
    3792 bool listen_for_packets(bool run_election);
    3793 bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
    3794                    const char *srcname, int src_type,
    3795                    const char *dstname, int dest_type,
    3796                    struct in_addr dest_ip,struct in_addr src_ip,
    3797                    int dest_port);
    3798 
    3799 /* The following definitions come from nmbd/nmbd_processlogon.c  */
    3800 
    3801 bool initialize_nmbd_proxy_logon(void);
    3802 
    3803 void process_logon_packet(struct packet_struct *p, char *buf,int len,
    3804                           const char *mailslot);
    3805 
    3806 /* The following definitions come from nmbd/nmbd_responserecordsdb.c  */
    3807 
    3808 void remove_response_record(struct subnet_record *subrec,
    3809                                 struct response_record *rrec);
    3810 struct response_record *make_response_record( struct subnet_record *subrec,
    3811                                               struct packet_struct *p,
    3812                                               response_function resp_fn,
    3813                                               timeout_response_function timeout_fn,
    3814                                               success_function success_fn,
    3815                                               fail_function fail_fn,
    3816                                               struct userdata_struct *userdata);
    3817 struct response_record *find_response_record(struct subnet_record **ppsubrec,
    3818                                 uint16 id);
    3819 bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
    3820 
    3821 /* The following definitions come from nmbd/nmbd_sendannounce.c  */
    3822 
    3823 void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
    3824 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
    3825 void announce_my_server_names(time_t t);
    3826 void announce_my_lm_server_names(time_t t);
    3827 void reset_announce_timer(void);
    3828 void announce_myself_to_domain_master_browser(time_t t);
    3829 void announce_my_servers_removed(void);
    3830 void announce_remote(time_t t);
    3831 void browse_sync_remote(time_t t);
    3832 
    3833 /* The following definitions come from nmbd/nmbd_serverlistdb.c  */
    3834 
    3835 void remove_all_servers(struct work_record *work);
    3836 struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
    3837 void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
    3838 struct server_record *create_server_on_workgroup(struct work_record *work,
    3839                                                  const char *name,int servertype,
    3840                                                  int ttl, const char *comment);
    3841 void update_server_ttl(struct server_record *servrec, int ttl);
    3842 void expire_servers(struct work_record *work, time_t t);
    3843 void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
    3844                 const char *local_master_browser_name, const char *description);
    3845 void write_browse_list(time_t t, bool force_write);
    3846 
    3847 /* The following definitions come from nmbd/nmbd_subnetdb.c  */
    3848 
    3849 void close_subnet(struct subnet_record *subrec);
    3850 struct subnet_record *make_normal_subnet(const struct interface *iface);
    3851 bool create_subnets(void);
    3852 bool we_are_a_wins_client(void);
    3853 struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
    3854 struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
    3855 
    3856 /* The following definitions come from nmbd/nmbd_synclists.c  */
    3857 
    3858 void sync_browse_lists(struct work_record *work,
    3859                        char *name, int nm_type,
    3860                        struct in_addr ip, bool local, bool servers);
    3861 void sync_check_completion(void);
    3862 
    3863 /* The following definitions come from nmbd/nmbd_winsproxy.c  */
    3864 
    3865 void make_wins_proxy_name_query_request( struct subnet_record *subrec,
    3866                                          struct packet_struct *incoming_packet,
    3867                                          struct nmb_name *question_name);
    3868 
    3869 /* The following definitions come from nmbd/nmbd_winsserver.c  */
    3870 
    3871 struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
    3872 bool wins_store_changed_namerec(const struct name_record *namerec);
    3873 bool add_name_to_wins_subnet(const struct name_record *namerec);
    3874 bool remove_name_from_wins_namelist(struct name_record *namerec);
    3875 void dump_wins_subnet_namelist(XFILE *fp);
    3876 bool packet_is_for_wins_server(struct packet_struct *packet);
    3877 bool initialise_wins(void);
    3878 void wins_process_name_refresh_request( struct subnet_record *subrec,
    3879                                         struct packet_struct *p );
    3880 void wins_process_name_registration_request(struct subnet_record *subrec,
    3881                                             struct packet_struct *p);
    3882 void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
    3883                                                         struct packet_struct *p);
    3884 void fetch_all_active_wins_1b_names(void);
    3885 void send_wins_name_query_response(int rcode, struct packet_struct *p,
    3886                                           struct name_record *namerec);
    3887 void wins_process_name_query_request(struct subnet_record *subrec,
    3888                                      struct packet_struct *p);
    3889 void wins_process_name_release_request(struct subnet_record *subrec,
    3890                                        struct packet_struct *p);
    3891 void initiate_wins_processing(time_t t);
    3892 void wins_write_name_record(struct name_record *namerec, XFILE *fp);
    3893 void wins_write_database(time_t t, bool background);
    3894 void nmbd_wins_new_entry(struct messaging_context *msg,
    3895                                        void *private_data,
    3896                                        uint32_t msg_type,
    3897                                        struct server_id server_id,
    3898                                        DATA_BLOB *data);
    3899 
    3900 /* The following definitions come from nmbd/nmbd_workgroupdb.c  */
    3901 
    3902 struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
    3903                                              const char *name);
    3904 struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
    3905                                                const char *name, int ttl);
    3906 void update_workgroup_ttl(struct work_record *work, int ttl);
    3907 void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
    3908 void dump_workgroups(bool force_write);
    3909 void expire_workgroups_and_servers(time_t t);
     1327                                     struct dom_sid **sids );
     1328NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
    39101329
    39111330/* The following definitions come from param/loadparm.c  */
     
    39781397char *lp_abort_shutdown_script(void);
    39791398char *lp_username_map_script(void);
     1399int lp_username_map_cache_time(void);
    39801400char *lp_check_password_script(void);
    39811401char *lp_wins_hook(void);
     
    39951415bool lp_winbind_rpc_only(void);
    39961416bool lp_create_krb5_conf(void);
    3997 const char **lp_idmap_domains(void);
     1417int lp_winbind_max_domain_connections(void);
    39981418const char *lp_idmap_backend(void);
    3999 char *lp_idmap_alloc_backend(void);
    40001419int lp_idmap_cache_time(void);
    40011420int lp_idmap_negative_cache_time(void);
     
    40281447bool lp_disable_netbios(void);
    40291448bool lp_reset_on_zero_vc(void);
     1449bool lp_log_writeable_files_on_exit(void);
    40301450bool lp_ms_add_printer_wizard(void);
    40311451bool lp_dns_proxy(void);
     
    40391459bool lp_load_printers(void);
    40401460bool lp_readraw(void);
     1461bool _lp_readraw(void);
    40411462bool lp_large_readwrite(void);
    40421463bool lp_writeraw(void);
     1464bool _lp_writeraw(void);
    40431465bool lp_null_passwords(void);
    40441466bool lp_obey_pam_restrictions(void);
    40451467bool lp_encrypted_passwords(void);
    4046 bool lp_update_encrypted(void);
    40471468int lp_client_schannel(void);
    40481469int lp_server_schannel(void);
     
    40821503bool lp_client_use_spnego(void);
    40831504bool lp_client_use_spnego_principal(void);
     1505bool lp_send_spnego_principal(void);
    40841506bool lp_hostname_lookups(void);
    40851507bool lp_change_notify(const struct share_params *p );
     
    41221544const char *lp_socket_options(void);
    41231545int lp_config_backend(void);
     1546int lp_smb2_max_read(void);
     1547int lp_smb2_max_write(void);
     1548int lp_smb2_max_trans(void);
     1549int lp_smb2_max_credits(void);
    41241550char *lp_preexec(int );
    41251551char *lp_postexec(int );
     
    41441570bool lp_clustering(void);
    41451571int lp_ctdb_timeout(void);
     1572int lp_ctdb_locktime_warn_threshold(void);
    41461573char *lp_printcommand(int );
    41471574char *lp_lpqcommand(int );
     
    41891616bool lp_administrative_share(int );
    41901617bool lp_print_ok(int );
     1618bool lp_print_notify_backchannel(int );
    41911619bool lp_map_hidden(int );
    41921620bool lp_map_archive(int );
     
    42141642bool lp_dos_filetime_resolution(int );
    42151643bool lp_fake_dir_create_times(int);
     1644bool lp_async_smb_echo_handler(void);
     1645bool lp_multicast_dns_register(void);
    42161646bool lp_blocking_locks(int );
    42171647bool lp_inherit_perms(int );
     
    42581688int lp_winbind_cache_time(void);
    42591689int lp_winbind_reconnect_delay(void);
     1690int lp_winbind_max_clients(void);
    42601691const char **lp_winbind_nss_info(void);
    42611692int lp_algorithmic_rid_base(void);
     
    42721703int lp_parm_enum(int snum, const char *type, const char *option,
    42731704                 const struct enum_list *_enum, int def);
     1705char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
    42741706bool lp_add_home(const char *pszHomename, int iDefaultService,
    42751707                 const char *user, const char *pszHomedir);
     
    43031735void *lp_local_ptr_by_snum(int snum, void *ptr);
    43041736bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
     1737bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
     1738bool lp_set_option(const char *option);
    43051739void init_locals(void);
    43061740bool lp_is_default(int snum, struct parm_struct *parm);
     
    43091743struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
    43101744bool lp_snum_ok(int iService);
    4311 void lp_add_one_printer(const char *name, const char *comment, void *pdata);
     1745void lp_add_one_printer(const char *name, const char *comment,
     1746                        const char *location, void *pdata);
    43121747bool lp_loaded(void);
    43131748void lp_killunused(bool (*snumused) (int));
     
    43231758                        char **pp_sharepath,
    43241759                        char **pp_comment,
    4325                         SEC_DESC **ppsd,
     1760                        char **pp_cp_share_name,
     1761                        struct security_descriptor **ppsd,
    43261762                        bool *pallow_guest);
    43271763int load_usershare_service(const char *servicename);
     
    43301766void lp_set_in_client(bool b);
    43311767bool lp_is_in_client(void);
    4332 bool lp_load_ex(const char *pszFname,
    4333                 bool global_only,
    4334                 bool save_defaults,
    4335                 bool add_ipc,
    4336                 bool initialize_globals,
    4337                 bool allow_include_registry,
    4338                 bool allow_registry_shares);
    43391768bool lp_load(const char *pszFname,
    43401769             bool global_only,
     
    43601789struct share_params *snum2params_static(int snum);
    43611790const char *volume_label(int snum);
    4362 int lp_server_role(void);
    43631791bool lp_domain_master(void);
     1792bool lp_domain_master_true_or_auto(void);
    43641793bool lp_preferred_master(void);
    43651794void lp_remove_service(int snum);
     
    43761805void lp_set_spoolss_state( uint32 state );
    43771806uint32 lp_get_spoolss_state( void );
     1807struct smb_signing_state;
    43781808bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
    43791809void set_use_sendfile(int snum, bool val);
     
    43881818void lp_set_passdb_backend(const char *backend);
    43891819void widelinks_warning(int snum);
     1820char *lp_ncalrpc_dir(void);
     1821
     1822/* The following definitions come from param/loadparm_server_role.c  */
     1823
     1824int lp_server_role(void);
     1825void set_server_role(void);
    43901826
    43911827/* The following definitions come from param/util.c  */
     
    43941830char* get_string_param( const char* param );
    43951831
    4396 /* The following definitions come from passdb/login_cache.c  */
    4397 
    4398 bool login_cache_init(void);
    4399 bool login_cache_shutdown(void);
    4400 LOGIN_CACHE * login_cache_read(struct samu *sampass);
    4401 bool login_cache_write(const struct samu *sampass, LOGIN_CACHE entry);
    4402 bool login_cache_delentry(const struct samu *sampass);
    4403 
    4404 /* The following definitions come from passdb/lookup_sid.c  */
    4405 
    4406 bool lookup_name(TALLOC_CTX *mem_ctx,
    4407                  const char *full_name, int flags,
    4408                  const char **ret_domain, const char **ret_name,
    4409                  DOM_SID *ret_sid, enum lsa_SidType *ret_type);
    4410 bool lookup_name_smbconf(TALLOC_CTX *mem_ctx,
    4411                  const char *full_name, int flags,
    4412                  const char **ret_domain, const char **ret_name,
    4413                  DOM_SID *ret_sid, enum lsa_SidType *ret_type);
    4414 NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
    4415                      const DOM_SID **sids, int level,
    4416                      struct lsa_dom_info **ret_domains,
    4417                      struct lsa_name_info **ret_names);
    4418 bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    4419                 const char **ret_domain, const char **ret_name,
    4420                 enum lsa_SidType *ret_type);
    4421 void store_uid_sid_cache(const DOM_SID *psid, uid_t uid);
    4422 void store_gid_sid_cache(const DOM_SID *psid, gid_t gid);
    4423 void uid_to_sid(DOM_SID *psid, uid_t uid);
    4424 void gid_to_sid(DOM_SID *psid, gid_t gid);
    4425 bool sid_to_uid(const DOM_SID *psid, uid_t *puid);
    4426 bool sid_to_gid(const DOM_SID *psid, gid_t *pgid);
    4427 
    4428 /* The following definitions come from passdb/machine_sid.c  */
    4429 
    4430 DOM_SID *get_global_sam_sid(void);
    4431 void reset_global_sam_sid(void) ;
    4432 bool sid_check_is_domain(const DOM_SID *sid);
    4433 bool sid_check_is_in_our_domain(const DOM_SID *sid);
    4434 
    4435 /* The following definitions come from passdb/passdb.c  */
    4436 
    4437 const char *my_sam_name(void);
    4438 struct samu *samu_new( TALLOC_CTX *ctx );
    4439 NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd);
    4440 NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd);
    4441 char *pdb_encode_acct_ctrl(uint32 acct_ctrl, size_t length);
    4442 uint32 pdb_decode_acct_ctrl(const char *p);
    4443 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32 acct_ctrl);
    4444 bool pdb_gethexpwd(const char *p, unsigned char *pwd);
    4445 void pdb_sethexhours(char *p, const unsigned char *hours);
    4446 bool pdb_gethexhours(const char *p, unsigned char *hours);
    4447 int algorithmic_rid_base(void);
    4448 uid_t algorithmic_pdb_user_rid_to_uid(uint32 user_rid);
    4449 uid_t max_algorithmic_uid(void);
    4450 uint32 algorithmic_pdb_uid_to_user_rid(uid_t uid);
    4451 gid_t pdb_group_rid_to_gid(uint32 group_rid);
    4452 gid_t max_algorithmic_gid(void);
    4453 uint32 algorithmic_pdb_gid_to_group_rid(gid_t gid);
    4454 bool algorithmic_pdb_rid_is_user(uint32 rid);
    4455 bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid,
    4456                             enum lsa_SidType *type);
    4457 NTSTATUS local_password_change(const char *user_name,
    4458                                 int local_flags,
    4459                                 const char *new_passwd,
    4460                                 char **pp_err_str,
    4461                                 char **pp_msg_str);
    4462 bool init_samu_from_buffer(struct samu *sampass, uint32_t level,
    4463                            uint8 *buf, uint32 buflen);
    4464 uint32 init_buffer_from_samu (uint8 **buf, struct samu *sampass, bool size_only);
    4465 bool pdb_copy_sam_account(struct samu *dst, struct samu *src );
    4466 bool pdb_update_bad_password_count(struct samu *sampass, bool *updated);
    4467 bool pdb_update_autolock_flag(struct samu *sampass, bool *updated);
    4468 bool pdb_increment_bad_password_count(struct samu *sampass);
    4469 bool is_dc_trusted_domain_situation(const char *domain_name);
    4470 bool get_trust_pw_clear(const char *domain, char **ret_pwd,
    4471                         const char **account_name,
    4472                         enum netr_SchannelType *channel);
    4473 bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
    4474                        const char **account_name,
    4475                        enum netr_SchannelType *channel);
    4476 struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
    4477                                                 struct samu *pw);
    4478 /* The following definitions come from passdb/pdb_compat.c  */
    4479 
    4480 uint32 pdb_get_user_rid (const struct samu *sampass);
    4481 uint32 pdb_get_group_rid (struct samu *sampass);
    4482 bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32 rid, enum pdb_value_state flag);
    4483 bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32 grid, enum pdb_value_state flag);
    4484 
    4485 /* The following definitions come from passdb/pdb_get_set.c  */
    4486 
    4487 uint32 pdb_get_acct_ctrl(const struct samu *sampass);
    4488 time_t pdb_get_logon_time(const struct samu *sampass);
    4489 time_t pdb_get_logoff_time(const struct samu *sampass);
    4490 time_t pdb_get_kickoff_time(const struct samu *sampass);
    4491 time_t pdb_get_bad_password_time(const struct samu *sampass);
    4492 time_t pdb_get_pass_last_set_time(const struct samu *sampass);
    4493 time_t pdb_get_pass_can_change_time(const struct samu *sampass);
    4494 time_t pdb_get_pass_can_change_time_noncalc(const struct samu *sampass);
    4495 time_t pdb_get_pass_must_change_time(const struct samu *sampass);
    4496 bool pdb_get_pass_can_change(const struct samu *sampass);
    4497 uint16 pdb_get_logon_divs(const struct samu *sampass);
    4498 uint32 pdb_get_hours_len(const struct samu *sampass);
    4499 const uint8 *pdb_get_hours(const struct samu *sampass);
    4500 const uint8 *pdb_get_nt_passwd(const struct samu *sampass);
    4501 const uint8 *pdb_get_lanman_passwd(const struct samu *sampass);
    4502 const uint8 *pdb_get_pw_history(const struct samu *sampass, uint32 *current_hist_len);
    4503 const char *pdb_get_plaintext_passwd(const struct samu *sampass);
    4504 const DOM_SID *pdb_get_user_sid(const struct samu *sampass);
    4505 const DOM_SID *pdb_get_group_sid(struct samu *sampass);
    4506 enum pdb_value_state pdb_get_init_flags(const struct samu *sampass, enum pdb_elements element);
    4507 const char *pdb_get_username(const struct samu *sampass);
    4508 const char *pdb_get_domain(const struct samu *sampass);
    4509 const char *pdb_get_nt_username(const struct samu *sampass);
    4510 const char *pdb_get_fullname(const struct samu *sampass);
    4511 const char *pdb_get_homedir(const struct samu *sampass);
    4512 const char *pdb_get_dir_drive(const struct samu *sampass);
    4513 const char *pdb_get_logon_script(const struct samu *sampass);
    4514 const char *pdb_get_profile_path(const struct samu *sampass);
    4515 const char *pdb_get_acct_desc(const struct samu *sampass);
    4516 const char *pdb_get_workstations(const struct samu *sampass);
    4517 const char *pdb_get_comment(const struct samu *sampass);
    4518 const char *pdb_get_munged_dial(const struct samu *sampass);
    4519 uint16 pdb_get_bad_password_count(const struct samu *sampass);
    4520 uint16 pdb_get_logon_count(const struct samu *sampass);
    4521 uint32 pdb_get_unknown_6(const struct samu *sampass);
    4522 void *pdb_get_backend_private_data(const struct samu *sampass, const struct pdb_methods *my_methods);
    4523 bool pdb_set_acct_ctrl(struct samu *sampass, uint32 acct_ctrl, enum pdb_value_state flag);
    4524 bool pdb_set_logon_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4525 bool pdb_set_logoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4526 bool pdb_set_kickoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4527 bool pdb_set_bad_password_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4528 bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4529 bool pdb_set_pass_must_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4530 bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4531 bool pdb_set_hours_len(struct samu *sampass, uint32 len, enum pdb_value_state flag);
    4532 bool pdb_set_logon_divs(struct samu *sampass, uint16 hours, enum pdb_value_state flag);
    4533 bool pdb_set_init_flags(struct samu *sampass, enum pdb_elements element, enum pdb_value_state value_flag);
    4534 bool pdb_set_user_sid(struct samu *sampass, const DOM_SID *u_sid, enum pdb_value_state flag);
    4535 bool pdb_set_user_sid_from_string(struct samu *sampass, fstring u_sid, enum pdb_value_state flag);
    4536 bool pdb_set_group_sid(struct samu *sampass, const DOM_SID *g_sid, enum pdb_value_state flag);
    4537 bool pdb_set_username(struct samu *sampass, const char *username, enum pdb_value_state flag);
    4538 bool pdb_set_domain(struct samu *sampass, const char *domain, enum pdb_value_state flag);
    4539 bool pdb_set_nt_username(struct samu *sampass, const char *nt_username, enum pdb_value_state flag);
    4540 bool pdb_set_fullname(struct samu *sampass, const char *full_name, enum pdb_value_state flag);
    4541 bool pdb_set_logon_script(struct samu *sampass, const char *logon_script, enum pdb_value_state flag);
    4542 bool pdb_set_profile_path(struct samu *sampass, const char *profile_path, enum pdb_value_state flag);
    4543 bool pdb_set_dir_drive(struct samu *sampass, const char *dir_drive, enum pdb_value_state flag);
    4544 bool pdb_set_homedir(struct samu *sampass, const char *home_dir, enum pdb_value_state flag);
    4545 bool pdb_set_acct_desc(struct samu *sampass, const char *acct_desc, enum pdb_value_state flag);
    4546 bool pdb_set_workstations(struct samu *sampass, const char *workstations, enum pdb_value_state flag);
    4547 bool pdb_set_comment(struct samu *sampass, const char *comment, enum pdb_value_state flag);
    4548 bool pdb_set_munged_dial(struct samu *sampass, const char *munged_dial, enum pdb_value_state flag);
    4549 bool pdb_set_nt_passwd(struct samu *sampass, const uint8 pwd[NT_HASH_LEN], enum pdb_value_state flag);
    4550 bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], enum pdb_value_state flag);
    4551 bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag);
    4552 bool pdb_set_plaintext_pw_only(struct samu *sampass, const char *password, enum pdb_value_state flag);
    4553 bool pdb_set_bad_password_count(struct samu *sampass, uint16 bad_password_count, enum pdb_value_state flag);
    4554 bool pdb_set_logon_count(struct samu *sampass, uint16 logon_count, enum pdb_value_state flag);
    4555 bool pdb_set_unknown_6(struct samu *sampass, uint32 unkn, enum pdb_value_state flag);
    4556 bool pdb_set_hours(struct samu *sampass, const uint8 *hours, enum pdb_value_state flag);
    4557 bool pdb_set_backend_private_data(struct samu *sampass, void *private_data,
    4558                                    void (*free_fn)(void **),
    4559                                    const struct pdb_methods *my_methods,
    4560                                    enum pdb_value_state flag);
    4561 bool pdb_set_pass_can_change(struct samu *sampass, bool canchange);
    4562 bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext);
    4563 uint32 pdb_build_fields_present(struct samu *sampass);
    4564 
    4565 /* The following definitions come from passdb/pdb_interface.c  */
    4566 
    4567 NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) ;
    4568 struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
    4569 struct event_context *pdb_get_event_context(void);
    4570 NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected);
    4571 struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx);
    4572 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ;
    4573 bool guest_user_info( struct samu *user );
    4574 bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) ;
    4575 NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32 flags,
    4576                          uint32 *rid);
    4577 NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct);
    4578 NTSTATUS pdb_add_sam_account(struct samu *sam_acct) ;
    4579 NTSTATUS pdb_update_sam_account(struct samu *sam_acct) ;
    4580 NTSTATUS pdb_delete_sam_account(struct samu *sam_acct) ;
    4581 NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname);
    4582 NTSTATUS pdb_update_login_attempts(struct samu *sam_acct, bool success);
    4583 bool pdb_getgrsid(GROUP_MAP *map, DOM_SID sid);
    4584 bool pdb_getgrgid(GROUP_MAP *map, gid_t gid);
    4585 bool pdb_getgrnam(GROUP_MAP *map, const char *name);
    4586 NTSTATUS pdb_create_dom_group(TALLOC_CTX *mem_ctx, const char *name,
    4587                               uint32 *rid);
    4588 NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32 rid);
    4589 NTSTATUS pdb_add_group_mapping_entry(GROUP_MAP *map);
    4590 NTSTATUS pdb_update_group_mapping_entry(GROUP_MAP *map);
    4591 NTSTATUS pdb_delete_group_mapping_entry(DOM_SID sid);
    4592 bool pdb_enum_group_mapping(const DOM_SID *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap,
    4593                             size_t *p_num_entries, bool unix_only);
    4594 NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx,
    4595                                 const DOM_SID *sid,
    4596                                 uint32 **pp_member_rids,
    4597                                 size_t *p_num_members);
    4598 NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,
    4599                                     DOM_SID **pp_sids, gid_t **pp_gids,
    4600                                     size_t *p_num_groups);
    4601 NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, struct samu *user);
    4602 NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,
    4603                           uint32 member_rid);
    4604 NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,
    4605                           uint32 member_rid);
    4606 NTSTATUS pdb_create_alias(const char *name, uint32 *rid);
    4607 NTSTATUS pdb_delete_alias(const DOM_SID *sid);
    4608 NTSTATUS pdb_get_aliasinfo(const DOM_SID *sid, struct acct_info *info);
    4609 NTSTATUS pdb_set_aliasinfo(const DOM_SID *sid, struct acct_info *info);
    4610 NTSTATUS pdb_add_aliasmem(const DOM_SID *alias, const DOM_SID *member);
    4611 NTSTATUS pdb_del_aliasmem(const DOM_SID *alias, const DOM_SID *member);
    4612 NTSTATUS pdb_enum_aliasmem(const DOM_SID *alias, TALLOC_CTX *mem_ctx,
    4613                            DOM_SID **pp_members, size_t *p_num_members);
    4614 NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx,
    4615                                     const DOM_SID *domain_sid,
    4616                                     const DOM_SID *members, size_t num_members,
    4617                                     uint32 **pp_alias_rids,
    4618                                     size_t *p_num_alias_rids);
    4619 NTSTATUS pdb_lookup_rids(const DOM_SID *domain_sid,
    4620                          int num_rids,
    4621                          uint32 *rids,
    4622                          const char **names,
    4623                          enum lsa_SidType *attrs);
    4624 NTSTATUS pdb_lookup_names(const DOM_SID *domain_sid,
    4625                           int num_names,
    4626                           const char **names,
    4627                           uint32 *rids,
    4628                           enum lsa_SidType *attrs);
    4629 bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
    4630 bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
    4631 bool pdb_get_seq_num(time_t *seq_num);
    4632 bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid);
    4633 bool pdb_gid_to_sid(gid_t gid, DOM_SID *sid);
    4634 bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
    4635                    enum lsa_SidType *type);
    4636 uint32_t pdb_capabilities(void);
    4637 bool pdb_new_rid(uint32 *rid);
    4638 bool initialize_password_db(bool reload, struct event_context *event_ctx);
    4639 struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
    4640                                    enum pdb_search_type type);
    4641 struct pdb_search *pdb_search_users(TALLOC_CTX *mem_ctx, uint32 acct_flags);
    4642 struct pdb_search *pdb_search_groups(TALLOC_CTX *mem_ctx);
    4643 struct pdb_search *pdb_search_aliases(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
    4644 uint32 pdb_search_entries(struct pdb_search *search,
    4645                           uint32 start_idx, uint32 max_entries,
    4646                           struct samr_displayentry **result);
    4647 bool pdb_get_trusteddom_pw(const char *domain, char** pwd, DOM_SID *sid,
    4648                            time_t *pass_last_set_time);
    4649 bool pdb_set_trusteddom_pw(const char* domain, const char* pwd,
    4650                            const DOM_SID *sid);
    4651 bool pdb_del_trusteddom_pw(const char *domain);
    4652 NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32 *num_domains,
    4653                               struct trustdom_info ***domains);
    4654 NTSTATUS make_pdb_method( struct pdb_methods **methods ) ;
    4655 
    4656 /* The following definitions come from passdb/pdb_ldap.c  */
    4657 
    4658 const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
    4659 int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state,
    4660                                           const char *user,
    4661                                           LDAPMessage ** result,
    4662                                           const char **attr);
    4663 const char **talloc_attrs(TALLOC_CTX *mem_ctx, ...);
    4664 NTSTATUS pdb_init_ldapsam_compat(struct pdb_methods **pdb_method, const char *location);
    4665 NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location);
    4666 NTSTATUS pdb_ldap_init(void);
    4667 
    4668 /* The following definitions come from passdb/pdb_nds.c  */
    4669 
    4670 int pdb_nds_get_password(
    4671         struct smbldap_state *ldap_state,
    4672         char *object_dn,
    4673         size_t *pwd_len,
    4674         char *pwd );
    4675 int pdb_nds_set_password(
    4676         struct smbldap_state *ldap_state,
    4677         char *object_dn,
    4678         const char *pwd );
    4679 NTSTATUS pdb_nds_init(void);
    4680 
    4681 /* The following definitions come from passdb/pdb_smbpasswd.c  */
    4682 
    4683 NTSTATUS pdb_smbpasswd_init(void) ;
    4684 
    4685 /* The following definitions come from passdb/pdb_wbc_sam.c  */
    4686 
    4687 NTSTATUS pdb_wbc_sam_init(void);
    4688 
    4689 /* The following definitions come from passdb/pdb_tdb.c  */
    4690 
    4691 bool init_sam_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32 buflen);
    4692 NTSTATUS pdb_tdbsam_init(void);
    4693 
    4694 /* The following definitions come from passdb/secrets.c  */
    4695 
    4696 bool secrets_init(void);
    4697 struct db_context *secrets_db_ctx(void);
    4698 void secrets_shutdown(void);
    4699 void *secrets_fetch(const char *key, size_t *size);
    4700 bool secrets_store(const char *key, const void *data, size_t size);
    4701 bool secrets_delete(const char *key);
    4702 bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid);
    4703 bool secrets_fetch_domain_sid(const char *domain, DOM_SID *sid);
    4704 bool secrets_store_domain_guid(const char *domain, struct GUID *guid);
    4705 bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid);
    4706 void *secrets_get_trust_account_lock(TALLOC_CTX *mem_ctx, const char *domain);
    4707 enum netr_SchannelType get_default_sec_channel(void);
    4708 bool secrets_fetch_trust_account_password_legacy(const char *domain,
    4709                                                  uint8 ret_pwd[16],
    4710                                                  time_t *pass_last_set_time,
    4711                                                  enum netr_SchannelType *channel);
    4712 bool secrets_fetch_trust_account_password(const char *domain, uint8 ret_pwd[16],
    4713                                           time_t *pass_last_set_time,
    4714                                           enum netr_SchannelType *channel);
    4715 bool secrets_fetch_trusted_domain_password(const char *domain, char** pwd,
    4716                                            DOM_SID *sid, time_t *pass_last_set_time);
    4717 bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
    4718                                            const DOM_SID *sid);
    4719 bool secrets_delete_machine_password(const char *domain);
    4720 bool secrets_delete_machine_password_ex(const char *domain);
    4721 bool secrets_delete_domain_sid(const char *domain);
    4722 bool secrets_store_machine_password(const char *pass, const char *domain, enum netr_SchannelType sec_channel);
    4723 char *secrets_fetch_prev_machine_password(const char *domain);
    4724 char *secrets_fetch_machine_password(const char *domain,
    4725                                      time_t *pass_last_set_time,
    4726                                      enum netr_SchannelType *channel);
    4727 bool trusted_domain_password_delete(const char *domain);
    4728 bool secrets_store_ldap_pw(const char* dn, char* pw);
    4729 bool fetch_ldap_pw(char **dn, char** pw);
    4730 NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
    4731                                  struct trustdom_info ***domains);
    4732 bool secrets_store_afs_keyfile(const char *cell, const struct afs_keyfile *keyfile);
    4733 bool secrets_fetch_afs_key(const char *cell, struct afs_key *result);
    4734 void secrets_fetch_ipc_userpass(char **username, char **domain, char **password);
    4735 bool secrets_store_generic(const char *owner, const char *key, const char *secret);
    4736 char *secrets_fetch_generic(const char *owner, const char *key);
    4737 bool secrets_delete_generic(const char *owner, const char *key);
    4738 bool secrets_store_local_schannel_key(uint8_t schannel_key[16]);
    4739 bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16]);
    4740 
    4741 /* The following definitions come from passdb/secrets_schannel.c  */
    4742 
    4743 TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx);
    4744 NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
    4745                                     const char *computer_name,
    4746                                     struct netlogon_creds_CredentialState **pcreds);
    4747 NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
    4748                                     struct netlogon_creds_CredentialState *creds);
    4749 
    4750 /* The following definitions come from passdb/util_builtin.c  */
    4751 
    4752 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
    4753 bool lookup_builtin_name(const char *name, uint32 *rid);
    4754 const char *builtin_domain_name(void);
    4755 bool sid_check_is_builtin(const DOM_SID *sid);
    4756 bool sid_check_is_in_builtin(const DOM_SID *sid);
    4757 
    4758 /* The following definitions come from passdb/util_unixsids.c  */
    4759 
    4760 bool sid_check_is_unix_users(const DOM_SID *sid);
    4761 bool sid_check_is_in_unix_users(const DOM_SID *sid);
    4762 bool uid_to_unix_users_sid(uid_t uid, DOM_SID *sid);
    4763 bool gid_to_unix_groups_sid(gid_t gid, DOM_SID *sid);
    4764 const char *unix_users_domain_name(void);
    4765 bool lookup_unix_user_name(const char *name, DOM_SID *sid);
    4766 bool sid_check_is_unix_groups(const DOM_SID *sid);
    4767 bool sid_check_is_in_unix_groups(const DOM_SID *sid);
    4768 const char *unix_groups_domain_name(void);
    4769 bool lookup_unix_group_name(const char *name, DOM_SID *sid);
    4770 
    4771 /* The following definitions come from passdb/util_wellknown.c  */
    4772 
    4773 bool sid_check_is_wellknown_domain(const DOM_SID *sid, const char **name);
    4774 bool sid_check_is_in_wellknown_domain(const DOM_SID *sid);
    4775 bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
     1832/* The following definitions come from lib/server_contexts.c  */
     1833struct tevent_context *server_event_context(void);
     1834void server_event_context_free(void);
     1835struct messaging_context *server_messaging_context(void);
     1836void server_messaging_context_free(void);
     1837
     1838/* The following definitions come from lib/sessionid_tdb.c  */
     1839struct sessionid;
     1840bool sessionid_init(void);
     1841struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
     1842int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
     1843                                 struct sessionid *session,
     1844                                 void *private_data),
     1845                       void *private_data);
     1846int sessionid_traverse_read(int (*fn)(const char *key,
     1847                                      struct sessionid *session,
     1848                                      void *private_data),
     1849                            void *private_data);
     1850
     1851/* The following definitions come from utils/passwd_util.c  */
     1852
     1853char *stdin_new_passwd( void);
     1854char *get_pass( const char *prompt, bool stdin_get);
     1855
     1856/* The following definitions come from lib/avahi.c */
     1857
     1858struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
     1859                                    struct tevent_context *ev);
     1860
     1861/* The following definitions come from lib/fncall.c */
     1862
     1863struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
     1864                                           int max_threads);
     1865struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
     1866                               struct fncall_context *ctx,
     1867                               void (*fn)(void *private_data),
     1868                               void *private_data);
     1869int fncall_recv(struct tevent_req *req, int *perr);
     1870
     1871/* The following definitions come from libsmb/smbsock_connect.c */
     1872
     1873struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
     1874                                        struct tevent_context *ev,
     1875                                        const struct sockaddr_storage *addr,
     1876                                        uint16_t port,
     1877                                        const char *called_name,
     1878                                        int called_type,
     1879                                        const char *calling_name,
     1880                                        int calling_type);
     1881NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
     1882                              uint16_t *ret_port);
     1883NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
     1884                         const char *called_name, int called_type,
     1885                         const char *calling_name, int calling_type,
     1886                         int *pfd, uint16_t *ret_port, int sec_timeout);
     1887
     1888struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
     1889                                            struct tevent_context *ev,
     1890                                            const struct sockaddr_storage *addrs,
     1891                                            const char **called_names,
     1892                                            int *called_types,
     1893                                            const char **calling_names,
     1894                                            int *calling_types,
     1895                                            size_t num_addrs, uint16_t port);
     1896NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
     1897                                  size_t *chosen_index, uint16_t *chosen_port);
     1898NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
     1899                             const char **called_names,
     1900                             int *called_types,
     1901                             const char **calling_names,
     1902                             int *calling_types,
     1903                             size_t num_addrs,
     1904                             uint16_t port,
     1905                             int sec_timeout,
     1906                             int *pfd, size_t *chosen_index,
     1907                             uint16_t *chosen_port);
     1908
     1909/* The following definitions come from lib/util_wellknown.c  */
     1910
     1911bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name);
     1912bool sid_check_is_in_wellknown_domain(const struct dom_sid *sid);
     1913bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
    47761914                          const char **domain, const char **name);
    47771915bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
    4778                            DOM_SID *sid, const char **domain);
    4779 
    4780 /* The following definitions come from printing/load.c  */
    4781 
    4782 void load_printers(void);
    4783 
    4784 /* The following definitions come from printing/lpq_parse.c  */
    4785 
    4786 bool parse_lpq_entry(enum printing_types printing_type,char *line,
    4787                      print_queue_struct *buf,
    4788                      print_status_struct *status,bool first);
    4789 uint32_t print_parse_jobid(const char *fname);
    4790 
    4791 /* The following definitions come from printing/notify.c  */
    4792 
    4793 int print_queue_snum(const char *qname);
    4794 void print_notify_send_messages(struct messaging_context *msg_ctx,
    4795                                 unsigned int timeout);
    4796 void notify_printer_status_byname(const char *sharename, uint32 status);
    4797 void notify_printer_status(int snum, uint32 status);
    4798 void notify_job_status_byname(const char *sharename, uint32 jobid, uint32 status,
    4799                               uint32 flags);
    4800 void notify_job_status(const char *sharename, uint32 jobid, uint32 status);
    4801 void notify_job_total_bytes(const char *sharename, uint32 jobid,
    4802                             uint32 size);
    4803 void notify_job_total_pages(const char *sharename, uint32 jobid,
    4804                             uint32 pages);
    4805 void notify_job_username(const char *sharename, uint32 jobid, char *name);
    4806 void notify_job_name(const char *sharename, uint32 jobid, char *name);
    4807 void notify_job_submitted(const char *sharename, uint32 jobid,
    4808                           time_t submitted);
    4809 void notify_printer_driver(int snum, char *driver_name);
    4810 void notify_printer_comment(int snum, char *comment);
    4811 void notify_printer_sharename(int snum, char *share_name);
    4812 void notify_printer_printername(int snum, char *printername);
    4813 void notify_printer_port(int snum, char *port_name);
    4814 void notify_printer_location(int snum, char *location);
    4815 void notify_printer_byname( const char *printername, uint32 change, const char *value );
    4816 
    4817 /* The following definitions come from printing/nt_printing.c  */
    4818 
    4819 bool nt_printing_init(struct messaging_context *msg_ctx);
    4820 uint32 update_c_setprinter(bool initialize);
    4821 uint32 get_c_setprinter(void);
    4822 int get_builtin_ntforms(nt_forms_struct **list);
    4823 bool get_a_builtin_ntform_by_string(const char *form_name, nt_forms_struct *form);
    4824 int get_ntforms(nt_forms_struct **list);
    4825 int write_ntforms(nt_forms_struct **list, int number);
    4826 bool add_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int *count);
    4827 bool delete_a_form(nt_forms_struct **list, const char *del_name, int *count, WERROR *ret);
    4828 void update_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int count);
    4829 int get_ntdrivers(fstring **list, const char *architecture, uint32 version);
    4830 const char *get_short_archi(const char *long_archi);
    4831 WERROR clean_up_driver_struct(struct pipes_struct *rpc_pipe,
    4832                               struct spoolss_AddDriverInfoCtr *r);
    4833 WERROR move_driver_to_download_area(struct pipes_struct *p,
    4834                                     struct spoolss_AddDriverInfoCtr *r,
    4835                                     WERROR *perr);
    4836 int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen);
    4837 uint32 del_a_printer(const char *sharename);
    4838 NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename);
    4839 void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr);
    4840 int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen);
    4841 int add_new_printer_key( NT_PRINTER_DATA *data, const char *name );
    4842 int delete_printer_key( NT_PRINTER_DATA *data, const char *name );
    4843 int lookup_printerkey( NT_PRINTER_DATA *data, const char *name );
    4844 int get_printer_subkeys( NT_PRINTER_DATA *data, const char* key, fstring **subkeys );
    4845 WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action);
    4846 WERROR check_published_printers(void);
    4847 bool is_printer_published(Printer_entry *print_hnd, int snum,
    4848                           struct GUID *guid);
    4849 WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action);
    4850 WERROR check_published_printers(void);
    4851 bool is_printer_published(Printer_entry *print_hnd, int snum,
    4852                           struct GUID *guid);
    4853 WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key );
    4854 WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
    4855 WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value,
    4856                            uint32 type, uint8 *data, int real_len );
    4857 struct regval_blob* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
    4858 WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
    4859 bool set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
    4860 bool del_driver_init(const char *drivername);
    4861 WERROR save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, uint8 *data, uint32 data_len);
    4862 WERROR get_a_printer( Printer_entry *print_hnd,
    4863                         NT_PRINTER_INFO_LEVEL **pp_printer,
    4864                         uint32 level,
    4865                         const char *sharename);
    4866 WERROR get_a_printer_search( Printer_entry *print_hnd,
    4867                         NT_PRINTER_INFO_LEVEL **pp_printer,
    4868                         uint32 level,
    4869                         const char *sharename);
    4870 uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
    4871 uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
    4872                               struct spoolss_AddDriverInfoCtr *r,
    4873                               char **driver_name,
    4874                               uint32_t *version);
    4875 WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx,
    4876                             struct spoolss_DriverInfo8 **driver_p,
    4877                             const char *drivername, const char *architecture,
    4878                             uint32_t version);
    4879 uint32_t free_a_printer_driver(struct spoolss_DriverInfo8 *driver);
    4880 bool printer_driver_in_use(const struct spoolss_DriverInfo8 *r);
    4881 bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
    4882                                  struct spoolss_DriverInfo8 *r);
    4883 WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
    4884                              const struct spoolss_DriverInfo8 *r,
    4885                              uint32 version, bool delete_files );
    4886 WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr);
    4887 bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **secdesc_ctr);
    4888 void map_printer_permissions(SEC_DESC *sd);
    4889 void map_job_permissions(SEC_DESC *sd);
    4890 bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
    4891                         int access_type);
    4892 bool print_time_access_check(const char *servicename);
    4893 char* get_server_name( Printer_entry *printer );
    4894 
    4895 /* The following definitions come from printing/pcap.c  */
    4896 
    4897 bool pcap_cache_add_specific(struct pcap_cache **ppcache, const char *name, const char *comment);
    4898 void pcap_cache_destroy_specific(struct pcap_cache **ppcache);
    4899 bool pcap_cache_add(const char *name, const char *comment);
    4900 bool pcap_cache_loaded(void);
    4901 void pcap_cache_replace(const struct pcap_cache *cache);
    4902 void pcap_cache_reload(void (*post_cache_fill_fn)(void));
    4903 bool pcap_printername_ok(const char *printername);
    4904 void pcap_printer_fn_specific(const struct pcap_cache *, void (*fn)(const char *, const char *, void *), void *);
    4905 void pcap_printer_fn(void (*fn)(const char *, const char *, void *), void *);
    4906 
    4907 /* The following definitions come from printing/print_aix.c  */
    4908 
    4909 bool aix_cache_reload(void);
    4910 
    4911 /* The following definitions come from printing/print_cups.c  */
    4912 
    4913 bool cups_cache_reload(void (*post_cache_fill_fn)(void));
    4914 bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer);
    4915 
    4916 /* The following definitions come from printing/print_generic.c  */
    4917 
    4918 
    4919 /* The following definitions come from printing/print_iprint.c  */
    4920 
    4921 bool iprint_cache_reload(void);
    4922 
    4923 /* The following definitions come from printing/print_svid.c  */
    4924 
    4925 bool sysv_cache_reload(void);
    4926 
    4927 /* The following definitions come from printing/printfsp.c  */
    4928 
    4929 NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
    4930                         const char *fname,
    4931                         uint16_t current_vuid, files_struct *fsp);
    4932 void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
    4933 
    4934 /* The following definitions come from printing/printing.c  */
    4935 
    4936 uint16 pjobid_to_rap(const char* sharename, uint32 jobid);
    4937 bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid);
    4938 bool print_backend_init(struct messaging_context *msg_ctx);
    4939 void printing_end(void);
    4940 int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob );
    4941 uint32 sysjob_to_jobid(int unix_jobid);
    4942 void pjob_delete(const char* sharename, uint32 jobid);
    4943 void start_background_queue(void);
    4944 bool print_notify_register_pid(int snum);
    4945 bool print_notify_deregister_pid(int snum);
    4946 bool print_job_exists(const char* sharename, uint32 jobid);
    4947 int print_job_fd(const char* sharename, uint32 jobid);
    4948 char *print_job_fname(const char* sharename, uint32 jobid);
    4949 NT_DEVICEMODE *print_job_devmode(const char* sharename, uint32 jobid);
    4950 bool print_job_set_place(const char *sharename, uint32 jobid, int place);
    4951 bool print_job_set_name(const char *sharename, uint32 jobid, char *name);
    4952 bool print_job_delete(struct auth_serversupplied_info *server_info, int snum,
    4953                       uint32 jobid, WERROR *errcode);
    4954 bool print_job_pause(struct auth_serversupplied_info *server_info, int snum,
    4955                      uint32 jobid, WERROR *errcode);
    4956 bool print_job_resume(struct auth_serversupplied_info *server_info, int snum,
    4957                       uint32 jobid, WERROR *errcode);
    4958 ssize_t print_job_write(int snum, uint32 jobid, const char *buf, SMB_OFF_T pos, size_t size);
    4959 int print_queue_length(int snum, print_status_struct *pstatus);
    4960 uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum,
    4961                        const char *jobname, NT_DEVICEMODE *nt_devmode );
    4962 void print_job_endpage(int snum, uint32 jobid);
    4963 bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type);
    4964 int print_queue_status(int snum,
    4965                        print_queue_struct **ppqueue,
    4966                        print_status_struct *status);
    4967 WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum);
    4968 WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum);
    4969 WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum);
    4970 
    4971 /* The following definitions come from printing/printing_db.c  */
    4972 
    4973 struct tdb_print_db *get_print_db_byname(const char *printername);
    4974 void release_print_db( struct tdb_print_db *pdb);
    4975 void close_all_print_db(void);
    4976 TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist);
    4977 
    4978 /* The following definitions come from profile/profile.c  */
    4979 
    4980 void set_profile_level(int level, struct server_id src);
    4981 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
    4982 
    4983 /* The following definitions come from registry/reg_api.c  */
    4984 
    4985 WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
    4986                     uint32 desired_access,
    4987                     const struct nt_user_token *token,
    4988                     struct registry_key **pkey);
    4989 WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent,
    4990                    const char *name, uint32 desired_access,
    4991                    struct registry_key **pkey);
    4992 WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key,
    4993                    uint32 idx, char **name, NTTIME *last_write_time);
    4994 WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
    4995                      uint32 idx, char **pname, struct registry_value **pval);
    4996 WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
    4997                       const char *name, struct registry_value **pval);
    4998 WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
    4999                         uint32_t *max_subkeylen, uint32_t *max_subkeysize,
    5000                         uint32_t *num_values, uint32_t *max_valnamelen,
    5001                         uint32_t *max_valbufsize, uint32_t *secdescsize,
    5002                         NTTIME *last_changed_time);
    5003 WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
    5004                      const char *subkeypath, uint32 desired_access,
    5005                      struct registry_key **pkey,
    5006                      enum winreg_CreateAction *paction);
    5007 WERROR reg_deletekey(struct registry_key *parent, const char *path);
    5008 WERROR reg_setvalue(struct registry_key *key, const char *name,
    5009                     const struct registry_value *val);
    5010 WERROR reg_deletevalue(struct registry_key *key, const char *name);
    5011 WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key,
    5012                           struct security_descriptor **psecdesc);
    5013 WERROR reg_setkeysecurity(struct registry_key *key,
    5014                           struct security_descriptor *psecdesc);
    5015 WERROR reg_getversion(uint32_t *version);
    5016 WERROR reg_restorekey(struct registry_key *key, const char *fname);
    5017 WERROR reg_savekey(struct registry_key *key, const char *fname);
    5018 WERROR reg_deleteallvalues(struct registry_key *key);
    5019 WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path,
    5020                      uint32 desired_access, const struct nt_user_token *token,
    5021                      struct registry_key **pkey);
    5022 WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
    5023                                struct registry_key *parent,
    5024                                const char *path);
    5025 WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx,
    5026                                    struct registry_key *parent,
    5027                                    const char *path);
    5028 WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path,
    5029                        uint32 desired_access,
    5030                        const struct nt_user_token *token,
    5031                        enum winreg_CreateAction *paction,
    5032                        struct registry_key **pkey);
    5033 WERROR reg_delete_path(const struct nt_user_token *token,
    5034                        const char *orig_path);
    5035 
    5036 /* The following definitions come from registry/reg_backend_current_version.c  */
    5037 
    5038 
    5039 /* The following definitions come from registry/reg_backend_db.c  */
    5040 
    5041 WERROR init_registry_key(const char *add_path);
    5042 WERROR init_registry_data(void);
    5043 WERROR regdb_init(void);
    5044 WERROR regdb_open( void );
    5045 int regdb_close( void );
    5046 WERROR regdb_transaction_start(void);
    5047 WERROR regdb_transaction_commit(void);
    5048 WERROR regdb_transaction_cancel(void);
    5049 int regdb_get_seqnum(void);
    5050 bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr);
    5051 int regdb_fetch_keys(const char *key, struct regsubkey_ctr *ctr);
    5052 int regdb_fetch_values(const char* key, struct regval_ctr *values);
    5053 bool regdb_store_values(const char *key, struct regval_ctr *values);
    5054 bool regdb_subkeys_need_update(struct regsubkey_ctr *subkeys);
    5055 bool regdb_values_need_update(struct regval_ctr *values);
    5056 
    5057 /* The following definitions come from registry/reg_backend_hkpt_params.c  */
    5058 
    5059 
    5060 /* The following definitions come from registry/reg_backend_netlogon_params.c  */
    5061 
    5062 
    5063 /* The following definitions come from registry/reg_backend_perflib.c  */
    5064 
    5065 
    5066 /* The following definitions come from registry/reg_backend_printing.c  */
    5067 
    5068 
    5069 /* The following definitions come from registry/reg_backend_prod_options.c  */
    5070 
    5071 
    5072 /* The following definitions come from registry/reg_backend_shares.c  */
    5073 
    5074 
    5075 /* The following definitions come from registry/reg_backend_smbconf.c  */
    5076 
    5077 
    5078 /* The following definitions come from registry/reg_backend_tcpip_params.c  */
    5079 
    5080 
    5081 /* The following definitions come from registry/reg_cachehook.c  */
    5082 
    5083 WERROR reghook_cache_init(void);
    5084 WERROR reghook_cache_add(const char *keyname, struct registry_ops *ops);
    5085 struct registry_ops *reghook_cache_find(const char *keyname);
    5086 void reghook_dump_cache( int debuglevel );
    5087 
    5088 /* The following definitions come from registry/reg_dispatcher.c  */
    5089 
    5090 bool store_reg_keys(struct registry_key_handle *key,
    5091                     struct regsubkey_ctr *subkeys);
    5092 bool store_reg_values(struct registry_key_handle *key, struct regval_ctr *val);
    5093 WERROR create_reg_subkey(struct registry_key_handle *key, const char *subkey);
    5094 WERROR delete_reg_subkey(struct registry_key_handle *key, const char *subkey);
    5095 int fetch_reg_keys(struct registry_key_handle *key,
    5096                    struct regsubkey_ctr *subkey_ctr);
    5097 int fetch_reg_values(struct registry_key_handle *key, struct regval_ctr *val);
    5098 bool regkey_access_check(struct registry_key_handle *key, uint32 requested,
    5099                          uint32 *granted,
    5100                          const struct nt_user_token *token);
    5101 WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, struct registry_key_handle *key,
    5102                           struct security_descriptor **psecdesc);
    5103 WERROR regkey_set_secdesc(struct registry_key_handle *key,
    5104                           struct security_descriptor *psecdesc);
    5105 bool reg_subkeys_need_update(struct registry_key_handle *key,
    5106                              struct regsubkey_ctr *subkeys);
    5107 bool reg_values_need_update(struct registry_key_handle *key,
    5108                             struct regval_ctr *values);
    5109 
    5110 /* The following definitions come from registry/reg_eventlog.c  */
    5111 
    5112 bool eventlog_init_keys(void);
    5113 bool eventlog_add_source( const char *eventlog, const char *sourcename,
    5114                           const char *messagefile );
    5115 
    5116 /* The following definitions come from registry/reg_init_basic.c  */
    5117 
    5118 WERROR registry_init_common(void);
    5119 WERROR registry_init_basic(void);
    5120 
    5121 /* The following definitions come from registry/reg_init_full.c  */
    5122 
    5123 WERROR registry_init_full(void);
    5124 
    5125 /* The following definitions come from registry/reg_init_smbconf.c  */
    5126 
    5127 NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx,
    5128                                      NT_USER_TOKEN **ptoken);
    5129 WERROR registry_init_smbconf(const char *keyname);
    5130 
    5131 /* The following definitions come from registry/reg_objects.c  */
    5132 
    5133 WERROR regsubkey_ctr_init(TALLOC_CTX *mem_ctx, struct regsubkey_ctr **ctr);
    5134 WERROR regsubkey_ctr_reinit(struct regsubkey_ctr *ctr);
    5135 WERROR regsubkey_ctr_set_seqnum(struct regsubkey_ctr *ctr, int seqnum);
    5136 int regsubkey_ctr_get_seqnum(struct regsubkey_ctr *ctr);
    5137 WERROR regsubkey_ctr_addkey( struct regsubkey_ctr *ctr, const char *keyname );
    5138 WERROR regsubkey_ctr_delkey( struct regsubkey_ctr *ctr, const char *keyname );
    5139 bool regsubkey_ctr_key_exists( struct regsubkey_ctr *ctr, const char *keyname );
    5140 int regsubkey_ctr_numkeys( struct regsubkey_ctr *ctr );
    5141 char* regsubkey_ctr_specific_key( struct regsubkey_ctr *ctr, uint32 key_index );
    5142 int regval_ctr_numvals(struct regval_ctr *ctr);
    5143 struct regval_blob* dup_registry_value(struct regval_blob *val);
    5144 void free_registry_value(struct regval_blob *val);
    5145 uint8* regval_data_p(struct regval_blob *val);
    5146 uint32 regval_size(struct regval_blob *val);
    5147 char* regval_name(struct regval_blob *val);
    5148 uint32 regval_type(struct regval_blob *val);
    5149 struct regval_blob* regval_ctr_specific_value(struct regval_ctr *ctr,
    5150                                               uint32 idx);
    5151 bool regval_ctr_key_exists(struct regval_ctr *ctr, const char *value);
    5152 struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name,
    5153                                    uint16 type,
    5154                                    const char *data_p, size_t size);
    5155 int regval_ctr_addvalue(struct regval_ctr *ctr, const char *name, uint16 type,
    5156                         const char *data_p, size_t size);
    5157 int regval_ctr_addvalue_sz(struct regval_ctr *ctr, const char *name, const char *data);
    5158 int regval_ctr_addvalue_multi_sz(struct regval_ctr *ctr, const char *name, const char **data);
    5159 int regval_ctr_copyvalue(struct regval_ctr *ctr, struct regval_blob *val);
    5160 int regval_ctr_delvalue(struct regval_ctr *ctr, const char *name);
    5161 struct regval_blob* regval_ctr_getvalue(struct regval_ctr *ctr,
    5162                                         const char *name);
    5163 uint32 regval_dword(struct regval_blob *val);
    5164 const char *regval_sz(struct regval_blob *val);
    5165 
    5166 /* The following definitions come from registry/reg_perfcount.c  */
    5167 
    5168 void perfcount_init_keys( void );
    5169 uint32 reg_perfcount_get_base_index(void);
    5170 uint32 reg_perfcount_get_last_counter(uint32 base_index);
    5171 uint32 reg_perfcount_get_last_help(uint32 last_counter);
    5172 uint32 reg_perfcount_get_counter_help(uint32 base_index, char **retbuf);
    5173 uint32 reg_perfcount_get_counter_names(uint32 base_index, char **retbuf);
    5174 WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbuf_len, const char *object_ids);
    5175 
    5176 /* The following definitions come from registry/reg_util.c  */
    5177 
    5178 bool reg_split_path(char *path, char **base, char **new_path);
    5179 bool reg_split_key(char *path, char **base, char **key);
    5180 char *normalize_reg_path(TALLOC_CTX *ctx, const char *keyname );
    5181 void normalize_dbkey(char *key);
    5182 char *reg_remaining_path(TALLOC_CTX *ctx, const char *key);
    5183 
    5184 /* The following definitions come from registry/reg_util_legacy.c  */
    5185 
    5186 WERROR regkey_open_internal(TALLOC_CTX *ctx,
    5187                             struct registry_key_handle **regkey,
    5188                             const char *path,
    5189                             const struct nt_user_token *token,
    5190                             uint32 access_desired );
    5191 
    5192 /* The following definitions come from registry/regfio.c  */
    5193 
    5194 
    5195 /* The following definitions come from rpc_client/cli_lsarpc.c  */
    5196 
    5197 NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
    5198                                 TALLOC_CTX *mem_ctx,
    5199                                 bool sec_qos, uint32 des_access,
    5200                                 struct policy_handle *pol);
    5201 NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
    5202                                  TALLOC_CTX *mem_ctx, bool sec_qos,
    5203                                  uint32 des_access, struct policy_handle *pol);
    5204 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
    5205                                 TALLOC_CTX *mem_ctx,
    5206                                 struct policy_handle *pol,
    5207                                 int num_sids,
    5208                                 const DOM_SID *sids,
    5209                                 char ***pdomains,
    5210                                 char ***pnames,
    5211                                 enum lsa_SidType **ptypes);
    5212 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
    5213                                  TALLOC_CTX *mem_ctx,
    5214                                  struct policy_handle *pol,
    5215                                  int num_sids,
    5216                                  const DOM_SID *sids,
    5217                                  char ***pdomains,
    5218                                  char ***pnames,
    5219                                  enum lsa_SidType **ptypes);
    5220 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
    5221                                  TALLOC_CTX *mem_ctx,
    5222                                  struct policy_handle *pol, int num_names,
    5223                                  const char **names,
    5224                                  const char ***dom_names,
    5225                                  int level,
    5226                                  DOM_SID **sids,
    5227                                  enum lsa_SidType **types);
    5228 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
    5229                                   TALLOC_CTX *mem_ctx,
    5230                                   struct policy_handle *pol, int num_names,
    5231                                   const char **names,
    5232                                   const char ***dom_names,
    5233                                   int level,
    5234                                   DOM_SID **sids,
    5235                                   enum lsa_SidType **types);
    5236 
    5237 bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid);
    5238 
    5239 /* The following definitions come from rpc_client/cli_netlogon.c  */
    5240 
    5241 NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
    5242                                      const char *server_name,
    5243                                      const char *domain,
    5244                                      const char *clnt_name,
    5245                                      const char *machine_account,
    5246                                      const unsigned char machine_pwd[16],
    5247                                      enum netr_SchannelType sec_chan_type,
    5248                                      uint32_t *neg_flags_inout);
    5249 NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
    5250                                    TALLOC_CTX *mem_ctx,
    5251                                    uint32 logon_parameters,
    5252                                    const char *domain,
    5253                                    const char *username,
    5254                                    const char *password,
    5255                                    const char *workstation,
    5256                                    int logon_type);
    5257 NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
    5258                                            TALLOC_CTX *mem_ctx,
    5259                                            uint32 logon_parameters,
    5260                                            const char *server,
    5261                                            const char *username,
    5262                                            const char *domain,
    5263                                            const char *workstation,
    5264                                            const uint8 chal[8],
    5265                                            uint16_t validation_level,
    5266                                            DATA_BLOB lm_response,
    5267                                            DATA_BLOB nt_response,
    5268                                            struct netr_SamInfo3 **info3);
    5269 NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
    5270                                               TALLOC_CTX *mem_ctx,
    5271                                               uint32 logon_parameters,
    5272                                               const char *server,
    5273                                               const char *username,
    5274                                               const char *domain,
    5275                                               const char *workstation,
    5276                                               const uint8 chal[8],
    5277                                               uint16_t validation_level,
    5278                                               DATA_BLOB lm_response,
    5279                                               DATA_BLOB nt_response,
    5280                                               struct netr_SamInfo3 **info3);
    5281 NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli,
    5282                                             TALLOC_CTX *mem_ctx,
    5283                                             const char *account_name,
    5284                                             const unsigned char orig_trust_passwd_hash[16],
    5285                                             const char *new_trust_pwd_cleartext,
    5286                                             const unsigned char new_trust_passwd_hash[16],
    5287                                             enum netr_SchannelType sec_channel_type);
    5288 
    5289 /* The following definitions come from rpc_client/cli_pipe.c  */
    5290 
    5291 struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
    5292                                          struct event_context *ev,
    5293                                          struct rpc_pipe_client *cli,
    5294                                          uint8_t op_num,
    5295                                          prs_struct *req_data);
    5296 NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    5297                                prs_struct *reply_pdu);
    5298 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
    5299                                       struct event_context *ev,
    5300                                       struct rpc_pipe_client *cli,
    5301                                       struct cli_pipe_auth_data *auth);
    5302 NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
    5303 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
    5304                        struct cli_pipe_auth_data *auth);
    5305 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
    5306                                 unsigned int timeout);
    5307 bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
    5308 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
    5309 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
    5310                                struct cli_pipe_auth_data **presult);
    5311 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
    5312                                    enum dcerpc_AuthLevel auth_level,
    5313                                    struct netlogon_creds_CredentialState *creds,
    5314                                    struct cli_pipe_auth_data **presult);
    5315 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
    5316                            const struct ndr_syntax_id *abstract_syntax,
    5317                            struct rpc_pipe_client **presult);
    5318 NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
    5319                                const struct ndr_syntax_id *abstract_syntax,
    5320                                struct rpc_pipe_client **presult);
    5321 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *abstract_syntax,
    5322                                 NTSTATUS (*dispatch) (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r),
    5323                                 struct auth_serversupplied_info *serversupplied_info,
    5324                                 struct rpc_pipe_client **presult);
    5325 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
    5326                                   const struct ndr_syntax_id *interface,
    5327                                   struct rpc_pipe_client **presult);
    5328 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
    5329                                             enum dcerpc_transport_t transport,
    5330                                             const struct ndr_syntax_id *interface,
    5331                                             struct rpc_pipe_client **presult);
    5332 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
    5333                                    const struct ndr_syntax_id *interface,
    5334                                    enum dcerpc_transport_t transport,
    5335                                    enum dcerpc_AuthLevel auth_level,
    5336                                    const char *domain,
    5337                                    const char *username,
    5338                                    const char *password,
    5339                                    struct rpc_pipe_client **presult);
    5340 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
    5341                                           const struct ndr_syntax_id *interface,
    5342                                           enum dcerpc_transport_t transport,
    5343                                           enum dcerpc_AuthLevel auth_level,
    5344                                           const char *domain,
    5345                                           const char *username,
    5346                                           const char *password,
    5347                                           struct rpc_pipe_client **presult);
    5348 NTSTATUS get_schannel_session_key(struct cli_state *cli,
    5349                                   const char *domain,
    5350                                   uint32 *pneg_flags,
    5351                                   struct rpc_pipe_client **presult);
    5352 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
    5353                                              const struct ndr_syntax_id *interface,
    5354                                              enum dcerpc_transport_t transport,
    5355                                              enum dcerpc_AuthLevel auth_level,
    5356                                              const char *domain,
    5357                                              struct netlogon_creds_CredentialState **pdc,
    5358                                              struct rpc_pipe_client **presult);
    5359 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
    5360                                                  const struct ndr_syntax_id *interface,
    5361                                                  enum dcerpc_transport_t transport,
    5362                                                  enum dcerpc_AuthLevel auth_level,
    5363                                                  const char *domain,
    5364                                                  const char *username,
    5365                                                  const char *password,
    5366                                                  struct rpc_pipe_client **presult);
    5367 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
    5368                                     const struct ndr_syntax_id *interface,
    5369                                     enum dcerpc_transport_t transport,
    5370                                     enum dcerpc_AuthLevel auth_level,
    5371                                     const char *domain,
    5372                                     struct rpc_pipe_client **presult);
    5373 NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
    5374                                 const struct ndr_syntax_id *interface,
    5375                                 enum dcerpc_AuthLevel auth_level,
    5376                                 const char *service_princ,
    5377                                 const char *username,
    5378                                 const char *password,
    5379                                 struct rpc_pipe_client **presult);
    5380 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
    5381                              struct rpc_pipe_client *cli,
    5382                              DATA_BLOB *session_key);
    5383 NTSTATUS rpc_pipe_open_local(TALLOC_CTX *mem_ctx,
    5384                              struct rpc_cli_smbd_conn *conn,
    5385                              const struct ndr_syntax_id *syntax,
    5386                              struct rpc_pipe_client **presult);
    5387 
    5388 /* The following definitions come from rpc_client/rpc_transport_np.c  */
    5389 
    5390 struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
    5391                                               struct event_context *ev,
    5392                                               struct cli_state *cli,
    5393                                               const struct ndr_syntax_id *abstract_syntax);
    5394 NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
    5395                                     TALLOC_CTX *mem_ctx,
    5396                                     struct rpc_cli_transport **presult);
    5397 NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
    5398                                const struct ndr_syntax_id *abstract_syntax,
    5399                                struct rpc_cli_transport **presult);
    5400 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
    5401 
    5402 /* The following definitions come from rpc_client/rpc_transport_smbd.c  */
    5403 
    5404 struct tevent_req *rpc_cli_smbd_conn_init_send(TALLOC_CTX *mem_ctx,
    5405                                                struct event_context *ev,
    5406                                                void (*stdout_callback)(char *buf,
    5407                                                                        size_t len,
    5408                                                                        void *priv),
    5409                                                void *priv);
    5410 NTSTATUS rpc_cli_smbd_conn_init_recv(struct tevent_req *req,
    5411                                      TALLOC_CTX *mem_ctx,
    5412                                      struct rpc_cli_smbd_conn **pconn);
    5413 NTSTATUS rpc_cli_smbd_conn_init(TALLOC_CTX *mem_ctx,
    5414                                 struct rpc_cli_smbd_conn **pconn,
    5415                                 void (*stdout_callback)(char *buf,
    5416                                                         size_t len,
    5417                                                         void *priv),
    5418                                 void *priv);
    5419 
    5420 struct tevent_req *rpc_transport_smbd_init_send(TALLOC_CTX *mem_ctx,
    5421                                                 struct event_context *ev,
    5422                                                 struct rpc_cli_smbd_conn *conn,
    5423                                                 const struct ndr_syntax_id *abstract_syntax);
    5424 NTSTATUS rpc_transport_smbd_init_recv(struct tevent_req *req,
    5425                                       TALLOC_CTX *mem_ctx,
    5426                                       struct rpc_cli_transport **presult);
    5427 NTSTATUS rpc_transport_smbd_init(TALLOC_CTX *mem_ctx,
    5428                                  struct rpc_cli_smbd_conn *conn,
    5429                                  const struct ndr_syntax_id *abstract_syntax,
    5430                                  struct rpc_cli_transport **presult);
    5431 struct cli_state *rpc_pipe_smbd_smb_conn(struct rpc_pipe_client *p);
    5432 
    5433 /* The following definitions come from rpc_client/rpc_transport_sock.c  */
    5434 
    5435 NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
    5436                                  struct rpc_cli_transport **presult);
    5437 
    5438 /* The following definitions come from rpc_client/cli_samr.c  */
    5439 
    5440 NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
    5441                                     TALLOC_CTX *mem_ctx,
    5442                                     struct policy_handle *user_handle,
    5443                                     const char *newpassword,
    5444                                     const char *oldpassword);
    5445 NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli,
    5446                                      TALLOC_CTX *mem_ctx,
    5447                                      const char *username,
    5448                                      const char *newpassword,
    5449                                      const char *oldpassword);
    5450 NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
    5451                                          TALLOC_CTX *mem_ctx,
    5452                                          const char *username,
    5453                                          DATA_BLOB new_nt_password_blob,
    5454                                          DATA_BLOB old_nt_hash_enc_blob,
    5455                                          DATA_BLOB new_lm_password_blob,
    5456                                          DATA_BLOB old_lm_hash_enc_blob);
    5457 NTSTATUS rpccli_samr_chgpasswd_user3(struct rpc_pipe_client *cli,
    5458                                      TALLOC_CTX *mem_ctx,
    5459                                      const char *username,
    5460                                      const char *newpassword,
    5461                                      const char *oldpassword,
    5462                                      struct samr_DomInfo1 **dominfo1,
    5463                                      struct samr_ChangeReject **reject);
    5464 void get_query_dispinfo_params(int loop_count, uint32 *max_entries,
    5465                                uint32 *max_size);
    5466 NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
    5467                                   TALLOC_CTX *mem_ctx,
    5468                                   uint32_t access_mask,
    5469                                   struct policy_handle *connect_pol);
    5470 
    5471 /* The following definitions come from rpc_client/cli_spoolss.c  */
    5472 
    5473 WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
    5474                                      TALLOC_CTX *mem_ctx,
    5475                                      const char *printername,
    5476                                      uint32_t access_desired,
    5477                                      struct policy_handle *handle);
    5478 WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
    5479                                        TALLOC_CTX *mem_ctx,
    5480                                        struct policy_handle *handle,
    5481                                        const char *architecture,
    5482                                        uint32_t level,
    5483                                        uint32_t offered,
    5484                                        union spoolss_DriverInfo *info);
    5485 WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli,
    5486                                         TALLOC_CTX *mem_ctx,
    5487                                         struct policy_handle *handle,
    5488                                         const char *architecture,
    5489                                         uint32_t level,
    5490                                         uint32_t offered,
    5491                                         uint32_t client_major_version,
    5492                                         uint32_t client_minor_version,
    5493                                         union spoolss_DriverInfo *info,
    5494                                         uint32_t *server_major_version,
    5495                                         uint32_t *server_minor_version);
    5496 WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli,
    5497                                    TALLOC_CTX *mem_ctx,
    5498                                    struct spoolss_SetPrinterInfoCtr *info_ctr);
    5499 WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli,
    5500                                  TALLOC_CTX *mem_ctx,
    5501                                  struct policy_handle *handle,
    5502                                  uint32_t level,
    5503                                  uint32_t offered,
    5504                                  union spoolss_PrinterInfo *info);
    5505 WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli,
    5506                              TALLOC_CTX *mem_ctx,
    5507                              struct policy_handle *handle,
    5508                              uint32_t job_id,
    5509                              uint32_t level,
    5510                              uint32_t offered,
    5511                              union spoolss_JobInfo *info);
    5512 WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli,
    5513                                 TALLOC_CTX *mem_ctx,
    5514                                 struct policy_handle *handle,
    5515                                 uint32_t level,
    5516                                 uint32_t offered,
    5517                                 uint32_t *count,
    5518                                 union spoolss_FormInfo **info);
    5519 WERROR rpccli_spoolss_enumprintprocessors(struct rpc_pipe_client *cli,
    5520                                           TALLOC_CTX *mem_ctx,
    5521                                           const char *servername,
    5522                                           const char *environment,
    5523                                           uint32_t level,
    5524                                           uint32_t offered,
    5525                                           uint32_t *count,
    5526                                           union spoolss_PrintProcessorInfo **info);
    5527 WERROR rpccli_spoolss_enumprintprocessordatatypes(struct rpc_pipe_client *cli,
    5528                                                   TALLOC_CTX *mem_ctx,
    5529                                                   const char *servername,
    5530                                                   const char *print_processor_name,
    5531                                                   uint32_t level,
    5532                                                   uint32_t offered,
    5533                                                   uint32_t *count,
    5534                                                   union spoolss_PrintProcDataTypesInfo **info);
    5535 WERROR rpccli_spoolss_enumports(struct rpc_pipe_client *cli,
    5536                                 TALLOC_CTX *mem_ctx,
    5537                                 const char *servername,
    5538                                 uint32_t level,
    5539                                 uint32_t offered,
    5540                                 uint32_t *count,
    5541                                 union spoolss_PortInfo **info);
    5542 WERROR rpccli_spoolss_enummonitors(struct rpc_pipe_client *cli,
    5543                                    TALLOC_CTX *mem_ctx,
    5544                                    const char *servername,
    5545                                    uint32_t level,
    5546                                    uint32_t offered,
    5547                                    uint32_t *count,
    5548                                    union spoolss_MonitorInfo **info);
    5549 WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
    5550                                TALLOC_CTX *mem_ctx,
    5551                                struct policy_handle *handle,
    5552                                uint32_t firstjob,
    5553                                uint32_t numjobs,
    5554                                uint32_t level,
    5555                                uint32_t offered,
    5556                                uint32_t *count,
    5557                                union spoolss_JobInfo **info);
    5558 WERROR rpccli_spoolss_enumprinterdrivers(struct rpc_pipe_client *cli,
    5559                                          TALLOC_CTX *mem_ctx,
    5560                                          const char *server,
    5561                                          const char *environment,
    5562                                          uint32_t level,
    5563                                          uint32_t offered,
    5564                                          uint32_t *count,
    5565                                          union spoolss_DriverInfo **info);
    5566 WERROR rpccli_spoolss_enumprinters(struct rpc_pipe_client *cli,
    5567                                    TALLOC_CTX *mem_ctx,
    5568                                    uint32_t flags,
    5569                                    const char *server,
    5570                                    uint32_t level,
    5571                                    uint32_t offered,
    5572                                    uint32_t *count,
    5573                                    union spoolss_PrinterInfo **info);
    5574 WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
    5575                                      TALLOC_CTX *mem_ctx,
    5576                                      struct policy_handle *handle,
    5577                                      const char *value_name,
    5578                                      uint32_t offered,
    5579                                      enum winreg_Type *type,
    5580                                      uint32_t *needed_p,
    5581                                      uint8_t **data_p);
    5582 WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli,
    5583                                      TALLOC_CTX *mem_ctx,
    5584                                      struct policy_handle *handle,
    5585                                      const char *key_name,
    5586                                      const char ***key_buffer,
    5587                                      uint32_t offered);
    5588 WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli,
    5589                                         TALLOC_CTX *mem_ctx,
    5590                                         struct policy_handle *handle,
    5591                                         const char *key_name,
    5592                                         uint32_t offered,
    5593                                         uint32_t *count,
    5594                                         struct spoolss_PrinterEnumValues **info);
    5595 
    5596 /* The following definitions come from rpc_client/init_spoolss.c  */
    5597 
    5598 bool init_systemtime(struct spoolss_Time *r,
    5599                      struct tm *unixtime);
    5600 WERROR pull_spoolss_PrinterData(TALLOC_CTX *mem_ctx,
    5601                                 const DATA_BLOB *blob,
    5602                                 union spoolss_PrinterData *data,
    5603                                 enum winreg_Type type);
    5604 WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
    5605                                 enum winreg_Type type,
    5606                                 union spoolss_PrinterData *data);
    5607 void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *i,
    5608                                              struct spoolss_SetPrinterInfo2 *s);
    5609 
    5610 /* The following definitions come from rpc_client/init_lsa.c  */
    5611 
    5612 void init_lsa_String(struct lsa_String *name, const char *s);
    5613 void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s);
    5614 void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s);
    5615 void init_lsa_AsciiStringLarge(struct lsa_AsciiStringLarge *name, const char *s);
    5616 
    5617 /* The following definitions come from rpc_client/init_netlogon.c  */
    5618 
    5619 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
    5620                                 uint8_t *pipe_session_key,
    5621                                 size_t pipe_session_key_len,
    5622                                 struct netr_SamInfo2 *sam2);
    5623 NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info,
    5624                                 uint8_t *pipe_session_key,
    5625                                 size_t pipe_session_key_len,
    5626                                 struct netr_SamInfo3 *sam3);
    5627 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
    5628                                 uint8_t *pipe_session_key,
    5629                                 size_t pipe_session_key_len,
    5630                                 struct netr_SamInfo6 *sam6);
    5631 void init_netr_CryptPassword(const char *pwd,
    5632                              unsigned char session_key[16],
    5633                              struct netr_CryptPassword *pwd_buf);
    5634 
    5635 /* The following definitions come from rpc_client/init_samr.c  */
    5636 
    5637 void init_samr_CryptPasswordEx(const char *pwd,
    5638                                DATA_BLOB *session_key,
    5639                                struct samr_CryptPasswordEx *pwd_buf);
    5640 void init_samr_CryptPassword(const char *pwd,
    5641                              DATA_BLOB *session_key,
    5642                              struct samr_CryptPassword *pwd_buf);
    5643 
    5644 /* The following definitions come from rpc_client/ndr.c  */
    5645 
    5646 struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
    5647                                        struct tevent_context *ev,
    5648                                        struct rpc_pipe_client *cli,
    5649                                        const struct ndr_interface_table *table,
    5650                                        uint32_t opnum,
    5651                                        void *r);
    5652 NTSTATUS cli_do_rpc_ndr_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
    5653 NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
    5654                         TALLOC_CTX *mem_ctx,
    5655                         const struct ndr_interface_table *table,
    5656                         uint32 opnum, void *r);
    5657 
    5658 /* The following definitions come from rpc_parse/parse_misc.c  */
    5659 
    5660 bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth);
    5661 bool smb_io_uuid(const char *desc, struct GUID *uuid,
    5662                  prs_struct *ps, int depth);
    5663 
    5664 /* The following definitions come from rpc_parse/parse_prs.c  */
    5665 
    5666 void prs_dump(const char *name, int v, prs_struct *ps);
    5667 void prs_dump_before(const char *name, int v, prs_struct *ps);
    5668 void prs_dump_region(const char *name, int v, prs_struct *ps,
    5669                      int from_off, int to_off);
    5670 void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name);
    5671 bool prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, bool io);
    5672 void prs_mem_free(prs_struct *ps);
    5673 void prs_mem_clear(prs_struct *ps);
    5674 char *prs_alloc_mem_(prs_struct *ps, size_t size, unsigned int count);
    5675 char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count);
    5676 TALLOC_CTX *prs_get_mem_context(prs_struct *ps);
    5677 void prs_give_memory(prs_struct *ps, char *buf, uint32 size, bool is_dynamic);
    5678 char *prs_take_memory(prs_struct *ps, uint32 *psize);
    5679 bool prs_set_buffer_size(prs_struct *ps, uint32 newsize);
    5680 bool prs_grow(prs_struct *ps, uint32 extra_space);
    5681 bool prs_force_grow(prs_struct *ps, uint32 extra_space);
    5682 char *prs_data_p(prs_struct *ps);
    5683 uint32 prs_data_size(prs_struct *ps);
    5684 uint32 prs_offset(prs_struct *ps);
    5685 bool prs_set_offset(prs_struct *ps, uint32 offset);
    5686 bool prs_append_prs_data(prs_struct *dst, prs_struct *src);
    5687 bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start,
    5688                           uint32_t len);
    5689 bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len);
    5690 bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len);
    5691 bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len);
    5692 bool prs_copy_all_data_out(char *dst, prs_struct *src);
    5693 void prs_set_endian_data(prs_struct *ps, bool endian);
    5694 bool prs_align(prs_struct *ps);
    5695 bool prs_align_uint16(prs_struct *ps);
    5696 bool prs_align_uint64(prs_struct *ps);
    5697 bool prs_align_custom(prs_struct *ps, uint8 boundary);
    5698 bool prs_align_needed(prs_struct *ps, uint32 needed);
    5699 char *prs_mem_get(prs_struct *ps, uint32 extra_size);
    5700 void prs_switch_type(prs_struct *ps, bool io);
    5701 void prs_force_dynamic(prs_struct *ps);
    5702 void prs_set_session_key(prs_struct *ps, const char sess_key[16]);
    5703 bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8);
    5704 bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16);
    5705 bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32);
    5706 bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32);
    5707 bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64);
    5708 bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
    5709 bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len);
    5710 bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
    5711 bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len);
    5712 bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str);
    5713 bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
    5714 bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
    5715 
    5716 /* The following definitions come from rpc_parse/parse_rpc.c  */
    5717 
    5718 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
    5719 const struct ndr_interface_table *get_iface_from_syntax(
    5720         const struct ndr_syntax_id *syntax);
    5721 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
    5722                                       const struct ndr_syntax_id *syntax);
    5723 void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_pkt_type pkt_type, uint8 flags,
    5724                                 uint32 call_id, int data_len, int auth_len);
    5725 bool smb_io_rpc_hdr(const char *desc,  RPC_HDR *rpc, prs_struct *ps, int depth);
    5726 void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
    5727                       const struct ndr_syntax_id *abstract,
    5728                       const struct ndr_syntax_id *transfer);
    5729 void init_rpc_hdr_rb(RPC_HDR_RB *rpc,
    5730                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
    5731                                 RPC_CONTEXT *context);
    5732 bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth);
    5733 bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth);
    5734 void init_rpc_hdr_ba(RPC_HDR_BA *rpc,
    5735                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
    5736                                 const char *pipe_addr,
    5737                                 uint8 num_results, uint16 result, uint16 reason,
    5738                                 const struct ndr_syntax_id *transfer);
    5739 bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth);
    5740 void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum);
    5741 bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth);
    5742 bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth);
    5743 bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth);
    5744 void init_rpc_hdr_auth(RPC_HDR_AUTH *rai,
    5745                                 uint8 auth_type, uint8 auth_level,
    5746                                 uint8 auth_pad_len,
    5747                                 uint32 auth_context_id);
    5748 bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
    5749 
    5750 /* The following definitions come from lib/eventlog/eventlog.c  */
    5751 
    5752 TDB_CONTEXT *elog_init_tdb( char *tdbfilename );
    5753 char *elog_tdbname(TALLOC_CTX *ctx, const char *name );
    5754 int elog_tdb_size( TDB_CONTEXT * tdb, int *MaxSize, int *Retention );
    5755 bool prune_eventlog( TDB_CONTEXT * tdb );
    5756 ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only );
    5757 int elog_close_tdb( ELOG_TDB *etdb, bool force_close );
    5758 bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, struct eventlog_Record_tdb *entry, bool * eor );
    5759 size_t fixup_eventlog_record_tdb(struct eventlog_Record_tdb *r);
    5760 struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx,
    5761                                                   TDB_CONTEXT *tdb,
    5762                                                   uint32_t record_number);
    5763 NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx,
    5764                                TDB_CONTEXT *tdb,
    5765                                struct eventlog_Record_tdb *r,
    5766                                uint32_t *record_number);
    5767 NTSTATUS evlog_push_record(TALLOC_CTX *mem_ctx,
    5768                            TDB_CONTEXT *tdb,
    5769                            struct EVENTLOGRECORD *r,
    5770                            uint32_t *record_number);
    5771 struct EVENTLOGRECORD *evlog_pull_record(TALLOC_CTX *mem_ctx,
    5772                                          TDB_CONTEXT *tdb,
    5773                                          uint32_t record_number);
    5774 NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx,
    5775                                       const struct EVENTLOGRECORD *e,
    5776                                       struct eventlog_Record_tdb *t);
    5777 NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
    5778                                       const struct eventlog_Record_tdb *t,
    5779                                       struct EVENTLOGRECORD *e);
    5780 NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx,
    5781                                   ELOG_TDB *etdb,
    5782                                   DATA_BLOB *blob_p,
    5783                                   uint32_t *num_records_p);
    5784 
    5785 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
    5786 
    5787 /* The following definitions come from rpc_server/srv_lsa_hnd.c  */
    5788 
    5789 size_t num_pipe_handles(struct handle_list *list);
    5790 bool init_pipe_handle_list(pipes_struct *p,
    5791                            const struct ndr_syntax_id *syntax);
    5792 bool create_policy_hnd(pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
    5793 bool find_policy_by_hnd(pipes_struct *p, const struct policy_handle *hnd,
    5794                         void **data_p);
    5795 bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd);
    5796 void close_policy_by_pipe(pipes_struct *p);
    5797 bool pipe_access_check(pipes_struct *p);
    5798 
    5799 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
    5800                             uint32_t access_granted, size_t data_size,
    5801                             const char *type, NTSTATUS *pstatus);
    5802 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
    5803         (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
    5804                                        (_pstatus))
    5805 
    5806 void *_policy_handle_find(struct pipes_struct *p,
    5807                           const struct policy_handle *hnd,
    5808                           uint32_t access_required, uint32_t *paccess_granted,
    5809                           const char *name, const char *location,
    5810                           NTSTATUS *pstatus);
    5811 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
    5812         (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
    5813                                      (_access_granted), #_type, __location__, (_pstatus))
    5814 
    5815 
    5816 /* The following definitions come from rpc_server/srv_pipe.c  */
    5817 
    5818 bool create_next_pdu(pipes_struct *p);
    5819 bool api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p);
    5820 bool setup_fault_pdu(pipes_struct *p, NTSTATUS status);
    5821 bool setup_cancel_ack_reply(pipes_struct *p, prs_struct *rpc_in_p);
    5822 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
    5823                                     const char *srv,
    5824                                     const struct ndr_syntax_id *interface,
    5825                                     const struct api_struct *cmds, int size);
    5826 NTSTATUS rpc_srv_register(int version, const char *clnt,
    5827                           const char *srv,
    5828                           const struct ndr_interface_table *iface,
    5829                           const struct api_struct *cmds, int size);
    5830 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
    5831 bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p);
    5832 bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p);
    5833 bool api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in,
    5834                                         uint32 *p_ss_padding_len, NTSTATUS *pstatus);
    5835 bool api_pipe_schannel_process(pipes_struct *p, prs_struct *rpc_in, uint32 *p_ss_padding_len);
    5836 void free_pipe_rpc_context( PIPE_RPC_FNS *list );
    5837 bool api_pipe_request(pipes_struct *p);
    5838 
    5839 /* The following definitions come from rpc_server/srv_pipe_hnd.c  */
    5840 
    5841 pipes_struct *get_first_internal_pipe(void);
    5842 pipes_struct *get_next_internal_pipe(pipes_struct *p);
    5843 
    5844 bool fsp_is_np(struct files_struct *fsp);
    5845 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
    5846                  const char *client_address,
    5847                  struct auth_serversupplied_info *server_info,
    5848                  struct fake_file_handle **phandle);
    5849 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    5850                                  struct fake_file_handle *handle,
    5851                                  const uint8_t *data, size_t len);
    5852 NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
    5853 struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    5854                                 struct fake_file_handle *handle,
    5855                                 uint8_t *data, size_t len);
    5856 NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
    5857                       bool *is_data_outstanding);
    5858 
    5859 /* The following definitions come from rpc_server/srv_samr_util.c  */
    5860 
    5861 void copy_id2_to_sam_passwd(struct samu *to,
    5862                             struct samr_UserInfo2 *from);
    5863 void copy_id4_to_sam_passwd(struct samu *to,
    5864                             struct samr_UserInfo4 *from);
    5865 void copy_id6_to_sam_passwd(struct samu *to,
    5866                             struct samr_UserInfo6 *from);
    5867 void copy_id8_to_sam_passwd(struct samu *to,
    5868                             struct samr_UserInfo8 *from);
    5869 void copy_id10_to_sam_passwd(struct samu *to,
    5870                              struct samr_UserInfo10 *from);
    5871 void copy_id11_to_sam_passwd(struct samu *to,
    5872                              struct samr_UserInfo11 *from);
    5873 void copy_id12_to_sam_passwd(struct samu *to,
    5874                              struct samr_UserInfo12 *from);
    5875 void copy_id13_to_sam_passwd(struct samu *to,
    5876                              struct samr_UserInfo13 *from);
    5877 void copy_id14_to_sam_passwd(struct samu *to,
    5878                              struct samr_UserInfo14 *from);
    5879 void copy_id16_to_sam_passwd(struct samu *to,
    5880                              struct samr_UserInfo16 *from);
    5881 void copy_id17_to_sam_passwd(struct samu *to,
    5882                              struct samr_UserInfo17 *from);
    5883 void copy_id18_to_sam_passwd(struct samu *to,
    5884                              struct samr_UserInfo18 *from);
    5885 void copy_id20_to_sam_passwd(struct samu *to,
    5886                              struct samr_UserInfo20 *from);
    5887 void copy_id21_to_sam_passwd(const char *log_prefix,
    5888                              struct samu *to,
    5889                              struct samr_UserInfo21 *from);
    5890 void copy_id23_to_sam_passwd(struct samu *to,
    5891                              struct samr_UserInfo23 *from);
    5892 void copy_id24_to_sam_passwd(struct samu *to,
    5893                              struct samr_UserInfo24 *from);
    5894 void copy_id25_to_sam_passwd(struct samu *to,
    5895                              struct samr_UserInfo25 *from);
    5896 void copy_id26_to_sam_passwd(struct samu *to,
    5897                              struct samr_UserInfo26 *from);
    5898 
    5899 /* The following definitions come from rpc_server/srv_spoolss_nt.c  */
    5900 
    5901 void do_drv_upgrade_printer(struct messaging_context *msg,
    5902                             void *private_data,
    5903                             uint32_t msg_type,
    5904                             struct server_id server_id,
    5905                             DATA_BLOB *data);
    5906 void update_monitored_printq_cache( void );
    5907 void reset_all_printerdata(struct messaging_context *msg,
    5908                            void *private_data,
    5909                            uint32_t msg_type,
    5910                            struct server_id server_id,
    5911                            DATA_BLOB *data);
    5912 bool convert_devicemode(const char *printername,
    5913                         const struct spoolss_DeviceMode *devmode,
    5914                         NT_DEVICEMODE **pp_nt_devmode);
    5915 WERROR set_printer_dataex(NT_PRINTER_INFO_LEVEL *printer,
    5916                           const char *key, const char *value,
    5917                           uint32_t type, uint8_t *data, int real_len);
    5918 void spoolss_notify_server_name(int snum,
    5919                                        struct spoolss_Notify *data,
    5920                                        print_queue_struct *queue,
    5921                                        NT_PRINTER_INFO_LEVEL *printer,
    5922                                        TALLOC_CTX *mem_ctx);
    5923 void spoolss_notify_printer_name(int snum,
    5924                                         struct spoolss_Notify *data,
    5925                                         print_queue_struct *queue,
    5926                                         NT_PRINTER_INFO_LEVEL *printer,
    5927                                         TALLOC_CTX *mem_ctx);
    5928 void spoolss_notify_share_name(int snum,
    5929                                       struct spoolss_Notify *data,
    5930                                       print_queue_struct *queue,
    5931                                       NT_PRINTER_INFO_LEVEL *printer,
    5932                                       TALLOC_CTX *mem_ctx);
    5933 void spoolss_notify_port_name(int snum,
    5934                                      struct spoolss_Notify *data,
    5935                                      print_queue_struct *queue,
    5936                                      NT_PRINTER_INFO_LEVEL *printer,
    5937                                      TALLOC_CTX *mem_ctx);
    5938 void spoolss_notify_driver_name(int snum,
    5939                                        struct spoolss_Notify *data,
    5940                                        print_queue_struct *queue,
    5941                                        NT_PRINTER_INFO_LEVEL *printer,
    5942                                        TALLOC_CTX *mem_ctx);
    5943 void spoolss_notify_comment(int snum,
    5944                                    struct spoolss_Notify *data,
    5945                                    print_queue_struct *queue,
    5946                                    NT_PRINTER_INFO_LEVEL *printer,
    5947                                    TALLOC_CTX *mem_ctx);
    5948 void spoolss_notify_location(int snum,
    5949                                     struct spoolss_Notify *data,
    5950                                     print_queue_struct *queue,
    5951                                     NT_PRINTER_INFO_LEVEL *printer,
    5952                                     TALLOC_CTX *mem_ctx);
    5953 void spoolss_notify_sepfile(int snum,
    5954                                    struct spoolss_Notify *data,
    5955                                    print_queue_struct *queue,
    5956                                    NT_PRINTER_INFO_LEVEL *printer,
    5957                                    TALLOC_CTX *mem_ctx);
    5958 void spoolss_notify_print_processor(int snum,
    5959                                            struct spoolss_Notify *data,
    5960                                            print_queue_struct *queue,
    5961                                            NT_PRINTER_INFO_LEVEL *printer,
    5962                                            TALLOC_CTX *mem_ctx);
    5963 void spoolss_notify_parameters(int snum,
    5964                                       struct spoolss_Notify *data,
    5965                                       print_queue_struct *queue,
    5966                                       NT_PRINTER_INFO_LEVEL *printer,
    5967                                       TALLOC_CTX *mem_ctx);
    5968 void spoolss_notify_datatype(int snum,
    5969                                     struct spoolss_Notify *data,
    5970                                     print_queue_struct *queue,
    5971                                     NT_PRINTER_INFO_LEVEL *printer,
    5972                                     TALLOC_CTX *mem_ctx);
    5973 void spoolss_notify_attributes(int snum,
    5974                                       struct spoolss_Notify *data,
    5975                                       print_queue_struct *queue,
    5976                                       NT_PRINTER_INFO_LEVEL *printer,
    5977                                       TALLOC_CTX *mem_ctx);
    5978 void spoolss_notify_cjobs(int snum,
    5979                                  struct spoolss_Notify *data,
    5980                                  print_queue_struct *queue,
    5981                                  NT_PRINTER_INFO_LEVEL *printer,
    5982                                  TALLOC_CTX *mem_ctx);
    5983 void construct_info_data(struct spoolss_Notify *info_data,
    5984                          enum spoolss_NotifyType type,
    5985                          uint16_t field,
    5986                          int id);
    5987 struct spoolss_DeviceMode *construct_dev_mode(TALLOC_CTX *mem_ctx,
    5988                                               const char *servicename);
    5989 bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer);
    5990 
    5991 /* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
    5992 
    5993 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
    5994 
    5995 /* The following definitions come from rpc_server/srv_svcctl_nt.c  */
    5996 
    5997 bool init_service_op_table( void );
    5998 
    5999 /* The following definitions come from rpcclient/cmd_dfs.c  */
    6000 
    6001 
    6002 /* The following definitions come from rpcclient/cmd_dssetup.c  */
    6003 
    6004 
    6005 /* The following definitions come from rpcclient/cmd_echo.c  */
    6006 
    6007 
    6008 /* The following definitions come from rpcclient/cmd_lsarpc.c  */
    6009 
    6010 
    6011 /* The following definitions come from rpcclient/cmd_netlogon.c  */
    6012 
    6013 
    6014 /* The following definitions come from rpcclient/cmd_ntsvcs.c  */
    6015 
    6016 
    6017 /* The following definitions come from rpcclient/cmd_samr.c  */
    6018 
    6019 
    6020 /* The following definitions come from rpcclient/cmd_shutdown.c  */
    6021 
    6022 
    6023 /* The following definitions come from rpcclient/cmd_spoolss.c  */
    6024 
    6025 
    6026 /* The following definitions come from rpcclient/cmd_srvsvc.c  */
    6027 
    6028 
    6029 /* The following definitions come from rpcclient/cmd_test.c  */
    6030 
    6031 
    6032 /* The following definitions come from rpcclient/cmd_wkssvc.c  */
    6033 
    6034 
    6035 /* The following definitions come from rpcclient/rpcclient.c  */
    6036 
    6037 
    6038 /* The following definitions come from services/services_db.c  */
    6039 
    6040 void svcctl_init_keys( void );
    6041 SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token );
    6042 bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc, NT_USER_TOKEN *token );
    6043 const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token );
    6044 const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token );
    6045 struct regval_ctr *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token );
    6046 
    6047 /* The following definitions come from services/svc_netlogon.c  */
    6048 
    6049 
    6050 /* The following definitions come from services/svc_rcinit.c  */
    6051 
    6052 
    6053 /* The following definitions come from services/svc_spoolss.c  */
    6054 
    6055 
    6056 /* The following definitions come from services/svc_winreg.c  */
    6057 
    6058 
    6059 /* The following definitions come from services/svc_wins.c  */
    6060 
    6061 
    6062 /* The following definitions come from smbd/aio.c  */
    6063 
    6064 void initialize_async_io_handler(void);
    6065 bool schedule_aio_read_and_X(connection_struct *conn,
    6066                              struct smb_request *req,
    6067                              files_struct *fsp, SMB_OFF_T startpos,
    6068                              size_t smb_maxcnt);
    6069 bool schedule_aio_write_and_X(connection_struct *conn,
    6070                               struct smb_request *req,
    6071                               files_struct *fsp, char *data,
    6072                               SMB_OFF_T startpos,
    6073                               size_t numtowrite);
    6074 int wait_for_aio_completion(files_struct *fsp);
    6075 void cancel_aio_by_fsp(files_struct *fsp);
    6076 void smbd_aio_complete_mid(unsigned int mid);
    6077 
    6078 /* The following definitions come from smbd/blocking.c  */
    6079 
    6080 void process_blocking_lock_queue(void);
    6081 bool push_blocking_lock_request( struct byte_range_lock *br_lck,
    6082                 struct smb_request *req,
    6083                 files_struct *fsp,
    6084                 int lock_timeout,
    6085                 int lock_num,
    6086                 uint32 lock_pid,
    6087                 enum brl_type lock_type,
    6088                 enum brl_flavour lock_flav,
    6089                 uint64_t offset,
    6090                 uint64_t count,
    6091                 uint32 blocking_pid);
    6092 void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck);
    6093 void remove_pending_lock_requests_by_mid(int mid);
    6094 bool blocking_lock_was_deferred(int mid);
    6095 struct blocking_lock_record *blocking_lock_cancel(files_struct *fsp,
    6096                         uint32 lock_pid,
    6097                         uint64_t offset,
    6098                         uint64_t count,
    6099                         enum brl_flavour lock_flav,
    6100                         unsigned char locktype,
    6101                         NTSTATUS err);
    6102 
    6103 /* The following definitions come from smbd/change_trust_pw.c  */
    6104 
    6105 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
    6106 
    6107 /* The following definitions come from smbd/chgpasswd.c  */
    6108 
    6109 bool chgpasswd(const char *name, const struct passwd *pass,
    6110                const char *oldpass, const char *newpass, bool as_root);
    6111 bool chgpasswd(const char *name, const struct passwd *pass,
    6112                const char *oldpass, const char *newpass, bool as_root);
    6113 bool check_lanman_password(char *user, uchar * pass1,
    6114                            uchar * pass2, struct samu **hnd);
    6115 bool change_lanman_password(struct samu *sampass, uchar *pass2);
    6116 NTSTATUS pass_oem_change(char *user,
    6117                          uchar password_encrypted_with_lm_hash[516],
    6118                          const uchar old_lm_hash_encrypted[16],
    6119                          uchar password_encrypted_with_nt_hash[516],
    6120                          const uchar old_nt_hash_encrypted[16],
    6121                          uint32 *reject_reason);
    6122 bool password_in_history(uint8_t nt_pw[NT_HASH_LEN],
    6123                          uint32_t pw_history_len,
    6124                          const uint8_t *pw_history);
    6125 NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passwd, bool as_root, uint32 *samr_reject_reason);
    6126 
    6127 /* The following definitions come from smbd/close.c  */
    6128 
    6129 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
    6130 NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
    6131                     enum file_close_type close_type);
    6132 void msg_close_file(struct messaging_context *msg_ctx,
    6133                     void *private_data,
    6134                     uint32_t msg_type,
    6135                     struct server_id server_id,
    6136                     DATA_BLOB *data);
    6137 NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
    6138 
    6139 /* The following definitions come from smbd/conn.c  */
    6140 
    6141 void conn_init(struct smbd_server_connection *sconn);
    6142 int conn_num_open(struct smbd_server_connection *sconn);
    6143 bool conn_snum_used(int snum);
    6144 connection_struct *conn_find(struct smbd_server_connection *sconn,
    6145                              unsigned cnum);
    6146 connection_struct *conn_new(struct smbd_server_connection *sconn);
    6147 bool conn_close_all(struct smbd_server_connection *sconn);
    6148 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
    6149 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
    6150 void conn_free(connection_struct *conn);
    6151 void msg_force_tdis(struct messaging_context *msg,
    6152                     void *private_data,
    6153                     uint32_t msg_type,
    6154                     struct server_id server_id,
    6155                     DATA_BLOB *data);
    6156 
    6157 /* The following definitions come from smbd/connection.c  */
    6158 
    6159 bool yield_connection(connection_struct *conn, const char *name);
    6160 int count_current_connections( const char *sharename, bool clear  );
    6161 int count_all_current_connections(void);
    6162 bool claim_connection(connection_struct *conn, const char *name,
    6163                       uint32 msg_flags);
    6164 bool register_message_flags(bool doreg, uint32 msg_flags);
    6165 
    6166 /* The following definitions come from smbd/dfree.c  */
    6167 
    6168 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
    6169                               uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    6170 uint64_t get_dfree_info(connection_struct *conn,
    6171                         const char *path,
    6172                         bool small_query,
    6173                         uint64_t *bsize,
    6174                         uint64_t *dfree,
    6175                         uint64_t *dsize);
    6176 
    6177 /* The following definitions come from smbd/dir.c  */
    6178 
    6179 bool make_dir_struct(TALLOC_CTX *ctx,
    6180                         char *buf,
    6181                         const char *mask,
    6182                         const char *fname,
    6183                         SMB_OFF_T size,
    6184                         uint32 mode,
    6185                         time_t date,
    6186                         bool uc);
    6187 bool init_dptrs(struct smbd_server_connection *sconn);
    6188 char *dptr_path(struct smbd_server_connection *sconn, int key);
    6189 char *dptr_wcard(struct smbd_server_connection *sconn, int key);
    6190 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
    6191 void dptr_close(struct smbd_server_connection *sconn, int *key);
    6192 void dptr_closecnum(connection_struct *conn);
    6193 void dptr_idlecnum(connection_struct *conn);
    6194 void dptr_closepath(struct smbd_server_connection *sconn,
    6195                     char *path,uint16 spid);
    6196 NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, bool expect_close,uint16 spid,
    6197                 const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
    6198 int dptr_CloseDir(struct dptr_struct *dptr);
    6199 void dptr_SeekDir(struct dptr_struct *dptr, long offset);
    6200 long dptr_TellDir(struct dptr_struct *dptr);
    6201 bool dptr_has_wild(struct dptr_struct *dptr);
    6202 int dptr_dnum(struct dptr_struct *dptr);
    6203 char *dptr_ReadDirName(TALLOC_CTX *ctx,
    6204                         struct dptr_struct *dptr,
    6205                         long *poffset,
    6206                         SMB_STRUCT_STAT *pst);
    6207 bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
    6208 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
    6209 void dptr_init_search_op(struct dptr_struct *dptr);
    6210 bool dptr_fill(struct smbd_server_connection *sconn,
    6211                char *buf1,unsigned int key);
    6212 struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
    6213                                char *buf,int *num);
    6214 struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
    6215                                        int dptr_num);
    6216 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
    6217 bool get_dir_entry(TALLOC_CTX *ctx,
    6218                 struct dptr_struct *dirptr,
    6219                 const char *mask,
    6220                 uint32 dirtype,
    6221                 char **pp_fname_out,
    6222                 SMB_OFF_T *size,
    6223                 uint32 *mode,
    6224                 struct timespec *date,
    6225                 bool check_descend,
    6226                 bool ask_sharemode);
    6227 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
    6228 struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
    6229                         const char *name, const char *mask, uint32 attr);
    6230 const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
    6231                         SMB_STRUCT_STAT *sbuf, char **talloced);
    6232 void RewindDir(struct smb_Dir *dirp, long *poffset);
    6233 void SeekDir(struct smb_Dir *dirp, long offset);
    6234 long TellDir(struct smb_Dir *dirp);
    6235 void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
    6236 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
    6237 NTSTATUS can_delete_directory(struct connection_struct *conn,
    6238                                 const char *dirname);
    6239 
    6240 /* The following definitions come from smbd/dmapi.c  */
    6241 
    6242 const void *dmapi_get_current_session(void);
    6243 bool dmapi_have_session(void);
    6244 bool dmapi_new_session(void);
    6245 bool dmapi_destroy_session(void);
    6246 uint32 dmapi_file_flags(const char * const path);
    6247 
    6248 /* The following definitions come from smbd/dnsregister.c  */
    6249 
    6250 bool smbd_setup_mdns_registration(struct tevent_context *ev,
    6251                                   TALLOC_CTX *mem_ctx,
    6252                                   uint16_t port);
    6253 
    6254 /* The following definitions come from smbd/dosmode.c  */
    6255 
    6256 mode_t unix_mode(connection_struct *conn, int dosmode,
    6257                  const struct smb_filename *smb_fname,
    6258                  const char *inherit_from_dir);
    6259 uint32 dos_mode_msdfs(connection_struct *conn,
    6260                       const struct smb_filename *smb_fname);
    6261 int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
    6262 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
    6263 int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
    6264                      uint32 dosmode, const char *parent_dir, bool newfile);
    6265 int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
    6266                 struct smb_file_time *ft);
    6267 bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
    6268 bool set_sticky_write_time_fsp(struct files_struct *fsp,
    6269                                struct timespec mtime);
    6270 
    6271 NTSTATUS set_create_timespec_ea(connection_struct *conn,
    6272                                 const struct smb_filename *smb_fname,
    6273                                 struct timespec create_time);
    6274 
    6275 struct timespec get_create_timespec(connection_struct *conn,
    6276                                 struct files_struct *fsp,
    6277                                 const struct smb_filename *smb_fname);
    6278 
    6279 struct timespec get_change_timespec(connection_struct *conn,
    6280                                 struct files_struct *fsp,
    6281                                 const struct smb_filename *smb_fname);
    6282 
    6283 /* The following definitions come from smbd/error.c  */
    6284 
    6285 bool use_nt_status(void);
    6286 void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
    6287 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
    6288 void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
    6289                     int line, const char *file);
    6290 void reply_force_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
    6291                     int line, const char *file);
    6292 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
    6293                       NTSTATUS status, int line, const char *file);
    6294 void reply_openerror(struct smb_request *req, NTSTATUS status);
    6295 
    6296 /* The following definitions come from smbd/fake_file.c  */
    6297 
    6298 enum FAKE_FILE_TYPE is_fake_file_path(const char *path);
    6299 enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
    6300 NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
    6301                                 uint16_t current_vuid,
    6302                                 enum FAKE_FILE_TYPE fake_file_type,
    6303                                 const struct smb_filename *smb_fname,
    6304                                 uint32 access_mask,
    6305                                 files_struct **result);
    6306 NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
    6307 
    6308 /* The following definitions come from smbd/file_access.c  */
    6309 
    6310 bool can_access_file_acl(struct connection_struct *conn,
    6311                          const struct smb_filename *smb_fname,
    6312                          uint32_t access_mask);
    6313 bool can_delete_file_in_directory(connection_struct *conn,
    6314                                   struct smb_filename *smb_fname);
    6315 bool can_access_file_data(connection_struct *conn,
    6316                           const struct smb_filename *smb_fname,
    6317                           uint32 access_mask);
    6318 bool can_write_to_file(connection_struct *conn,
    6319                        const struct smb_filename *smb_fname);
    6320 bool directory_has_default_acl(connection_struct *conn, const char *fname);
    6321 
    6322 /* The following definitions come from smbd/fileio.c  */
    6323 
    6324 ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
    6325 void update_write_time_handler(struct event_context *ctx,
    6326                                       struct timed_event *te,
    6327                                       struct timeval now,
    6328                                       void *private_data);
    6329 void trigger_write_time_update(struct files_struct *fsp);
    6330 void trigger_write_time_update_immediate(struct files_struct *fsp);
    6331 ssize_t write_file(struct smb_request *req,
    6332                         files_struct *fsp,
    6333                         const char *data,
    6334                         SMB_OFF_T pos,
    6335                         size_t n);
    6336 void delete_write_cache(files_struct *fsp);
    6337 void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size);
    6338 ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
    6339 NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
    6340 int fsp_stat(files_struct *fsp);
    6341 
    6342 /* The following definitions come from smbd/filename.c  */
    6343 
    6344 NTSTATUS unix_convert(TALLOC_CTX *ctx,
    6345                       connection_struct *conn,
    6346                       const char *orig_path,
    6347                       struct smb_filename **smb_fname,
    6348                       uint32_t ucf_flags);
    6349 NTSTATUS check_name(connection_struct *conn, const char *name);
    6350 int get_real_filename(connection_struct *conn, const char *path,
    6351                       const char *name, TALLOC_CTX *mem_ctx,
    6352                       char **found_name);
    6353 NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
    6354                         connection_struct *conn,
    6355                         bool dfs_path,
    6356                         const char *name_in,
    6357                         uint32_t ucf_flags,
    6358                         bool *ppath_contains_wcard,
    6359                         struct smb_filename **pp_smb_fname);
    6360 
    6361 /* The following definitions come from smbd/filename_utils.c */
     1916                           struct dom_sid *sid, const char **domain);
     1917
     1918/* The following definitions come from lib/util_unixsids.c  */
     1919
     1920bool sid_check_is_unix_users(const struct dom_sid *sid);
     1921bool sid_check_is_in_unix_users(const struct dom_sid *sid);
     1922void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
     1923void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
     1924const char *unix_users_domain_name(void);
     1925bool lookup_unix_user_name(const char *name, struct dom_sid *sid);
     1926bool sid_check_is_unix_groups(const struct dom_sid *sid);
     1927bool sid_check_is_in_unix_groups(const struct dom_sid *sid);
     1928const char *unix_groups_domain_name(void);
     1929bool lookup_unix_group_name(const char *name, struct dom_sid *sid);
     1930
     1931/* The following definitions come from lib/filename_util.c */
    63621932
    63631933NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
     
    63791949bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
    63801950
    6381 /* The following definitions come from smbd/files.c  */
    6382 
    6383 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
    6384                   files_struct **result);
    6385 void file_close_conn(connection_struct *conn);
    6386 void file_close_pid(uint16 smbpid, int vuid);
    6387 void file_init(void);
    6388 void file_close_user(int vuid);
    6389 void file_dump_open_table(void);
    6390 struct files_struct *file_walk_table(
    6391         struct files_struct *(*fn)(struct files_struct *fsp,
    6392                                    void *private_data),
    6393         void *private_data);
    6394 files_struct *file_find_fd(int fd);
    6395 files_struct *file_find_dif(struct file_id id, unsigned long gen_id);
    6396 files_struct *file_find_fsp(files_struct *orig_fsp);
    6397 files_struct *file_find_di_first(struct file_id id);
    6398 files_struct *file_find_di_next(files_struct *start_fsp);
    6399 files_struct *file_find_print(void);
    6400 bool file_find_subpath(files_struct *dir_fsp);
    6401 void file_sync_all(connection_struct *conn);
    6402 void file_free(struct smb_request *req, files_struct *fsp);
    6403 files_struct *file_fnum(uint16 fnum);
    6404 files_struct *file_fsp(struct smb_request *req, uint16 fid);
    6405 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
    6406                       uint32 access_mask, uint32 share_access,
    6407                       uint32 create_options, files_struct *to);
    6408 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
    6409                            const struct smb_filename *smb_fname_in);
    6410 
    6411 /* The following definitions come from smbd/ipc.c  */
    6412 
    6413 void send_trans_reply(connection_struct *conn,
    6414                       struct smb_request *req,
    6415                       char *rparam, int rparam_len,
    6416                       char *rdata, int rdata_len,
    6417                       bool buffer_too_large);
    6418 void reply_trans(struct smb_request *req);
    6419 void reply_transs(struct smb_request *req);
    6420 
    6421 /* The following definitions come from smbd/lanman.c  */
    6422 
    6423 void api_reply(connection_struct *conn, uint16 vuid,
    6424                struct smb_request *req,
    6425                char *data, char *params,
    6426                int tdscnt, int tpscnt,
    6427                int mdrcnt, int mprcnt);
    6428 
    6429 /* The following definitions come from smbd/mangle.c  */
    6430 
    6431 void mangle_reset_cache(void);
    6432 void mangle_change_to_posix(void);
    6433 bool mangle_is_mangled(const char *s, const struct share_params *p);
    6434 bool mangle_is_8_3(const char *fname, bool check_case,
    6435                    const struct share_params *p);
    6436 bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
    6437                              const struct share_params *p);
    6438 bool mangle_must_mangle(const char *fname,
    6439                    const struct share_params *p);
    6440 bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
    6441                         const char *in,
    6442                         char **out, /* talloced on the given context. */
    6443                         const struct share_params *p);
    6444 bool name_to_8_3(const char *in,
    6445                 char out[13],
    6446                 bool cache83,
    6447                 const struct share_params *p);
    6448 
    6449 /* The following definitions come from smbd/mangle_hash.c  */
    6450 
    6451 const struct mangle_fns *mangle_hash_init(void);
    6452 
    6453 /* The following definitions come from smbd/mangle_hash2.c  */
    6454 
    6455 const struct mangle_fns *mangle_hash2_init(void);
    6456 const struct mangle_fns *posix_mangle_init(void);
    6457 
    6458 /* The following definitions come from smbd/map_username.c  */
    6459 
    6460 bool map_username(struct smbd_server_connection *sconn, fstring user);
    6461 
    6462 /* The following definitions come from smbd/message.c  */
    6463 
    6464 void reply_sends(struct smb_request *req);
    6465 void reply_sendstrt(struct smb_request *req);
    6466 void reply_sendtxt(struct smb_request *req);
    6467 void reply_sendend(struct smb_request *req);
    6468 
    6469 /* The following definitions come from smbd/msdfs.c  */
    6470 
    6471 bool is_msdfs_link(connection_struct *conn,
    6472                 const char *path,
    6473                 SMB_STRUCT_STAT *sbufp);
    6474 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
    6475                         struct auth_serversupplied_info *server_info,
    6476                         const char *dfs_path,
    6477                         struct junction_map *jucn,
    6478                         int *consumedcntp,
    6479                         bool *self_referralp);
    6480 int setup_dfs_referral(connection_struct *orig_conn,
    6481                         const char *dfs_path,
    6482                         int max_referral_level,
    6483                         char **ppdata, NTSTATUS *pstatus);
    6484 bool create_junction(TALLOC_CTX *ctx,
    6485                 const char *dfs_path,
    6486                 struct junction_map *jucn);
    6487 bool create_msdfs_link(const struct junction_map *jucn);
    6488 bool remove_msdfs_link(const struct junction_map *jucn);
    6489 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
    6490 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
    6491                         connection_struct *conn,
    6492                         bool dfs_pathnames,
    6493                         const char *name_in,
    6494                         char **pp_name_out);
    6495 NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
    6496                                 connection_struct *conn,
    6497                                 bool dfs_pathnames,
    6498                                 const char *name_in,
    6499                                 bool allow_wcards,
    6500                                 char **pp_name_out,
    6501                                 bool *ppath_contains_wcard);
    6502 NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
    6503                                 connection_struct **pconn,
    6504                                 int snum,
    6505                                 const char *path,
    6506                                 struct auth_serversupplied_info *server_info,
    6507                                 char **poldcwd);
    6508 
    6509 /* The following definitions come from smbd/negprot.c  */
    6510 
    6511 void reply_negprot(struct smb_request *req);
    6512 
    6513 /* The following definitions come from smbd/notify.c  */
    6514 
    6515 void change_notify_reply(connection_struct *conn,
    6516                          struct smb_request *req,
    6517                          NTSTATUS error_code,
    6518                          uint32_t max_param,
    6519                          struct notify_change_buf *notify_buf,
    6520                          void (*reply_fn)(struct smb_request *req,
    6521                                 NTSTATUS error_code,
    6522                                 uint8_t *buf, size_t len));
    6523 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
    6524                               bool recursive);
    6525 NTSTATUS change_notify_add_request(struct smb_request *req,
    6526                                 uint32 max_param,
    6527                                 uint32 filter, bool recursive,
    6528                                 struct files_struct *fsp,
    6529                                 void (*reply_fn)(struct smb_request *req,
    6530                                         NTSTATUS error_code,
    6531                                         uint8_t *buf, size_t len));
    6532 void remove_pending_change_notify_requests_by_mid(uint16 mid);
    6533 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
    6534                                                   NTSTATUS status);
    6535 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
    6536                   const char *path);
    6537 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
    6538 struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
    6539                                                      TALLOC_CTX *mem_ctx,
    6540                                                      struct event_context *ev);
    6541 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
    6542                           struct notify_entry *e,
    6543                           void (*callback)(struct sys_notify_context *ctx,
    6544                                            void *private_data,
    6545                                            struct notify_event *ev),
    6546                           void *private_data, void *handle);
    6547 
    6548 /* The following definitions come from smbd/notify_inotify.c  */
    6549 
    6550 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
    6551                        struct notify_entry *e,
    6552                        void (*callback)(struct sys_notify_context *ctx,
    6553                                         void *private_data,
    6554                                         struct notify_event *ev),
    6555                        void *private_data,
    6556                        void *handle_p);
    6557 
    6558 /* The following definitions come from smbd/notify_internal.c  */
    6559 
    6560 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
    6561                                    struct messaging_context *messaging_ctx,
    6562                                    struct event_context *ev,
    6563                                    connection_struct *conn);
    6564 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
    6565                     void (*callback)(void *, const struct notify_event *),
    6566                     void *private_data);
    6567 NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
    6568 NTSTATUS notify_remove_onelevel(struct notify_context *notify,
    6569                                 const struct file_id *fid,
    6570                                 void *private_data);
    6571 void notify_onelevel(struct notify_context *notify, uint32_t action,
    6572                      uint32_t filter, struct file_id fid, const char *name);
    6573 void notify_trigger(struct notify_context *notify,
    6574                     uint32_t action, uint32_t filter, const char *path);
    6575 
    6576 /* The following definitions come from smbd/ntquotas.c  */
    6577 
    6578 int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, SMB_NTQUOTA_STRUCT *qt);
    6579 int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, SMB_NTQUOTA_STRUCT *qt);
    6580 int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
    6581 void *init_quota_handle(TALLOC_CTX *mem_ctx);
    6582 
    6583 /* The following definitions come from smbd/nttrans.c  */
    6584 
    6585 void send_nt_replies(connection_struct *conn,
    6586                         struct smb_request *req, NTSTATUS nt_error,
    6587                      char *params, int paramsize,
    6588                      char *pdata, int datasize);
    6589 void reply_ntcreate_and_X(struct smb_request *req);
    6590 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
    6591 void reply_ntcancel(struct smb_request *req);
    6592 void reply_ntrename(struct smb_request *req);
    6593 void reply_nttrans(struct smb_request *req);
    6594 void reply_nttranss(struct smb_request *req);
    6595 
    6596 /* The following definitions come from smbd/open.c  */
    6597 
    6598 NTSTATUS smb1_file_se_access_check(connection_struct *conn,
    6599                           const struct security_descriptor *sd,
    6600                           const NT_USER_TOKEN *token,
    6601                           uint32_t access_desired,
    6602                           uint32_t *access_granted);
    6603 NTSTATUS fd_close(files_struct *fsp);
    6604 void change_file_owner_to_parent(connection_struct *conn,
    6605                                  const char *inherit_from_dir,
    6606                                  files_struct *fsp);
    6607 NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
    6608                                     const char *inherit_from_dir,
    6609                                     const char *fname,
    6610                                     SMB_STRUCT_STAT *psbuf);
    6611 bool is_executable(const char *fname);
    6612 bool is_stat_open(uint32 access_mask);
    6613 bool request_timed_out(struct timeval request_time,
    6614                        struct timeval timeout);
    6615 bool open_match_attributes(connection_struct *conn,
    6616                            uint32 old_dos_attr,
    6617                            uint32 new_dos_attr,
    6618                            mode_t existing_unx_mode,
    6619                            mode_t new_unx_mode,
    6620                            mode_t *returned_unx_mode);
    6621 NTSTATUS fcb_or_dos_open(struct smb_request *req,
    6622                          connection_struct *conn,
    6623                          files_struct *fsp_to_dup_into,
    6624                          const struct smb_filename *smb_fname,
    6625                          struct file_id id,
    6626                          uint16 file_pid,
    6627                          uint16 vuid,
    6628                          uint32 access_mask,
    6629                          uint32 share_access,
    6630                          uint32 create_options);
    6631 bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
    6632                                  int deny_mode, int open_func,
    6633                                  uint32 *paccess_mask,
    6634                                  uint32 *pshare_mode,
    6635                                  uint32 *pcreate_disposition,
    6636                                  uint32 *pcreate_options);
    6637 NTSTATUS open_file_fchmod(connection_struct *conn,
    6638                           struct smb_filename *smb_fname,
    6639                           files_struct **result);
    6640 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
    6641                           struct smb_filename *smb_dname);
    6642 void msg_file_was_renamed(struct messaging_context *msg,
    6643                           void *private_data,
    6644                           uint32_t msg_type,
    6645                           struct server_id server_id,
    6646                           DATA_BLOB *data);
    6647 NTSTATUS open_streams_for_delete(connection_struct *conn,
    6648                                  const char *fname);
    6649 NTSTATUS create_file_default(connection_struct *conn,
    6650                              struct smb_request *req,
    6651                              uint16_t root_dir_fid,
    6652                              struct smb_filename * smb_fname,
    6653                              uint32_t access_mask,
    6654                              uint32_t share_access,
    6655                              uint32_t create_disposition,
    6656                              uint32_t create_options,
    6657                              uint32_t file_attributes,
    6658                              uint32_t oplock_request,
    6659                              uint64_t allocation_size,
    6660                              struct security_descriptor *sd,
    6661                              struct ea_list *ea_list,
    6662 
    6663                              files_struct **result,
    6664                              int *pinfo);
    6665 NTSTATUS get_relative_fid_filename(connection_struct *conn,
    6666                                    struct smb_request *req,
    6667                                    uint16_t root_dir_fid,
    6668                                    const struct smb_filename *smb_fname,
    6669                                    struct smb_filename **smb_fname_out);
    6670 
    6671 /* The following definitions come from smbd/oplock.c  */
    6672 
    6673 int32 get_number_of_exclusive_open_oplocks(void);
    6674 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
    6675 bool set_file_oplock(files_struct *fsp, int oplock_type);
    6676 void release_file_oplock(files_struct *fsp);
    6677 bool remove_oplock(files_struct *fsp);
    6678 bool downgrade_oplock(files_struct *fsp);
    6679 bool should_notify_deferred_opens(void);
    6680 void break_level2_to_none_async(files_struct *fsp);
    6681 void reply_to_oplock_break_requests(files_struct *fsp);
    6682 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
    6683                                                       void *private_data,
    6684                                                       uint32_t msg_type,
    6685                                                       struct server_id src,
    6686                                                       DATA_BLOB *data);
     1951/* The following definitions come from lib/dummyroot.c */
     1952
     1953void become_root(void);
     1954void unbecome_root(void);
     1955
     1956/* The following definitions come from lib/dummysmbd.c */
     1957
     1958int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
     1959bool conn_snum_used(int snum);
     1960void cancel_pending_lock_requests_by_fid(files_struct *fsp,
     1961                        struct byte_range_lock *br_lck,
     1962                        enum file_close_type close_type);
     1963void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
     1964                                    const char *name);
     1965NTSTATUS can_delete_directory(struct connection_struct *conn,
     1966                                const char *dirname);
     1967bool change_to_root_user(void);
     1968struct event_context *smbd_event_context(void);
    66871969void contend_level2_oplocks_begin(files_struct *fsp,
    66881970                                  enum level2_contention_type type);
    66891971void contend_level2_oplocks_end(files_struct *fsp,
    66901972                                enum level2_contention_type type);
    6691 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
    6692 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
    6693 bool init_oplocks(struct messaging_context *msg_ctx);
    6694 
    6695 /* The following definitions come from smbd/oplock_irix.c  */
    6696 
    6697 struct kernel_oplocks *irix_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
    6698 
    6699 /* The following definitions come from smbd/oplock_linux.c  */
    6700 
    6701 void linux_set_lease_capability(void);
    6702 int linux_set_lease_sighandler(int fd);
    6703 int linux_setlease(int fd, int leasetype);
    6704 struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
    6705 
    6706 /* The following definitions come from smbd/oplock_onefs.c  */
    6707 
    6708 struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
    6709 
    6710 /* The following definitions come from smbd/password.c  */
    6711 
    6712 user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
    6713                                    uint16 vuid);
    6714 bool is_partial_auth_vuid(struct smbd_server_connection *sconn, uint16 vuid);
    6715 user_struct *get_partial_auth_user_struct(struct smbd_server_connection *sconn,
    6716                                           uint16 vuid);
    6717 void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid);
    6718 void invalidate_all_vuids(struct smbd_server_connection *sconn);
    6719 int register_initial_vuid(struct smbd_server_connection *sconn);
    6720 int register_existing_vuid(struct smbd_server_connection *sconn,
    6721                         uint16 vuid,
    6722                         auth_serversupplied_info *server_info,
    6723                         DATA_BLOB response_blob,
    6724                         const char *smb_name);
    6725 void add_session_user(struct smbd_server_connection *sconn, const char *user);
    6726 void add_session_workgroup(struct smbd_server_connection *sconn,
    6727                            const char *workgroup);
    6728 const char *get_session_workgroup(struct smbd_server_connection *sconn);
    6729 bool user_in_netgroup(struct smbd_server_connection *sconn,
    6730                       const char *user, const char *ngname);
    6731 bool user_in_list(struct smbd_server_connection *sconn,
    6732                   const char *user,const char **list);
    6733 bool authorise_login(struct smbd_server_connection *sconn,
    6734                      int snum, fstring user, DATA_BLOB password,
    6735                      bool *guest);
    6736 
    6737 /* The following definitions come from smbd/pipes.c  */
    6738 
    6739 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
    6740                       struct files_struct **pfsp);
    6741 void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
    6742 void reply_pipe_write(struct smb_request *req);
    6743 void reply_pipe_write_and_X(struct smb_request *req);
    6744 void reply_pipe_read_and_X(struct smb_request *req);
    6745 void reply_pipe_close(connection_struct *conn, struct smb_request *req);
    6746 
    6747 /* The following definitions come from smbd/posix_acls.c  */
    6748 
    6749 void create_file_sids(const SMB_STRUCT_STAT *psbuf, DOM_SID *powner_sid, DOM_SID *pgroup_sid);
    6750 bool nt4_compatible_acls(void);
    6751 uint32_t map_canon_ace_perms(int snum,
    6752                                 enum security_ace_type *pacl_type,
    6753                                 mode_t perms,
    6754                                 bool directory_ace);
    6755 NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const SEC_DESC *psd);
    6756 bool current_user_in_group(gid_t gid);
    6757 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
    6758 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
    6759                            SEC_DESC **ppdesc);
    6760 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
    6761                           uint32_t security_info, SEC_DESC **ppdesc);
    6762 int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
    6763               uid_t uid, gid_t gid);
    6764 NTSTATUS append_parent_acl(files_struct *fsp,
    6765                                 const SEC_DESC *pcsd,
    6766                                 SEC_DESC **pp_new_sd);
    6767 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd);
    6768 int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
    6769 int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
    6770 int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
    6771                        const char *name, mode_t mode);
    6772 int fchmod_acl(files_struct *fsp, mode_t mode);
    6773 bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
    6774                                 const SMB_STRUCT_STAT *psbuf,
    6775                                 uint16 num_def_acls, const char *pdata);
    6776 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
    6777 SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
    6778 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
    6779                                         const char *name,
    6780                                         SMB_STRUCT_STAT *psbuf,
    6781                                         SEC_DESC **ppdesc);
    6782 
    6783 /* The following definitions come from smbd/process.c  */
    6784 
    6785 void smbd_setup_sig_term_handler(void);
    6786 void smbd_setup_sig_hup_handler(void);
    6787 bool srv_send_smb(int fd, char *buffer,
    6788                   bool no_signing, uint32_t seqnum,
    6789                   bool do_encrypt,
    6790                   struct smb_perfcount_data *pcd);
    6791 int srv_set_message(char *buf,
    6792                         int num_words,
    6793                         int num_bytes,
    6794                         bool zero);
    6795 void init_smb_request(struct smb_request *req,
    6796                         const uint8 *inbuf,
    6797                         size_t unread_bytes,
    6798                         bool encrypted);
    6799 void remove_deferred_open_smb_message(uint16 mid);
    6800 void schedule_deferred_open_smb_message(uint16 mid);
    6801 bool open_was_deferred(uint16 mid);
    6802 struct pending_message_list *get_open_deferred_message(uint16 mid);
    6803 bool push_deferred_smb_message(struct smb_request *req,
    6804                                struct timeval request_time,
    6805                                struct timeval timeout,
    6806                                char *private_data, size_t priv_len);
    6807 struct idle_event *event_add_idle(struct event_context *event_ctx,
    6808                                   TALLOC_CTX *mem_ctx,
    6809                                   struct timeval interval,
    6810                                   const char *name,
    6811                                   bool (*handler)(const struct timeval *now,
    6812                                                   void *private_data),
    6813                                   void *private_data);
    6814 NTSTATUS allow_new_trans(struct trans_state *list, int mid);
    6815 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
    6816 const char *smb_fn_name(int type);
    6817 void add_to_common_flags2(uint32 v);
    6818 void remove_from_common_flags2(uint32 v);
    6819 void construct_reply_common_req(struct smb_request *req, char *outbuf);
    6820 size_t req_wct_ofs(struct smb_request *req);
    6821 void chain_reply(struct smb_request *req);
    6822 bool req_is_in_chain(struct smb_request *req);
    6823 void check_reload(time_t t);
    6824 void smbd_process(void);
    6825 
    6826 /* The following definitions come from smbd/quotas.c  */
    6827 
    6828 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6829 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6830 bool disk_quotas(const char *path,
    6831                 uint64_t *bsize,
    6832                 uint64_t *dfree,
    6833                 uint64_t *dsize);
    6834 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6835 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6836 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6837 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6838 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    6839 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    6840 
    6841 /* The following definitions come from smbd/reply.c  */
    6842 
    6843 NTSTATUS check_path_syntax(char *path);
    6844 NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard);
    6845 NTSTATUS check_path_syntax_posix(char *path);
    6846 size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
    6847                         const char *inbuf,
    6848                         uint16 smb_flags2,
    6849                         char **pp_dest,
    6850                         const char *src,
    6851                         size_t src_len,
    6852                         int flags,
    6853                         NTSTATUS *err,
    6854                         bool *contains_wcard);
    6855 size_t srvstr_get_path(TALLOC_CTX *ctx,
    6856                         const char *inbuf,
    6857                         uint16 smb_flags2,
    6858                         char **pp_dest,
    6859                         const char *src,
    6860                         size_t src_len,
    6861                         int flags,
    6862                         NTSTATUS *err);
    6863 size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
    6864                                  char **pp_dest, const char *src, int flags,
    6865                                  NTSTATUS *err, bool *contains_wcard);
    6866 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
    6867                            char **pp_dest, const char *src, int flags,
    6868                            NTSTATUS *err);
    6869 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
    6870                     files_struct *fsp);
    6871 bool check_fsp(connection_struct *conn, struct smb_request *req,
    6872                files_struct *fsp);
    6873 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
    6874                               files_struct *fsp);
    6875 bool fsp_belongs_conn(connection_struct *conn, struct smb_request *req,
    6876                       files_struct *fsp);
    6877 void reply_special(char *inbuf, size_t inbuf_len);
    6878 void reply_tcon(struct smb_request *req);
    6879 void reply_tcon_and_X(struct smb_request *req);
    6880 void reply_unknown_new(struct smb_request *req, uint8 type);
    6881 void reply_ioctl(struct smb_request *req);
    6882 void reply_checkpath(struct smb_request *req);
    6883 void reply_getatr(struct smb_request *req);
    6884 void reply_setatr(struct smb_request *req);
    6885 void reply_dskattr(struct smb_request *req);
    6886 void reply_search(struct smb_request *req);
    6887 void reply_fclose(struct smb_request *req);
    6888 void reply_open(struct smb_request *req);
    6889 void reply_open_and_X(struct smb_request *req);
    6890 void reply_ulogoffX(struct smb_request *req);
    6891 void reply_mknew(struct smb_request *req);
    6892 void reply_ctemp(struct smb_request *req);
    6893 NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
    6894                           uint32 dirtype, struct smb_filename *smb_fname,
    6895                           bool has_wild);
    6896 void reply_unlink(struct smb_request *req);
    6897 void reply_readbraw(struct smb_request *req);
    6898 void reply_lockread(struct smb_request *req);
    6899 void reply_read(struct smb_request *req);
    6900 void reply_read_and_X(struct smb_request *req);
    6901 void error_to_writebrawerr(struct smb_request *req);
    6902 void reply_writebraw(struct smb_request *req);
    6903 void reply_writeunlock(struct smb_request *req);
    6904 void reply_write(struct smb_request *req);
    6905 bool is_valid_writeX_buffer(const uint8_t *inbuf);
    6906 void reply_write_and_X(struct smb_request *req);
    6907 void reply_lseek(struct smb_request *req);
    6908 void reply_flush(struct smb_request *req);
    6909 void reply_exit(struct smb_request *req);
    6910 void reply_close(struct smb_request *req);
    6911 void reply_writeclose(struct smb_request *req);
    6912 void reply_lock(struct smb_request *req);
    6913 void reply_unlock(struct smb_request *req);
    6914 void reply_tdis(struct smb_request *req);
    6915 void reply_echo(struct smb_request *req);
    6916 void reply_printopen(struct smb_request *req);
    6917 void reply_printclose(struct smb_request *req);
    6918 void reply_printqueue(struct smb_request *req);
    6919 void reply_printwrite(struct smb_request *req);
    6920 void reply_mkdir(struct smb_request *req);
    6921 void reply_rmdir(struct smb_request *req);
    6922 NTSTATUS rename_internals_fsp(connection_struct *conn,
    6923                         files_struct *fsp,
    6924                         const struct smb_filename *smb_fname_dst_in,
    6925                         uint32 attrs,
    6926                         bool replace_if_exists);
    6927 NTSTATUS rename_internals(TALLOC_CTX *ctx,
    6928                         connection_struct *conn,
    6929                         struct smb_request *req,
    6930                         struct smb_filename *smb_fname_src,
    6931                         struct smb_filename *smb_fname_dst,
    6932                         uint32 attrs,
    6933                         bool replace_if_exists,
    6934                         bool src_has_wild,
    6935                         bool dest_has_wild,
    6936                         uint32_t access_mask);
    6937 void reply_mv(struct smb_request *req);
    6938 NTSTATUS copy_file(TALLOC_CTX *ctx,
    6939                         connection_struct *conn,
    6940                         struct smb_filename *smb_fname_src,
    6941                         struct smb_filename *smb_fname_dst,
    6942                         int ofun,
    6943                         int count,
    6944                         bool target_is_directory);
    6945 void reply_copy(struct smb_request *req);
    6946 uint32 get_lock_pid(const uint8_t *data, int data_offset,
    6947                     bool large_file_format);
    6948 uint64_t get_lock_count(const uint8_t *data, int data_offset,
    6949                         bool large_file_format);
    6950 uint64_t get_lock_offset(const uint8_t *data, int data_offset,
    6951                          bool large_file_format, bool *err);
    6952 void reply_lockingX(struct smb_request *req);
    6953 void reply_readbmpx(struct smb_request *req);
    6954 void reply_readbs(struct smb_request *req);
    6955 void reply_setattrE(struct smb_request *req);
    6956 void reply_writebmpx(struct smb_request *req);
    6957 void reply_writebs(struct smb_request *req);
    6958 void reply_getattrE(struct smb_request *req);
    6959 
    6960 /* The following definitions come from smbd/seal.c  */
    6961 
    6962 uint16_t srv_enc_ctx(void);
    6963 bool is_encrypted_packet(const uint8_t *inbuf);
    6964 void srv_free_enc_buffer(char *buf);
    6965 NTSTATUS srv_decrypt_buffer(char *buf);
    6966 NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out);
    6967 NTSTATUS srv_request_encryption_setup(connection_struct *conn,
    6968                                         unsigned char **ppdata,
    6969                                         size_t *p_data_size,
    6970                                         unsigned char **pparam,
    6971                                         size_t *p_param_size);
    6972 NTSTATUS srv_encryption_start(connection_struct *conn);
    6973 void server_encryption_shutdown(void);
    6974 
    6975 /* The following definitions come from smbd/sec_ctx.c  */
    6976 
    6977 bool unix_token_equal(const UNIX_USER_TOKEN *t1, const UNIX_USER_TOKEN *t2);
    6978 bool push_sec_ctx(void);
    6979 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, NT_USER_TOKEN *token);
    6980 void set_root_sec_ctx(void);
    6981 bool pop_sec_ctx(void);
    6982 void init_sec_ctx(void);
    6983 
    6984 /* The following definitions come from smbd/server.c  */
    6985 
    6986 int smbd_server_fd(void);
    6987 int get_client_fd(void);
    6988 struct event_context *smbd_event_context(void);
    6989 struct messaging_context *smbd_messaging_context(void);
    6990 struct memcache *smbd_memcache(void);
    6991 void reload_printers(void);
    6992 bool reload_services(bool test);
    6993 void exit_server(const char *const explanation);
    6994 void exit_server_cleanly(const char *const explanation);
    6995 void exit_server_fault(void);
    6996 
    6997 /* The following definitions come from smbd/service.c  */
    6998 
    6999 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
    7000 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
    7001 void load_registry_shares(void);
    7002 int add_home_service(const char *service, const char *username, const char *homedir);
    7003 int find_service(fstring service);
    7004 connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
    7005                                         int snum, user_struct *vuser,
    7006                                         DATA_BLOB password,
    7007                                         const char *pdev,
    7008                                         NTSTATUS *pstatus);
    7009 connection_struct *make_connection(struct smbd_server_connection *sconn,
    7010                                    const char *service_in, DATA_BLOB password,
    7011                                    const char *pdev, uint16 vuid,
    7012                                    NTSTATUS *status);
    7013 void close_cnum(connection_struct *conn, uint16 vuid);
    7014 
    7015 /* The following definitions come from smbd/session.c  */
    7016 
    7017 bool session_init(void);
    7018 bool session_claim(user_struct *vuser);
    7019 void session_yield(user_struct *vuser);
    7020 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
    7021 
    7022 /* The following definitions come from smbd/sesssetup.c  */
    7023 
    7024 NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in,
    7025                 DATA_BLOB *pblob_out,
    7026                 char **kerb_mechOID);
    7027 void reply_sesssetup_and_X(struct smb_request *req);
    7028 
    7029 /* The following definitions come from smbd/share_access.c  */
    7030 
    7031 bool token_contains_name_in_list(const char *username,
    7032                                  const char *domain,
    7033                                  const char *sharename,
    7034                                  const struct nt_user_token *token,
    7035                                  const char **list);
    7036 bool user_ok_token(const char *username, const char *domain,
    7037                    const struct nt_user_token *token, int snum);
    7038 bool is_share_read_only_for_token(const char *username,
    7039                                   const char *domain,
    7040                                   const struct nt_user_token *token,
    7041                                   connection_struct *conn);
    7042 
    7043 /* The following definitions come from smbd/srvstr.c  */
    7044 
    7045 size_t srvstr_push_fn(const char *function, unsigned int line,
    7046                       const char *base_ptr, uint16 smb_flags2, void *dest,
    7047                       const char *src, int dest_len, int flags);
    7048 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
    7049 
    7050 /* The following definitions come from smbd/statcache.c  */
    7051 
    7052 void stat_cache_add( const char *full_orig_name,
    7053                 char *translated_path,
    7054                 bool case_sensitive);
    7055 bool stat_cache_lookup(connection_struct *conn,
    7056                         char **pp_name,
    7057                         char **pp_dirpath,
    7058                         char **pp_start,
    7059                         SMB_STRUCT_STAT *pst);
    7060 void send_stat_cache_delete_message(const char *name);
    7061 void stat_cache_delete(const char *name);
    7062 unsigned int fast_string_hash(TDB_DATA *key);
    7063 bool reset_stat_cache( void );
    7064 
    7065 /* The following definitions come from smbd/statvfs.c  */
    7066 
    7067 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
    7068 
    7069 /* The following definitions come from smbd/trans2.c  */
    7070 
    7071 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
    7072 uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
    7073 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
    7074                       files_struct *fsp, const char *fname,
    7075                       const char *ea_name, struct ea_struct *pea);
    7076 NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
    7077                                 files_struct *fsp, const char *fname,
    7078                                 char ***pnames, size_t *pnum_names);
    7079 NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
    7080                 const struct smb_filename *smb_fname, struct ea_list *ea_list);
    7081 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
    7082 void send_trans2_replies(connection_struct *conn,
    7083                         struct smb_request *req,
    7084                          const char *params,
    7085                          int paramsize,
    7086                          const char *pdata,
    7087                          int datasize,
    7088                          int max_data_bytes);
    7089 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
    7090 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
    7091                 connection_struct *conn,
    7092                 const struct smb_filename *smb_fname_old,
    7093                 const struct smb_filename *smb_fname_new);
    7094 NTSTATUS smb_set_file_time(connection_struct *conn,
    7095                            files_struct *fsp,
    7096                            const struct smb_filename *smb_fname,
    7097                            struct smb_file_time *ft,
    7098                            bool setting_write_time);
    7099 void reply_findclose(struct smb_request *req);
    7100 void reply_findnclose(struct smb_request *req);
    7101 void reply_trans2(struct smb_request *req);
    7102 void reply_transs2(struct smb_request *req);
    7103 
    7104 /* The following definitions come from smbd/uid.c  */
    7105 
    7106 bool change_to_guest(void);
    7107 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
    7108 bool change_to_user(connection_struct *conn, uint16 vuid);
    7109 bool change_to_root_user(void);
    7110 bool become_authenticated_pipe_user(pipes_struct *p);
    7111 bool unbecome_authenticated_pipe_user(void);
    7112 void become_root(void);
    7113 void unbecome_root(void);
    7114 bool become_user(connection_struct *conn, uint16 vuid);
    7115 bool unbecome_user(void);
    7116 
    7117 /* The following definitions come from smbd/utmp.c  */
    7118 
    7119 void sys_utmp_claim(const char *username, const char *hostname,
    7120                         const char *ip_addr_str,
    7121                         const char *id_str, int id_num);
    7122 void sys_utmp_yield(const char *username, const char *hostname,
    7123                         const char *ip_addr_str,
    7124                         const char *id_str, int id_num);
    7125 void sys_utmp_yield(const char *username, const char *hostname,
    7126                         const char *ip_addr_str,
    7127                         const char *id_str, int id_num);
    7128 void sys_utmp_claim(const char *username, const char *hostname,
    7129                         const char *ip_addr_str,
    7130                         const char *id_str, int id_num);
    7131 
    7132 /* The following definitions come from smbd/vfs.c  */
    7133 
    7134 NTSTATUS smb_register_vfs(int version, const char *name,
    7135                           const struct vfs_fn_pointers *fns);
    7136 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
    7137 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
    7138                                    files_struct *fsp, size_t ext_size,
    7139                                    void (*destroy_fn)(void *p_data));
    7140 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    7141 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    7142 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    7143 bool smbd_vfs_init(connection_struct *conn);
    7144 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
    7145 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
    7146 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
    7147                 size_t byte_count, SMB_OFF_T offset);
    7148 ssize_t vfs_write_data(struct smb_request *req,
    7149                         files_struct *fsp,
    7150                         const char *buffer,
    7151                         size_t N);
    7152 ssize_t vfs_pwrite_data(struct smb_request *req,
    7153                         files_struct *fsp,
    7154                         const char *buffer,
    7155                         size_t N,
    7156                         SMB_OFF_T offset);
    7157 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
    7158 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
    7159 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
    7160 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
    7161 const char *vfs_readdirname(connection_struct *conn, void *p,
    7162                             SMB_STRUCT_STAT *sbuf, char **talloced);
    7163 int vfs_ChDir(connection_struct *conn, const char *path);
    7164 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
    7165 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
    7166 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
    7167                        SMB_STRUCT_STAT *psbuf);
    7168 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
    7169                         SMB_STRUCT_STAT *psbuf);
    7170 NTSTATUS vfs_stat_fsp(files_struct *fsp);
    7171 
    7172 /* The following definitions come from torture/denytest.c  */
    7173 
    7174 bool torture_denytest1(int dummy);
    7175 bool torture_denytest2(int dummy);
    7176 
    7177 /* The following definitions come from torture/mangle_test.c  */
    7178 
    7179 bool torture_mangle(int dummy);
    7180 
    7181 /* The following definitions come from torture/nbio.c  */
    7182 
    7183 double nbio_total(void);
    7184 void nb_alarm(int ignore);
    7185 void nbio_shmem(int n);
    7186 void nb_setup(struct cli_state *cli);
    7187 void nb_unlink(const char *fname);
    7188 void nb_createx(const char *fname,
    7189                 unsigned create_options, unsigned create_disposition, int handle);
    7190 void nb_writex(int handle, int offset, int size, int ret_size);
    7191 void nb_readx(int handle, int offset, int size, int ret_size);
    7192 void nb_close(int handle);
    7193 void nb_rmdir(const char *fname);
    7194 void nb_rename(const char *oldname, const char *newname);
    7195 void nb_qpathinfo(const char *fname);
    7196 void nb_qfileinfo(int fnum);
    7197 void nb_qfsinfo(int level);
    7198 void nb_findfirst(const char *mask);
    7199 void nb_flush(int fnum);
    7200 void nb_deltree(const char *dname);
    7201 void nb_cleanup(void);
    7202 
    7203 /* The following definitions come from torture/scanner.c  */
    7204 
    7205 bool torture_trans2_scan(int dummy);
    7206 bool torture_nttrans_scan(int dummy);
    7207 
    7208 /* The following definitions come from torture/torture.c  */
    7209 
    7210 void start_timer(void);
    7211 double end_timer(void);
    7212 void *shm_setup(int size);
    7213 bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
    7214                       char **hostname, char **sharename);
    7215 void torture_open_connection_free_unclist(char **unc_list);
    7216 bool torture_open_connection(struct cli_state **c, int conn_index);
    7217 bool torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid);
    7218 bool torture_close_connection(struct cli_state *c);
    7219 bool torture_ioctl_test(int dummy);
    7220 bool torture_chkpath_test(int dummy);
    7221 
    7222 /* The following definitions come from torture/utable.c  */
    7223 
    7224 bool torture_utable(int dummy);
    7225 bool torture_casetable(int dummy);
    7226 
    7227 /* The following definitions come from utils/passwd_util.c  */
    7228 
    7229 char *stdin_new_passwd( void);
    7230 char *get_pass( const char *prompt, bool stdin_get);
    7231 
    7232 /* The following definitions come from winbindd/idmap.c  */
    7233 
    7234 bool idmap_is_offline(void);
    7235 bool idmap_is_online(void);
    7236 NTSTATUS smb_register_idmap(int version, const char *name,
    7237                             struct idmap_methods *methods);
    7238 NTSTATUS smb_register_idmap_alloc(int version, const char *name,
    7239                                   struct idmap_alloc_methods *methods);
    7240 void idmap_close(void);
    7241 NTSTATUS idmap_init_cache(void);
    7242 NTSTATUS idmap_allocate_uid(struct unixid *id);
    7243 NTSTATUS idmap_allocate_gid(struct unixid *id);
    7244 NTSTATUS idmap_set_uid_hwm(struct unixid *id);
    7245 NTSTATUS idmap_set_gid_hwm(struct unixid *id);
    7246 NTSTATUS idmap_backends_unixid_to_sid(const char *domname,
    7247                                       struct id_map *id);
    7248 NTSTATUS idmap_backends_sid_to_unixid(const char *domname,
    7249                                       struct id_map *id);
    7250 NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type,
    7251                            struct unixid *pxid);
    7252 NTSTATUS idmap_set_mapping(const struct id_map *map);
    7253 NTSTATUS idmap_remove_mapping(const struct id_map *map);
    7254 
    7255 /* The following definitions come from winbindd/idmap_cache.c  */
    7256 
    7257 bool idmap_cache_find_sid2uid(const struct dom_sid *sid, uid_t *puid,
    7258                               bool *expired);
    7259 bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired);
    7260 void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid);
    7261 bool idmap_cache_find_sid2gid(const struct dom_sid *sid, gid_t *pgid,
    7262                               bool *expired);
    7263 bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired);
    7264 void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid);
    7265 
    7266 
    7267 /* The following definitions come from winbindd/idmap_nss.c  */
    7268 
    7269 NTSTATUS idmap_nss_init(void);
    7270 
    7271 /* The following definitions come from winbindd/idmap_passdb.c  */
    7272 
    7273 NTSTATUS idmap_passdb_init(void);
    7274 
    7275 /* The following definitions come from winbindd/idmap_tdb.c  */
    7276 
    7277 bool idmap_tdb_tdb_close(TDB_CONTEXT *tdbctx);
    7278 NTSTATUS idmap_alloc_tdb_init(void);
    7279 NTSTATUS idmap_tdb_init(void);
    7280 
    7281 /* The following definitions come from winbindd/idmap_util.c  */
    7282 
    7283 NTSTATUS idmap_uid_to_sid(const char *domname, DOM_SID *sid, uid_t uid);
    7284 NTSTATUS idmap_gid_to_sid(const char *domname, DOM_SID *sid, gid_t gid);
    7285 NTSTATUS idmap_sid_to_uid(const char *dom_name, DOM_SID *sid, uid_t *uid);
    7286 NTSTATUS idmap_sid_to_gid(const char *domname, DOM_SID *sid, gid_t *gid);
    7287 
    7288 /* The following definitions come from winbindd/nss_info.c  */
    7289 
    7290 
    7291 /* The following definitions come from winbindd/nss_info_template.c  */
    7292 
    7293 NTSTATUS nss_info_template_init( void );
    7294 
    7295 /* The following definitions come from lib/avahi.c */
    7296 
    7297 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
    7298                                     struct tevent_context *ev);
    7299 
    7300 /* The following definitions come from smbd/avahi_register.c */
    7301 
    7302 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
    7303                            uint16_t port);
    7304 
    7305 /* Misc protos */
    7306 
    7307 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
    7308                                            int max_threads);
    7309 struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
    7310                                struct fncall_context *ctx,
    7311                                void (*fn)(void *private_data),
    7312                                void *private_data);
    7313 int fncall_recv(struct tevent_req *req, int *perr);
    7314 
    7315 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
    7316                                         struct tevent_context *ev,
    7317                                         const struct sockaddr_storage *addr,
    7318                                         const char *called_name,
    7319                                         const char *calling_name);
    7320 NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
    7321                               uint16_t *port);
    7322 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr,
    7323                          const char *called_name, const char *calling_name,
    7324                          int *pfd, uint16_t *port);
    7325 
    7326 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
    7327                                             struct tevent_context *ev,
    7328                                             const struct sockaddr_storage *addrs,
    7329                                             const char **called_names,
    7330                                             size_t num_addrs);
    7331 NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
    7332                                   size_t *chosen_index, uint16_t *port);
    7333 NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
    7334                              const char **called_names, size_t num_addrs,
    7335                              int *pfd, size_t *chosen_index, uint16_t *port);
    7336 
    7337 /* The following definitions come from rpc_server/srv_samr_nt.c */
    7338 NTSTATUS access_check_object( SEC_DESC *psd, NT_USER_TOKEN *token,
    7339                                 SE_PRIV *rights, uint32 rights_mask,
    7340                                 uint32 des_access, uint32 *acc_granted,
    7341                                 const char *debug);
    7342 void map_max_allowed_access(const NT_USER_TOKEN *nt_token,
    7343                             const struct unix_user_token *unix_token,
    7344                             uint32_t *pacc_requested);
    7345 
    7346 /* The following definitions come from ../libds/common/flag_mapping.c  */
    7347 
    7348 uint32_t ds_acb2uf(uint32_t acb);
    7349 uint32_t ds_uf2acb(uint32_t uf);
    7350 uint32_t ds_uf2atype(uint32_t uf);
    7351 uint32_t ds_gtype2atype(uint32_t gtype);
    7352 enum lsa_SidType ds_atype_map(uint32_t atype);
    73531973
    73541974#endif /*  _PROTO_H_  */
Note: See TracChangeset for help on using the changeset viewer.