s3-build: avoid to globally include printing and spoolss headers.
[vlendec/samba-autobuild/.git] / source3 / include / proto.h
index 6f8eebb459119a305cf5d4a63312c6c9cd4e601c..4e3ec7a24f34ad5666c8ca43cf4ed8f4333abdf8 100644 (file)
@@ -54,39 +54,11 @@ NTSTATUS auth_netlogond_init(void);
 
 /* The following definitions come from auth/auth_ntlmssp.c  */
 
-NTSTATUS auth_ntlmssp_server_info(TALLOC_CTX *mem_ctx,
-                                 struct auth_ntlmssp_state *auth_ntlmssp_state,
-                                 struct auth_serversupplied_info **_server_info);
-struct ntlmssp_state *auth_ntlmssp_get_ntlmssp_state(struct auth_ntlmssp_state *auth_ntlmssp_state);
-const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *auth_ntlmssp_state);
-const char *auth_ntlmssp_get_domain(struct auth_ntlmssp_state *auth_ntlmssp_state);
-const char *auth_ntlmssp_get_client(struct auth_ntlmssp_state *auth_ntlmssp_state);
-bool auth_ntlmssp_negotiated_sign(struct auth_ntlmssp_state *auth_ntlmssp_state);
-bool auth_ntlmssp_negotiated_seal(struct auth_ntlmssp_state *auth_ntlmssp_state);
-void auth_ntlmssp_want_sign(struct auth_ntlmssp_state *auth_ntlmssp_state);
-void auth_ntlmssp_want_seal(struct auth_ntlmssp_state *auth_ntlmssp_state);
+NTSTATUS auth_ntlmssp_steal_server_info(TALLOC_CTX *mem_ctx,
+                               struct auth_ntlmssp_state *auth_ntlmssp_state,
+                               struct auth_serversupplied_info **server_info);
 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state);
-void auth_ntlmssp_end(struct auth_ntlmssp_state **auth_ntlmssp_state);
-NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *auth_ntlmssp_state,
-                            const DATA_BLOB request, DATA_BLOB *reply) ;
-NTSTATUS auth_ntlmssp_sign_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
-                                 TALLOC_CTX *sig_mem_ctx,
-                                 const uint8_t *data, size_t length,
-                                 const uint8_t *whole_pdu, size_t pdu_length,
-                                 DATA_BLOB *sig);
-NTSTATUS auth_ntlmssp_check_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
-                                  const uint8_t *data, size_t length,
-                                  const uint8_t *whole_pdu, size_t pdu_length,
-                                  const DATA_BLOB *sig) ;
-NTSTATUS auth_ntlmssp_seal_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
-                                 TALLOC_CTX *sig_mem_ctx,
-                                 uint8_t *data, size_t length,
-                                 const uint8_t *whole_pdu, size_t pdu_length,
-                                 DATA_BLOB *sig);
-NTSTATUS auth_ntlmssp_unseal_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
-                                   uint8_t *data, size_t length,
-                                   const uint8_t *whole_pdu, size_t pdu_length,
-                                   const DATA_BLOB *sig);
+
 
 /* The following definitions come from auth/auth_sam.c  */
 
@@ -1365,7 +1337,7 @@ bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **
 
 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
-void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
+void se_map_standard(uint32 *access_mask, const struct standard_mapping *mapping);
 NTSTATUS se_access_check(const struct security_descriptor *sd, const NT_USER_TOKEN *token,
                     uint32 acc_desired, uint32 *acc_granted);
 
@@ -1936,9 +1908,6 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
                                          TALLOC_CTX *mem_ctx,
                                          ADS_MODLIST *mods,
                                          const char *printer);
-bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
-                                      ADS_MODLIST *mods,
-                                      NT_PRINTER_DATA *data);
 
 /* The following definitions come from libads/ldap_user.c  */
 
