Add cli_posix_readlink() and a torture test for it.
[ira/wip.git] / source3 / include / proto.h
index 194d74db5e523b6e30d7448ce021a475c62eafe1..342c1432eb336dbf620b135401e57353b3f2eb0b 100644 (file)
@@ -597,6 +597,7 @@ bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
 bool revoke_all_privileges( DOM_SID *sid );
 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
 NTSTATUS privilege_create_account(const DOM_SID *sid );
+NTSTATUS privilege_delete_account(const struct dom_sid *sid);
 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
 void privilege_set_free(PRIVILEGE_SET *priv_set);
@@ -1009,13 +1010,6 @@ void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
 void put_long_date_timespec(char *p, struct timespec ts);
 void put_long_date(char *p, time_t t);
-struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs);
-struct timespec get_atimespec(const SMB_STRUCT_STAT *pst);
-void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
-struct timespec get_mtimespec(const SMB_STRUCT_STAT *pst);
-void set_mtimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
-struct timespec get_ctimespec(const SMB_STRUCT_STAT *pst);
-void set_ctimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
 void dos_filetime_timespec(struct timespec *tsp);
 time_t make_unix_date2(const void *date_ptr, int zone_offset);
 time_t make_unix_date3(const void *date_ptr, int zone_offset);
@@ -1112,7 +1106,7 @@ char *clean_name(TALLOC_CTX *ctx, const char *s);
 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
 int set_blocking(int fd, bool set);
 void smb_msleep(unsigned int t);
-bool reinit_after_fork(struct messaging_context *msg_ctx,
+NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
                       struct event_context *ev_ctx,
                       bool parent_longlived);
 bool yesno(const char *p);
@@ -1415,11 +1409,6 @@ int create_pipe_sock(const char *socket_dir,
                     mode_t dir_perms);
 const char *get_mydnsfullname(void);
 bool is_myname_or_ipaddr(const char *s);
-struct tevent_req *read_smb_send(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                int fd);
-ssize_t read_smb_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-                     uint8_t **pbuf, int *perrno);
 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
                                    struct fncall_context *ctx,
@@ -2169,11 +2158,21 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
                           const char *pass, int passlen,
                           const char *ntpass, int ntpasslen,
                           const char *workgroup);
+struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
+                                                 struct event_context *ev,
+                                                 struct cli_state *cli,
+                                                 struct tevent_req **psmbreq);
 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
                                                struct event_context *ev,
                                                struct cli_state *cli);
 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
 bool cli_ulogoff(struct cli_state *cli);
+struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       struct cli_state *cli,
+                                       const char *share, const char *dev,
+                                       const char *pass, int passlen,
+                                       struct tevent_req **psmbreq);
 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
                                      struct event_context *ev,
                                      struct cli_state *cli,
@@ -2333,12 +2332,37 @@ void cli_reset_error(struct cli_state *cli);
 
 /* The following definitions come from libsmb/clifile.c  */
 
+struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       struct cli_state *cli,
+                                       const char *oldname,
+                                       const char *newname);
+NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
+NTSTATUS cli_posix_symlink(struct cli_state *cli,
+                       const char *oldname,
+                       const char *newname);
+struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       struct cli_state *cli,
+                                       const char *fname,
+                                       size_t len);
+NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
+                               char *retpath, size_t len);
+NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
+                       char *linkpath, size_t len);
+struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       struct cli_state *cli,
+                                       const char *oldname,
+                                       const char *newname);
+NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
+NTSTATUS cli_posix_hardlink(struct cli_state *cli,
+                       const char *oldname,
+                       const char *newname);
 uint32_t unix_perms_to_wire(mode_t perms);
 mode_t wire_perms_to_unix(uint32_t perms);
 bool cli_unix_getfacl(struct cli_state *cli, const char *name, size_t *prb_size, char **retbuf);
 bool cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbuf);
