param: calculate server role from security, and security from server role
[kai/samba.git] / source3 / include / proto.h
index ad8ae994ff1738954466bea67eff6223eab48b4e..0228120cc6f8ae4a2a8eba1fc67655cd8d19cee8 100644 (file)
@@ -46,7 +46,7 @@ char *afs_createtoken_str(const char *username, const char *cell);
 /* The following definitions come from lib/afs_settoken.c  */
 
 int afs_syscall( int subcall,
-         char * path,
+         const char * path,
          int cmd,
          char * cmarg,
          int follow);
@@ -61,26 +61,9 @@ const char *audit_description_str(uint32 category);
 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
 
-/* The following definitions come from lib/bitmap.c  */
-
-struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
-int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
-bool bitmap_set(struct bitmap *bm, unsigned i);
-bool bitmap_clear(struct bitmap *bm, unsigned i);
-bool bitmap_query(struct bitmap *bm, unsigned i);
-int bitmap_find(struct bitmap *bm, unsigned ofs);
-
 /* The following definitions come from lib/charcnv.c  */
 
 void gfree_charcnv(void);
-bool convert_string(charset_t from, charset_t to,
-                     void const *src, size_t srclen, 
-                     void *dest, size_t destlen,
-                     size_t *converted_size);
-bool convert_string_error(charset_t from, charset_t to,
-                           void const *src, size_t srclen,
-                           void *dest, size_t destlen,
-                           size_t *converted_size);
 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
 size_t push_ascii_fstring(void *dest, const char *src);
@@ -202,16 +185,6 @@ void init_ldap_debugging(void);
 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
 char *escape_rdn_val_string_alloc(const char *s);
 
-/* The following definitions come from lib/module.c  */
-
-NTSTATUS smb_load_module(const char *module_name);
-int smb_load_modules(const char **modules);
-NTSTATUS smb_probe_module(const char *subsystem, const char *module);
-NTSTATUS smb_load_module(const char *module_name);
-int smb_load_modules(const char **modules);
-NTSTATUS smb_probe_module(const char *subsystem, const char *module);
-void init_modules(void);
-
 /* The following definitions come from lib/ms_fnmatch.c  */
 
 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
@@ -252,8 +225,10 @@ struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *ser
                              size_t *psize);
 bool set_share_security(const char *share_name, struct security_descriptor *psd);
 bool delete_share_security(const char *servicename);
-bool share_access_check(const struct security_token *token, const char *sharename,
-                       uint32 desired_access);
+bool share_access_check(const struct security_token *token,
+                       const char *sharename,
+                       uint32 desired_access,
+                       uint32_t *pgranted);
 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
 
 /* The following definitions come from lib/smbrun.c  */
@@ -478,22 +453,12 @@ time_t make_unix_date3(const void *date_ptr, int zone_offset);
 time_t srv_make_unix_date(const void *date_ptr);
 time_t srv_make_unix_date2(const void *date_ptr);
 time_t srv_make_unix_date3(const void *date_ptr);
-struct timespec convert_time_t_to_timespec(time_t t);
-struct timespec convert_timeval_to_timespec(const struct timeval tv);
-struct timeval convert_timespec_to_timeval(const struct timespec ts);
-struct timespec timespec_current(void);
-struct timespec timespec_min(const struct timespec *ts1,
-                          const struct timespec *ts2);
-int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
-void round_timespec_to_sec(struct timespec *ts);
-void round_timespec_to_usec(struct timespec *ts);
 struct timespec interpret_long_date(const char *p);
 void TimeInit(void);
 void get_process_uptime(struct timeval *ret_time);
 void get_startup_time(struct timeval *ret_time);
 time_t nt_time_to_unix_abs(const NTTIME *nt);
 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
-void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
 const char *time_to_asc(const time_t t);
 const char *display_time(NTTIME nttime);
@@ -524,8 +489,6 @@ bool socket_exist(const char *fname);
 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
 SMB_OFF_T get_file_size(char *file_name);
 void show_msg(const char *buf);
-void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
-void smb_setlen(char *buf,int len);
 int set_message_bcc(char *buf,int num_bytes);
 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
@@ -549,6 +512,8 @@ int interpret_protocol(const char *str,int def);
 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
 bool process_exists(const struct server_id pid);
+bool processes_exist(const struct server_id *pids, int num_pids,
+                    bool *results);
 const char *uidtoname(uid_t uid);
 char *gidtoname(gid_t gid);
 uid_t nametouid(const char *name);
@@ -604,7 +569,6 @@ struct server_id interpret_pid(const char *pid_string);
 char *procid_str_static(const struct server_id *pid);
 bool procid_valid(const struct server_id *pid);
 bool procid_is_local(const struct server_id *pid);
-bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
@@ -621,6 +585,15 @@ bool tevent_req_poll_ntstatus(struct tevent_req *req,
 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
 int timeval_to_msec(struct timeval t);
 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
+bool is_executable(const char *fname);
+bool map_open_params_to_ntcreate(const char *smb_base_fname,
+                                int deny_mode, int open_func,
+                                uint32 *paccess_mask,
+                                uint32 *pshare_mode,
+                                uint32 *pcreate_disposition,
+                                uint32 *pcreate_options,
+                                uint32_t *pprivate_flags);
+void init_modules(void);
 
 /* The following definitions come from lib/util_cmdline.c  */
 
@@ -652,8 +625,6 @@ void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info)
 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
-struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
-                                                const struct user_auth_info *info);
 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
 
@@ -746,10 +717,6 @@ int get_socket_port(int fd);
 const char *client_addr(int fd, char *addr, size_t addrlen);
 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
 int client_socket_port(int fd);
-void set_smb_read_error(enum smb_read_errors *pre,
-                       enum smb_read_errors newerr);
-void cond_set_smb_read_error(enum smb_read_errors *pre,
-                       enum smb_read_errors newerr);
 bool is_a_socket(int fd);
 void set_socket_options(int fd, const char *options);
 ssize_t read_udp_v4_socket(int fd,
@@ -796,9 +763,17 @@ NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
 int open_udp_socket(const char *host, int port);
 const char *get_peer_name(int fd, bool force_lookup);
 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
+
+struct tsocket_address;
+
+int get_remote_hostname(const struct tsocket_address *remote_address,
+                       char **name,
+                       TALLOC_CTX *mem_ctx);
+
 int create_pipe_sock(const char *socket_dir,
                     const char *socket_name,
                     mode_t dir_perms);
+int create_tcpip_socket(const struct sockaddr_storage *ifss, uint16_t *port);
 const char *get_mydnsfullname(void);
 bool is_myname_or_ipaddr(const char *s);
 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
@@ -898,7 +873,6 @@ bool validate_net_name( const char *name,
                int max_len);
 char *escape_shell_string(const char *src);
 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
-char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
 
 /* The following definitions come from lib/version.c  */
 
@@ -982,9 +956,6 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
 /* The following definitions come from libsmb/errormap.c  */
 
 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
-void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
-NTSTATUS werror_to_ntstatus(WERROR error);
-WERROR ntstatus_to_werror(NTSTATUS error);
 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
 
 /* The following definitions come from libsmb/namecache.c  */
@@ -1047,6 +1018,13 @@ NTSTATUS name_query(const char *name, int name_type,
                    TALLOC_CTX *mem_ctx,
                    struct sockaddr_storage **addrs,
                    int *num_addrs, uint8_t *flags);
+struct tevent_req *name_resolve_bcast_send(TALLOC_CTX *mem_ctx,
+                                          struct tevent_context *ev,
+                                          const char *name,
+                                          int name_type);
+NTSTATUS name_resolve_bcast_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                                struct sockaddr_storage **addrs,
+                                int *num_addrs);
 NTSTATUS name_resolve_bcast(const char *name,
                        int name_type,
                        TALLOC_CTX *mem_ctx,
@@ -1098,13 +1076,6 @@ bool get_dc_name(const char *domain,
                fstring srv_name,
                struct sockaddr_storage *ss_out);
 
-/* The following definitions come from libsmb/nterr.c  */
-
-const char *nt_errstr(NTSTATUS nt_code);
-const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
-NTSTATUS nt_status_string_to_code(const char *nt_status_str);
-NTSTATUS nt_status_squash(NTSTATUS nt_status);
-
 /* The following definitions come from libsmb/ntlmssp.c  */
 struct ntlmssp_state;
 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
@@ -1150,7 +1121,6 @@ bool netsamlogon_cache_have(const struct dom_sid *user_sid);
 const char *smb_dos_err_name(uint8 e_class, uint16 num);
 const char *get_dos_error_msg(WERROR result);
 const char *smb_dos_err_class(uint8 e_class);
-char *smb_dos_errstr(char *inbuf);
 WERROR map_werror_from_unix(int error);
 
 /* The following definitions come from libsmb/trustdom_cache.c  */
@@ -1175,9 +1145,6 @@ NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *m
 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli, 
                                           TALLOC_CTX *mem_ctx, 
                                           const char *domain) ;
-bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
-                                     char ***domain_names, uint32 *num_domains,
-                                    struct dom_sid **sids );
 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
 
 /* The following definitions come from param/loadparm.c  */