@@ -2492,7 +2461,13 @@ NTSTATUS cli_ctemp(struct cli_state *cli,
 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
 bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
-bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
+struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
+                                            struct tevent_context *ev,
+                                            struct cli_state *cli,
+                                            const char *fname);
+NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                                  size_t *pnum_eas, struct ea_struct **peas);
+NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
                TALLOC_CTX *ctx,
                size_t *pnum_eas,
                struct ea_struct **pea_list);
@@ -2600,11 +2575,14 @@ 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 *, file_info *, const char *, void *), void *state);
+                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 *, file_info *, const char *, void *), void *state);
+                void (*fn)(const char *, struct file_info *, const char *,
+                           void *), void *state);
 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
-            void (*fn)(const char *, file_info *, const char *, void *), void *state);
+            void (*fn)(const char *, struct file_info *, const char *,
+                       void *), void *state);
 
 /* The following definitions come from libsmb/climessage.c  */
 
@@ -2662,7 +2640,17 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
                       void *state);
 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
                              const char *old_password);
-bool cli_qpathinfo(struct cli_state *cli,
+struct tevent_req *cli_qpathinfo1_send(TALLOC_CTX *mem_ctx,
+                                      struct event_context *ev,
+                                      struct cli_state *cli,
+                                      const char *fname);
+NTSTATUS cli_qpathinfo1_recv(struct tevent_req *req,
+                            time_t *change_time,
+                            time_t *access_time,
+                            time_t *write_time,
+                            SMB_OFF_T *size,
+                            uint16 *mode);
+NTSTATUS cli_qpathinfo1(struct cli_state *cli,
                        const char *fname,
                        time_t *change_time,
                        time_t *access_time,
@@ -2675,17 +2663,36 @@ bool cli_setpathinfo(struct cli_state *cli, const char *fname,
                      time_t write_time,
                      time_t change_time,
                      uint16 mode);
-bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
-                   struct timespec *create_time,
-                    struct timespec *access_time,
-                    struct timespec *write_time,
-                   struct timespec *change_time,
-                    SMB_OFF_T *size, uint16 *mode,
-                   SMB_INO_T *ino);
-bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
-                          TALLOC_CTX *mem_ctx,
-                          unsigned int *pnum_streams,
-                          struct stream_struct **pstreams);
+struct tevent_req *cli_qpathinfo2_send(TALLOC_CTX *mem_ctx,
+                                      struct event_context *ev,
+                                      struct cli_state *cli,
+                                      const char *fname);
+NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req,
+                            struct timespec *create_time,
+                            struct timespec *access_time,
+                            struct timespec *write_time,
+                            struct timespec *change_time,
+                            SMB_OFF_T *size, uint16 *mode,
+                            SMB_INO_T *ino);
+NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname,
+                       struct timespec *create_time,
+                       struct timespec *access_time,
+                       struct timespec *write_time,
+                       struct timespec *change_time,
+                       SMB_OFF_T *size, uint16 *mode,
+                       SMB_INO_T *ino);
+struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
+                                             struct tevent_context *ev,
+                                             struct cli_state *cli,
+                                             const char *fname);
+NTSTATUS cli_qpathinfo_streams_recv(struct tevent_req *req,
+                                   TALLOC_CTX *mem_ctx,
+                                   unsigned int *pnum_streams,
+                                   struct stream_struct **pstreams);
+NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
+                              TALLOC_CTX *mem_ctx,
+                              unsigned int *pnum_streams,
+                              struct stream_struct **pstreams);
 bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen);
 bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum,
                   uint16 *mode, SMB_OFF_T *size,
@@ -2694,10 +2701,27 @@ bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum,
                    struct timespec *write_time,
                   struct timespec *change_time,
                    SMB_INO_T *ino);
+struct tevent_req *cli_qpathinfo_basic_send(TALLOC_CTX *mem_ctx,
+                                           struct event_context *ev,
+                                           struct cli_state *cli,
+                                           const char *fname);
+NTSTATUS cli_qpathinfo_basic_recv(struct tevent_req *req,
+                                 SMB_STRUCT_STAT *sbuf, uint32 *attributes);
 NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
                             SMB_STRUCT_STAT *sbuf, uint32 *attributes);
 bool cli_qfileinfo_test(struct cli_state *cli, uint16_t fnum, int level, char **poutdata, uint32 *poutlen);
 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
+struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx,
+                                     struct tevent_context *ev,
+                                     struct cli_state *cli, const char *fname,
+                                     uint16_t level, uint32_t min_rdata,
+                                     uint32_t max_rdata);
+NTSTATUS cli_qpathinfo_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                           uint8_t **rdata, uint32_t *num_rdata);
+NTSTATUS cli_qpathinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
+                      const char *fname, uint16_t level, uint32_t min_rdata,
+                      uint32_t max_rdata,
+                      uint8_t **rdata, uint32_t *num_rdata);
 
 /* The following definitions come from libsmb/clirap2.c  */
 struct rap_group_info_1;
@@ -2822,28 +2846,30 @@ bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descr
 
 /* The following definitions come from libsmb/clispnego.c  */
 
-DATA_BLOB spnego_gen_negTokenInit(char guid[16], 
-                                 const char *OIDs[], 
+DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
+                                 const char *OIDs[],
+                                 DATA_BLOB *psecblob,
                                  const char *principal);
-DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
-bool spnego_parse_negTokenInit(DATA_BLOB blob,
+bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
+                              DATA_BLOB blob,
                               char *OIDs[ASN1_MAX_OIDS],
-                              char **principal);
-DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
-bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
-DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
-bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
-int spnego_gen_negTokenTarg(const char *principal, int time_offset, 
-                           DATA_BLOB *targ, 
+                              char **principal,
+                              DATA_BLOB *secblob);
+DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
+bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
+int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
+                           const char *principal, int time_offset,
+                           DATA_BLOB *targ,
                            DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
                            time_t *expire_time);
-bool spnego_parse_challenge(const DATA_BLOB blob,
+bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
                            DATA_BLOB *chal1, DATA_BLOB *chal2);
-DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
-bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
-DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
+DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
+bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
+DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
                                   const char *mechOID);
-bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
+bool spnego_parse_auth_response(TALLOC_CTX *ctx,
+                               DATA_BLOB blob, NTSTATUS nt_status,
                                const char *mechOID,
                                DATA_BLOB *auth);
 
@@ -2937,12 +2963,13 @@ NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
 void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v);
 uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob);
 void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v);
+uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
 NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
                                  TALLOC_CTX *mem_ctx,
-                                 DATA_BLOB *pkt_auth_blob,
+                                 DATA_BLOB *pkt_trailer,
                                  struct dcerpc_auth *auth,
                                  uint32_t *auth_length,
-                                 bool check_pad);
+                                 bool auth_data_only);
 
 /* The following definitions come from libsmb/dsgetdcname.c  */
 
@@ -3101,7 +3128,6 @@ void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *featur
 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
                        const DATA_BLOB in, DATA_BLOB *out) ;
-void ntlmssp_end(struct ntlmssp_state **ntlmssp_state);
 DATA_BLOB ntlmssp_weaken_keys(struct ntlmssp_state *ntlmssp_state, TALLOC_CTX *mem_ctx);
 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
                              bool is_standalone,
@@ -4691,139 +4717,19 @@ 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 );
 