-bool cli_unix_symlink(struct cli_state *cli, const char *oldname, const char *newname);
-bool cli_unix_hardlink(struct cli_state *cli, const char *oldname, const char *newname);
 bool cli_unix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
 bool cli_unix_chown(struct cli_state *cli, const char *fname, uid_t uid, gid_t gid);
 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
@@ -2460,10 +2484,19 @@ NTSTATUS cli_getattrE(struct cli_state *cli,
                        time_t *change_time,
                        time_t *access_time,
                        time_t *write_time);
-bool cli_setattrE(struct cli_state *cli, int fd,
-                 time_t change_time,
-                  time_t access_time,
-                  time_t write_time);
+struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
+                               struct event_context *ev,
+                               struct cli_state *cli,
+                               uint16_t fnum,
+                               time_t change_time,
+                               time_t access_time,
+                               time_t write_time);
+NTSTATUS cli_setattrE_recv(struct tevent_req *req);
+NTSTATUS cli_setattrE(struct cli_state *cli,
+                       uint16_t fnum,
+                       time_t change_time,
+                       time_t access_time,
+                       time_t write_time);
 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
                                struct event_context *ev,
                                struct cli_state *cli,
@@ -2477,7 +2510,17 @@ NTSTATUS cli_getatr(struct cli_state *cli,
                        uint16_t *attr,
                        SMB_OFF_T *size,
                        time_t *write_time);
-bool cli_setatr(struct cli_state *cli, const char *fname, uint16_t attr, time_t t);
+struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
+                               struct event_context *ev,
+                               struct cli_state *cli,
+                               const char *fname,
+                               uint16_t attr,
+                               time_t mtime);
+NTSTATUS cli_setatr_recv(struct tevent_req *req);
+NTSTATUS cli_setatr(struct cli_state *cli,
+                const char *fname,
+                uint16_t attr,
+                time_t mtime);
 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
                                  struct event_context *ev,
                                  struct cli_state *cli,
@@ -2502,14 +2545,28 @@ bool cli_get_ea_list_fnum(struct cli_state *cli, uint16_t fnum,
                TALLOC_CTX *ctx,
                size_t *pnum_eas,
                struct ea_struct **pea_list);
-int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t mode);
-int cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
+struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       struct cli_state *cli,
+                                       const char *fname,
+                                       int flags,
+                                       mode_t mode);
+NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
+NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
+                       int flags, mode_t mode, uint16_t *fnum);
+struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev,
+                                        struct cli_state *cli,
+                                        const char *fname,
+                                        mode_t mode);
+NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
+NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
 
 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
                                        struct event_context *ev,
                                        struct cli_state *cli,
                                        const char *fname);
-NTSTATUS cli_posix_unlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
 
 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
@@ -4048,7 +4105,7 @@ bool lp_recursive_veto_delete(int );
 bool lp_dos_filemode(int );
 bool lp_dos_filetimes(int );
 bool lp_dos_filetime_resolution(int );
-bool lp_fake_dir_create_times(int );
+bool lp_fake_dir_create_times(void);
 bool lp_blocking_locks(int );
 bool lp_inherit_perms(int );
 bool lp_inherit_acls(int );
@@ -4223,13 +4280,6 @@ int lp_min_receive_file_size(void);
 char* lp_perfcount_module(void);
 
 
-/* The following definitions come from param/params.c  */
-
-bool pm_process( const char *FileName,
-               bool (*sfunc)(const char *, void *),
-               bool (*pfunc)(const char *, const char *, void *),
-               void *userdata);
-
 /* The following definitions come from param/util.c  */
 
 uint32 get_int_param( const char* param );
@@ -4315,11 +4365,6 @@ bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
                       const char **account_name, uint32 *channel);
 struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
                                                struct samu *pw);
-NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
-                        uint32_t acct_flags,
-                        const char *account,
-                        struct passwd **passwd_p);
-
 /* The following definitions come from passdb/pdb_compat.c  */
 
 uint32 pdb_get_user_rid (const struct samu *sampass);
@@ -4799,12 +4844,9 @@ bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type);
 int print_queue_status(int snum, 
                       print_queue_struct **ppqueue,
                       print_status_struct *status);
-bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum,
-                      WERROR *errcode);
-bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum,
-                       WERROR *errcode);
-bool print_queue_purge(struct auth_serversupplied_info *server_info, int snum,
-                      WERROR *errcode);
+WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum);
+WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum);
+WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum);
 
 /* The following definitions come from printing/printing_db.c  */
 
@@ -5791,6 +5833,28 @@ NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
 
 /* The following definitions come from rpc_server/srv_samr_util.c  */
 
+void copy_id2_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo2 *from);
+void copy_id4_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo4 *from);
+void copy_id6_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo6 *from);
+void copy_id8_to_sam_passwd(struct samu *to,
+                           struct samr_UserInfo8 *from);
+void copy_id10_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo10 *from);
+void copy_id11_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo11 *from);
+void copy_id12_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo12 *from);
+void copy_id13_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo13 *from);
+void copy_id14_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo14 *from);
+void copy_id16_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo16 *from);
+void copy_id17_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo17 *from);
 void copy_id18_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo18 *from);
 void copy_id20_to_sam_passwd(struct samu *to,
@@ -6110,7 +6174,7 @@ void dptr_SeekDir(struct dptr_struct *dptr, long offset);
 long dptr_TellDir(struct dptr_struct *dptr);
 bool dptr_has_wild(struct dptr_struct *dptr);
 int dptr_dnum(struct dptr_struct *dptr);
-const char *dptr_ReadDirName(TALLOC_CTX *ctx,
+char *dptr_ReadDirName(TALLOC_CTX *ctx,
                        struct dptr_struct *dptr,
                        long *poffset,
                        SMB_STRUCT_STAT *pst);
@@ -6128,7 +6192,7 @@ bool get_dir_entry(TALLOC_CTX *ctx,
                char **pp_fname_out,
                SMB_OFF_T *size,
                uint32 *mode,
-               time_t *date,
+               struct timespec *date,
                bool check_descend,
                bool ask_sharemode);
 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
@@ -6232,13 +6296,13 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst);
 
 /* The following definitions come from smbd/filename.c  */
 
+NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
+                             char **full_name);
 NTSTATUS unix_convert(TALLOC_CTX *ctx,
-                       connection_struct *conn,
-                       const char *orig_path,
-                       bool allow_wcard_last_component,
-                       char **pp_conv_path,
-                       char **pp_saved_last_component,
-                       SMB_STRUCT_STAT *pst);
+                     connection_struct *conn,
+                     const char *orig_path,
+                     struct smb_filename **smb_fname,
+                     uint32_t ucf_flags);
 NTSTATUS check_name(connection_struct *conn, const char *name);
 int get_real_filename(connection_struct *conn, const char *path,
                      const char *name, TALLOC_CTX *mem_ctx,
@@ -6253,6 +6317,10 @@ void file_close_pid(uint16 smbpid, int vuid);
 void file_init(void);
 void file_close_user(int vuid);
 void file_dump_open_table(void);
+struct files_struct *file_walk_table(
+       struct files_struct *(*fn)(struct files_struct *fsp,
+                                  void *private_data),
+       void *private_data);
 files_struct *file_find_fd(int fd);
 files_struct *file_find_dif(struct file_id id, unsigned long gen_id);
 files_struct *file_find_fsp(files_struct *orig_fsp);
@@ -7138,4 +7206,11 @@ struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                               void *private_data);
 int fncall_recv(struct tevent_req *req, int *perr);
 
+/* The following definitions come from rpc_server/srv_samr_nt.c */
+NTSTATUS access_check_object( SEC_DESC *psd, NT_USER_TOKEN *token,
+                               SE_PRIV *rights, uint32 rights_mask,
+                               uint32 des_access, uint32 *acc_granted,
+                               const char *debug);
+void map_max_allowed_access(const NT_USER_TOKEN *token,
+                               uint32_t *pacc_requested);
 #endif /*  _PROTO_H_  */