Rolled back Lukes changes. Not quite ready for prime time.
[kai/samba.git] / source3 / include / proto.h
index c2fab684293ee9e7a676d48b6a2cb4b8265e68a7..3929348da6dcf8381cc5ff2bbccd7dc05edfff17 100644 (file)
@@ -14,7 +14,7 @@ int interpret_character_set(char *str, int def);
 
 /*The following definitions come from  charset.c  */
 
-void charset_initialise(void);
+void charset_initialise(int client_codepage);
 void add_char_string(char *s);
 
 /*The following definitions come from  chgpasswd.c  */
@@ -51,6 +51,7 @@ char *smb_errstr(char *inbuf);
 /*The following definitions come from  clitar.c  */
 
 int strslashcmp(char *s1,char *s2);
+int padit(char *buf, int bufsize, int padsize);
 void cmd_block(void);
 void cmd_tarmode(void);
 void cmd_setmode(void);
@@ -139,12 +140,16 @@ char *lp_domain_controller(void);
 char *lp_username_map(void);
 char *lp_character_set(void);
 char *lp_logon_script(void);
+char *lp_logon_path(void);
+char *lp_veto_files(void);
 char *lp_remote_announce(void);
 char *lp_wins_server(void);
 char *lp_interfaces(void);
 char *lp_socket_address(void);
+char *lp_nis_home_map_name(void);
 BOOL lp_wins_support(void);
 BOOL lp_wins_proxy(void);
+BOOL lp_local_master(void);
 BOOL lp_domain_master(void);
 BOOL lp_domain_logons(void);
 BOOL lp_preferred_master(void);
@@ -160,6 +165,9 @@ BOOL lp_strip_dot(void);
 BOOL lp_encrypted_passwords(void);
 BOOL lp_syslog_only(void);
 BOOL lp_browse_list(void);
+BOOL lp_unix_realname(void);
+BOOL lp_nis_home_map(void);
+BOOL lp_time_server(void);
 int lp_os_level(void);
 int lp_max_ttl(void);
 int lp_max_log_size(void);
@@ -170,6 +178,8 @@ int lp_maxpacket(void);
 int lp_keepalive(void);
 int lp_passwordlevel(void);
 int lp_readsize(void);
+int lp_shmem_size(void);
+int lp_shmem_hash_size(void);
 int lp_deadtime(void);
 int lp_maxprotocol(void);
 int lp_security(void);
@@ -177,6 +187,7 @@ int lp_printing(void);
 int lp_maxdisksize(void);
 int lp_lpqcachetime(void);
 int lp_syslog(void);
+int lp_client_code_page(void);
 char *lp_preexec(int );
 char *lp_postexec(int );
 char *lp_rootpreexec(int );
@@ -235,6 +246,9 @@ BOOL lp_map_system(int );
 BOOL lp_delete_readonly(int );
 BOOL lp_fake_oplocks(int );
 int lp_create_mode(int );
+int lp_force_create_mode(int );
+int lp_dir_mode(int );
+int lp_force_dir_mode(int );
 int lp_max_connections(int );
 int lp_defaultcase(int );
 int lp_minprintspace(int );
@@ -254,25 +268,22 @@ char *volume_label(int snum);
 
 /*The following definitions come from  locking.c  */
 
-BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
-int file_lock(char *name,int timeout);
-void file_unlock(int fd);
 BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset);
 BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
 BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
 BOOL start_share_mode_mgmt(void);
 BOOL stop_share_mode_mgmt(void);
-int get_share_mode_by_fnum(int cnum,int fnum,int *pid);
-int get_share_mode_byname(int cnum,char *fname,int *pid);
-int get_share_mode(int cnum,struct stat *sbuf,int *pid);
-void del_share_mode(int fnum);
-BOOL set_share_mode(int fnum,int mode);
-void clean_share_modes(void);
+BOOL lock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token *);
+BOOL unlock_share_entry(int cnum, uint32 dev, uint32 inode, share_lock_token);
+int get_share_modes(int cnum, share_lock_token token, uint32 dev, uint32 inode, 
+                    min_share_mode_entry **old_shares);
+void del_share_mode(share_lock_token token, int fnum);
+BOOL set_share_mode(share_lock_token token, int fnum);
 
 /*The following definitions come from  mangle.c  */
 
 int str_checksum(char *s);
-BOOL is_8_3(char *fname);
+BOOL is_8_3(char *fname, BOOL check_case);
 void create_mangled_stack(int size);
 BOOL check_mangled_stack(char *s);
 BOOL is_mangled(char *s);
@@ -291,19 +302,21 @@ int reply_sendend(char *inbuf,char *outbuf);
 
 /*The following definitions come from  nameannounce.c  */
 