-/* The following definitions come from printing/nt_printing.c  */
-
-bool nt_printing_init(struct messaging_context *msg_ctx);
-uint32 update_c_setprinter(bool initialize);
-uint32 get_c_setprinter(void);
-int get_builtin_ntforms(nt_forms_struct **list);
-bool get_a_builtin_ntform_by_string(const char *form_name, nt_forms_struct *form);
-int get_ntforms(nt_forms_struct **list);
-int write_ntforms(nt_forms_struct **list, int number);
-bool add_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int *count);
-bool delete_a_form(nt_forms_struct **list, const char *del_name, int *count, WERROR *ret);
-void update_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int count);
-int get_ntdrivers(fstring **list, const char *architecture, uint32 version);
-const char *get_short_archi(const char *long_archi);
-WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
-                             struct pipes_struct *rpc_pipe,
-                             struct spoolss_AddDriverInfoCtr *r);
-WERROR move_driver_to_download_area(struct pipes_struct *p,
-                                   struct spoolss_AddDriverInfoCtr *r,
-                                   WERROR *perr);
-int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen);
-uint32 del_a_printer(const char *sharename);
-NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename);
-void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr);
-int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen);
-WERROR spoolss_create_default_devmode(TALLOC_CTX *mem_ctx,
-                                     const char *devicename,
-                                     struct spoolss_DeviceMode **devmode);
-WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx,
-                                     struct spoolss_security_descriptor **secdesc);
-WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername);
-int add_new_printer_key( NT_PRINTER_DATA *data, const char *name );
-int delete_printer_key( NT_PRINTER_DATA *data, const char *name );
-int lookup_printerkey( NT_PRINTER_DATA *data, const char *name );
-int get_printer_subkeys( NT_PRINTER_DATA *data, const char* key, fstring **subkeys );
-WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action);
-WERROR check_published_printers(void);
-bool is_printer_published(Printer_entry *print_hnd, int snum, 
-                         struct GUID *guid);
-WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action);
-WERROR check_published_printers(void);
-bool is_printer_published(Printer_entry *print_hnd, int snum, 
-                         struct GUID *guid);
-WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key );
-WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
-WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value, 
-                           uint32 type, uint8 *data, int real_len );
-struct regval_blob* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
-WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
-WERROR get_a_printer( Printer_entry *print_hnd,
-                       NT_PRINTER_INFO_LEVEL **pp_printer,
-                       uint32 level,
-                       const char *sharename);
-WERROR get_a_printer_search( Printer_entry *print_hnd,
-                       NT_PRINTER_INFO_LEVEL **pp_printer,
-                       uint32 level,
-                       const char *sharename);
-uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
-bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
-                             struct spoolss_DriverInfo8 *_info8);
-uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
-                             struct spoolss_AddDriverInfoCtr *r,
-                             char **driver_name,
-                             uint32_t *version);
-WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx,
-                           struct spoolss_DriverInfo8 **driver_p,
-                           const char *drivername, const char *architecture,
-                           uint32_t version);
-uint32_t free_a_printer_driver(struct spoolss_DriverInfo8 *driver);
-bool printer_driver_in_use(const struct spoolss_DriverInfo8 *r);
-bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
-                                struct spoolss_DriverInfo8 *r);
-WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
-                            const struct spoolss_DriverInfo8 *r,
-                            uint32 version, bool delete_files );
-WERROR nt_printing_setsec(const char *sharename, struct sec_desc_buf *secdesc_ctr);
-bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, struct sec_desc_buf **secdesc_ctr);
-void map_printer_permissions(struct security_descriptor *sd);
-void map_job_permissions(struct security_descriptor *sd);
-bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
-                       int access_type);
-bool print_time_access_check(const char *servicename);
-char* get_server_name( Printer_entry *printer );
-
 /* The following definitions come from printing/pcap.c  */
 
 void pcap_cache_reload(void);
 bool pcap_printername_ok(const char *printername);
 
-/* The following definitions come from printing/printfsp.c  */
-
-NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
-                       const char *fname,
-                       uint16_t current_vuid, files_struct *fsp);
-void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
-SMB_OFF_T printfile_offset(files_struct *fsp, SMB_OFF_T offset);
-
 /* The following definitions come from printing/printing.c  */
 
 uint16 pjobid_to_rap(const char* sharename, uint32 jobid);
 bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid);
+void rap_jobid_delete(const char* sharename, uint32 jobid);
 bool print_backend_init(struct messaging_context *msg_ctx);
-void printing_end(void);
-int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob );
-uint32 sysjob_to_jobid(int unix_jobid);
-void pjob_delete(const char* sharename, uint32 jobid);
 void start_background_queue(void);
