s3:smbd: add a nfs backend for sysquotas.
[amitay/samba.git] / source3 / include / proto.h
index e2fcdceef3aaf6cd6a8d89e3ef37a2b2626cd84e..67718a954a424cef47e37e95383ddbdbf1ea152b 100644 (file)
@@ -66,6 +66,10 @@ NTSTATUS check_sam_security(const DATA_BLOB *challenge,
                            TALLOC_CTX *mem_ctx,
                            const struct auth_usersupplied_info *user_info,
                            struct auth_serversupplied_info **server_info);
+NTSTATUS check_sam_security_info3(const DATA_BLOB *challenge,
+                                 TALLOC_CTX *mem_ctx,
+                                 const struct auth_usersupplied_info *user_info,
+                                 struct netr_SamInfo3 **pinfo3);
 NTSTATUS auth_sam_init(void);
 
 /* The following definitions come from auth/auth_server.c  */
@@ -79,13 +83,15 @@ NTSTATUS auth_unix_init(void);
 /* The following definitions come from auth/auth_util.c  */
 
 NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info,
-                           const char *smb_name, 
-                           const char *client_domain, 
+                           const char *smb_name,
+                           const char *client_domain,
                            const char *workstation_name,
-                           DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd,
-                           DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd,
-                           DATA_BLOB *plaintext, 
-                           bool encrypted);
+                           DATA_BLOB *lm_pwd,
+                           DATA_BLOB *nt_pwd,
+                           const struct samr_Password *lm_interactive_pwd,
+                           const struct samr_Password *nt_interactive_pwd,
+                           const char *plaintext,
+                           enum auth_password_state password_state);
 bool make_user_info_netlogon_network(struct auth_usersupplied_info **user_info,
                                     const char *smb_name, 
                                     const char *client_domain, 
@@ -142,7 +148,7 @@ NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
 NTSTATUS make_server_info_system(TALLOC_CTX *mem_ctx,
                                 struct auth_serversupplied_info **server_info);
 bool copy_current_user(struct current_user *dst, struct current_user *src);
-struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
+struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
                             fstring save_username, bool create );
 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, 
                                const char *sent_nt_username,
@@ -160,7 +166,7 @@ bool is_trusted_domain(const char* dom_name);
 
 /* The following definitions come from auth/user_info.c  */
 
-NTSTATUS make_user_info(struct auth_usersupplied_info **user_info,
+NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
                        const char *smb_name,
                        const char *internal_username,
                        const char *client_domain,
@@ -168,10 +174,10 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **user_info,
                        const char *workstation_name,
                        const DATA_BLOB *lm_pwd,
                        const DATA_BLOB *nt_pwd,
-                       const DATA_BLOB *lm_interactive_pwd,
-                       const DATA_BLOB *nt_interactive_pwd,
-                       const DATA_BLOB *plaintext,
-                       bool encrypted);
+                       const struct samr_Password *lm_interactive_pwd,
+                       const struct samr_Password *nt_interactive_pwd,
+                       const char *plaintext_password,
+                       enum auth_password_state password_state);
 void free_user_info(struct auth_usersupplied_info **user_info);
 
 /* The following definitions come from auth/auth_winbind.c  */
@@ -215,10 +221,9 @@ NTSTATUS auth_wbc_init(void);
 
 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
 bool smb_pam_close_session(char *user, char *tty, char *rhost);
-NTSTATUS smb_pam_accountcheck(const char * user);
+NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
 NTSTATUS smb_pam_passcheck(const char * user, const char * password);
 bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword);
-NTSTATUS smb_pam_accountcheck(const char * user);
 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
 
@@ -226,7 +231,7 @@ bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
 
 void dfs_unlogin(void);
 NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password, 
-                   int pwlen, bool (*fn) (const char *, const char *), bool run_cracker);
+                   bool run_cracker);
 
 /* The following definitions come from auth/token_util.c  */
 
@@ -345,7 +350,6 @@ bool allow_access(const char **deny_list,
                const char **allow_list,
                const char *cname,
                const char *caddr);
-bool check_access(int sock, const char **allow_list, const char **deny_list);
 
 /* The following definitions come from passdb/account_pol.c  */
 
@@ -964,6 +968,13 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
 
+int sys_get_nfs_quota(const char *path, const char *bdev,
+                     enum SMB_QUOTA_TYPE qtype,
+                     unid_t id, SMB_DISK_QUOTA *dp);
+int sys_set_nfs_quota(const char *path, const char *bdev,
+                     enum SMB_QUOTA_TYPE qtype,
+                     unid_t id, SMB_DISK_QUOTA *dp);
+
 /* The following definitions come from lib/system.c  */
 
 void *sys_memalign( size_t align, size_t size );