+void reset_announce_timer();
 void announce_request(struct work_record *work, struct in_addr ip);
 void do_announce_request(char *info, char *to_name, int announce_type, 
                         int from,
                         int to, struct in_addr dest_ip);
 void sync_server(enum state_type state, char *serv_name, char *work_name, 
                 int name_type,
+                 struct subnet_record *d,
                 struct in_addr ip);
 void do_announce_host(int command,
                char *from_name, int from_type, struct in_addr from_ip,
                char *to_name  , int to_type  , struct in_addr to_ip,
                time_t announce_interval,
                char *server_name, int server_type, char *server_comment);
-void remove_my_servers(void);
+void announce_my_servers_removed(void);
 void announce_server(struct subnet_record *d, struct work_record *work,
                     char *name, char *comment, time_t ttl, int server_type);
 void announce_host(time_t t);
@@ -314,7 +327,9 @@ void announce_remote(time_t t);
 
 void expire_browse_cache(time_t t);
 struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
-                                             time_t ttl, struct in_addr ip, BOOL local);
+                                             time_t ttl, 
+                                              struct subnet_record *d,
+                                              struct in_addr ip, BOOL local);
 void do_browser_lists(time_t t);
 
 /*The following definitions come from  nameconf.c  */
@@ -338,8 +353,7 @@ BOOL name_equal(struct nmb_name *n1,struct nmb_name *n2);
 BOOL ms_browser_name(char *name, int type);
 void remove_name(struct subnet_record *d, struct name_record *n);
 struct name_record *find_name(struct name_record *n,
-                       struct nmb_name *name,
-                       int search);
+                       struct nmb_name *name, int search);
 struct name_record *find_name_search(struct subnet_record **d,
                        struct nmb_name *name,
                        int search, struct in_addr ip);
@@ -353,8 +367,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
                int ttl, enum name_source source, struct in_addr ip,
                BOOL new_only,BOOL wins);
 void expire_names(time_t t);
-struct name_record *dns_name_search(struct nmb_name *question,
-                                   int Time, int search);
+struct name_record *dns_name_search(struct nmb_name *question, int Time);
 
 /*The following definitions come from  namedbresp.c  */
 
@@ -387,11 +400,9 @@ void expire_servers(time_t t);
 
 struct subnet_record *find_subnet(struct in_addr bcast_ip);
 struct subnet_record *find_req_subnet(struct in_addr ip, BOOL bcast);
-void add_subnet_interfaces(void);
+struct subnet_record *find_subnet_all(struct in_addr bcast_ip);
+void add_workgroup_to_subnet( struct subnet_record *d, char *group);
 void add_my_subnets(char *group);
-struct subnet_record *add_subnet_entry(struct in_addr bcast_ip, 
-                                      struct in_addr mask_ip,
-                                      char *name, BOOL add, BOOL lmhosts);
 void write_browse_list(time_t t);
 
 /*The following definitions come from  namedbwork.c  */