-bool print_notify_register_pid(int snum);
-bool print_notify_deregister_pid(int snum);
-bool print_job_exists(const char* sharename, uint32 jobid);
-int print_job_fd(const char* sharename, uint32 jobid);
-char *print_job_fname(const char* sharename, uint32 jobid);
-NT_DEVICEMODE *print_job_devmode(const char* sharename, uint32 jobid);
-bool print_job_set_name(const char *sharename, uint32 jobid, const char *name);
-bool print_job_get_name(TALLOC_CTX *mem_ctx, const char *sharename, uint32_t jobid, char **name);
-bool print_job_delete(struct auth_serversupplied_info *server_info, int snum,
-                     uint32 jobid, WERROR *errcode);
-bool print_job_pause(struct auth_serversupplied_info *server_info, int snum,
-                    uint32 jobid, WERROR *errcode);
-bool print_job_resume(struct auth_serversupplied_info *server_info, int snum,
-                     uint32 jobid, WERROR *errcode);
-ssize_t print_job_write(int snum, uint32 jobid, const char *buf, SMB_OFF_T pos, size_t size);
-int print_queue_length(int snum, print_status_struct *pstatus);
-uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum,
-                      const char *jobname, NT_DEVICEMODE *nt_devmode );
-void print_job_endpage(int snum, uint32 jobid);
-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);
-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);
+void printing_end(void);
 
 /* The following definitions come from printing/printing_db.c  */
 
@@ -4843,7 +4749,6 @@ const struct ndr_interface_table *get_iface_from_syntax(
        const struct ndr_syntax_id *syntax);
 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
                                      const struct ndr_syntax_id *syntax);
-enum dcerpc_AuthType map_pipe_auth_type_to_rpc_auth_type(enum pipe_auth_type auth_type);
 
 struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
                                         struct event_context *ev,
@@ -4855,20 +4760,20 @@ NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
                                      struct event_context *ev,
                                      struct rpc_pipe_client *cli,
-                                     struct cli_pipe_auth_data *auth);
+                                     struct pipe_auth_data *auth);
 NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
-                      struct cli_pipe_auth_data *auth);
+                      struct pipe_auth_data *auth);
 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
                                unsigned int timeout);
 bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
-                              struct cli_pipe_auth_data **presult);
+                              struct pipe_auth_data **presult);
 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
                                   enum dcerpc_AuthLevel auth_level,
                                   struct netlogon_creds_CredentialState *creds,
-                                  struct cli_pipe_auth_data **presult);
+                                  struct pipe_auth_data **presult);
 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
                           const struct ndr_syntax_id *abstract_syntax,
                           struct rpc_pipe_client **presult);
@@ -4934,11 +4839,20 @@ NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
                                    struct rpc_pipe_client **presult);
 NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
                                const struct ndr_syntax_id *interface,
+                               enum dcerpc_transport_t transport,
                                enum dcerpc_AuthLevel auth_level,
                                const char *service_princ,
                                const char *username,
                                const char *password,
                                struct rpc_pipe_client **presult);
+NTSTATUS cli_rpc_pipe_open_spnego_krb5(struct cli_state *cli,
+                                       const struct ndr_syntax_id *interface,
+                                       enum dcerpc_transport_t transport,
+                                       enum dcerpc_AuthLevel auth_level,
+                                       const char *server,
+                                       const char *username,
+                                       const char *password,
+                                       struct rpc_pipe_client **presult);
 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
                             struct rpc_pipe_client *cli,
                             DATA_BLOB *session_key);
@@ -5022,14 +4936,14 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
 
 /* The following definitions come from rpc_server/rpc_handles.c  */
 
-size_t num_pipe_handles(pipes_struct *p);
-bool init_pipe_handles(pipes_struct *p, const struct ndr_syntax_id *syntax);
-bool create_policy_hnd(pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
-bool find_policy_by_hnd(pipes_struct *p, const struct policy_handle *hnd,
+size_t num_pipe_handles(struct pipes_struct *p);
+bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
+bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
+bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
                        void **data_p);
-bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd);
-void close_policy_by_pipe(pipes_struct *p);
-bool pipe_access_check(pipes_struct *p);
+bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
+void close_policy_by_pipe(struct pipes_struct *p);
+bool pipe_access_check(struct pipes_struct *p);
 
 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
                            uint32_t access_granted, size_t data_size,