@@ -1442,8 +1453,6 @@ bool send_keepalive(int client);
 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
                                          unsigned int timeout,
                                          size_t *len);
-NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
-                        size_t *len);
 NTSTATUS receive_smb_raw(int fd,
                        char *buffer,
                        size_t buflen,
@@ -1872,7 +1881,6 @@ bool cli_state_seqnum_persistent(struct cli_state *cli,
 bool cli_state_seqnum_remove(struct cli_state *cli,
                             uint16_t mid);
 bool cli_receive_smb(struct cli_state *cli);
-ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
 bool cli_receive_smb_readX_header(struct cli_state *cli);
 bool cli_send_smb(struct cli_state *cli);
 bool cli_send_smb_direct_writeX(struct cli_state *cli,
@@ -2067,6 +2075,8 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
                      uint16_t *pfid);
 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
                            size_t str_len, size_t *pconverted_size);
+uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
+                             const uint8_t *bytes, size_t num_bytes);
 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
                                   struct event_context *ev,
                                   struct cli_state *cli, const char *fname,
@@ -2331,12 +2341,22 @@ bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_
 
 /* The following definitions come from libsmb/clilist.c  */
 
-int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
-                void (*fn)(const char *, struct file_info *, const char *,
-                           void *), void *state);
-int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
-                void (*fn)(const char *, struct file_info *, const char *,
-                           void *), void *state);
+NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
+                     void (*fn)(const char *, struct file_info *,
+                                const char *, void *), void *state);
+NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
+                       uint16_t attribute, int info_level,
+                       void (*fn)(const char *mnt, struct file_info *finfo,
+                                  const char *mask, void *private_data),
+                       void *private_data);
+struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
+                                struct tevent_context *ev,
+                                struct cli_state *cli,
+                                const char *mask,
+                                uint16_t attribute,
+                                uint16_t info_level);
+NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                      struct file_info **finfo, size_t *num_finfo);
 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
                  void (*fn)(const char *, struct file_info *, const char *,
                             void *), void *state);
@@ -2480,6 +2500,13 @@ NTSTATUS cli_qpathinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
                       uint32_t max_rdata,
                       uint8_t **rdata, uint32_t *num_rdata);
 
+struct tevent_req *cli_flush_send(TALLOC_CTX *mem_ctx,
+                                 struct event_context *ev,
+                                 struct cli_state *cli,
+                                 uint16_t fnum);
+NTSTATUS cli_flush_recv(struct tevent_req *req);
+NTSTATUS cli_flush(TALLOC_CTX *mem_ctx, struct cli_state *cli, uint16_t fnum);
+
 /* The following definitions come from libsmb/clirap2.c  */
 struct rap_group_info_1;
 struct rap_user_info_1;
@@ -3653,7 +3680,7 @@ bool lp_winbind_normalize_names(void);
 bool lp_winbind_rpc_only(void);
 bool lp_create_krb5_conf(void);
 const char *lp_idmap_backend(void);
-char *lp_idmap_alloc_backend(void);
+bool lp_idmap_read_only(void);
 int lp_idmap_cache_time(void);
 int lp_idmap_negative_cache_time(void);
 int lp_keepalive(void);
@@ -3703,7 +3730,6 @@ bool _lp_writeraw(void);
 bool lp_null_passwords(void);
 bool lp_obey_pam_restrictions(void);
 bool lp_encrypted_passwords(void);
-bool lp_update_encrypted(void);
 int lp_client_schannel(void);
 int lp_server_schannel(void);
 bool lp_syslog_only(void);
@@ -3995,13 +4021,6 @@ int load_usershare_shares(void);
 void gfree_loadparm(void);
 void lp_set_in_client(bool b);
 bool lp_is_in_client(void);