@@ -412,8 +423,14 @@ void send_election(struct subnet_record *d, char *group,uint32 criterion,
 void name_unregister_work(struct subnet_record *d, char *name, int name_type);
 void name_register_work(struct subnet_record *d, char *name, int name_type,
                                int nb_flags, time_t ttl, struct in_addr ip, BOOL bcast);
-void become_master(struct subnet_record *d, struct work_record *work);
-void become_nonmaster(struct subnet_record *d, struct work_record *work,
+void become_local_master(struct subnet_record *d, struct work_record *work);
+void become_domain_master(struct subnet_record *d, struct work_record *work);
+void become_logon_server(struct subnet_record *d, struct work_record *work);
+void unbecome_local_master(struct subnet_record *d, struct work_record *work,
+                               int remove_type);
+void unbecome_domain_master(struct subnet_record *d, struct work_record *work,
+                               int remove_type);
+void unbecome_logon_server(struct subnet_record *d, struct work_record *work,
                                int remove_type);
 void run_elections(time_t t);
 void process_election(struct packet_struct *p,char *buf);
@@ -427,9 +444,9 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len);
 
 void debug_browse_data(char *outbuf, int len);
 void initiate_netbios_packet(uint16 *id,
-                               int fd,int quest_type,char *name,int name_type,
-                           int nb_flags,BOOL bcast,BOOL recurse,
-                           struct in_addr to_ip);
+                            int fd,int quest_type,char *name,int name_type,
+                            int nb_flags,BOOL bcast,BOOL recurse,
+                            struct in_addr to_ip);
 void reply_netbios_packet(struct packet_struct *p1,int trn_id,
                                int rcode, int rcv_code, int opcode, BOOL recurse,
                                struct nmb_name *rr_name,int rr_type,int rr_class,int ttl,
@@ -437,7 +454,7 @@ void reply_netbios_packet(struct packet_struct *p1,int trn_id,
 void queue_packet(struct packet_struct *packet);
 void run_packet_queue();
 void listen_for_packets(BOOL run_election);
-BOOL send_mailslot_reply(char *mailslot,int fd,char *buf,int len,char *srcname,
+BOOL send_mailslot_reply(BOOL unique, char *mailslot,int fd,char *buf,int len,char *srcname,
                         char *dstname,int src_type,int dest_type,
                         struct in_addr dest_ip,struct in_addr src_ip);
 
@@ -453,7 +470,7 @@ BOOL name_query(int fd,char *name,int name_type,
 /*The following definitions come from  nameresp.c  */
 
 void expire_netbios_response_entries(time_t t);
-struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
+struct response_record *queue_netbios_pkt_wins(
                                int fd,int quest_type,enum state_type state,
                            char *name,int name_type,int nb_flags, time_t ttl,
                                int server_type, char *my_name, char *my_comment,
@@ -463,13 +480,14 @@ struct response_record *queue_netbios_packet(struct subnet_record *d,
                        int fd,int quest_type,enum state_type state,char *name,
                        int name_type,int nb_flags, time_t ttl,
                        int server_type, char *my_name, char *my_comment,
-                   BOOL bcast,BOOL recurse,
+                       BOOL bcast,BOOL recurse,
                        struct in_addr send_ip, struct in_addr reply_to_ip);
 
 /*The following definitions come from  nameserv.c  */
 
-void remove_name_entry(struct subnet_record *d, char *name,int type);
-void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags);
+void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct);
+void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags, BOOL direct);
+void add_domain_names(time_t t);
 void add_my_names(void);
 void remove_my_names();
 void refresh_my_names(time_t t);
@@ -482,10 +500,6 @@ void add_name_respond(struct subnet_record *d, int fd, struct in_addr from_ip,
                                struct nmb_name *name,
                                int nb_flags, int ttl, struct in_addr register_ip,
                                BOOL new_owner, struct in_addr reply_to_ip);
-void send_name_response(int fd, struct in_addr from_ip,
-                               int name_trn_id, int opcode, BOOL success, BOOL recurse,
-                               struct nmb_name *reply_name, int nb_flags, int ttl,
-                               struct in_addr ip);
 void reply_name_release(struct packet_struct *p);
 void reply_name_reg(struct packet_struct *p);
 void reply_name_status(struct packet_struct *p);
@@ -537,11 +551,10 @@ BOOL pm_process(char *pszFileName,BOOL (*sfunc)(char *),BOOL (*pfunc)(char *,cha
 void generate_next_challenge(char *challenge);
 BOOL set_challenge(char *challenge);
 BOOL last_challenge(char *challenge);
-int valid_uid(int uid);
-user_struct *get_valid_user_struct(int uid);
-void invalidate_uid(int uid);
-char *validated_username(int vuid);
-void register_uid(int uid,int gid, char *name,BOOL guest);
+user_struct *get_valid_user_struct(uint16 vuid);
+void invalidate_vuid(uint16 vuid);
+char *validated_username(uint16 vuid);
+uint16 register_vuid(int uid,int gid, char *name,BOOL guest);
 void add_session_user(char *user);
 void dfs_unlogin(void);
 BOOL password_check(char *password);
@@ -549,7 +562,7 @@ BOOL smb_password_check(char *password, unsigned char *part_passwd, unsigned cha
 BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd);
 BOOL user_ok(char *user,int snum);
 BOOL authorise_login(int snum,char *user,char *password, int pwlen, 
-                    BOOL *guest,BOOL *force,int vuid);
+                    BOOL *guest,BOOL *force,uint16 vuid);
 BOOL check_hosts_equiv(char *user);
 BOOL server_cryptkey(char *buf);
 BOOL server_validate(char *buf);
@@ -658,14 +671,18 @@ int reply_getattrE(char *inbuf,char *outbuf);
 
 /*The following definitions come from  server.c  */
 
+void  *dflt_sig(void);
+void  killkids(void);
 mode_t unix_mode(int cnum,int dosmode);
 int dos_mode(int cnum,char *path,struct stat *sbuf);
 int dos_chmod(int cnum,char *fname,int dosmode,struct stat *st);
-BOOL unix_convert(char *name,int cnum);
+BOOL unix_convert(char *name,int cnum,pstring saved_last_component);
 int disk_free(char *path,int *bsize,int *dfree,int *dsize);
 int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
 BOOL check_name(char *name,int cnum);
-void open_file(int fnum,int cnum,char *fname1,int flags,int mode);
+int fd_attempt_open(char *fname, int flags, int mode);
+void fd_attempt_reopen(char *fname, int mode, file_fd_struct *fd_ptr);
+int fd_attempt_close(file_fd_struct *fd_ptr);
 void sync_file(int fnum);
 void close_file(int fnum);
 BOOL check_file_sharing(int cnum,char *fname);
@@ -683,14 +700,14 @@ BOOL snum_used(int snum);
 BOOL reload_services(BOOL test);
 int setup_groups(char *user, int uid, int gid, int *p_ngroups, 
                 int **p_igroups, gid_t **p_groups);
-int make_connection(char *service,char *user,char *password, int pwlen, char *dev,int vuid);
+int make_connection(char *service,char *user,char *password, int pwlen, char *dev,uint16 vuid);
 int find_free_file(void );
 int reply_corep(char *outbuf);
 int reply_coreplus(char *outbuf);
 int reply_lanman1(char *outbuf);
 int reply_lanman2(char *outbuf);
 int reply_nt1(char *outbuf);
-void close_cnum(int cnum, int uid);
+void close_cnum(int cnum, uint16 vuid);
 BOOL yield_connection(int cnum,char *name,int max_connections);
 BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear);
 void exit_server(char *reason);
@@ -701,17 +718,19 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize);
 
 /*The following definitions come from  shmem.c  */
 
-BOOL shm_open( char *file_name, int size);
-BOOL shm_close( void );
-shm_offset_t shm_alloc(int size);
-BOOL shm_free(shm_offset_t offset);
-shm_offset_t shm_get_userdef_off(void);
-BOOL shm_set_userdef_off(shm_offset_t userdef_off);
-void * shm_offset2addr(shm_offset_t offset);
-shm_offset_t shm_addr2offset(void *addr);
-BOOL shm_lock(void);
-BOOL shm_unlock(void);
-BOOL shm_get_usage(int *bytes_free,
+BOOL smb_shm_open( char *file_name, int size);
+BOOL smb_shm_close( void );
+BOOL smb_shm_free(smb_shm_offset_t offset);
+BOOL smb_shm_set_userdef_off(smb_shm_offset_t userdef_off);
+void * smb_shm_offset2addr(smb_shm_offset_t offset);
+BOOL smb_shm_lock(void);
+BOOL smb_shm_unlock(void);
+smb_shm_offset_t smb_shm_alloc(int size);
+smb_shm_offset_t smb_shm_addr2offset(void *addr);
+smb_shm_offset_t smb_shm_get_userdef_off(void);
+BOOL smb_shm_lock_hash_entry( unsigned int entry);
+BOOL smb_shm_unlock_hash_entry( unsigned int entry );
+BOOL smb_shm_get_usage(int *bytes_free,
                   int *bytes_used,
                   int *bytes_overhead);
 
@@ -763,6 +782,7 @@ int sys_rename(char *from, char *to);
 int sys_chmod(char *fname,int mode);
 int sys_chown(char *fname,int uid,int gid);
 int sys_chroot(char *dname);
+struct hostent *sys_gethostbyname(char *name);
 
 /*The following definitions come from  testparm.c  */
 
@@ -803,7 +823,7 @@ char *ufc_crypt(char *key,char *salt);
 
 void init_uid(void);
 BOOL become_guest(void);
-BOOL become_user(int cnum, int uid);
+BOOL become_user(int cnum, uint16 vuid);
 BOOL unbecome_user(void );
 int smbrun(char *cmd,char *outfile,BOOL shared);
 
@@ -836,8 +856,8 @@ time_t file_modtime(char *fname);
 BOOL directory_exist(char *dname,struct stat *st);
 uint32 file_size(char *file_name);
 char *attrib_string(int mode);
-int StrCaseCmp(char *s, char *t);
-int StrnCaseCmp(char *s, char *t, int n);
+int StrCaseCmp(const char *s, const char *t);
+int StrnCaseCmp(const char *s, const char *t, int n);
 BOOL strequal(char *s1,char *s2);
 BOOL strnequal(char *s1,char *s2,int n);
 BOOL strcsequal(char *s1,char *s2);
@@ -913,6 +933,7 @@ int interpret_security(char *str,int def);
 uint32 interpret_addr(char *str);
 struct in_addr *interpret_addr2(char *str);
 BOOL zero_ip(struct in_addr ip);
+void reset_globals_after_fork();
 char *client_name(void);
 char *client_addr(void);
 void standard_sub_basic(char *s);
@@ -925,6 +946,11 @@ char *gidtoname(int gid);
 void BlockSignals(BOOL block,int signum);
 void ajt_panic(void);
 char *readdirname(void *p);
+BOOL is_vetoed_name(char *name);
+BOOL is_vetoed_path(char *name);
+BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
+int file_lock(char *name,int timeout);
+void file_unlock(int fd);
 
 /*The following definitions come from  vt_mode.c  */