@@ -5048,29 +4962,41 @@ void *_policy_handle_find(struct pipes_struct *p,
                                     (_access_granted), #_type, __location__, (_pstatus))
 
 
+/* The following definitions come from rpc_server/srv_rpc_register.c  */
+
+struct rpc_srv_callbacks {
+       bool (*init)(void *private_data);
+       bool (*shutdown)(void *private_data);
+       void *private_data;
+};
+
+NTSTATUS rpc_srv_register(int version, const char *clnt,
+                         const char *srv,
+                         const struct ndr_interface_table *iface,
+                         const struct api_struct *cmds, int size,
+                         const struct rpc_srv_callbacks *rpc_srv_cb);
+
+NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
+
 /* The following definitions come from rpc_server/srv_pipe.c  */
 
-bool create_next_pdu(pipes_struct *p);
-bool api_pipe_bind_auth3(pipes_struct *p, struct ncacn_packet *pkt);
-bool setup_fault_pdu(pipes_struct *p, NTSTATUS status);
+bool create_next_pdu(struct pipes_struct *p);
+bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt);
+bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status);
 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
                                    const char *srv,
                                    const struct ndr_syntax_id *interface,
                                    const struct api_struct *cmds, int size);
-NTSTATUS rpc_srv_register(int version, const char *clnt,
-                         const char *srv,
-                         const struct ndr_interface_table *iface,
-                         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(pipes_struct *p, struct ncacn_packet *pkt);
-bool api_pipe_alter_context(pipes_struct *p, struct ncacn_packet *pkt);
+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(pipes_struct *p, struct ncacn_packet *pkt);
+bool api_pipe_request(struct pipes_struct *p, struct ncacn_packet *pkt);
 
 /* The following definitions come from rpc_server/srv_pipe_hnd.c  */
 
-pipes_struct *get_first_internal_pipe(void);
-pipes_struct *get_next_internal_pipe(pipes_struct *p);
+struct pipes_struct *get_first_internal_pipe(void);
+struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p);
 bool check_open_pipes(void);
 
 bool fsp_is_np(struct files_struct *fsp);
@@ -5104,15 +5030,6 @@ void reset_all_printerdata(struct messaging_context *msg,
                           uint32_t msg_type,
                           struct server_id server_id,
                           DATA_BLOB *data);
-bool convert_devicemode(const char *printername,
-                       const struct spoolss_DeviceMode *devmode,
-                       NT_DEVICEMODE **pp_nt_devmode);
-WERROR set_printer_dataex(NT_PRINTER_INFO_LEVEL *printer,
-                         const char *key, const char *value,
-                         uint32_t type, uint8_t *data, int real_len);
-struct spoolss_DeviceMode *construct_dev_mode(TALLOC_CTX *mem_ctx,
-                                             const char *servicename);
-bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer);
 
 /* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
 
@@ -6170,7 +6087,8 @@ NTSTATUS do_map_to_guest(NTSTATUS status,
                struct auth_serversupplied_info **server_info,
                const char *user, const char *domain);
 
-NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in,
+NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
+               DATA_BLOB blob_in,
                DATA_BLOB *pblob_out,
                char **kerb_mechOID);
 void reply_sesssetup_and_X(struct smb_request *req);
@@ -6258,7 +6176,7 @@ bool change_to_guest(void);
 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
 bool change_to_user(connection_struct *conn, uint16 vuid);
 bool change_to_root_user(void);
-bool become_authenticated_pipe_user(pipes_struct *p);
+bool become_authenticated_pipe_user(struct pipes_struct *p);
 bool unbecome_authenticated_pipe_user(void);
 void become_root(void);
 void unbecome_root(void);