-bool lp_load_ex(const char *pszFname,
-               bool global_only,
-               bool save_defaults,
-               bool add_ipc,
-               bool initialize_globals,
-               bool allow_include_registry,
-               bool allow_registry_shares);
 bool lp_load(const char *pszFname,
             bool global_only,
             bool save_defaults,
@@ -4396,7 +4415,8 @@ bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
 
 /* The following definitions come from printing/load.c  */
 
-void load_printers(void);
+void load_printers(struct tevent_context *ev,
+                  struct messaging_context *msg_ctx);
 
 /* The following definitions come from printing/lpq_parse.c  */
 
@@ -4424,25 +4444,51 @@ void notify_job_status_byname(struct tevent_context *ev,
 void notify_job_status(struct tevent_context *ev,
                       struct messaging_context *msg_ctx,
                       const char *sharename, uint32 jobid, uint32 status);
-void notify_job_total_bytes(const char *sharename, uint32 jobid,
+void notify_job_total_bytes(struct tevent_context *ev,
+                           struct messaging_context *msg_ctx,
+                           const char *sharename, uint32 jobid,
                            uint32 size);
-void notify_job_total_pages(const char *sharename, uint32 jobid,
+void notify_job_total_pages(struct tevent_context *ev,
+                           struct messaging_context *msg_ctx,
+                           const char *sharename, uint32 jobid,
                            uint32 pages);
-void notify_job_username(const char *sharename, uint32 jobid, char *name);
-void notify_job_name(const char *sharename, uint32 jobid, char *name);
-void notify_job_submitted(const char *sharename, uint32 jobid,
+void notify_job_username(struct tevent_context *ev,
+                        struct messaging_context *msg_ctx,
+                        const char *sharename, uint32 jobid, char *name);
+void notify_job_name(struct tevent_context *ev,
+                    struct messaging_context *msg_ctx,
+                    const char *sharename, uint32 jobid, char *name);
+void notify_job_submitted(struct tevent_context *ev,
+                         struct messaging_context *msg_ctx,
+                         const char *sharename, uint32 jobid,
                          time_t submitted);
-void notify_printer_driver(int snum, const char *driver_name);
-void notify_printer_comment(int snum, const char *comment);
-void notify_printer_sharename(int snum, const char *share_name);
-void notify_printer_printername(int snum, const char *printername);
-void notify_printer_port(int snum, const char *port_name);
-void notify_printer_location(int snum, const char *location);
-void notify_printer_byname( const char *printername, uint32 change, const char *value );
+void notify_printer_driver(struct tevent_context *ev,
+                          struct messaging_context *msg_ctx,
+                          int snum, const char *driver_name);
+void notify_printer_comment(struct tevent_context *ev,
+                           struct messaging_context *msg_ctx,
+                           int snum, const char *comment);
+void notify_printer_sharename(struct tevent_context *ev,
+                             struct messaging_context *msg_ctx,
+                             int snum, const char *share_name);
+void notify_printer_printername(struct tevent_context *ev,
+                               struct messaging_context *msg_ctx,
+                               int snum, const char *printername);
+void notify_printer_port(struct tevent_context *ev,
+                        struct messaging_context *msg_ctx,
+                        int snum, const char *port_name);
+void notify_printer_location(struct tevent_context *ev,
+                            struct messaging_context *msg_ctx,
+                            int snum, const char *location);
+void notify_printer_byname(struct tevent_context *ev,
+                          struct messaging_context *msg_ctx,
+                          const char *printername, uint32 change,
+                          const char *value);
 
 /* The following definitions come from printing/pcap.c  */
 
-void pcap_cache_reload(void);
+void pcap_cache_reload(struct tevent_context *ev,
+                      struct messaging_context *msg_ctx);
 bool pcap_printername_ok(const char *printername);
 
 /* The following definitions come from printing/printing.c  */
@@ -4506,12 +4552,13 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
                               struct rpc_pipe_client **presult);
 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
                                              const struct ndr_syntax_id *syntax,
-                                             const char *client_address,
+                                             struct client_address *client_id,
                                              struct auth_serversupplied_info *server_info,
                                              struct messaging_context *msg_ctx);
 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
                                const struct ndr_syntax_id *abstract_syntax,
                                struct auth_serversupplied_info *serversupplied_info,
+                               struct client_address *client_id,
                                struct messaging_context *msg_ctx,
                                struct rpc_pipe_client **presult);
 NTSTATUS rpc_connect_spoolss_pipe(connection_struct *conn,
@@ -4583,10 +4630,6 @@ NTSTATUS cli_rpc_pipe_open_spnego_krb5(struct cli_state *cli,
 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
                             struct rpc_pipe_client *cli,
                             DATA_BLOB *session_key);
-NTSTATUS rpc_pipe_open_local(TALLOC_CTX *mem_ctx,
-                            struct rpc_cli_smbd_conn *conn,
-                            const struct ndr_syntax_id *syntax,
-                            struct rpc_pipe_client **presult);
 
 /* The following definitions come from rpc_client/rpc_transport_np.c  */
 
@@ -4715,10 +4758,6 @@ NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
                                    const struct ndr_syntax_id *interface,
                                    const struct api_struct *cmds, int size);
 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
-bool api_pipe_bind_req(struct pipes_struct *p, struct ncacn_packet *pkt);
-bool api_pipe_alter_context(struct pipes_struct *p, struct ncacn_packet *pkt);
-void free_pipe_rpc_context( PIPE_RPC_FNS *list );
-bool api_pipe_request(struct pipes_struct *p, struct ncacn_packet *pkt);
 
 /* The following definitions come from rpc_server/srv_pipe_hnd.c  */
 
@@ -4731,6 +4770,7 @@ struct tsocket_address;
 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
                 const struct tsocket_address *local_address,
                 const struct tsocket_address *remote_address,
+                struct client_address *client_id,
                 struct auth_serversupplied_info *server_info,
                 struct messaging_context *msg_ctx,
                 struct fake_file_handle **phandle);
@@ -4752,7 +4792,7 @@ void do_drv_upgrade_printer(struct messaging_context *msg,
                            uint32_t msg_type,
                            struct server_id server_id,
                            DATA_BLOB *data);
-void update_monitored_printq_cache( void );
+void update_monitored_printq_cache(struct messaging_context *msg_ctx);
 void reset_all_printerdata(struct messaging_context *msg,
                           void *private_data,
                           uint32_t msg_type,
@@ -5557,7 +5597,7 @@ struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fna
 void smbd_setup_sig_term_handler(void);
 void smbd_setup_sig_hup_handler(struct tevent_context *ev,
                                struct messaging_context *msg_ctx);
-bool srv_send_smb(int fd, char *buffer,
+bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
                  bool no_signing, uint32_t seqnum,
                  bool do_encrypt,
                  struct smb_perfcount_data *pcd);
@@ -5593,8 +5633,7 @@ void construct_reply_common_req(struct smb_request *req, char *outbuf);
 size_t req_wct_ofs(struct smb_request *req);
 void chain_reply(struct smb_request *req);
 bool req_is_in_chain(struct smb_request *req);
-void check_reload(time_t t);
-void smbd_process(void);
+void smbd_process(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/quotas.c  */
 
@@ -5762,12 +5801,12 @@ void server_messaging_context_free(void);
 /* The following definitions come from smbd/server.c  */
 
 int smbd_server_fd(void);
-int get_client_fd(void);
 struct event_context *smbd_event_context(void);
 struct messaging_context *smbd_messaging_context(void);
 struct memcache *smbd_memcache(void);
 void reload_printers(struct messaging_context *msg_ctx);
-bool reload_services(struct messaging_context *msg_ctx, bool test);
+bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
+                    bool test);
 void exit_server(const char *const explanation);
 void exit_server_cleanly(const char *const explanation);
 void exit_server_fault(void);
@@ -5793,7 +5832,7 @@ void close_cnum(connection_struct *conn, uint16 vuid);
 /* The following definitions come from smbd/session.c  */
 
 bool session_init(void);
-bool session_claim(struct server_id pid, user_struct *vuser);
+bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser);
 void session_yield(user_struct *vuser);
 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
 
@@ -5984,22 +6023,16 @@ bool idmap_is_offline(void);
 bool idmap_is_online(void);
 NTSTATUS smb_register_idmap(int version, const char *name,
                            struct idmap_methods *methods);
-NTSTATUS smb_register_idmap_alloc(int version, const char *name,
-                                 struct idmap_alloc_methods *methods);
 void idmap_close(void);
 NTSTATUS idmap_init_cache(void);
 NTSTATUS idmap_allocate_uid(struct unixid *id);
 NTSTATUS idmap_allocate_gid(struct unixid *id);
-NTSTATUS idmap_set_uid_hwm(struct unixid *id);
-NTSTATUS idmap_set_gid_hwm(struct unixid *id);
 NTSTATUS idmap_backends_unixid_to_sid(const char *domname,
                                      struct id_map *id);
 NTSTATUS idmap_backends_sid_to_unixid(const char *domname,
                                      struct id_map *id);
 NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type,
                           struct unixid *pxid);
-NTSTATUS idmap_set_mapping(const struct id_map *map);
-NTSTATUS idmap_remove_mapping(const struct id_map *map);
 
 /* The following definitions come from winbindd/idmap_cache.c  */
 
@@ -6023,7 +6056,6 @@ NTSTATUS idmap_passdb_init(void);
 
 /* The following definitions come from winbindd/idmap_tdb.c  */
 
-NTSTATUS idmap_alloc_tdb_init(void);
 NTSTATUS idmap_tdb_init(void);
 
 /* The following definitions come from winbindd/idmap_util.c  */
@@ -6032,6 +6064,7 @@ NTSTATUS idmap_uid_to_sid(const char *domname, struct dom_sid *sid, uid_t uid);
 NTSTATUS idmap_gid_to_sid(const char *domname, struct dom_sid *sid, gid_t gid);
 NTSTATUS idmap_sid_to_uid(const char *dom_name, struct dom_sid *sid, uid_t *uid);
 NTSTATUS idmap_sid_to_gid(const char *domname, struct dom_sid *sid, gid_t *gid);
+bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom);
 
 /* The following definitions come from winbindd/nss_info.c  */