From a1bd6766172c91ae93a9c237cbfd8adca60e655c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 18 Jul 2000 05:16:30 +0000 Subject: Fixed some more client SPOOLSS functions. The following functions work now: - spoolenum - spoolopen - spoolgetprinter - spoolgetprinterdriver Items todo: - track down memory bug with spoolenumdata - fix spoolgetprinterdriverdir - fix spoolgetdata - fix display_job_info_ctr in spooljobs All part of the ongoing rpcclient work. Also included a new generic list ADT. Cleaner and simplier than the stuff in util_array.c i think (but then that's why I wrote it). --jerry (This used to be commit 381aba2c9a63faa53728f0520ac316478bc7a1c3) --- source3/include/includes.h | 1 + source3/include/ntdomain.h | 21 -- source3/include/proto.h | 840 +++++++++++++++++++++--------------------- source3/include/rpc_creds.h | 3 +- source3/include/rpc_dce.h | 3 +- source3/include/rpc_misc.h | 37 +- source3/include/rpc_spoolss.h | 2 - source3/include/util_list.h | 59 +++ 8 files changed, 525 insertions(+), 441 deletions(-) create mode 100644 source3/include/util_list.h diff --git a/source3/include/includes.h b/source3/include/includes.h index 4b4d741648..eb2f23b6fe 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -612,6 +612,7 @@ extern int errno; #include "trans2.h" #include "nterr.h" #include "secrets.h" +#include "util_list.h" #ifndef UBI_BINTREE_H #include "ubi_Cache.h" diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 1e1ef36795..fe6704c2ad 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -244,27 +244,6 @@ struct acct_info /* end higher order functions */ -struct cli_connection; - -typedef struct cli_auth_fns -{ - /* these three will do for now. they *should* match with server-side */ - BOOL (*create_bind_req) (struct cli_connection *, prs_struct *, - uint32, RPC_IFACE *, RPC_IFACE *); - BOOL (*decode_bind_resp) (struct cli_connection *, prs_struct *); - BOOL (*create_bind_cont) (struct cli_connection *, prs_struct *, - uint32); - /* creates an authenticated PDU */ - BOOL (*cli_create_pdu) (struct cli_connection *, uint8, - prs_struct *, int, int *, - prs_struct *, uint8 *); - /* decodes an authenticated PDU */ - BOOL (*cli_decode_pdu) (struct cli_connection *, prs_struct *, - int, int); - -} -cli_auth_fns; - /* security descriptor structures */ #include "rpc_secdes.h" diff --git a/source3/include/proto.h b/source3/include/proto.h index 8e2a0053e1..2335b8f07d 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -210,258 +210,10 @@ void CatchChildLeaveStatus(void); int vslprintf(char *str, int n, char *format, va_list ap); -/*The following definitions come from libsmb/cliconnect.c */ - -BOOL cli_session_setup(struct cli_state *cli, - char *user, - char *pass, int passlen, - char *ntpass, int ntpasslen, - char *workgroup); -BOOL cli_ulogoff(struct cli_state *cli); -BOOL cli_send_tconX(struct cli_state *cli, - char *share, char *dev, char *pass, int passlen); -BOOL cli_tdis(struct cli_state *cli); -BOOL cli_negprot(struct cli_state *cli); -BOOL cli_session_request(struct cli_state *cli, - struct nmb_name *calling, struct nmb_name *called); -BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip); -BOOL cli_reestablish_connection(struct cli_state *cli); -BOOL cli_establish_connection(struct cli_state *cli, - char *dest_host, struct in_addr *dest_ip, - struct nmb_name *calling, struct nmb_name *called, - char *service, char *service_type, - BOOL do_shutdown, BOOL do_tcon); -BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost, - struct in_addr *pdest_ip); - -/*The following definitions come from libsmb/clientgen.c */ - -int cli_set_port(struct cli_state *cli, int port); -BOOL cli_receive_smb(struct cli_state *cli); -BOOL cli_send_smb(struct cli_state *cli); -void cli_setup_packet(struct cli_state *cli); -void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr); -struct cli_state *cli_initialise(struct cli_state *cli); -void cli_shutdown(struct cli_state *cli); -void cli_sockopt(struct cli_state *cli, char *options); -uint16 cli_setpid(struct cli_state *cli, uint16 pid); - -/*The following definitions come from libsmb/clierror.c */ - -char *cli_errstr(struct cli_state *cli); -int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_error); - -/*The following definitions come from libsmb/clifile.c */ - -BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst); -BOOL cli_unlink(struct cli_state *cli, char *fname); -BOOL cli_mkdir(struct cli_state *cli, char *dname); -BOOL cli_rmdir(struct cli_state *cli, char *dname); -int cli_nt_create(struct cli_state *cli, char *fname); -int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode); -BOOL cli_close(struct cli_state *cli, int fnum); -BOOL cli_lock(struct cli_state *cli, int fnum, - uint32 offset, uint32 len, int timeout, enum brl_type lock_type); -BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len); -BOOL cli_getattrE(struct cli_state *cli, int fd, - uint16 *attr, size_t *size, - time_t *c_time, time_t *a_time, time_t *m_time); -BOOL cli_getatr(struct cli_state *cli, char *fname, - uint16 *attr, size_t *size, time_t *t); -BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t); -BOOL cli_chkpath(struct cli_state *cli, char *path); -BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail); - -/*The following definitions come from libsmb/clilist.c */ - -int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, - void (*fn)(file_info *, const char *)); -int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, - void (*fn)(file_info *, const char *)); - -/*The following definitions come from libsmb/climessage.c */ - -BOOL cli_message_start(struct cli_state *cli, char *host, char *username, - int *grp); -BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp); -BOOL cli_message_end(struct cli_state *cli, int grp); - -/*The following definitions come from libsmb/cliprint.c */ - -int cli_print_queue(struct cli_state *cli, - void (*fn)(struct print_job_info *)); -int cli_printjob_del(struct cli_state *cli, int job); - -/*The following definitions come from libsmb/clirap.c */ - -BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len, - uint16 *setup, uint32 setup_count, uint32 max_setup_count, - char *params, uint32 param_count, uint32 max_param_count, - char *data, uint32 data_count, uint32 max_data_count, - char **rparam, uint32 *rparam_count, - char **rdata, uint32 *rdata_count); -BOOL cli_api(struct cli_state *cli, - char *param, int prcnt, int mprcnt, - char *data, int drcnt, int mdrcnt, - char **rparam, int *rprcnt, - char **rdata, int *rdrcnt); -BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation); -int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *)); -BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, - void (*fn)(const char *, uint32, const char *)); -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, const char *fname, - time_t *c_time, time_t *a_time, time_t *m_time, - size_t *size, uint16 *mode); -BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, - time_t *c_time, time_t *a_time, time_t *m_time, - time_t *w_time, size_t *size, uint16 *mode, - SMB_INO_T *ino); -BOOL cli_qfileinfo(struct cli_state *cli, int fnum, - uint16 *mode, size_t *size, - time_t *c_time, time_t *a_time, time_t *m_time, - time_t *w_time, SMB_INO_T *ino); - -/*The following definitions come from libsmb/clireadwrite.c */ - -size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size); -ssize_t cli_write(struct cli_state *cli, - int fnum, uint16 write_mode, - char *buf, off_t offset, size_t size); -ssize_t cli_smbwrite(struct cli_state *cli, - int fnum, char *buf, off_t offset, size_t size1); - -/*The following definitions come from libsmb/clitrans.c */ - -BOOL cli_send_trans(struct cli_state *cli, int trans, - char *name, int pipe_name_len, - int fid, int flags, - uint16 *setup, int lsetup, int msetup, - char *param, int lparam, int mparam, - char *data, int ldata, int mdata); -BOOL cli_receive_trans(struct cli_state *cli,int trans, - char **param, int *param_len, - char **data, int *data_len); - -/*The following definitions come from libsmb/credentials.c */ - -char *credstr(uchar *cred); -void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass, - uchar session_key[8]); -void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp, - DOM_CHAL *cred); -int cred_assert(DOM_CHAL *cred, uchar session_key[8], DOM_CHAL *stored_cred, - UTIME timestamp); -BOOL clnt_deal_with_creds(uchar sess_key[8], - DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred); -BOOL deal_with_creds(uchar sess_key[8], - DOM_CRED *sto_clnt_cred, - DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred); - -/*The following definitions come from libsmb/namequery.c */ - -BOOL name_status(int fd,char *name,int name_type,BOOL recurse, - struct in_addr to_ip,char *master,char *rname); -struct in_addr *name_query(int fd,const char *name,int name_type, - BOOL bcast,BOOL recurse, - struct in_addr to_ip, int *count); -FILE *startlmhosts(char *fname); -BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr); -void endlmhosts(FILE *fp); -BOOL is_ip_address(const char *name); -BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type); -BOOL resolve_srv_name(const char* srv_name, fstring dest_host, - struct in_addr *ip); -BOOL find_master_ip(char *group, struct in_addr *master_ip); -BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pdc_ip, char *ret_name); -BOOL get_dc_list(char *group, struct in_addr **ip_list, int *count); - -/*The following definitions come from libsmb/nmblib.c */ - -void debug_nmb_packet(struct packet_struct *p); -char *nmb_namestr(struct nmb_name *n); -struct packet_struct *copy_packet(struct packet_struct *packet); -void free_packet(struct packet_struct *packet); -struct packet_struct *parse_packet(char *buf,int length, - enum packet_type packet_type); -struct packet_struct *read_packet(int fd,enum packet_type packet_type); -void make_nmb_name( struct nmb_name *n, const char *name, int type); -BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2); -int build_packet(char *buf, struct packet_struct *p); -BOOL send_packet(struct packet_struct *p); -struct packet_struct *receive_packet(int fd,enum packet_type type,int t); -struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id); -struct packet_struct *receive_dgram_packet(int fd, int t, char *mailslot_name); -BOOL match_mailslot_name(struct packet_struct *p, char *mailslot_name); -void sort_query_replies(char *data, int n, struct in_addr ip); -char *dns_to_netbios_name(char *dns_name); -int name_mangle( char *In, char *Out, char name_type ); -int name_extract(char *buf,int ofs,char *name); -int name_len(char *s1); - -/*The following definitions come from libsmb/nterr.c */ - -BOOL get_safe_nt_error_msg(uint32 nt_code,char *msg, size_t len); -const char *get_nt_error_msg(uint32 nt_code); - -/*The following definitions come from libsmb/passchange.c */ - -BOOL remote_password_change(const char *remote_machine, const char *user_name, - const char *old_passwd, const char *new_passwd, - char *err_str, size_t err_str_len); - -/*The following definitions come from libsmb/pwd_cache.c */ - -void pwd_init(struct pwd_info *pwd); -BOOL pwd_is_nullpwd(const struct pwd_info *pwd); -BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2); -void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt); -void pwd_set_nullpwd(struct pwd_info *pwd); -void pwd_set_cleartext(struct pwd_info *pwd, char *clr); -void pwd_get_cleartext(struct pwd_info *pwd, char *clr); -void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]); -void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]); -void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr); -void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]); -void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]); - /*The following definitions come from lib/smbrun.c */ int smbrun(char *cmd,char *outfile,BOOL shared); -/*The following definitions come from libsmb/smbdes.c */ - -void E_P16(unsigned char *p14,unsigned char *p16); -void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24); -void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out); -void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out); -void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key); -void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key); -void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw); -void SamOEMhash( unsigned char *data, unsigned char *key, int val); - -/*The following definitions come from libsmb/smbencrypt.c */ - -void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24); -void E_md4hash(uchar *passwd, uchar *p16); -void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]); -void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]); -void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]); -void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24); -BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode); - -/*The following definitions come from libsmb/smberr.c */ - -char *smb_errstr(char *inbuf); - -/*The following definitions come from libsmb/unexpected.c */ - -void unexpected_packet(struct packet_struct *p); -void clear_unexpected(time_t t); -struct packet_struct *receive_unexpected(enum packet_type packet_type, int id, - char *mailslot_name); - /*The following definitions come from lib/snprintf.c */ @@ -554,24 +306,7 @@ struct passwd *Get_Pwnam(char *user,BOOL allow_change); BOOL user_in_list(char *user,char *list); struct passwd *smb_getpwnam(char *user, BOOL allow_change); -/*The following definitions come from lib/util_array.c */ - -void free_void_array(uint32 num_entries, void **entries, - void(free_item)(void*)); -void* add_copy_to_array(uint32 *len, void ***array, const void *item, - void*(item_dup)(const void*), BOOL alloc_anyway); -void* add_item_to_array(uint32 *len, void ***array, void *item); -void free_use_info_array(uint32 num_entries, struct use_info **entries); -struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array, - const struct use_info *name); -void free_char_array(uint32 num_entries, char **entries); -char* add_chars_to_array(uint32 *len, char ***array, const char *name); -void free_uint32_array(uint32 num_entries, uint32 **entries); -uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name); -void free_sid_array(uint32 num_entries, DOM_SID **entries); -DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid); - -/*The following definitions come from lib/util.c */ +/*The following definitions come from lib/util.c */ char *tmpdir(void); BOOL in_group(gid_t group, gid_t current_gid, int ngroups, gid_t *groups); @@ -639,6 +374,23 @@ BOOL ms_has_wild(char *s); BOOL mask_match(char *string, char *pattern, BOOL is_case_sensitive); int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6); +/*The following definitions come from lib/util_array.c */ + +void free_void_array(uint32 num_entries, void **entries, + void(free_item)(void*)); +void* add_copy_to_array(uint32 *len, void ***array, const void *item, + void*(item_dup)(const void*), BOOL alloc_anyway); +void* add_item_to_array(uint32 *len, void ***array, void *item); +void free_use_info_array(uint32 num_entries, struct use_info **entries); +struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array, + const struct use_info *name); +void free_char_array(uint32 num_entries, char **entries); +char* add_chars_to_array(uint32 *len, char ***array, const char *name); +void free_uint32_array(uint32 num_entries, uint32 **entries); +uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name); +void free_sid_array(uint32 num_entries, DOM_SID **entries); +DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid); + /*The following definitions come from lib/util_file.c */ BOOL do_file_lock(int fd, int waitsecs, int type); @@ -658,6 +410,16 @@ char **file_lines_pload(char *syscmd, int *numlines); void file_lines_free(char **lines); void file_lines_slashcont(char **lines); +/*The following definitions come from lib/util_list.c */ + +BOOL copy_policy_hnd (POLICY_HND *dest, const POLICY_HND *src); +BOOL compare_rpc_hnd_node(const RPC_HND_NODE *x, + const RPC_HND_NODE *y); +BOOL RpcHndList_set_connection(const POLICY_HND *hnd, + struct cli_connection *con); +BOOL RpcHndList_del_connection(const POLICY_HND *hnd); +struct cli_connection* RpcHndList_get_connection(const POLICY_HND *hnd); + /*The following definitions come from lib/util_seaccess.c */ BOOL se_access_check(SEC_DESC *sd, struct current_user *user, @@ -760,86 +522,334 @@ char *octal_string(int i); char *string_truncate(char *s, int length); void parse_domain_user(char *domuser, fstring domain, fstring user); -/*The following definitions come from lib/util_unistr.c */ +/*The following definitions come from lib/util_unistr.c */ + +size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate); +void unistr_to_dos(char *dest, const char *src, size_t len); +char *skip_unibuf(char *src, size_t len); +char *dos_unistrn2(uint16 *src, int len); +char *dos_unistr2(uint16 *src); +char *dos_unistr2_to_str(UNISTR2 *str); +void ascii_to_unistr(uint16 *dest, const char *src, int maxlen); +void unistr_to_ascii(char *dest, const uint16 *src, int len); +void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen); +uint32 buffer2_to_uint32(BUFFER2 *str); +char *dos_buffer2_to_str(BUFFER2 *str); +char *dos_buffer2_to_multistr(BUFFER2 *str); +size_t dos_struni2(char *dst, const char *src, size_t max_len); +char *dos_unistr(char *buf); +int unistrcpy(char *dst, char *src); +void default_unicode_map(smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp); +BOOL load_unicode_map(const char *codepage, smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp); +BOOL load_dos_unicode_map(int codepage); +BOOL load_unix_unicode_map(const char *unix_char_set); +smb_ucs2_t *multibyte_to_unicode(smb_ucs2_t *dst, const char *src, + size_t dst_len, smb_ucs2_t *cp_to_ucs2); +char *unicode_to_unix(char *dst, const smb_ucs2_t *src, size_t dst_len); +smb_ucs2_t *unix_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); +char *unicode_to_dos(char *dst, const smb_ucs2_t *src, size_t dst_len); +size_t unicode_to_dos_char(char *dst, const smb_ucs2_t src); +smb_ucs2_t *dos_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); +size_t strlen_w(const smb_ucs2_t *src); +smb_ucs2_t *safe_strcpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength); +smb_ucs2_t *safe_strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); +int strcmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +int strncmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len); +smb_ucs2_t *strstr_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *strtok_w(smb_ucs2_t *s1, const smb_ucs2_t *s2); +smb_ucs2_t *strdup_w(const smb_ucs2_t *s); +int isupper_w( smb_ucs2_t val); +int islower_w( smb_ucs2_t val); +int isdigit_w( smb_ucs2_t val); +int isxdigit_w( smb_ucs2_t val); +int isspace_w( smb_ucs2_t val); +smb_ucs2_t toupper_w( smb_ucs2_t val ); +smb_ucs2_t tolower_w( smb_ucs2_t val ); +void set_first_token_w(smb_ucs2_t *ptr); +BOOL next_token_w(smb_ucs2_t **ptr, smb_ucs2_t *buff, smb_ucs2_t *sep, size_t bufsize); +smb_ucs2_t **toktocliplist_w(int *ctok, smb_ucs2_t *sep); +int StrCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t); +int StrnCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t, size_t n); +BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +BOOL strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n); +BOOL strcsequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2); +void strlower_w(smb_ucs2_t *s); +void strupper_w(smb_ucs2_t *s); +void strnorm_w(smb_ucs2_t *s); +BOOL strisnormal_w(smb_ucs2_t *s); +void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc); +smb_ucs2_t *skip_string_w(smb_ucs2_t *buf,size_t n); +size_t str_charnum_w(const smb_ucs2_t *s); +BOOL trim_string_w(smb_ucs2_t *s,const smb_ucs2_t *front,const smb_ucs2_t *back); +BOOL strhasupper_w(const smb_ucs2_t *s); +BOOL strhaslower_w(const smb_ucs2_t *s); +size_t count_chars_w(const smb_ucs2_t *s,smb_ucs2_t c); +BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c); +smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); +smb_ucs2_t *StrnCpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src,size_t n); +smb_ucs2_t *strncpyn_w(smb_ucs2_t *dest, const smb_ucs2_t *src,size_t n, smb_ucs2_t c); +size_t strhex_to_str_w(char *p, size_t len, const smb_ucs2_t *strhex); +BOOL in_list_w(smb_ucs2_t *s,smb_ucs2_t *list,BOOL casesensitive); +BOOL string_init_w(smb_ucs2_t **dest,const smb_ucs2_t *src); +void string_free_w(smb_ucs2_t **s); +BOOL string_set_w(smb_ucs2_t **dest,const smb_ucs2_t *src); +void string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len); +void fstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert); +void pstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,smb_ucs2_t *insert); +void all_string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len); +void split_at_last_component_w(smb_ucs2_t *path, smb_ucs2_t *front, smb_ucs2_t sep, smb_ucs2_t *back); +smb_ucs2_t *octal_string_w(int i); +smb_ucs2_t *string_truncate_w(smb_ucs2_t *s, size_t length); + +/*The following definitions come from libsmb/cliconnect.c */ + +BOOL cli_session_setup(struct cli_state *cli, + char *user, + char *pass, int passlen, + char *ntpass, int ntpasslen, + char *workgroup); +BOOL cli_ulogoff(struct cli_state *cli); +BOOL cli_send_tconX(struct cli_state *cli, + char *share, char *dev, char *pass, int passlen); +BOOL cli_tdis(struct cli_state *cli); +BOOL cli_negprot(struct cli_state *cli); +BOOL cli_session_request(struct cli_state *cli, + struct nmb_name *calling, struct nmb_name *called); +BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip); +BOOL cli_reestablish_connection(struct cli_state *cli); +BOOL cli_establish_connection(struct cli_state *cli, + char *dest_host, struct in_addr *dest_ip, + struct nmb_name *calling, struct nmb_name *called, + char *service, char *service_type, + BOOL do_shutdown, BOOL do_tcon); +BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost, + struct in_addr *pdest_ip); + +/*The following definitions come from libsmb/clientgen.c */ + +int cli_set_port(struct cli_state *cli, int port); +BOOL cli_receive_smb(struct cli_state *cli); +BOOL cli_send_smb(struct cli_state *cli); +void cli_setup_packet(struct cli_state *cli); +void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr); +struct cli_state *cli_initialise(struct cli_state *cli); +void cli_shutdown(struct cli_state *cli); +void cli_sockopt(struct cli_state *cli, char *options); +uint16 cli_setpid(struct cli_state *cli, uint16 pid); + +/*The following definitions come from libsmb/clierror.c */ + +char *cli_errstr(struct cli_state *cli); +int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_error); + +/*The following definitions come from libsmb/clifile.c */ + +BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst); +BOOL cli_unlink(struct cli_state *cli, char *fname); +BOOL cli_mkdir(struct cli_state *cli, char *dname); +BOOL cli_rmdir(struct cli_state *cli, char *dname); +int cli_nt_create(struct cli_state *cli, char *fname); +int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode); +BOOL cli_close(struct cli_state *cli, int fnum); +BOOL cli_lock(struct cli_state *cli, int fnum, + uint32 offset, uint32 len, int timeout, enum brl_type lock_type); +BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len); +BOOL cli_getattrE(struct cli_state *cli, int fd, + uint16 *attr, size_t *size, + time_t *c_time, time_t *a_time, time_t *m_time); +BOOL cli_getatr(struct cli_state *cli, char *fname, + uint16 *attr, size_t *size, time_t *t); +BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t); +BOOL cli_chkpath(struct cli_state *cli, char *path); +BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail); + +/*The following definitions come from libsmb/clilist.c */ + +int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, + void (*fn)(file_info *, const char *)); +int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, + void (*fn)(file_info *, const char *)); + +/*The following definitions come from libsmb/climessage.c */ + +BOOL cli_message_start(struct cli_state *cli, char *host, char *username, + int *grp); +BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp); +BOOL cli_message_end(struct cli_state *cli, int grp); + +/*The following definitions come from libsmb/cliprint.c */ + +int cli_print_queue(struct cli_state *cli, + void (*fn)(struct print_job_info *)); +int cli_printjob_del(struct cli_state *cli, int job); + +/*The following definitions come from libsmb/clirap.c */ + +BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len, + uint16 *setup, uint32 setup_count, uint32 max_setup_count, + char *params, uint32 param_count, uint32 max_param_count, + char *data, uint32 data_count, uint32 max_data_count, + char **rparam, uint32 *rparam_count, + char **rdata, uint32 *rdata_count); +BOOL cli_api(struct cli_state *cli, + char *param, int prcnt, int mprcnt, + char *data, int drcnt, int mdrcnt, + char **rparam, int *rprcnt, + char **rdata, int *rdrcnt); +BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation); +int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *)); +BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, + void (*fn)(const char *, uint32, const char *)); +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, const char *fname, + time_t *c_time, time_t *a_time, time_t *m_time, + size_t *size, uint16 *mode); +BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, + time_t *c_time, time_t *a_time, time_t *m_time, + time_t *w_time, size_t *size, uint16 *mode, + SMB_INO_T *ino); +BOOL cli_qfileinfo(struct cli_state *cli, int fnum, + uint16 *mode, size_t *size, + time_t *c_time, time_t *a_time, time_t *m_time, + time_t *w_time, SMB_INO_T *ino); + +/*The following definitions come from libsmb/clireadwrite.c */ + +size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size); +ssize_t cli_write(struct cli_state *cli, + int fnum, uint16 write_mode, + char *buf, off_t offset, size_t size); +ssize_t cli_smbwrite(struct cli_state *cli, + int fnum, char *buf, off_t offset, size_t size1); + +/*The following definitions come from libsmb/clitrans.c */ + +BOOL cli_send_trans(struct cli_state *cli, int trans, + char *name, int pipe_name_len, + int fid, int flags, + uint16 *setup, int lsetup, int msetup, + char *param, int lparam, int mparam, + char *data, int ldata, int mdata); +BOOL cli_receive_trans(struct cli_state *cli,int trans, + char **param, int *param_len, + char **data, int *data_len); + +/*The following definitions come from libsmb/credentials.c */ + +char *credstr(uchar *cred); +void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass, + uchar session_key[8]); +void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp, + DOM_CHAL *cred); +int cred_assert(DOM_CHAL *cred, uchar session_key[8], DOM_CHAL *stored_cred, + UTIME timestamp); +BOOL clnt_deal_with_creds(uchar sess_key[8], + DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred); +BOOL deal_with_creds(uchar sess_key[8], + DOM_CRED *sto_clnt_cred, + DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred); + +/*The following definitions come from libsmb/namequery.c */ + +BOOL name_status(int fd,char *name,int name_type,BOOL recurse, + struct in_addr to_ip,char *master,char *rname); +struct in_addr *name_query(int fd,const char *name,int name_type, + BOOL bcast,BOOL recurse, + struct in_addr to_ip, int *count); +FILE *startlmhosts(char *fname); +BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr); +void endlmhosts(FILE *fp); +BOOL is_ip_address(const char *name); +BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type); +BOOL resolve_srv_name(const char* srv_name, fstring dest_host, + struct in_addr *ip); +BOOL find_master_ip(char *group, struct in_addr *master_ip); +BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pdc_ip, char *ret_name); +BOOL get_dc_list(char *group, struct in_addr **ip_list, int *count); + +/*The following definitions come from libsmb/nmblib.c */ + +void debug_nmb_packet(struct packet_struct *p); +char *nmb_namestr(struct nmb_name *n); +struct packet_struct *copy_packet(struct packet_struct *packet); +void free_packet(struct packet_struct *packet); +struct packet_struct *parse_packet(char *buf,int length, + enum packet_type packet_type); +struct packet_struct *read_packet(int fd,enum packet_type packet_type); +void make_nmb_name( struct nmb_name *n, const char *name, int type); +BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2); +int build_packet(char *buf, struct packet_struct *p); +BOOL send_packet(struct packet_struct *p); +struct packet_struct *receive_packet(int fd,enum packet_type type,int t); +struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id); +struct packet_struct *receive_dgram_packet(int fd, int t, char *mailslot_name); +BOOL match_mailslot_name(struct packet_struct *p, char *mailslot_name); +void sort_query_replies(char *data, int n, struct in_addr ip); +char *dns_to_netbios_name(char *dns_name); +int name_mangle( char *In, char *Out, char name_type ); +int name_extract(char *buf,int ofs,char *name); +int name_len(char *s1); + +/*The following definitions come from libsmb/nterr.c */ + +BOOL get_safe_nt_error_msg(uint32 nt_code,char *msg, size_t len); +const char *get_nt_error_msg(uint32 nt_code); + +/*The following definitions come from libsmb/passchange.c */ + +BOOL remote_password_change(const char *remote_machine, const char *user_name, + const char *old_passwd, const char *new_passwd, + char *err_str, size_t err_str_len); + +/*The following definitions come from libsmb/pwd_cache.c */ + +void pwd_init(struct pwd_info *pwd); +BOOL pwd_is_nullpwd(const struct pwd_info *pwd); +BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2); +void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt); +void pwd_set_nullpwd(struct pwd_info *pwd); +void pwd_set_cleartext(struct pwd_info *pwd, char *clr); +void pwd_get_cleartext(struct pwd_info *pwd, char *clr); +void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]); +void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]); +void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr); +void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]); +void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]); + +/*The following definitions come from libsmb/smbdes.c */ -size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate); -void unistr_to_dos(char *dest, const char *src, size_t len); -char *skip_unibuf(char *src, size_t len); -char *dos_unistrn2(uint16 *src, int len); -char *dos_unistr2(uint16 *src); -char *dos_unistr2_to_str(UNISTR2 *str); -void ascii_to_unistr(uint16 *dest, const char *src, int maxlen); -void unistr_to_ascii(char *dest, const uint16 *src, int len); -void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen); -uint32 buffer2_to_uint32(BUFFER2 *str); -char *dos_buffer2_to_str(BUFFER2 *str); -char *dos_buffer2_to_multistr(BUFFER2 *str); -size_t dos_struni2(char *dst, const char *src, size_t max_len); -char *dos_unistr(char *buf); -int unistrcpy(char *dst, char *src); -void default_unicode_map(smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp); -BOOL load_unicode_map(const char *codepage, smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp); -BOOL load_dos_unicode_map(int codepage); -BOOL load_unix_unicode_map(const char *unix_char_set); -smb_ucs2_t *multibyte_to_unicode(smb_ucs2_t *dst, const char *src, - size_t dst_len, smb_ucs2_t *cp_to_ucs2); -char *unicode_to_unix(char *dst, const smb_ucs2_t *src, size_t dst_len); -smb_ucs2_t *unix_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); -char *unicode_to_dos(char *dst, const smb_ucs2_t *src, size_t dst_len); -size_t unicode_to_dos_char(char *dst, const smb_ucs2_t src); -smb_ucs2_t *dos_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); -size_t strlen_w(const smb_ucs2_t *src); -smb_ucs2_t *safe_strcpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength); -smb_ucs2_t *safe_strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); -int strcmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); -int strncmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len); -smb_ucs2_t *strstr_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); -smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c); -smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c); -smb_ucs2_t *strtok_w(smb_ucs2_t *s1, const smb_ucs2_t *s2); -smb_ucs2_t *strdup_w(const smb_ucs2_t *s); -int isupper_w( smb_ucs2_t val); -int islower_w( smb_ucs2_t val); -int isdigit_w( smb_ucs2_t val); -int isxdigit_w( smb_ucs2_t val); -int isspace_w( smb_ucs2_t val); -smb_ucs2_t toupper_w( smb_ucs2_t val ); -smb_ucs2_t tolower_w( smb_ucs2_t val ); -void set_first_token_w(smb_ucs2_t *ptr); -BOOL next_token_w(smb_ucs2_t **ptr, smb_ucs2_t *buff, smb_ucs2_t *sep, size_t bufsize); -smb_ucs2_t **toktocliplist_w(int *ctok, smb_ucs2_t *sep); -int StrCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t); -int StrnCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t, size_t n); -BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); -BOOL strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n); -BOOL strcsequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2); -void strlower_w(smb_ucs2_t *s); -void strupper_w(smb_ucs2_t *s); -void strnorm_w(smb_ucs2_t *s); -BOOL strisnormal_w(smb_ucs2_t *s); -void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc); -smb_ucs2_t *skip_string_w(smb_ucs2_t *buf,size_t n); -size_t str_charnum_w(const smb_ucs2_t *s); -BOOL trim_string_w(smb_ucs2_t *s,const smb_ucs2_t *front,const smb_ucs2_t *back); -BOOL strhasupper_w(const smb_ucs2_t *s); -BOOL strhaslower_w(const smb_ucs2_t *s); -size_t count_chars_w(const smb_ucs2_t *s,smb_ucs2_t c); -BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c); -smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); -smb_ucs2_t *StrnCpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src,size_t n); -smb_ucs2_t *strncpyn_w(smb_ucs2_t *dest, const smb_ucs2_t *src,size_t n, smb_ucs2_t c); -size_t strhex_to_str_w(char *p, size_t len, const smb_ucs2_t *strhex); -BOOL in_list_w(smb_ucs2_t *s,smb_ucs2_t *list,BOOL casesensitive); -BOOL string_init_w(smb_ucs2_t **dest,const smb_ucs2_t *src); -void string_free_w(smb_ucs2_t **s); -BOOL string_set_w(smb_ucs2_t **dest,const smb_ucs2_t *src); -void string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len); -void fstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert); -void pstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,smb_ucs2_t *insert); -void all_string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len); -void split_at_last_component_w(smb_ucs2_t *path, smb_ucs2_t *front, smb_ucs2_t sep, smb_ucs2_t *back); -smb_ucs2_t *octal_string_w(int i); -smb_ucs2_t *string_truncate_w(smb_ucs2_t *s, size_t length); +void E_P16(unsigned char *p14,unsigned char *p16); +void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24); +void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out); +void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out); +void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key); +void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key); +void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw); +void SamOEMhash( unsigned char *data, unsigned char *key, int val); + +/*The following definitions come from libsmb/smbencrypt.c */ + +void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24); +void E_md4hash(uchar *passwd, uchar *p16); +void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]); +void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]); +void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]); +void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24); +BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode); + +/*The following definitions come from libsmb/smberr.c */ + +char *smb_errstr(char *inbuf); + +/*The following definitions come from libsmb/unexpected.c */ + +void unexpected_packet(struct packet_struct *p); +void clear_unexpected(time_t t); +struct packet_struct *receive_unexpected(enum packet_type packet_type, int id, + char *mailslot_name); /*The following definitions come from locking/brlock.c */ @@ -927,6 +937,9 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question, struct name_record **n); void kill_async_dns_child(void); +/*The following definitions come from nmbd/nmbd.c */ + + /*The following definitions come from nmbd/nmbd_become_dmb.c */ void add_domain_names(time_t t); @@ -957,9 +970,6 @@ void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec, void collect_all_workgroup_names_from_wins_server(time_t t); void sync_all_dmbs(time_t t); -/*The following definitions come from nmbd/nmbd.c */ - - /*The following definitions come from nmbd/nmbd_elections.c */ void check_master_browser_exists(time_t t); @@ -1685,6 +1695,11 @@ void pcap_printer_fn(void (*fn)(char *, char *)); void cups_printer_fn(void (*fn)(char *, char *)); int cups_printername_ok(char *name); +/*The following definitions come from printing/print_svid.c */ + +void sysv_printer_fn(void (*fn)(char *, char *)); +int sysv_printername_ok(char *name); + /*The following definitions come from printing/printfsp.c */ #if OLD_NTDOMAIN @@ -1715,11 +1730,6 @@ BOOL print_queue_pause(struct current_user *user, int snum); BOOL print_queue_resume(struct current_user *user, int snum); BOOL print_queue_purge(struct current_user *user, int snum); -/*The following definitions come from printing/print_svid.c */ - -void sysv_printer_fn(void (*fn)(char *, char *)); -int sysv_printername_ok(char *name); - /*The following definitions come from profile/profile.c */ BOOL profile_setup(BOOL rdonly); @@ -1735,7 +1745,7 @@ BOOL cli_connection_init(const char *srv_name, const char *pipe_name, BOOL cli_connection_init_auth(const char *srv_name, const char *pipe_name, struct cli_connection **con, cli_auth_fns * auth, void *auth_creds); -struct cli_auth_fns *cli_conn_get_authfns(struct cli_connection *con); +struct _cli_auth_fns *cli_conn_get_authfns(struct cli_connection *con); void *cli_conn_get_auth_creds(struct cli_connection *con); BOOL rpc_hnd_pipe_req(const POLICY_HND * hnd, uint8 op_num, prs_struct * data, prs_struct * rdata); @@ -1960,46 +1970,6 @@ BOOL do_wks_query_info(struct cli_state *cli, char *server_name, uint32 switch_value, WKS_INFO_100 *wks100); -/*The following definitions come from rpcclient/cmd_spoolss.c */ - -uint32 cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_getprinter(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_getprinterdata(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_getprinterdriver(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_enumprinterdrivers(struct client_info *info, int argc, char *argv[]); -uint32 cmd_spoolss_getprinterdriverdir(struct client_info *info, int argc, char *argv[]); - -/*The following definitions come from rpcclient/display_sec.c */ - -void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec); - -/*The following definitions come from rpcclient/display_spool.c */ - -void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level, - uint32 count, PRINTER_INFO_CTR ctr); -void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx, - uint32 valuelen, uint16 *value, uint32 rvaluelen, - uint32 type, - uint32 datalen, uint8 *data, uint32 rdatalen); -void display_job_info_2(FILE *out_hnd, enum action_type action, - JOB_INFO_2 *const i2); -void display_job_info_1(FILE *out_hnd, enum action_type action, - JOB_INFO_1 *const i1); -void display_job_info_2_ctr(FILE *out_hnd, enum action_type action, - uint32 count, JOB_INFO_2 *const *const ctr); -void display_job_info_1_ctr(FILE *out_hnd, enum action_type action, - uint32 count, JOB_INFO_1 *const *const ctr); -void display_job_info_ctr(FILE *out_hnd, enum action_type action, - uint32 level, uint32 count, - void *const *const ctr); -void display_printer_driver_ctr(FILE *out_hnd, enum action_type action, uint32 level, - uint32 count, PRINTER_DRIVER_CTR ctr); -void display_printerdriverdir_info_ctr(FILE *out_hnd, enum action_type action, uint32 level, - DRIVER_DIRECTORY_CTR ctr); - /*The following definitions come from rpc_client/msrpc_spoolss.c */ BOOL msrpc_spoolss_enum_printers(char* srv_name, uint32 flags, @@ -2042,13 +2012,6 @@ struct ncacn_np *ncacn_np_use_add(const char *pipe_name, const struct ntuser_creds *ntc, BOOL reuse, BOOL *is_new_connection); -/*The following definitions come from rpcclient/rpcclient.c */ - - -/*The following definitions come from rpcclient/spoolss_cmds.c */ - -void add_spl_commands(void); - /*The following definitions come from rpc_parse/parse_creds.c */ BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name, @@ -2089,7 +2052,7 @@ BOOL create_user_creds( prs_struct *ps, const char* name, uint16 version, uint16 command, uint32 pid, - const struct user_creds *usr); + struct user_creds *usr); /*The following definitions come from rpc_parse/parse_dfs.c */ @@ -3196,6 +3159,53 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid); BOOL api_wkssvc_rpc(pipes_struct *p); #endif +/*The following definitions come from rpcclient/cmd_spoolss.c */ + +uint32 cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_getprinter(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_getprinterdata(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_getprinterdriver(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_enumprinterdrivers(struct client_info *info, int argc, char *argv[]); +uint32 cmd_spoolss_getprinterdriverdir(struct client_info *info, int argc, char *argv[]); + +/*The following definitions come from rpcclient/display_sec.c */ + +void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec); + +/*The following definitions come from rpcclient/display_spool.c */ + +void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level, + uint32 count, PRINTER_INFO_CTR ctr); +void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx, + uint32 valuelen, uint16 *value, uint32 rvaluelen, + uint32 type, + uint32 datalen, uint8 *data, uint32 rdatalen); +void display_job_info_2(FILE *out_hnd, enum action_type action, + JOB_INFO_2 *const i2); +void display_job_info_1(FILE *out_hnd, enum action_type action, + JOB_INFO_1 *const i1); +void display_job_info_2_ctr(FILE *out_hnd, enum action_type action, + uint32 count, JOB_INFO_2 *const *const ctr); +void display_job_info_1_ctr(FILE *out_hnd, enum action_type action, + uint32 count, JOB_INFO_1 *const *const ctr); +void display_job_info_ctr(FILE *out_hnd, enum action_type action, + uint32 level, uint32 count, + void *const *const ctr); +void display_printer_driver_ctr(FILE *out_hnd, enum action_type action, uint32 level, + uint32 count, PRINTER_DRIVER_CTR ctr); +void display_printerdriverdir_info_ctr(FILE *out_hnd, enum action_type action, uint32 level, + DRIVER_DIRECTORY_CTR ctr); + +/*The following definitions come from rpcclient/rpcclient.c */ + + +/*The following definitions come from rpcclient/spoolss_cmds.c */ + +void add_spl_commands(void); + /*The following definitions come from smbd/blocking.c */ #if OLD_NTDOMAIN @@ -3688,19 +3698,6 @@ size_t get_nt_acl(files_struct *fsp, SEC_DESC **ppdesc); BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd); #endif -/*The following definitions come from smbd/vfs.c */ - -int vfs_init_default(connection_struct *conn); -BOOL vfs_init_custom(connection_struct *conn); -BOOL vfs_directory_exist(connection_struct *conn, char *dname, - SMB_STRUCT_STAT *st); -BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf); -ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N); -SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp, - int out_fd, files_struct *out_fsp, - SMB_OFF_T n, char *header, int headlen, int align); -char *vfs_readdirname(connection_struct *conn, void *p); - /*The following definitions come from smbd/vfs-wrap.c */ int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service, @@ -3730,6 +3727,19 @@ int vfswrap_utime(char *path, struct utimbuf *times); int vfswrap_ftruncate(int fd, SMB_OFF_T offset); BOOL vfswrap_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); +/*The following definitions come from smbd/vfs.c */ + +int vfs_init_default(connection_struct *conn); +BOOL vfs_init_custom(connection_struct *conn); +BOOL vfs_directory_exist(connection_struct *conn, char *dname, + SMB_STRUCT_STAT *st); +BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf); +ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N); +SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp, + int out_fd, files_struct *out_fsp, + SMB_OFF_T n, char *header, int headlen, int align); +char *vfs_readdirname(connection_struct *conn, void *p); + /*The following definitions come from smbwrapper/realcalls.c */ int real_utime(const char *name, struct utimbuf *buf); diff --git a/source3/include/rpc_creds.h b/source3/include/rpc_creds.h index 3247e1efdf..0ab508ffe7 100644 --- a/source3/include/rpc_creds.h +++ b/source3/include/rpc_creds.h @@ -20,6 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #ifndef _RPC_CREDS_H /* _RPC_CREDS_H */ #define _RPC_CREDS_H @@ -91,6 +92,6 @@ typedef struct cred_command CREDS_HYBRID *cred; } CREDS_CMD; - + #endif /* _RPC_CREDS_H */ diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index 4e7b3f0437..96704b3361 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -24,7 +24,7 @@ #ifndef _DCE_RPC_H /* _DCE_RPC_H */ #define _DCE_RPC_H -#include "rpc_misc.h" /* this only pulls in STRHDR */ +#include "rpc_misc.h" /* this only pulls in STRHDR */ /* DCE/RPC packet types */ @@ -341,4 +341,5 @@ typedef struct rpc_auth_ntlmssp_chk_info #define RPC_AUTH_NTLMSSP_CHK_LEN 16 + #endif /* _DCE_RPC_H */ diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index 4f37a4b956..5ef4044cb4 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -21,11 +21,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "ntdomain.h" +#include "rpc_dce.h" + #ifndef _RPC_MISC_H /* _RPC_MISC_H */ #define _RPC_MISC_H -#include "rpc_dce.h" /* well-known RIDs - Relative IDs */ @@ -293,6 +295,39 @@ typedef struct lsa_policy_info } POLICY_HND; + +/* + * A client connection's state, pipe name, + * user credentials, etc... + */ +typedef struct _cli_auth_fns cli_auth_fns; +struct user_creds; +struct cli_connection { + + uint32 num_connections; + char *srv_name; + char *pipe_name; + struct user_creds usr_creds; + + struct cli_state *pCli_state; + + cli_auth_fns *auth; + + void *auth_info; + void *auth_creds; +}; + + +/* + * Associate a POLICY_HND with a cli_connection + */ +typedef struct rpc_hnd_node { + + POLICY_HND hnd; + struct cli_connection *cli; + +} RPC_HND_NODE; + typedef struct uint64_s { uint32 low; diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 5cd2058045..bf854492af 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -351,8 +351,6 @@ #define PRINTER_ENUM_ICON7 0x00400000 #define PRINTER_ENUM_ICON8 0x00800000 -#define POLICY_HND_SIZE 20 - /* this struct is undocumented */ /* thanks to the ddk ... */ typedef struct spool_user_1 diff --git a/source3/include/util_list.h b/source3/include/util_list.h new file mode 100644 index 0000000000..4ccb1667f0 --- /dev/null +++ b/source3/include/util_list.h @@ -0,0 +1,59 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + Samba utility functions + Copyright (C) Andrew Tridgell 1992-1999 + Copyright (C) Gerald Carter 2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/****************************************************************** + Implementation of a generic list. See lib/util_list.c for + details on using this. + *****************************************************************/ + +#include "smb.h" + +#ifndef _GENERIC_LIST_H +#define _GENERIC_LIST_H + +struct _list_node; + +/* + * node container in list + */ +struct _list_node { + + void *data; /* generic container pointer */ + uint8 type; /* needed for identifiers + in a hetergenous list */ + struct _list_node *next; /* next in the list */ + +}; + +/* + * list data structure + */ +typedef struct _generic_list { + + struct _list_node *head, *tail; + uint32 length; + BOOL initialized; + +} GENERIC_LIST; + + +#endif /* _GENERIC_LIST_H */ -- cgit