@@ -1185,7 +1152,6 @@ NTSTATUS change_trust_account_password( const char *domain, const char *remote_m
 const char *lp_smb_ports(void);
 const char *lp_dos_charset(void);
 const char *lp_unix_charset(void);
-const char *lp_display_charset(void);
 char *lp_logfile(void);
 char *lp_configfile(void);
 const char *lp_smb_passwd_file(void);
@@ -1306,11 +1272,9 @@ bool lp_reset_on_zero_vc(void);
 bool lp_log_writeable_files_on_exit(void);
 bool lp_ms_add_printer_wizard(void);
 bool lp_dns_proxy(void);
-bool lp_wins_support(void);
 bool lp_we_are_a_wins_server(void);
 bool lp_wins_proxy(void);
 bool lp_local_master(void);
-bool lp_domain_logons(void);
 const char **lp_init_logon_delayed_hosts(void);
 int lp_init_logon_delay(void);
 bool lp_load_printers(void);
@@ -1485,6 +1449,7 @@ bool lp_oplocks(int );
 bool lp_level2_oplocks(int );
 bool lp_onlyuser(int );
 bool lp_manglednames(const struct share_params *p );
+bool lp_allow_insecure_widelinks(void);
 bool lp_widelinks(int );
 bool lp_symlinks(int );
 bool lp_syncalways(int );
@@ -1510,7 +1475,7 @@ bool lp_force_printername(int );
 bool lp_nt_acl_support(int );
 bool lp_force_unknown_acl_user(int );
 bool lp_ea_support(int );
-bool _lp_use_sendfile(int );
+bool lp__use_sendfile(int );
 bool lp_profile_acls(int );
 bool lp_map_acl_inherit(int );
 bool lp_afs_share(int );
@@ -1553,10 +1518,13 @@ int lp_server_signing(void);
 int lp_client_ldap_sasl_wrapping(void);
 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def);
 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
+struct loadparm_service;
+const char *lp_parm_const_string_service(struct loadparm_service *service, const char *type, const char *option);
 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def);
 int lp_parm_int(int snum, const char *type, const char *option, int def);
 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def);
 bool lp_parm_bool(int snum, const char *type, const char *option, bool def);
+struct enum_list;
 int lp_parm_enum(int snum, const char *type, const char *option,
                 const struct enum_list *_enum, int def);
 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
@@ -1589,7 +1557,13 @@ const char *lp_ldap_machine_suffix(void);
 const char *lp_ldap_user_suffix(void);
 const char *lp_ldap_group_suffix(void);
 const char *lp_ldap_idmap_suffix(void);
-void *lp_local_ptr_by_snum(int snum, void *ptr);
+struct parm_struct;
+/* Return a pointer to a service by name.  */
+struct loadparm_service *lp_service(const char *pszServiceName);
+struct loadparm_service *lp_servicebynum(int snum);
+struct loadparm_service *lp_default_loadparm_service(void);
+void *lp_parm_ptr(struct loadparm_service *service, struct parm_struct *parm);
+void *lp_local_ptr_by_snum(int snum, struct parm_struct *parm);
 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
 bool lp_set_option(const char *option);
@@ -1621,14 +1595,16 @@ enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
 int load_usershare_service(const char *servicename);
 int load_usershare_shares(struct smbd_server_connection *sconn);
 void gfree_loadparm(void);
-void lp_set_in_client(bool b);
-bool lp_is_in_client(void);
 bool lp_load(const char *pszFname,
             bool global_only,
             bool save_defaults,
             bool add_ipc,
             bool initialize_globals);
 bool lp_load_initial_only(const char *pszFname);
+bool lp_load_global(const char *file_name);
+bool lp_load_client(const char *file_name);
+bool lp_load_global_no_reinit(const char *file_name);
+bool lp_load_client_no_reinit(const char *file_name);
 bool lp_load_with_registry_shares(const char *pszFname,
                                  bool global_only,
                                  bool save_defaults,
@@ -1643,13 +1619,10 @@ struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
                                      const char *sharename);
 const char *volume_label(int snum);
 bool lp_domain_master(void);
-bool lp_domain_master_true_or_auto(void);
 bool lp_preferred_master(void);
 void lp_remove_service(int snum);
 void lp_copy_service(int snum, const char *new_name);
 int lp_default_server_announce(void);
-int lp_major_announce_version(void);
-int lp_minor_announce_version(void);
 void lp_set_name_resolve_order(const char *new_order);
 const char *lp_printername(int snum);
 void lp_set_logfile(const char *name);
@@ -1669,9 +1642,9 @@ enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
 int lp_min_receive_file_size(void);
 char* lp_perfcount_module(void);
-void lp_set_passdb_backend(const char *backend);
 void widelinks_warning(int snum);
 const char *lp_ncalrpc_dir(void);
+void _lp_set_server_role(int server_role);
 
 /* The following definitions come from param/loadparm_ctx.c  */
 
@@ -1697,14 +1670,14 @@ void server_messaging_context_free(void);
 struct sessionid;
 bool sessionid_init(void);
 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
-int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
-                                struct sessionid *session,
-                                void *private_data),
-                      void *private_data);
-int sessionid_traverse_read(int (*fn)(const char *key,
+NTSTATUS sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
                                      struct sessionid *session,
                                      void *private_data),
                            void *private_data);
+NTSTATUS sessionid_traverse_read(int (*fn)(const char *key,
+                                          struct sessionid *session,
+                                          void *private_data),
+                                void *private_data);
 
 /* The following definitions come from utils/passwd_util.c  */
 
@@ -1823,7 +1796,6 @@ void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
 bool change_to_root_user(void);
-void smbd_set_server_fd(int fd);
 void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
 void contend_level2_oplocks_end(files_struct *fsp,