summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>2000-03-07 19:26:16 +0000
committerLuke Leighton <lkcl@samba.org>2000-03-07 19:26:16 +0000
commit45efe4500b18899947de2f85a35ca986878db113 (patch)
tree8bfb20fbc6af8ea46e461634b401ba49c9f087d3
parentefbfe500d5cbb173d0d417ec58d6b0d2016a6742 (diff)
downloadsamba-45efe4500b18899947de2f85a35ca986878db113.tar.gz
more of those wonderful connection-related issues, found by rpctorture
-rw-r--r--source/include/lib_smb_proto.h146
-rw-r--r--source/include/proto.h1521
-rw-r--r--source/include/rpc_client_proto.h27
-rw-r--r--source/include/rpc_parse_proto.h119
-rw-r--r--source/include/winbindd_proto.h564
-rw-r--r--source/lib/cmd_interp.c44
-rw-r--r--source/lib/domain_namemap.c3
-rw-r--r--source/lib/set_uid.c5
-rw-r--r--source/libsmb/pwd_cache.c30
-rw-r--r--source/msrpc/msrpcd_process.c19
-rw-r--r--source/rpc_client/cli_connect.c19
-rw-r--r--source/rpc_client/ncacn_np_use.c36
-rw-r--r--source/rpcclient/cmd_netlogon.c4
-rw-r--r--source/utils/rpctorture.c1
14 files changed, 1252 insertions, 1286 deletions
diff --git a/source/include/lib_smb_proto.h b/source/include/lib_smb_proto.h
index 0b092fbf2d2..0f7895358c9 100644
--- a/source/include/lib_smb_proto.h
+++ b/source/include/lib_smb_proto.h
@@ -23,6 +23,74 @@ void MD5Update(struct MD5Context *ctx, uchar const *buf, unsigned len);
void MD5Final(uchar digest[16], struct MD5Context *ctx);
void MD5Transform(uint32 buf[4], const uchar inext[64]);
+/*The following definitions come from lib/util_hnd.c */
+
+struct policy_cache *get_global_hnd_cache(void);
+struct policy_cache *init_policy_cache(int num_pol_hnds);
+void free_policy_cache(struct policy_cache *cache);
+BOOL policy_hnd_set_name(struct policy_cache *cache,
+ POLICY_HND *hnd, const char *name);
+const char *policy_hnd_get_name(struct policy_cache *cache,
+ const POLICY_HND *hnd);
+BOOL dup_policy_hnd(struct policy_cache *cache,
+ POLICY_HND *hnd,
+ const POLICY_HND *from);
+BOOL register_policy_hnd(struct policy_cache *cache,
+ const vuser_key *key,
+ POLICY_HND *hnd,
+ uint32 access_mask);
+BOOL open_policy_hnd(struct policy_cache *cache,
+ const vuser_key *key,
+ POLICY_HND *hnd,
+ uint32 access_mask);
+BOOL open_policy_hnd_link(struct policy_cache *cache,
+ const POLICY_HND *parent_hnd,
+ POLICY_HND *hnd,
+ uint32 access_mask);
+int find_policy_by_hnd(struct policy_cache *cache, const POLICY_HND *hnd);
+BOOL set_policy_state(struct policy_cache *cache, POLICY_HND *hnd,
+ void(*fn)(void*), void *dev);
+void *get_policy_state_info(struct policy_cache *cache, const POLICY_HND *hnd);
+BOOL policy_hnd_set_state_type(struct policy_cache *cache,
+ POLICY_HND *hnd, int type);
+int policy_hnd_get_state_type(struct policy_cache *cache,
+ const POLICY_HND *hnd);
+BOOL policy_hnd_check_state_type(struct policy_cache *cache,
+ const POLICY_HND *hnd, int type);
+BOOL close_policy_hnd(struct policy_cache *cache, POLICY_HND *hnd);
+BOOL policy_link_key(struct policy_cache *cache, const POLICY_HND *hnd,
+ POLICY_HND *to);
+const vuser_key *get_policy_vuser_key(struct policy_cache *cache,
+ const POLICY_HND *hnd);
+BOOL pol_get_usr_sesskey(struct policy_cache *cache, const POLICY_HND *hnd,
+ uchar usr_sess_key[16]);
+
+/*The following definitions come from lib/vuser.c */
+
+BOOL is_valid_user_struct(const vuser_key * key);
+user_struct *get_valid_user_struct(const vuser_key * key);
+void invalidate_vuid(vuser_key * key);
+BOOL validated_username(vuser_key * key, char *name, size_t len);
+uint16 create_vuid(pid_t pid,
+ uid_t uid, gid_t gid,
+ int n_groups, gid_t * groups,
+ const char *unix_name,
+ const char *requested_name,
+ const char *real_name,
+ BOOL guest, const NET_USER_INFO_3 * info3);
+uint16 register_vuid(pid_t pid, uid_t uid, gid_t gid,
+ const char *unix_name,
+ const char *requested_name,
+ BOOL guest, const NET_USER_INFO_3 * info3);
+BOOL check_vuser_ok(struct uid_cache *cache, user_struct * vuser, int snum);
+
+/*The following definitions come from lib/vuser_db.c */
+
+BOOL tdb_delete_vuid( const vuser_key *uk);
+BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
+BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
+BOOL vuid_init_db(void);
+
/*The following definitions come from libsmb/clientgen.c */
int cli_set_port(struct cli_state *cli, int port);
@@ -240,74 +308,6 @@ BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
char *smb_errstr(char *inbuf);
-/*The following definitions come from lib/util_hnd.c */
-
-struct policy_cache *get_global_hnd_cache(void);
-struct policy_cache *init_policy_cache(int num_pol_hnds);
-void free_policy_cache(struct policy_cache *cache);
-BOOL policy_hnd_set_name(struct policy_cache *cache,
- POLICY_HND *hnd, const char *name);
-const char *policy_hnd_get_name(struct policy_cache *cache,
- const POLICY_HND *hnd);
-BOOL dup_policy_hnd(struct policy_cache *cache,
- POLICY_HND *hnd,
- const POLICY_HND *from);
-BOOL register_policy_hnd(struct policy_cache *cache,
- const vuser_key *key,
- POLICY_HND *hnd,
- uint32 access_mask);
-BOOL open_policy_hnd(struct policy_cache *cache,
- const vuser_key *key,
- POLICY_HND *hnd,
- uint32 access_mask);
-BOOL open_policy_hnd_link(struct policy_cache *cache,
- const POLICY_HND *parent_hnd,
- POLICY_HND *hnd,
- uint32 access_mask);
-int find_policy_by_hnd(struct policy_cache *cache, const POLICY_HND *hnd);
-BOOL set_policy_state(struct policy_cache *cache, POLICY_HND *hnd,
- void(*fn)(void*), void *dev);
-void *get_policy_state_info(struct policy_cache *cache, const POLICY_HND *hnd);
-BOOL policy_hnd_set_state_type(struct policy_cache *cache,
- POLICY_HND *hnd, int type);
-int policy_hnd_get_state_type(struct policy_cache *cache,
- const POLICY_HND *hnd);
-BOOL policy_hnd_check_state_type(struct policy_cache *cache,
- const POLICY_HND *hnd, int type);
-BOOL close_policy_hnd(struct policy_cache *cache, POLICY_HND *hnd);
-BOOL policy_link_key(struct policy_cache *cache, const POLICY_HND *hnd,
- POLICY_HND *to);
-const vuser_key *get_policy_vuser_key(struct policy_cache *cache,
- const POLICY_HND *hnd);
-BOOL pol_get_usr_sesskey(struct policy_cache *cache, const POLICY_HND *hnd,
- uchar usr_sess_key[16]);
-
-/*The following definitions come from lib/vuser.c */
-
-BOOL is_valid_user_struct(const vuser_key * key);
-user_struct *get_valid_user_struct(const vuser_key * key);
-void invalidate_vuid(vuser_key * key);
-BOOL validated_username(vuser_key * key, char *name, size_t len);
-uint16 create_vuid(pid_t pid,
- uid_t uid, gid_t gid,
- int n_groups, gid_t * groups,
- const char *unix_name,
- const char *requested_name,
- const char *real_name,
- BOOL guest, const NET_USER_INFO_3 * info3);
-uint16 register_vuid(pid_t pid, uid_t uid, gid_t gid,
- const char *unix_name,
- const char *requested_name,
- BOOL guest, const NET_USER_INFO_3 * info3);
-BOOL check_vuser_ok(struct uid_cache *cache, user_struct * vuser, int snum);
-
-/*The following definitions come from lib/vuser_db.c */
-
-BOOL tdb_delete_vuid( const vuser_key *uk);
-BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
-BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
-BOOL vuid_init_db(void);
-
/*The following definitions come from rpc_parse/parse_creds.c */
BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
@@ -548,7 +548,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_stru
void prs_debug(prs_struct * ps, int depth, const char *desc,
const char *fn_name);
void prs_debug_out(const prs_struct * ps, char *msg, int level);
-void prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
+BOOL prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
void prs_set_packtype(prs_struct * ps, const uint8 * pack_type);
void prs_create(prs_struct * ps, char *data, uint32 size, uint8 align,
BOOL io);
@@ -563,10 +563,16 @@ BOOL prs_grow_data(prs_struct * buf, BOOL io, int new_size, BOOL force_grow);
uint32 prs_buf_len(const prs_struct * buf);
char *prs_data(const prs_struct * buf, uint32 offset);
void prs_link(prs_struct * prev, prs_struct * ps, prs_struct * next);
-void prs_align(prs_struct * ps);
+BOOL prs_align(prs_struct * ps);
BOOL prs_grow(prs_struct * ps, uint32 new_size);
BOOL prs_append_data(prs_struct * ps, const char *data, int len);
BOOL prs_add_data(prs_struct * ps, const char *data, int len);
+void prs_switch_type(prs_struct *ps, BOOL io);
+void prs_force_dynamic(prs_struct *ps);
+uint32 prs_offset(prs_struct *ps);
+BOOL prs_set_offset(prs_struct *ps, uint32 offset);
+void prs_mem_free(prs_struct *ps);
+BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len);
BOOL _prs_uint8(char *name, prs_struct * ps, int depth, uint8 * data8);
BOOL _prs_uint16(char *name, prs_struct * ps, int depth, uint16 * data16);
BOOL _prs_hash1(prs_struct * ps, uint32 offset, uint8 sess_key[16]);
diff --git a/source/include/proto.h b/source/include/proto.h
index 18132475bdc..2d975b73293 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -186,6 +186,7 @@ char *complete_samenum_grp(char *text, int state);
char *complete_samenum_usr(char *text, int state);
char *complete_samenum_als(char *text, int state);
char *complete_samenum_grp(char *text, int state);
+void cmd_set_no_autoconnect(void);
void readline_init(void);
int command_main(int argc, char *argv[]);
@@ -387,269 +388,10 @@ void CatchChildLeaveStatus(void);
int vslprintf(char *str, int n, char *format, va_list ap);
-/*The following definitions come from libsmb/clientgen.c */
-
-int cli_set_port(struct cli_state *cli, int port);
-char *cli_errstr(struct cli_state *cli);
-void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
-BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
-void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
-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_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);
-BOOL 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_session_setup_x(struct cli_state *cli,
- char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-BOOL cli_session_setup(struct cli_state *cli,
- char *myhostname, char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-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_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, const char *fname);
-int cli_open(struct cli_state *cli, const 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);
-BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
-size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
-size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
-ssize_t cli_write(struct cli_state *cli,
- int fnum, uint16 write_mode,
- char *buf, off_t offset, size_t size, size_t bytes_left);
-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_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);
-int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
- void (*fn)(file_info *, const char *));
-BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
- const char *old_password);
-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);
-void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
-struct cli_state *cli_initialise(struct cli_state *cli);
-void cli_close_socket(struct cli_state *cli);
-void cli_shutdown(struct cli_state *cli);
-int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
-void cli_sockopt(struct cli_state *cli, char *options);
-uint16 cli_setpid(struct cli_state *cli, uint16 pid);
-BOOL cli_reestablish_connection(struct cli_state *cli);
-BOOL cli_establish_connection(struct cli_state *cli,
- const 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 cli_connect_auth(struct cli_state *cli,
- const char* desthost,
- struct in_addr *dest_ip,
- const struct ntuser_creds *usr);
-BOOL cli_connect_servers_auth(struct cli_state *cli,
- char *p,
- const struct ntuser_creds *usr);
-BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
-int cli_printjob_del(struct cli_state *cli, int job);
-int cli_print_queue(struct cli_state *cli,
- void (*fn)(struct print_job_info *));
-BOOL cli_chkpath(struct cli_state *cli, char *path);
-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);
-BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
-BOOL get_any_dc_name(const char *domain, char *srv_name);
-
-/*The following definitions come from libsmb/credentials.c */
-
-char *credstr(const uchar *cred);
-void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const 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(const 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,
- const 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,
- void (*fn)(struct packet_struct *));
-struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
- struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
-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);
-
-/*The following definitions come from libsmb/nmblib.c */
-
-void debug_nmb_packet(struct packet_struct *p);
-char *nmb_namestr(struct nmb_name *n);
-void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
-struct packet_struct *copy_packet(struct packet_struct *packet);
-void free_packet(struct packet_struct *packet);
-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, const char *this_scope );
-BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
-BOOL send_packet(struct packet_struct *p);
-struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
-void sort_query_replies(char *data, int n, struct in_addr ip);
-BOOL read_nmb_sock(int c, struct nmb_state *con);
-int get_nmb_sock(void);
-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);
-void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
-BOOL pwd_compare(const struct pwd_info *_pwd1, const 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,
- const uchar lm_pwd[16],
- const uchar nt_pwd[16]);
-void pwd_get_lm_nt_16(const 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_owf2(struct pwd_info *pwd, const uchar srv_key[8],
- const char *user, const char *server, const char *domain,
- uchar sess_key[16]);
-void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
- uchar sess_key[16]);
-void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
- uchar *nt_owf, size_t *nt_owf_len);
-
/*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 smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
-void E_P16(uchar *p14,uchar *p16);
-void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
-void D_P16(const uchar *p14, const uchar *in, uchar *out);
-void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
-void cred_hash1(uchar *out, const uchar *in, const uchar *key);
-void cred_hash2(uchar *out,uchar *in,uchar *key);
-void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
-void SamOEMhash( uchar *data, const uchar *key, int val);
-void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
-
-/*The following definitions come from libsmb/smbencrypt.c */
-
-void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void E_md4hash(uchar * pwrd, uchar * p16);
-void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
-void lm_owf_gen(const char *pwd, uchar p16[16]);
-void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
-void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
-void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
-void SMBOWFencrypt_ntv2(const uchar kr[16],
- const uchar * srv_chal, int srv_chal_len,
- const uchar * cli_chal, int cli_chal_len,
- char resp_buf[16]);
-void SMBsesskeygen_ntv2(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBsesskeygen_ntv1(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBgenclientchals(char *lm_cli_chal,
- char *nt_cli_chal, int *nt_cli_chal_len,
- const char *srv, const char *dom);
-void ntv2_owf_gen(const uchar owf[16],
- const char *user_n, const char *domain_n, uchar kr_buf[16]);
-void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
- uchar p24[24]);
-BOOL make_oem_passwd_hash(uchar data[516],
- const char *pwrd, int new_pw_len,
- const uchar old_pw_hash[16], BOOL unicode);
-BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-void create_ntlmssp_resp(struct pwd_info *pwd,
- char *domain, char *user_name, char *my_name,
- uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
-BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
- int new_pwrd_size, uint32 * new_pw_len);
-BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
- int new_pw_len, BOOL nt_pass_set);
-
-/*The following definitions come from libsmb/smberr.c */
-
-char *smb_err_msg(uint8 class, uint32 num);
-BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
-BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
-char *smb_errstr(char *inbuf);
-
/*The following definitions come from lib/snprintf.c */
@@ -659,6 +401,11 @@ void become_root(BOOL save_dir);
void unbecome_root(BOOL restore_dir);
const vuser_key *get_sec_ctx(void);
+/*The following definitions come from lib/surs.c */
+
+BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
+BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
+
/*The following definitions come from lib/sursalgdomonly.c */
BOOL surs_algdomonly_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id,
@@ -673,11 +420,6 @@ BOOL surs_nt5ldap_sam_sid_to_unixid(LDAPDB *hds, DOM_SID * sid, uint32 type,
BOOL surs_nt5ldap_unixid_to_sam_sid(LDAPDB *hds, uint32 id, uint32 type,
DOM_SID * sid, BOOL create);
-/*The following definitions come from lib/surs.c */
-
-BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
-BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
-
/*The following definitions come from lib/surstdb.c */
BOOL surs_tdb_sam_sid_to_unixid(DOM_SID * sid, uint32 type, uint32 * id,
@@ -750,25 +492,6 @@ const struct passwd *Get_Pwnam(char *user,BOOL allow_change);
BOOL user_ok(char *user,int snum);
BOOL user_in_list(char *user,char *list);
-/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
-UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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 */
BOOL init_myworkgroup(void);
@@ -876,6 +599,25 @@ char *passdb_path(char *name);
char *lock_path(char *name);
const char *get_sid_name_use_str(uint32 sid_name_use);
+/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
+UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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);
@@ -1109,6 +851,265 @@ BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
BOOL vuid_init_db(void);
+/*The following definitions come from libsmb/clientgen.c */
+
+int cli_set_port(struct cli_state *cli, int port);
+char *cli_errstr(struct cli_state *cli);
+void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
+BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
+void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
+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_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);
+BOOL 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_session_setup_x(struct cli_state *cli,
+ char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+BOOL cli_session_setup(struct cli_state *cli,
+ char *myhostname, char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+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_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, const char *fname);
+int cli_open(struct cli_state *cli, const 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);
+BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
+size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
+size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
+ssize_t cli_write(struct cli_state *cli,
+ int fnum, uint16 write_mode,
+ char *buf, off_t offset, size_t size, size_t bytes_left);
+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_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);
+int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *));
+BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
+ const char *old_password);
+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);
+void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
+struct cli_state *cli_initialise(struct cli_state *cli);
+void cli_close_socket(struct cli_state *cli);
+void cli_shutdown(struct cli_state *cli);
+int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
+void cli_sockopt(struct cli_state *cli, char *options);
+uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+BOOL cli_reestablish_connection(struct cli_state *cli);
+BOOL cli_establish_connection(struct cli_state *cli,
+ const 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 cli_connect_auth(struct cli_state *cli,
+ const char* desthost,
+ struct in_addr *dest_ip,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_servers_auth(struct cli_state *cli,
+ char *p,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
+int cli_printjob_del(struct cli_state *cli, int job);
+int cli_print_queue(struct cli_state *cli,
+ void (*fn)(struct print_job_info *));
+BOOL cli_chkpath(struct cli_state *cli, char *path);
+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);
+BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
+BOOL get_any_dc_name(const char *domain, char *srv_name);
+
+/*The following definitions come from libsmb/credentials.c */
+
+char *credstr(const uchar *cred);
+void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const 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(const 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,
+ const 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,
+ void (*fn)(struct packet_struct *));
+struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
+ struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
+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);
+
+/*The following definitions come from libsmb/nmblib.c */
+
+void debug_nmb_packet(struct packet_struct *p);
+char *nmb_namestr(struct nmb_name *n);
+void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
+struct packet_struct *copy_packet(struct packet_struct *packet);
+void free_packet(struct packet_struct *packet);
+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, const char *this_scope );
+BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
+BOOL send_packet(struct packet_struct *p);
+struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
+void sort_query_replies(char *data, int n, struct in_addr ip);
+BOOL read_nmb_sock(int c, struct nmb_state *con);
+int get_nmb_sock(void);
+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);
+void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
+BOOL pwd_compare(const struct pwd_info *_pwd1, const 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,
+ const uchar lm_pwd[16],
+ const uchar nt_pwd[16]);
+void pwd_get_lm_nt_16(const 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_owf2(struct pwd_info *pwd, const uchar srv_key[8],
+ const char *user, const char *server, const char *domain,
+ uchar sess_key[16]);
+void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
+ uchar sess_key[16]);
+void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
+ uchar *nt_owf, size_t *nt_owf_len);
+
+/*The following definitions come from libsmb/smbdes.c */
+
+void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
+void E_P16(uchar *p14,uchar *p16);
+void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
+void D_P16(const uchar *p14, const uchar *in, uchar *out);
+void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
+void cred_hash1(uchar *out, const uchar *in, const uchar *key);
+void cred_hash2(uchar *out,uchar *in,uchar *key);
+void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
+void SamOEMhash( uchar *data, const uchar *key, int val);
+void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
+
+/*The following definitions come from libsmb/smbencrypt.c */
+
+void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void E_md4hash(uchar * pwrd, uchar * p16);
+void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
+void lm_owf_gen(const char *pwd, uchar p16[16]);
+void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
+void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
+void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
+void SMBOWFencrypt_ntv2(const uchar kr[16],
+ const uchar * srv_chal, int srv_chal_len,
+ const uchar * cli_chal, int cli_chal_len,
+ char resp_buf[16]);
+void SMBsesskeygen_ntv2(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBsesskeygen_ntv1(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBgenclientchals(char *lm_cli_chal,
+ char *nt_cli_chal, int *nt_cli_chal_len,
+ const char *srv, const char *dom);
+void ntv2_owf_gen(const uchar owf[16],
+ const char *user_n, const char *domain_n, uchar kr_buf[16]);
+void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
+ uchar p24[24]);
+BOOL make_oem_passwd_hash(uchar data[516],
+ const char *pwrd, int new_pw_len,
+ const uchar old_pw_hash[16], BOOL unicode);
+BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+void create_ntlmssp_resp(struct pwd_info *pwd,
+ char *domain, char *user_name, char *my_name,
+ uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
+BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
+ int new_pwrd_size, uint32 * new_pw_len);
+BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
+ int new_pw_len, BOOL nt_pass_set);
+
+/*The following definitions come from libsmb/smberr.c */
+
+char *smb_err_msg(uint8 class, uint32 num);
+BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
+BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
+char *smb_errstr(char *inbuf);
+
/*The following definitions come from locking/locking.c */
BOOL is_locked(files_struct *fsp,connection_struct *conn,
@@ -1267,6 +1268,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);
@@ -1297,9 +1301,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);
@@ -2059,6 +2060,11 @@ void init_devicemode(NT_DEVICEMODE *nt_devmode);
BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname);
void pcap_printer_fn(void (*fn)(char *, char *));
+/*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/printing.c */
void lpq_reset(int snum);
@@ -2077,11 +2083,6 @@ uint32 status_printqueue(connection_struct *conn,const vuser_key *key,
int snum,int status);
void load_printers(void);
-/*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);
@@ -2453,20 +2454,19 @@ BOOL samr_query_dispinfo( POLICY_HND *pol_domain, uint16 level,
/*The following definitions come from rpc_client/cli_spoolss.c */
-BOOL spoolss_enum_printers(uint32 flags, const char *srv_name,
- uint32 level,
- uint32 *count,
- void ***printers);
-uint32 spoolss_enum_jobs( const POLICY_HND *hnd,
- uint32 firstjob,
- uint32 numofjobs,
- uint32 level,
- uint32 *buf_size,
- uint32 *count,
- void ***jobs);
-BOOL spoolss_open_printer_ex( const char *printername,
- uint32 cbbuf, uint32 devmod, uint32 des_access,
- const char *station, const char *username,
+uint32 spoolss_enum_printers(uint32 flags, fstring srv_name, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 spoolss_enum_jobs(const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs,
+ uint32 level, NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 spoolss_enum_printerdata(const POLICY_HND *hnd, uint32 index,
+ uint32 *valuelen, uint16 *value, uint32 *rvaluelen,
+ uint32 *type,
+ uint32 *datalen, uint8 *data, uint32 *rdatalen);
+BOOL spoolss_open_printer_ex( char *printername,
+ char *datatype, uint32 access_required,
+ char *station, char *username,
POLICY_HND *hnd);
BOOL spoolss_closeprinter(POLICY_HND *hnd);
@@ -2551,315 +2551,6 @@ void cli_use_wait_keyboard(void);
BOOL wks_query_info( char *srv_name, uint32 switch_value,
WKS_INFO_100 *wks100);
-/*The following definitions come from rpcclient/cmdat.c */
-
-
-/*The following definitions come from rpcclient/cmdat_cmds.c */
-
-void add_at_commands(void);
-
-/*The following definitions come from rpcclient/cmd_atsvc.c */
-
-void cmd_at(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_brs.c */
-
-void cmd_brs_query_info(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_eventlog.c */
-
-void cmd_eventlog(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_lsarpc.c */
-
-void cmd_lsa_enum_trust_dom(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_query_info(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_set_secret(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_create_secret(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_query_secret_secobj(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_netlogon.c */
-
-void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]);
-void cmd_netlogon_domain_test(struct client_info *info, int argc,
- char *argv[]);
-void cmd_sam_sync(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_reg.c */
-
-void split_server_keyname(char *srv_name, char *key, const char* arg);
-BOOL msrpc_reg_enum_key(const char* srv_name, const char* full_keyname,
- REG_FN(reg_fn),
- REG_KEY_FN(reg_key_fn),
- REG_VAL_FN(reg_val_fn));
-void cmd_reg_enum(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_query_info(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_query_key(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_create_val(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_create_key(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_samr.c */
-
-void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_test(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_lookup_domain(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_lookup_names(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_lookup_rids(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_del_aliasmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_delete_dom_alias(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_add_aliasmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_trusting(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_user(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_alias(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_del_groupmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_delete_dom_user(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_delete_dom_group(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_add_groupmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_group(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_users(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_groupmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_group(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_sec_obj(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_user(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_set_userinfo2(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_set_userinfo(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_dispinfo(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_dominfo(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_aliasmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_alias(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_aliases(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_groups(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_domains(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_spoolss.c */
-
-BOOL msrpc_spoolss_enum_printers( const char* srv_name,
- uint32 level,
- uint32 *num,
- void ***ctr,
- PRINT_INFO_FN(fn));
-void cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]);
-void cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_spoolss_enum_jobs( const char* printer_name,
- const char* station, const char* user_name,
- uint32 level,
- uint32 *num,
- void ***ctr,
- JOB_INFO_FN(fn));
-void cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_srvsvc.c */
-
-BOOL net_srv_get_info(struct client_info *info,
- uint32 info_level,
- SRV_INFO_CTR *ctr);
-void cmd_srv_query_info(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_srv_enum_tprt( const char* dest_srv,
- uint32 info_level,
- SRV_TPRT_INFO_CTR *ctr,
- TPRT_INFO_FN(tprt_fn));
-void cmd_srv_enum_tprt(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_share_get_info(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[]);
-void cmd_time(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_svcctl.c */
-
-void svc_display_query_svc_cfg(const QUERY_SERVICE_CONFIG *cfg);
-BOOL svc_query_service( POLICY_HND *pol_scm,
- const char *svc_name,
- SVC_QUERY_FN(svc_query_fn));
-void cmd_svc_info(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_svc_enum(const char* srv_name,
- ENUM_SRVC_STATUS **svcs,
- uint32 *num_svcs,
- SVC_INFO_FN(info_fn),
- SVC_QUERY_FN(query_fn));
-void cmd_svc_enum(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_stop(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_start(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_set(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_wkssvc.c */
-
-void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/display_at.c */
-
-void display_at_enum_info(FILE *out_hnd, enum action_type action,
- uint32 num_jobs, const AT_ENUM_INFO *const jobs,
- char *const *const commands);
-void display_at_job_info(FILE *out_hnd, enum action_type action,
- AT_JOB_INFO *const job, fstring command);
-
-/*The following definitions come from rpcclient/display_event.c */
-
-void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
-
-/*The following definitions come from rpcclient/display_reg.c */
-
-char *get_reg_val_type_str(uint32 type);
-void display_reg_value_info(FILE *out_hnd, enum action_type action,
- const char *val_name,
- uint32 val_type, const BUFFER2 *value);
-void display_reg_key_info(FILE *out_hnd, enum action_type action,
- const char *key_name, time_t key_mod_time);
-
-/*The following definitions come from rpcclient/display_sam.c */
-
-void display_alias_members(FILE *out_hnd, enum action_type action,
- uint32 num_mem, char *const *const sid_mem,
- uint32 *const type);
-void display_alias_rid_info(FILE *out_hnd, enum action_type action,
- DOM_SID *const sid,
- uint32 num_rids, uint32 *const rid);
-void display_group_members(FILE *out_hnd, enum action_type action,
- uint32 num_mem, char *const *const name, uint32 *const type);
-void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1);
-void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4);
-void display_group_info_ctr(FILE *out_hnd, enum action_type action,
- GROUP_INFO_CTR *const ctr);
-void display_group_rid_info(FILE *out_hnd, enum action_type action,
- uint32 num_gids, DOM_GID *const gid);
-void display_alias_name_info(FILE *out_hnd, enum action_type action,
- uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs);
-void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3);
-void display_alias_info_ctr(FILE *out_hnd, enum action_type action,
- ALIAS_INFO_CTR *const ctr);
-void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr);
-void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
- SAM_UNK_INFO_2 *const info2);
-void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
- uint32 switch_value, SAM_UNK_CTR *const ctr);
-void display_sam_info_1(FILE *out_hnd, enum action_type action,
- SAM_ENTRY1 *const e1, SAM_STR1 *const s1);
-void display_sam_info_1_ctr(FILE *out_hnd, enum action_type action,
- uint32 count, SAM_DISPINFO_1 *const ctr);
-void display_sam_disp_info_ctr(FILE *out_hnd, enum action_type action,
- uint16 level, uint32 count,
- SAM_DISPINFO_CTR *const ctr);
-
-/*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_print_info_0(FILE *out_hnd, enum action_type action,
- PRINTER_INFO_0 *const i0);
-void display_print_info_1(FILE *out_hnd, enum action_type action,
- PRINTER_INFO_1 *const i1);
-void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action,
- uint32 count, PRINTER_INFO_0 *const *const ctr);
-void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action,
- uint32 count, PRINTER_INFO_1 *const *const ctr);
-void display_printer_info_ctr(FILE *out_hnd, enum action_type action,
- uint32 level, uint32 count,
- void *const *const ctr);
-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);
-
-/*The following definitions come from rpcclient/display_srv.c */
-
-char *get_file_mode_str(uint32 share_mode);
-char *get_file_oplock_str(uint32 op_type);
-char *get_server_type_str(uint32 type);
-void display_srv_info_ctr(FILE *out_hnd, enum action_type action,
- const SRV_INFO_CTR *ctr);
-void display_conn_info_0(FILE *out_hnd, enum action_type action,
- CONN_INFO_0 *const info0);
-void display_conn_info_1(FILE *out_hnd, enum action_type action,
- CONN_INFO_1 *const info1, CONN_INFO_1_STR *const str1);
-void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_0 *const ctr);
-void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_1 *const ctr);
-void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_CTR *const ctr);
-void display_tprt_info_0(FILE *out_hnd, enum action_type action,
- TPRT_INFO_0 *const info0, TPRT_INFO_0_STR *const str0);
-void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action,
- const SRV_TPRT_INFO_0 *const ctr);
-void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action,
- const SRV_TPRT_INFO_CTR *const ctr);
-void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_SHARE_INFO_CTR *const ctr);
-void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_FILE_INFO_CTR *const ctr);
-void display_sess_info_0(FILE *out_hnd, enum action_type action,
- SESS_INFO_0 *const info0, SESS_INFO_0_STR *const str0);
-void display_sess_info_1(FILE *out_hnd, enum action_type action,
- SESS_INFO_1 *const info1, SESS_INFO_1_STR *const str1);
-void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action,
- SRV_SESS_INFO_0 *const ctr);
-void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action,
- SRV_SESS_INFO_1 *const ctr);
-void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_SESS_INFO_CTR *const ctr);
-void display_server(FILE *out_hnd, enum action_type action,
- char *const sname, uint32 type, char *const comment);
-void display_share(FILE *out_hnd, enum action_type action,
- char *const sname, uint32 type, char *const comment);
-void display_share2(FILE *out_hnd, enum action_type action,
- char *const sname, uint32 type, char *const comment,
- uint32 perms, uint32 max_uses, uint32 num_uses,
- char *const path, char *const password);
-void display_name(FILE *out_hnd, enum action_type action,
- char *const sname);
-
-/*The following definitions come from rpcclient/display_svc.c */
-
-char *get_svc_start_type_str(uint32 type);
-void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
- const QUERY_SERVICE_CONFIG *const cfg);
-void display_svc_info(FILE *out_hnd, enum action_type action,
- const ENUM_SRVC_STATUS *const svc);
-
-/*The following definitions come from rpcclient/display_sync.c */
-
-void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
- SAM_DELTA_HDR *const delta,
- SAM_DELTA_CTR *const ctr);
-void display_sam_sync(FILE *out_hnd, enum action_type action,
- SAM_DELTA_HDR *const deltas,
- SAM_DELTA_CTR *const ctr,
- uint32 num);
-
-/*The following definitions come from rpcclient/eventlog.c */
-
-int main(int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/eventlog_cmds.c */
-
-void add_evt_commands(void);
-
-/*The following definitions come from rpcclient/lsa.c */
-
-
-/*The following definitions come from rpcclient/lsa_cmds.c */
-
-void add_lsa_commands(void);
-
/*The following definitions come from rpc_client/msrpc_lsarpc.c */
uint32 lookup_lsa_names(const char *srv_name,
@@ -3115,51 +2806,6 @@ BOOL ncalrpc_l_use_del(const char *pipe_name,
void ncalrpc_l_use_enum(uint32 * num_cons, struct use_info ***use);
void ncalrpc_use_wait_keyboard(void);
-/*The following definitions come from rpcclient/net.c */
-
-
-/*The following definitions come from rpcclient/net_cmds.c */
-
-void add_net_commands(void);
-
-/*The following definitions come from rpcclient/netlogon_cmds.c */
-
-void add_ntl_commands(void);
-
-/*The following definitions come from rpcclient/regedit.c */
-
-
-/*The following definitions come from rpcclient/regedit_cmds.c */
-
-void add_reg_commands(void);
-
-/*The following definitions come from rpcclient/rpcclient.c */
-
-
-/*The following definitions come from rpcclient/samedit.c */
-
-
-/*The following definitions come from rpcclient/samedit_cmds.c */
-
-void add_sam_commands(void);
-
-/*The following definitions come from rpcclient/spoolss.c */
-
-int main(int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/spoolss_cmds.c */
-
-void add_spl_commands(void);
-
-/*The following definitions come from rpcclient/svcctrl.c */
-
-int main(int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/svcctrl_cmds.c */
-
-char *complete_svcenum(char *text, int state);
-void add_svc_commands(void);
-
/*The following definitions come from rpc_parse/parse_creds.c */
BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
@@ -3500,7 +3146,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_stru
void prs_debug(prs_struct * ps, int depth, const char *desc,
const char *fn_name);
void prs_debug_out(const prs_struct * ps, char *msg, int level);
-void prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
+BOOL prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
void prs_set_packtype(prs_struct * ps, const uint8 * pack_type);
void prs_create(prs_struct * ps, char *data, uint32 size, uint8 align,
BOOL io);
@@ -3515,10 +3161,16 @@ BOOL prs_grow_data(prs_struct * buf, BOOL io, int new_size, BOOL force_grow);
uint32 prs_buf_len(const prs_struct * buf);
char *prs_data(const prs_struct * buf, uint32 offset);
void prs_link(prs_struct * prev, prs_struct * ps, prs_struct * next);
-void prs_align(prs_struct * ps);
+BOOL prs_align(prs_struct * ps);
BOOL prs_grow(prs_struct * ps, uint32 new_size);
BOOL prs_append_data(prs_struct * ps, const char *data, int len);
BOOL prs_add_data(prs_struct * ps, const char *data, int len);
+void prs_switch_type(prs_struct *ps, BOOL io);
+void prs_force_dynamic(prs_struct *ps);
+uint32 prs_offset(prs_struct *ps);
+BOOL prs_set_offset(prs_struct *ps, uint32 offset);
+void prs_mem_free(prs_struct *ps);
+BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len);
BOOL _prs_uint8(char *name, prs_struct * ps, int depth, uint8 * data8);
BOOL _prs_uint16(char *name, prs_struct * ps, int depth, uint16 * data16);
BOOL _prs_hash1(prs_struct * ps, uint32 offset, uint8 sess_key[16]);
@@ -3718,14 +3370,359 @@ BOOL api_svcctl_rpc(rpcsrv_struct *p);
BOOL api_wkssvc_rpc(rpcsrv_struct *p);
-/*The following definitions come from samrd/samrd.c */
+/*The following definitions come from rpcclient/cmd_atsvc.c */
-msrpc_service_fns *get_service_fns(void);
+void cmd_at(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_brs.c */
+
+void cmd_brs_query_info(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_eventlog.c */
+
+void cmd_eventlog(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_lsarpc.c */
+
+void cmd_lsa_enum_trust_dom(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_query_info(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_set_secret(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_create_secret(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_query_secret_secobj(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_netlogon.c */
+
+void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]);
+void cmd_netlogon_domain_test(struct client_info *info, int argc,
+ char *argv[]);
+void cmd_sam_sync(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_reg.c */
+
+void split_server_keyname(char *srv_name, char *key, const char* arg);
+BOOL msrpc_reg_enum_key(const char* srv_name, const char* full_keyname,
+ REG_FN(reg_fn),
+ REG_KEY_FN(reg_key_fn),
+ REG_VAL_FN(reg_val_fn));
+void cmd_reg_enum(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_query_info(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_query_key(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_create_val(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_create_key(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_samr.c */
+
+void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_test(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_lookup_domain(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_lookup_names(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_lookup_rids(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_del_aliasmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_delete_dom_alias(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_add_aliasmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_trusting(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_user(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_alias(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_del_groupmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_delete_dom_user(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_delete_dom_group(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_add_groupmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_group(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_users(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_groupmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_group(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_sec_obj(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_user(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_set_userinfo2(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_set_userinfo(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_dispinfo(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_dominfo(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_aliasmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_alias(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_aliases(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_groups(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_domains(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_spoolss.c */
+
+BOOL msrpc_spoolss_enum_printers(char* srv_name, uint32 flags, uint32 level, PRINTER_INFO_CTR ctr);
+void cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]);
+void cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_spoolss_enum_jobs( const char* printer_name,
+ const char* station, const char* user_name,
+ uint32 level,
+ void ***ctr, JOB_INFO_FN(fn));
+void cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_spoolss_enum_printerdata( const char* printer_name, const char* station, const char* user_name );
+void cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_srvsvc.c */
+
+BOOL net_srv_get_info(struct client_info *info,
+ uint32 info_level,
+ SRV_INFO_CTR *ctr);
+void cmd_srv_query_info(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_srv_enum_tprt( const char* dest_srv,
+ uint32 info_level,
+ SRV_TPRT_INFO_CTR *ctr,
+ TPRT_INFO_FN(tprt_fn));
+void cmd_srv_enum_tprt(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_share_get_info(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[]);
+void cmd_time(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_svcctl.c */
+
+void svc_display_query_svc_cfg(const QUERY_SERVICE_CONFIG *cfg);
+BOOL svc_query_service( POLICY_HND *pol_scm,
+ const char *svc_name,
+ SVC_QUERY_FN(svc_query_fn));
+void cmd_svc_info(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_svc_enum(const char* srv_name,
+ ENUM_SRVC_STATUS **svcs,
+ uint32 *num_svcs,
+ SVC_INFO_FN(info_fn),
+ SVC_QUERY_FN(query_fn));
+void cmd_svc_enum(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_stop(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_start(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_set(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_wkssvc.c */
+
+void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmdat.c */
+
+
+/*The following definitions come from rpcclient/cmdat_cmds.c */
+
+void add_at_commands(void);
+
+/*The following definitions come from rpcclient/display_at.c */
+
+void display_at_enum_info(FILE *out_hnd, enum action_type action,
+ uint32 num_jobs, const AT_ENUM_INFO *const jobs,
+ char *const *const commands);
+void display_at_job_info(FILE *out_hnd, enum action_type action,
+ AT_JOB_INFO *const job, fstring command);
+
+/*The following definitions come from rpcclient/display_event.c */
+
+void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
+
+/*The following definitions come from rpcclient/display_reg.c */
+
+char *get_reg_val_type_str(uint32 type);
+void display_reg_value_info(FILE *out_hnd, enum action_type action,
+ const char *val_name,
+ uint32 val_type, const BUFFER2 *value);
+void display_reg_key_info(FILE *out_hnd, enum action_type action,
+ const char *key_name, time_t key_mod_time);
+
+/*The following definitions come from rpcclient/display_sam.c */
+
+void display_alias_members(FILE *out_hnd, enum action_type action,
+ uint32 num_mem, char *const *const sid_mem,
+ uint32 *const type);
+void display_alias_rid_info(FILE *out_hnd, enum action_type action,
+ DOM_SID *const sid,
+ uint32 num_rids, uint32 *const rid);
+void display_group_members(FILE *out_hnd, enum action_type action,
+ uint32 num_mem, char *const *const name, uint32 *const type);
+void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1);
+void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4);
+void display_group_info_ctr(FILE *out_hnd, enum action_type action,
+ GROUP_INFO_CTR *const ctr);
+void display_group_rid_info(FILE *out_hnd, enum action_type action,
+ uint32 num_gids, DOM_GID *const gid);
+void display_alias_name_info(FILE *out_hnd, enum action_type action,
+ uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs);
+void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3);
+void display_alias_info_ctr(FILE *out_hnd, enum action_type action,
+ ALIAS_INFO_CTR *const ctr);
+void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr);
+void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
+ SAM_UNK_INFO_2 *const info2);
+void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
+ uint32 switch_value, SAM_UNK_CTR *const ctr);
+void display_sam_info_1(FILE *out_hnd, enum action_type action,
+ SAM_ENTRY1 *const e1, SAM_STR1 *const s1);
+void display_sam_info_1_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, SAM_DISPINFO_1 *const ctr);
+void display_sam_disp_info_ctr(FILE *out_hnd, enum action_type action,
+ uint16 level, uint32 count,
+ SAM_DISPINFO_CTR *const ctr);
+
+/*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 index,
+ 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);
+
+/*The following definitions come from rpcclient/display_srv.c */
+
+char *get_file_mode_str(uint32 share_mode);
+char *get_file_oplock_str(uint32 op_type);
+char *get_server_type_str(uint32 type);
+void display_srv_info_ctr(FILE *out_hnd, enum action_type action,
+ const SRV_INFO_CTR *ctr);
+void display_conn_info_0(FILE *out_hnd, enum action_type action,
+ CONN_INFO_0 *const info0);
+void display_conn_info_1(FILE *out_hnd, enum action_type action,
+ CONN_INFO_1 *const info1, CONN_INFO_1_STR *const str1);
+void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_0 *const ctr);
+void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_1 *const ctr);
+void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_CTR *const ctr);
+void display_tprt_info_0(FILE *out_hnd, enum action_type action,
+ TPRT_INFO_0 *const info0, TPRT_INFO_0_STR *const str0);
+void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action,
+ const SRV_TPRT_INFO_0 *const ctr);
+void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action,
+ const SRV_TPRT_INFO_CTR *const ctr);
+void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SHARE_INFO_CTR *const ctr);
+void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_FILE_INFO_CTR *const ctr);
+void display_sess_info_0(FILE *out_hnd, enum action_type action,
+ SESS_INFO_0 *const info0, SESS_INFO_0_STR *const str0);
+void display_sess_info_1(FILE *out_hnd, enum action_type action,
+ SESS_INFO_1 *const info1, SESS_INFO_1_STR *const str1);
+void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SESS_INFO_0 *const ctr);
+void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SESS_INFO_1 *const ctr);
+void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SESS_INFO_CTR *const ctr);
+void display_server(FILE *out_hnd, enum action_type action,
+ char *const sname, uint32 type, char *const comment);
+void display_share(FILE *out_hnd, enum action_type action,
+ char *const sname, uint32 type, char *const comment);
+void display_share2(FILE *out_hnd, enum action_type action,
+ char *const sname, uint32 type, char *const comment,
+ uint32 perms, uint32 max_uses, uint32 num_uses,
+ char *const path, char *const password);
+void display_name(FILE *out_hnd, enum action_type action,
+ char *const sname);
+
+/*The following definitions come from rpcclient/display_svc.c */
+
+char *get_svc_start_type_str(uint32 type);
+void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
+ const QUERY_SERVICE_CONFIG *const cfg);
+void display_svc_info(FILE *out_hnd, enum action_type action,
+ const ENUM_SRVC_STATUS *const svc);
+
+/*The following definitions come from rpcclient/display_sync.c */
+
+void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
+ SAM_DELTA_HDR *const delta,
+ SAM_DELTA_CTR *const ctr);
+void display_sam_sync(FILE *out_hnd, enum action_type action,
+ SAM_DELTA_HDR *const deltas,
+ SAM_DELTA_CTR *const ctr,
+ uint32 num);
+
+/*The following definitions come from rpcclient/eventlog.c */
+
+int main(int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/eventlog_cmds.c */
+
+void add_evt_commands(void);
+
+/*The following definitions come from rpcclient/lsa.c */
+
+
+/*The following definitions come from rpcclient/lsa_cmds.c */
+
+void add_lsa_commands(void);
+
+/*The following definitions come from rpcclient/net.c */
+
+
+/*The following definitions come from rpcclient/net_cmds.c */
+
+void add_net_commands(void);
+
+/*The following definitions come from rpcclient/netlogon_cmds.c */
+
+void add_ntl_commands(void);
+
+/*The following definitions come from rpcclient/regedit.c */
+
+
+/*The following definitions come from rpcclient/regedit_cmds.c */
+
+void add_reg_commands(void);
+
+/*The following definitions come from rpcclient/rpcclient.c */
+
+
+/*The following definitions come from rpcclient/samedit.c */
+
+
+/*The following definitions come from rpcclient/samedit_cmds.c */
+
+void add_sam_commands(void);
+
+/*The following definitions come from rpcclient/spoolss.c */
+
+int main(int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/spoolss_cmds.c */
+
+void add_spl_commands(void);
+
+/*The following definitions come from rpcclient/svcctrl.c */
+
+int main(int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/svcctrl_cmds.c */
+
+char *complete_svcenum(char *text, int state);
+void add_svc_commands(void);
/*The following definitions come from samrd/samr_util.c */
uint32 samr_make_usr_obj_sd(SEC_DESC_BUF *buf, DOM_SID *usr_sid);
+/*The following definitions come from samrd/samrd.c */
+
+msrpc_service_fns *get_service_fns(void);
+
/*The following definitions come from samrd/srv_samr_als_tdb.c */
uint32 _samr_add_aliasmem(const POLICY_HND *alias_pol, const DOM_SID *sid);
@@ -4507,17 +4504,6 @@ BOOL become_user(connection_struct *conn, uint16 vuid);
BOOL become_userk(connection_struct *conn, const vuser_key *key);
BOOL unbecome_user(void );
-/*The following definitions come from smbd/vfs.c */
-
-int vfs_init_default(connection_struct *conn);
-BOOL vfs_init_custom(connection_struct *conn);
-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,
@@ -4547,6 +4533,17 @@ int vfswrap_unlink(char *path);
int vfswrap_chmod(char *path, mode_t mode);
int vfswrap_utime(char *path, struct utimbuf *times);
+/*The following definitions come from smbd/vfs.c */
+
+int vfs_init_default(connection_struct *conn);
+BOOL vfs_init_custom(connection_struct *conn);
+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);
@@ -4630,55 +4627,31 @@ msrpc_service_fns *get_service_fns(void);
/*The following definitions come from spoolssd/srv_spoolss_nt.c */
+void init_printer_hnd(void);
uint32 _spoolss_open_printer_ex( const UNISTR2 *printername,
-
- uint32 unknown0, uint32 cbbuf,
- uint32 devmod, uint32 access_required,
- uint32 unknown1, uint32 unknown2,
- uint32 unknown3, uint32 unknown4,
- uint32 unknown5, uint32 unknown6,
- uint32 unknown7, uint32 unknown8,
- uint32 unknown9, uint32 unknown10,
- const UNISTR2 *station, const UNISTR2 *username,
- POLICY_HND *handle);
+ const PRINTER_DEFAULT *printer_default,
+ uint32 user_switch, SPOOL_USER_CTR user_ctr,
+ POLICY_HND *handle);
uint32 _spoolss_closeprinter(POLICY_HND *handle);
uint32 _spoolss_getprinterdata(const POLICY_HND *handle, UNISTR2 *valuename,
+ uint32 in_size,
uint32 *type,
- uint32 *size,
+ uint32 *out_size,
uint8 **data,
- uint32 *numeric_data,
- uint32 *needed);
-uint32 _spoolss_rffpcnex(const POLICY_HND *handle,
- uint32 flags, uint32 options,
- const UNISTR2 *localmachine,
- uint32 printerlocal,
- SPOOL_NOTIFY_OPTION *option);
-uint32 _spoolss_rfnpcnex( const POLICY_HND *handle,
- uint32 change,
- const SPOOL_NOTIFY_OPTION *option,
- uint32 *count,
- SPOOL_NOTIFY_INFO *info);
-uint32 _spoolss_enumprinters(
- uint32 flags,
- const UNISTR2 *servername,
- uint32 level,
- const BUFFER *buffer,
- uint32 buf_size,
- uint32 *offered,
- uint32 *needed,
- PRINTER_INFO_CTR *ctr,
- uint32 *returned);
-uint32 _spoolss_getprinter( POLICY_HND *handle,
- uint32 level,
- PRINTER_INFO *ctr,
- uint32 *offered,
- uint32 *needed);
-uint32 _spoolss_getprinterdriver2( const POLICY_HND *handle,
- const UNISTR2 *uni_arch,
- uint32 level,
- DRIVER_INFO *ctr,
- uint32 *offered,
uint32 *needed);
+uint32 _spoolss_rffpcnex(const POLICY_HND *handle, uint32 flags, uint32 options,
+ const UNISTR2 *localmachine, uint32 printerlocal,
+ SPOOL_NOTIFY_OPTION *option);
+uint32 _spoolss_rfnpcnex( const POLICY_HND *handle, uint32 change,
+ SPOOL_NOTIFY_OPTION *option, SPOOL_NOTIFY_INFO *info);
+uint32 _spoolss_enumprinters( uint32 flags, const UNISTR2 *servername, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 _spoolss_getprinter(POLICY_HND *handle, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered, uint32 *needed);
+uint32 _spoolss_getprinterdriver2(const POLICY_HND *handle, const UNISTR2 *uni_arch, uint32 level, uint32 unknown,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *unknown0, uint32 *unknown1);
uint32 _spoolss_startpageprinter(const POLICY_HND *handle);
uint32 _spoolss_endpageprinter(const POLICY_HND *handle);
uint32 _spoolss_startdocprinter( const POLICY_HND *handle, uint32 level,
@@ -4688,73 +4661,47 @@ uint32 _spoolss_writeprinter( const POLICY_HND *handle,
uint32 buffer_size,
const uint8 *buffer,
uint32 *buffer_written);
-uint32 _spoolss_setprinter( const POLICY_HND *handle,
- uint32 level,
- const SPOOL_PRINTER_INFO_LEVEL *info,
- const DEVICEMODE *devmode,
- uint32 sec_buf_size,
- const char *sec_buf,
- uint32 command);
-uint32 _spoolss_fcpn( const POLICY_HND *handle);
-uint32 _spoolss_addjob( const POLICY_HND *handle, uint32 level,
- const BUFFER *buffer,
- uint32 buf_size);
-uint32 _spoolss_enumjobs( const POLICY_HND *handle,
- uint32 reqfirstjob,
- uint32 reqnumofjobs,
- uint32 level,
- JOB_INFO_CTR *ctr,
- uint32 *buf_size,
- uint32 *numofjobs);
+uint32 _spoolss_setprinter(const POLICY_HND *handle, uint32 level,
+ const SPOOL_PRINTER_INFO_LEVEL *info,
+ const DEVMODE_CTR devmode_ctr,
+ uint32 command);
+uint32 _spoolss_fcpn(const POLICY_HND *handle);
+uint32 _spoolss_addjob(const POLICY_HND *handle, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered);
+uint32 _spoolss_enumjobs( POLICY_HND *handle, uint32 firstjob, uint32 numofjobs, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
uint32 _spoolss_schedulejob( const POLICY_HND *handle, uint32 jobid);
uint32 _spoolss_setjob( const POLICY_HND *handle,
uint32 jobid,
uint32 level,
JOB_INFO *ctr,
uint32 command);
-uint32 _spoolss_enumprinterdrivers( const UNISTR2 *name,
- const UNISTR2 *environment,
- uint32 level,
- DRIVER_INFO *ctr,
- uint32 *offered,
- uint32 *numofdrivers);
-uint32 _spoolss_enumforms( const POLICY_HND *handle,
- uint32 level,
- FORM_1 **forms_1,
- uint32 *offered,
- uint32 *numofforms);
-uint32 _spoolss_enumports( const UNISTR2 *name,
- uint32 level,
- PORT_INFO_CTR *ctr,
- uint32 *offered,
- uint32 *numofports);
-uint32 _spoolss_addprinterex( const UNISTR2 *uni_srv_name,
- uint32 level,
+uint32 _spoolss_enumprinterdrivers( UNISTR2 *name, UNISTR2 *environment, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 _new_spoolss_enumforms( const POLICY_HND *handle, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *numofforms);
+uint32 _spoolss_enumports( UNISTR2 *name, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 _spoolss_addprinterex( const UNISTR2 *uni_srv_name, uint32 level,
const SPOOL_PRINTER_INFO_LEVEL *info,
- uint32 unk0,
- uint32 unk1,
- uint32 unk2,
- uint32 unk3,
- uint32 user_level,
- const SPOOL_USER_LEVEL *user,
+ uint32 unk0, uint32 unk1, uint32 unk2, uint32 unk3,
+ uint32 user_switch, const SPOOL_USER_CTR *user,
POLICY_HND *handle);
uint32 _spoolss_addprinterdriver( const UNISTR2 *server_name,
uint32 level,
const SPOOL_PRINTER_DRIVER_INFO_LEVEL *info);
-uint32 _spoolss_getprinterdriverdirectory( const UNISTR2 *name,
- const UNISTR2 *uni_environment,
- uint32 level,
- DRIVER_DIRECTORY_CTR *ctr,
- uint32 *offered);
-uint32 _spoolss_enumprinterdata(const POLICY_HND *handle,
- uint32 idx,
- uint32 *valuesize,
- UNISTR *uni_value,
- uint32 *realvaluesize,
- uint32 *type,
- uint32 *datasize,
- uint8 **data,
- uint32 *realdatasize);
+uint32 _spoolss_getprinterdriverdirectory(UNISTR2 *name, UNISTR2 *uni_environment, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed);
+uint32 _spoolss_enumprinterdata(const POLICY_HND *handle, uint32 index,
+ uint32 in_value_len, uint32 in_data_len,
+ uint32 *out_max_value_len, uint16 **out_value, uint32 *out_value_len,
+ uint32 *out_type,
+ uint32 *out_max_data_len, uint8 **out_data, uint32 *out_data_len);
uint32 _spoolss_setprinterdata( const POLICY_HND *handle,
const UNISTR2 *value,
uint32 type,
@@ -4769,22 +4716,18 @@ uint32 _spoolss_setform( const POLICY_HND *handle,
const UNISTR2 *uni_name,
uint32 level,
const FORM *form);
-uint32 _spoolss_enumprintprocessors(const UNISTR2 *name,
- const UNISTR2 *environment,
- uint32 level,
- PRINTPROCESSOR_1 **info_1,
- uint32 *offered,
- uint32 *numofprintprocessors);
-uint32 _spoolss_enumprintmonitors( const UNISTR2 *name,
- uint32 level,
- PRINTMONITOR_1 **info_1,
- uint32 *offered,
- uint32 *numofprintmonitors);
-uint32 _spoolss_getjob( const POLICY_HND *handle,
- uint32 jobid,
- uint32 level,
- PJOB_INFO *ctr,
- uint32 *offered);
+uint32 _spoolss_enumprintprocessors(UNISTR2 *name, UNISTR2 *environment, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 _spoolss_enumprintprocdatatypes(UNISTR2 *name, UNISTR2 *processor, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 _spoolss_enumprintmonitors(UNISTR2 *name,uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 _spoolss_getjob( POLICY_HND *handle, uint32 jobid, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed);
/*The following definitions come from srvsvcd/srv_srvsvc_nt.c */
diff --git a/source/include/rpc_client_proto.h b/source/include/rpc_client_proto.h
index 140801c0475..7ee827f5ea2 100644
--- a/source/include/rpc_client_proto.h
+++ b/source/include/rpc_client_proto.h
@@ -366,20 +366,19 @@ BOOL samr_query_dispinfo( POLICY_HND *pol_domain, uint16 level,
/*The following definitions come from rpc_client/cli_spoolss.c */
-BOOL spoolss_enum_printers(uint32 flags, const char *srv_name,
- uint32 level,
- uint32 *count,
- void ***printers);
-uint32 spoolss_enum_jobs( const POLICY_HND *hnd,
- uint32 firstjob,
- uint32 numofjobs,
- uint32 level,
- uint32 *buf_size,
- uint32 *count,
- void ***jobs);
-BOOL spoolss_open_printer_ex( const char *printername,
- uint32 cbbuf, uint32 devmod, uint32 des_access,
- const char *station, const char *username,
+uint32 spoolss_enum_printers(uint32 flags, fstring srv_name, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 spoolss_enum_jobs(const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs,
+ uint32 level, NEW_BUFFER *buffer, uint32 offered,
+ uint32 *needed, uint32 *returned);
+uint32 spoolss_enum_printerdata(const POLICY_HND *hnd, uint32 index,
+ uint32 *valuelen, uint16 *value, uint32 *rvaluelen,
+ uint32 *type,
+ uint32 *datalen, uint8 *data, uint32 *rdatalen);
+BOOL spoolss_open_printer_ex( char *printername,
+ char *datatype, uint32 access_required,
+ char *station, char *username,
POLICY_HND *hnd);
BOOL spoolss_closeprinter(POLICY_HND *hnd);
diff --git a/source/include/rpc_parse_proto.h b/source/include/rpc_parse_proto.h
index 75c82792979..4fc560c6ae7 100644
--- a/source/include/rpc_parse_proto.h
+++ b/source/include/rpc_parse_proto.h
@@ -849,13 +849,10 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth);
BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data,
prs_struct *ps, int depth);
-BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth);
-BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u,
- const char *printername,
- uint32 cbbuf, uint32 devmod, uint32 des_access,
- const char *station,
- const char *username);
+BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, fstring printername, fstring datatype,
+ uint32 access_required, fstring client_name, fstring user_name);
BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth);
BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
POLICY_HND *handle,
char *valuename,
@@ -875,73 +872,81 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st
BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth);
-BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u,
- prs_struct *ps, int depth);
-BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u,
- prs_struct *ps, int depth);
-BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u,
- prs_struct *ps, int depth);
-BOOL spoolss_io_r_rfnpcnex(char *desc,
- SPOOL_R_RFNPCNEX *r_u,
- prs_struct *ps, int depth);
-BOOL spoolss_io_free_buffer(BUFFER *buffer);
-BOOL spoolss_io_q_getprinterdriver2(char *desc,
- SPOOL_Q_GETPRINTERDRIVER2 *q_u,
- prs_struct *ps, int depth);
-BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u,
- prs_struct *ps, int depth);
-BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u,
- uint32 flags,
- const char* servername,
- uint32 level,
- uint32 size);
-BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u,
- prs_struct *ps, int depth);
-void free_r_enumprinters(SPOOL_R_ENUMPRINTERS *r_u);
-BOOL spoolss_io_r_enumprinters(char *desc,
- SPOOL_R_ENUMPRINTERS *r_u,
- prs_struct *ps, int depth);
-BOOL spoolss_io_r_getprinter(char *desc,
- SPOOL_R_GETPRINTER *r_u,
- prs_struct *ps, int depth);
-BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u,
- POLICY_HND *hnd,
- uint32 level,
- uint32 buf_size);
-BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u,
- prs_struct *ps, int depth);
+BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth);
+BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth);
+BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth);
+BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth);
+BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth);
+BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) ;
+BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) ;
+BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth);
+BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth);
+BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth);
+BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth);
+void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest);
+void new_spoolss_allocate_buffer(NEW_BUFFER **buffer);
+void new_spoolss_free_buffer(NEW_BUFFER *buffer);
+uint32 new_get_buffer_size(NEW_BUFFER *buffer);
+BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth);
+BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth);
+BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth);
+BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth);
+BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth);
+BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth);
+BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth);
+uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info);
+uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info);
+uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info);
+uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info);
+uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info);
+uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info);
+uint32 spoolss_size_job_info_1(JOB_INFO_1 *info);
+uint32 spoolss_size_job_info_2(JOB_INFO_2 *info);
+uint32 spoolss_size_form_1(FORM_1 *info);
+uint32 spoolss_size_port_info_1(PORT_INFO_1 *info);
+uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info);
+uint32 spoolss_size_port_info_2(PORT_INFO_2 *info);
+uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info);
+uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info);
+uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info);
+uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info);
+BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth);
+BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags,
+ fstring servername, uint32 level,
+ NEW_BUFFER *buffer, uint32 offered);
+BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth);
+BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth);
+BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth);
-void free_job_info_ctr(JOB_INFO_CTR *ctr, uint32 level, uint32 numofjobs);
-void free_r_enumjobs(SPOOL_R_ENUMJOBS *r_u);
BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth);
BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd,
uint32 firstjob,
uint32 numofjobs,
uint32 level,
- uint32 buf_size);
+ NEW_BUFFER *buffer,
+ uint32 offered);
BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth);
-BOOL spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth);
-void free_spoolss_r_enumdrivers(SPOOL_R_ENUMPRINTERDRIVERS *r_u);
+BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth);
-BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth);
-void spoolss_free_r_enumforms(SPOOL_R_ENUMFORMS *r_u);
BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth);
-BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth);
-void spoolss_free_r_enumports(SPOOL_R_ENUMPORTS *r_u);
+BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth);
+BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth);
-BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth);
+BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth);
BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth);
-BOOL spool_io_user_level_1(char *desc, SPOOL_USER_LEVEL_1 **q_u, prs_struct *ps, int depth);
-BOOL spool_io_user_level(char *desc, SPOOL_USER_LEVEL *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth);
BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u,
@@ -955,14 +960,17 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni,
NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc);
BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
NT_PRINTER_INFO_LEVEL_2 **asc);
-BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth);
-BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth);
+BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth);
+BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth);
+BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, POLICY_HND *hnd, uint32 index, uint32 valuelen, uint32 datalen);
BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth);
BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value,
@@ -972,7 +980,6 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int
BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth);
BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth);
-void free_spoolss_r_getjob(SPOOL_R_GETJOB *r_u);
BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth);
void free_devmode(DEVICEMODE *devmode);
void free_printer_info_2(PRINTER_INFO_2 *printer);
diff --git a/source/include/winbindd_proto.h b/source/include/winbindd_proto.h
index c53eee37db8..f0c05084fa5 100644
--- a/source/include/winbindd_proto.h
+++ b/source/include/winbindd_proto.h
@@ -185,263 +185,10 @@ void CatchChildLeaveStatus(void);
int vslprintf(char *str, int n, char *format, va_list ap);
-/*The following definitions come from libsmb/clientgen.c */
-
-int cli_set_port(struct cli_state *cli, int port);
-char *cli_errstr(struct cli_state *cli);
-void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
-BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
-void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
-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_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);
-BOOL 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_session_setup_x(struct cli_state *cli,
- char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-BOOL cli_session_setup(struct cli_state *cli,
- char *myhostname, char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-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_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, const char *fname);
-int cli_open(struct cli_state *cli, const 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);
-BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
-size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
-size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
-ssize_t cli_write(struct cli_state *cli,
- int fnum, uint16 write_mode,
- char *buf, off_t offset, size_t size, size_t bytes_left);
-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_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);
-int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
- void (*fn)(file_info *, const char *));
-BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
- const char *old_password);
-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);
-void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
-struct cli_state *cli_initialise(struct cli_state *cli);
-void cli_close_socket(struct cli_state *cli);
-void cli_shutdown(struct cli_state *cli);
-int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
-void cli_sockopt(struct cli_state *cli, char *options);
-uint16 cli_setpid(struct cli_state *cli, uint16 pid);
-BOOL cli_reestablish_connection(struct cli_state *cli);
-BOOL cli_establish_connection(struct cli_state *cli,
- const 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 cli_connect_auth(struct cli_state *cli,
- const char* desthost,
- struct in_addr *dest_ip,
- const struct ntuser_creds *usr);
-BOOL cli_connect_servers_auth(struct cli_state *cli,
- char *p,
- const struct ntuser_creds *usr);
-BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
-int cli_printjob_del(struct cli_state *cli, int job);
-int cli_print_queue(struct cli_state *cli,
- void (*fn)(struct print_job_info *));
-BOOL cli_chkpath(struct cli_state *cli, char *path);
-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);
-BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
-BOOL get_any_dc_name(const char *domain, char *srv_name);
-
-/*The following definitions come from libsmb/credentials.c */
-
-char *credstr(const uchar *cred);
-void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const 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(const 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,
- const 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,
- void (*fn)(struct packet_struct *));
-struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
- struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
-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);
-
-/*The following definitions come from libsmb/nmblib.c */
-
-void debug_nmb_packet(struct packet_struct *p);
-char *nmb_namestr(struct nmb_name *n);
-void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
-struct packet_struct *copy_packet(struct packet_struct *packet);
-void free_packet(struct packet_struct *packet);
-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, const char *this_scope );
-BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
-BOOL send_packet(struct packet_struct *p);
-struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
-void sort_query_replies(char *data, int n, struct in_addr ip);
-BOOL read_nmb_sock(int c, struct nmb_state *con);
-int get_nmb_sock(void);
-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/pwd_cache.c */
-
-void pwd_init(struct pwd_info *pwd);
-BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
-void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
-BOOL pwd_compare(const struct pwd_info *_pwd1, const 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,
- const uchar lm_pwd[16],
- const uchar nt_pwd[16]);
-void pwd_get_lm_nt_16(const 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_owf2(struct pwd_info *pwd, const uchar srv_key[8],
- const char *user, const char *server, const char *domain,
- uchar sess_key[16]);
-void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
- uchar sess_key[16]);
-void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
- uchar *nt_owf, size_t *nt_owf_len);
-
/*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 smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
-void E_P16(uchar *p14,uchar *p16);
-void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
-void D_P16(const uchar *p14, const uchar *in, uchar *out);
-void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
-void cred_hash1(uchar *out, const uchar *in, const uchar *key);
-void cred_hash2(uchar *out,uchar *in,uchar *key);
-void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
-void SamOEMhash( uchar *data, const uchar *key, int val);
-void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
-
-/*The following definitions come from libsmb/smbencrypt.c */
-
-void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void E_md4hash(uchar * pwrd, uchar * p16);
-void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
-void lm_owf_gen(const char *pwd, uchar p16[16]);
-void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
-void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
-void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
-void SMBOWFencrypt_ntv2(const uchar kr[16],
- const uchar * srv_chal, int srv_chal_len,
- const uchar * cli_chal, int cli_chal_len,
- char resp_buf[16]);
-void SMBsesskeygen_ntv2(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBsesskeygen_ntv1(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBgenclientchals(char *lm_cli_chal,
- char *nt_cli_chal, int *nt_cli_chal_len,
- const char *srv, const char *dom);
-void ntv2_owf_gen(const uchar owf[16],
- const char *user_n, const char *domain_n, uchar kr_buf[16]);
-void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
- uchar p24[24]);
-BOOL make_oem_passwd_hash(uchar data[516],
- const char *pwrd, int new_pw_len,
- const uchar old_pw_hash[16], BOOL unicode);
-BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-void create_ntlmssp_resp(struct pwd_info *pwd,
- char *domain, char *user_name, char *my_name,
- uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
-BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
- int new_pwrd_size, uint32 * new_pw_len);
-BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
- int new_pw_len, BOOL nt_pass_set);
-
-/*The following definitions come from libsmb/smberr.c */
-
-char *smb_err_msg(uint8 class, uint32 num);
-BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
-BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
-char *smb_errstr(char *inbuf);
-
/*The following definitions come from lib/snprintf.c */
@@ -451,6 +198,11 @@ void become_root(BOOL save_dir);
void unbecome_root(BOOL restore_dir);
const vuser_key *get_sec_ctx(void);
+/*The following definitions come from lib/surs.c */
+
+BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
+BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
+
/*The following definitions come from lib/sursalgdomonly.c */
BOOL surs_algdomonly_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id,
@@ -465,11 +217,6 @@ BOOL surs_nt5ldap_sam_sid_to_unixid(LDAPDB *hds, DOM_SID * sid, uint32 type,
BOOL surs_nt5ldap_unixid_to_sam_sid(LDAPDB *hds, uint32 id, uint32 type,
DOM_SID * sid, BOOL create);
-/*The following definitions come from lib/surs.c */
-
-BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
-BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
-
/*The following definitions come from lib/surstdb.c */
BOOL surs_tdb_sam_sid_to_unixid(DOM_SID * sid, uint32 type, uint32 * id,
@@ -542,25 +289,6 @@ const struct passwd *Get_Pwnam(char *user,BOOL allow_change);
BOOL user_ok(char *user,int snum);
BOOL user_in_list(char *user,char *list);
-/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
-UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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 */
BOOL init_myworkgroup(void);
@@ -668,6 +396,25 @@ char *passdb_path(char *name);
char *lock_path(char *name);
const char *get_sid_name_use_str(uint32 sid_name_use);
+/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
+UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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);
@@ -883,6 +630,259 @@ BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
BOOL vuid_init_db(void);
+/*The following definitions come from libsmb/clientgen.c */
+
+int cli_set_port(struct cli_state *cli, int port);
+char *cli_errstr(struct cli_state *cli);
+void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
+BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
+void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
+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_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);
+BOOL 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_session_setup_x(struct cli_state *cli,
+ char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+BOOL cli_session_setup(struct cli_state *cli,
+ char *myhostname, char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+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_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, const char *fname);
+int cli_open(struct cli_state *cli, const 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);
+BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
+size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
+size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
+ssize_t cli_write(struct cli_state *cli,
+ int fnum, uint16 write_mode,
+ char *buf, off_t offset, size_t size, size_t bytes_left);
+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_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);
+int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *));
+BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
+ const char *old_password);
+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);
+void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
+struct cli_state *cli_initialise(struct cli_state *cli);
+void cli_close_socket(struct cli_state *cli);
+void cli_shutdown(struct cli_state *cli);
+int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
+void cli_sockopt(struct cli_state *cli, char *options);
+uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+BOOL cli_reestablish_connection(struct cli_state *cli);
+BOOL cli_establish_connection(struct cli_state *cli,
+ const 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 cli_connect_auth(struct cli_state *cli,
+ const char* desthost,
+ struct in_addr *dest_ip,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_servers_auth(struct cli_state *cli,
+ char *p,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
+int cli_printjob_del(struct cli_state *cli, int job);
+int cli_print_queue(struct cli_state *cli,
+ void (*fn)(struct print_job_info *));
+BOOL cli_chkpath(struct cli_state *cli, char *path);
+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);
+BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
+BOOL get_any_dc_name(const char *domain, char *srv_name);
+
+/*The following definitions come from libsmb/credentials.c */
+
+char *credstr(const uchar *cred);
+void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const 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(const 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,
+ const 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,
+ void (*fn)(struct packet_struct *));
+struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
+ struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
+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);
+
+/*The following definitions come from libsmb/nmblib.c */
+
+void debug_nmb_packet(struct packet_struct *p);
+char *nmb_namestr(struct nmb_name *n);
+void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
+struct packet_struct *copy_packet(struct packet_struct *packet);
+void free_packet(struct packet_struct *packet);
+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, const char *this_scope );
+BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
+BOOL send_packet(struct packet_struct *p);
+struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
+void sort_query_replies(char *data, int n, struct in_addr ip);
+BOOL read_nmb_sock(int c, struct nmb_state *con);
+int get_nmb_sock(void);
+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/pwd_cache.c */
+
+void pwd_init(struct pwd_info *pwd);
+BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
+void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
+BOOL pwd_compare(const struct pwd_info *_pwd1, const 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,
+ const uchar lm_pwd[16],
+ const uchar nt_pwd[16]);
+void pwd_get_lm_nt_16(const 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_owf2(struct pwd_info *pwd, const uchar srv_key[8],
+ const char *user, const char *server, const char *domain,
+ uchar sess_key[16]);
+void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
+ uchar sess_key[16]);
+void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
+ uchar *nt_owf, size_t *nt_owf_len);
+
+/*The following definitions come from libsmb/smbdes.c */
+
+void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
+void E_P16(uchar *p14,uchar *p16);
+void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
+void D_P16(const uchar *p14, const uchar *in, uchar *out);
+void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
+void cred_hash1(uchar *out, const uchar *in, const uchar *key);
+void cred_hash2(uchar *out,uchar *in,uchar *key);
+void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
+void SamOEMhash( uchar *data, const uchar *key, int val);
+void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
+
+/*The following definitions come from libsmb/smbencrypt.c */
+
+void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void E_md4hash(uchar * pwrd, uchar * p16);
+void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
+void lm_owf_gen(const char *pwd, uchar p16[16]);
+void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
+void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
+void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
+void SMBOWFencrypt_ntv2(const uchar kr[16],
+ const uchar * srv_chal, int srv_chal_len,
+ const uchar * cli_chal, int cli_chal_len,
+ char resp_buf[16]);
+void SMBsesskeygen_ntv2(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBsesskeygen_ntv1(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBgenclientchals(char *lm_cli_chal,
+ char *nt_cli_chal, int *nt_cli_chal_len,
+ const char *srv, const char *dom);
+void ntv2_owf_gen(const uchar owf[16],
+ const char *user_n, const char *domain_n, uchar kr_buf[16]);
+void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
+ uchar p24[24]);
+BOOL make_oem_passwd_hash(uchar data[516],
+ const char *pwrd, int new_pw_len,
+ const uchar old_pw_hash[16], BOOL unicode);
+BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+void create_ntlmssp_resp(struct pwd_info *pwd,
+ char *domain, char *user_name, char *my_name,
+ uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
+BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
+ int new_pwrd_size, uint32 * new_pw_len);
+BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
+ int new_pw_len, BOOL nt_pass_set);
+
+/*The following definitions come from libsmb/smberr.c */
+
+char *smb_err_msg(uint8 class, uint32 num);
+BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
+BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
+char *smb_errstr(char *inbuf);
+
/*The following definitions come from nsswitch/winbindd.c */
void exit_server(char *reason);
@@ -1978,7 +1978,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_stru
void prs_debug(prs_struct * ps, int depth, const char *desc,
const char *fn_name);
void prs_debug_out(const prs_struct * ps, char *msg, int level);
-void prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
+BOOL prs_init(prs_struct * ps, uint32 size, uint8 align, BOOL io);
void prs_set_packtype(prs_struct * ps, const uint8 * pack_type);
void prs_create(prs_struct * ps, char *data, uint32 size, uint8 align,
BOOL io);
@@ -1993,10 +1993,16 @@ BOOL prs_grow_data(prs_struct * buf, BOOL io, int new_size, BOOL force_grow);
uint32 prs_buf_len(const prs_struct * buf);
char *prs_data(const prs_struct * buf, uint32 offset);
void prs_link(prs_struct * prev, prs_struct * ps, prs_struct * next);
-void prs_align(prs_struct * ps);
+BOOL prs_align(prs_struct * ps);
BOOL prs_grow(prs_struct * ps, uint32 new_size);
BOOL prs_append_data(prs_struct * ps, const char *data, int len);
BOOL prs_add_data(prs_struct * ps, const char *data, int len);
+void prs_switch_type(prs_struct *ps, BOOL io);
+void prs_force_dynamic(prs_struct *ps);
+uint32 prs_offset(prs_struct *ps);
+BOOL prs_set_offset(prs_struct *ps, uint32 offset);
+void prs_mem_free(prs_struct *ps);
+BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len);
BOOL _prs_uint8(char *name, prs_struct * ps, int depth, uint8 * data8);
BOOL _prs_uint16(char *name, prs_struct * ps, int depth, uint16 * data16);
BOOL _prs_hash1(prs_struct * ps, uint32 offset, uint8 sess_key[16]);
diff --git a/source/lib/cmd_interp.c b/source/lib/cmd_interp.c
index 7084c29d451..fea7847c740 100644
--- a/source/lib/cmd_interp.c
+++ b/source/lib/cmd_interp.c
@@ -849,7 +849,6 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
BOOL net_use = False;
BOOL net_use_add = True;
BOOL force_close = False;
- struct ntuser_creds u;
fstring dest_host;
fstring srv_name;
BOOL null_pwd = False;
@@ -859,15 +858,15 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
if (usr_creds != NULL)
{
- copy_nt_creds(&u, &usr_creds->ntc);
+ copy_nt_creds(&usr.ntc, &usr_creds->ntc);
}
else
{
- copy_nt_creds(&u, NULL);
+ copy_nt_creds(&usr.ntc, NULL);
}
pstrcpy(dest_host, cli_info.dest_host);
- pstrcpy(u.user_name, optarg);
+ pstrcpy(usr.ntc.user_name, optarg);
info->reuse = False;
if (argc <= 1)
@@ -903,8 +902,8 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
case 'U':
{
char *lp;
- pstrcpy(u.user_name, optarg);
- if ((lp = strchr(u.user_name, '%')))
+ pstrcpy(usr.ntc.user_name, optarg);
+ if ((lp = strchr(usr.ntc.user_name, '%')))
{
*lp = 0;
pstrcpy(password, lp + 1);
@@ -912,7 +911,7 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
strlen(password));
got_pwd = True;
}
- if (u.user_name[0] == 0 && password[0] == 0)
+ if (usr.ntc.user_name[0] == 0 && password[0] == 0)
{
null_pwd = True;
}
@@ -925,7 +924,7 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
}
case 'W':
{
- pstrcpy(u.domain, optarg);
+ pstrcpy(usr.ntc.domain, optarg);
break;
}
@@ -999,22 +998,22 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
BOOL isnew;
if (null_pwd)
{
- set_user_password(&u, True, NULL);
+ set_user_password(&usr.ntc, True, NULL);
}
else
{
- set_user_password(&u, got_pwd, password);
+ set_user_password(&usr.ntc, got_pwd, password);
}
/* paranoia: destroy the local copy of the password */
bzero(password, sizeof(password));
report(out_hnd, "Server:\t%s:\tUser:\t%s\tDomain:\t%s\n",
- srv_name, u.user_name, u.domain);
+ srv_name, usr.ntc.user_name, usr.ntc.domain);
report(out_hnd, "Connection:\t");
if (cli_net_use_add
- (srv_name, &u, True, info->reuse, &isnew) != NULL)
+ (srv_name, &usr.ntc, True, info->reuse, &isnew) != NULL)
{
report(out_hnd, "OK\n");
}
@@ -1027,10 +1026,10 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
{
BOOL closed;
report(out_hnd, "Server:\t%s:\tUser:\t%s\tDomain:\t%s\n",
- srv_name, u.user_name, u.domain);
+ srv_name, usr.ntc.user_name, usr.ntc.domain);
report(out_hnd, "Connection:\t");
- if (!cli_net_use_del(srv_name, &u, force_close, &closed))
+ if (!cli_net_use_del(srv_name, &usr.ntc, force_close, &closed))
{
report(out_hnd, ": Does not exist\n");
}
@@ -1048,12 +1047,21 @@ static void cmd_use(struct client_info *info, int argc, char *argv[])
}
}
- usr_creds = NULL;
-
/* paranoia: destroy the local copy of the password */
bzero(password, sizeof(password));
}
+/******************************************************************
+ allow or disallow automatic connections. rpctorture, because it
+ does not reestablish connections after fork(), fails unless the
+ connection is established AFTER the fork()
+ ******************************************************************/
+static BOOL auto_connect = True;
+void cmd_set_no_autoconnect(void)
+{
+ auto_connect = False;
+}
+
#define CMD_STR 0x1
#define CMD_DBF 0x2
#define CMD_SVC 0x4
@@ -1337,16 +1345,16 @@ static void cmd_set(struct client_info *info, int argc, char *argv[])
fstrcat(srv_name, cli_info.dest_host);
strupper(srv_name);
- if (!strequal(srv_name, "\\\\."))
+ if (auto_connect && !strequal(srv_name, "\\\\."))
{
BOOL isnew;
cli_net_use_add(srv_name, &usr.ntc, True, False, &isnew);
+ usr_creds = NULL;
}
if (cmd_str != NULL)
{
process(&cli_info, cmd_str);
}
- usr_creds = NULL;
}
static void read_user_env(struct ntuser_creds *u)
diff --git a/source/lib/domain_namemap.c b/source/lib/domain_namemap.c
index 7d23c29a31a..6985b14c8da 100644
--- a/source/lib/domain_namemap.c
+++ b/source/lib/domain_namemap.c
@@ -716,7 +716,6 @@ static BOOL lookup_remote_ntname(const char *ntname, DOM_SID *sid, uint32 *type)
struct cli_state cli;
POLICY_HND lsa_pol;
fstring srv_name;
- extern struct user_creds *usr_creds;
BOOL res3 = True;
BOOL res4 = True;
@@ -725,8 +724,6 @@ static BOOL lookup_remote_ntname(const char *ntname, DOM_SID *sid, uint32 *type)
uint32 *types;
char *names[1];
- usr_creds = NULL;
-
DEBUG(5,("lookup_remote_ntname: %s\n", ntname));
if (!cli_connect_serverlist(&cli, lp_passwordserver()))
diff --git a/source/lib/set_uid.c b/source/lib/set_uid.c
index d2661fffc7f..87b56af687b 100644
--- a/source/lib/set_uid.c
+++ b/source/lib/set_uid.c
@@ -362,8 +362,8 @@ void unbecome_root(BOOL restore_dir)
if (become_root_depth > 0)
{
- DEBUG(10,("not yet non-root: unbecome root depth is %d\n",
- become_root_depth));
+ DEBUG(10,("not yet root: unbecome root depth is %d\n",
+ become_root_depth));
return;
}
/* we might have done a become_user() while running as root,
@@ -397,5 +397,4 @@ void unbecome_root(BOOL restore_dir)
dos_ChDir(become_root_dir);
current_user = current_user_saved;
-
}
diff --git a/source/libsmb/pwd_cache.c b/source/libsmb/pwd_cache.c
index 2c3352ea6c6..f35bb206348 100644
--- a/source/libsmb/pwd_cache.c
+++ b/source/libsmb/pwd_cache.c
@@ -84,6 +84,12 @@ BOOL pwd_compare(const struct pwd_info *_pwd1, const struct pwd_info *_pwd2)
pwd_deobfuscate(&pwd1);
pwd_deobfuscate(&pwd2);
+ if (pwd1.crypted || pwd2.crypted)
+ {
+ DEBUG(0,("pwd_compare: cannot compare crypted passwords\n"));
+ return True;
+ }
+
if (pwd1.cleartext && pwd2.cleartext)
{
if (strequal(pwd1.password, pwd2.password))
@@ -105,24 +111,14 @@ BOOL pwd_compare(const struct pwd_info *_pwd1, const struct pwd_info *_pwd2)
if (!pwd1.null_pwd && !pwd2.null_pwd &&
!pwd1.cleartext && !pwd2.cleartext)
{
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("pwd compare: nt#\n"));
- dump_data(100, pwd1.smb_nt_pwd, 16);
- dump_data(100, pwd2.smb_nt_pwd, 16);
-#endif
- if (memcmp(pwd1.smb_nt_pwd, pwd2.smb_nt_pwd, 16) == 0)
- {
- ZERO_STRUCT(pwd1);
- ZERO_STRUCT(pwd2);
+ dump_data_pw("pwd compare: nt#1\n", pwd1.smb_nt_pwd, 16);
+ dump_data_pw("pwd compare: nt#2\n", pwd2.smb_nt_pwd, 16);
- return True;
- }
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("pwd compare: lm#\n"));
- dump_data(100, pwd1.smb_lm_pwd, 16);
- dump_data(100, pwd2.smb_lm_pwd, 16);
-#endif
- if (memcmp(pwd1.smb_lm_pwd, pwd2.smb_lm_pwd, 16) == 0)
+ dump_data_pw("pwd compare: lm#1\n", pwd1.smb_lm_pwd, 16);
+ dump_data_pw("pwd compare: lm#2\n", pwd2.smb_lm_pwd, 16);
+
+ if (memcmp(pwd1.smb_nt_pwd, pwd2.smb_nt_pwd, 16) == 0 &&
+ memcmp(pwd1.smb_lm_pwd, pwd2.smb_lm_pwd, 16) == 0)
{
ZERO_STRUCT(pwd1);
ZERO_STRUCT(pwd2);
diff --git a/source/msrpc/msrpcd_process.c b/source/msrpc/msrpcd_process.c
index f8dda0b5281..daa12322297 100644
--- a/source/msrpc/msrpcd_process.c
+++ b/source/msrpc/msrpcd_process.c
@@ -2,7 +2,8 @@
Unix SMB/Netbios implementation.
Version 1.9.
process incoming packets - main loop
- Copyright (C) Andrew Tridgell 1992-1998
+ Copyright (C) Andrew Tridgell 1992-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996-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
@@ -383,7 +384,7 @@ BOOL msrpcd_init(int c, rpcsrv_struct ** l)
return False;
}
- ZERO_STRUCTP((*l));
+ ZERO_STRUCTP(*l);
(*l)->key = uk;
(*l)->c = c;
@@ -453,7 +454,7 @@ void msrpcd_process(msrpc_service_fns * fn, rpcsrv_struct * l,
{
time_t t;
- if (counter > 365 * 3600) /* big number of seconds. */
+ if (counter > 365 * 3600) /* big number of seconds. */
{
counter = 0;
service_load_counter = 0;
@@ -507,18 +508,6 @@ void msrpcd_process(msrpc_service_fns * fn, rpcsrv_struct * l,
* Use this as an excuse to print some stats.
*/
}
-
- /* automatic timeout if all connections are closed */
- if (counter >= IDLE_CLOSED_TIMEOUT)
- {
- DEBUG(2, ("Closing idle connection\n"));
- if (fn->idle != NULL)
- {
- fn->idle();
- }
- return;
- }
-
}
if (got_msrpc)
diff --git a/source/rpc_client/cli_connect.c b/source/rpc_client/cli_connect.c
index d9e72a52cc2..caf83cade2c 100644
--- a/source/rpc_client/cli_connect.c
+++ b/source/rpc_client/cli_connect.c
@@ -111,7 +111,7 @@ static struct cli_connection *cli_con_get(const char *srv_name,
memset(con, 0, sizeof(*con));
con->type = MSRPC_NONE;
- copy_user_creds(&con->usr_creds, usr_creds);
+ copy_user_creds(&con->usr_creds, NULL);
con->usr_creds.reuse = reuse;
if (srv_name != NULL)
@@ -147,10 +147,15 @@ static struct cli_connection *cli_con_get(const char *srv_name,
}
else
{
+ struct ntuser_creds *ntc = NULL;
+ if (usr_creds != NULL)
+ {
+ ntc = &usr_creds->ntc;
+ }
con->type = MSRPC_SMB;
con->msrpc.smb =
ncacn_np_use_add(pipe_name, user_key, srv_name,
- &con->usr_creds.ntc, True, reuse,
+ ntc, True, reuse,
&is_new_connection);
if (con->msrpc.smb != NULL)
{
@@ -158,6 +163,8 @@ static struct cli_connection *cli_con_get(const char *srv_name,
con->msrpc.smb->smb->nt.key.pid = 0;
con->msrpc.smb->smb->nt.key.vuid = UID_FIELD_INVALID;
}
+ copy_nt_creds(&con->usr_creds.ntc,
+ &con->msrpc.smb->smb->usr);
}
if (is_new_connection && con->msrpc.cli != NULL)
@@ -319,7 +326,6 @@ BOOL cli_connection_init_auth(const char *srv_name, const char *pipe_name,
struct cli_connection **con,
cli_auth_fns * auth, void *auth_creds)
{
- BOOL res = True;
BOOL reuse = False;
/*
@@ -331,12 +337,7 @@ BOOL cli_connection_init_auth(const char *srv_name, const char *pipe_name,
*con = cli_con_get(srv_name, pipe_name, auth, auth_creds, reuse);
- if ((*con) == NULL)
- {
- return False;
- }
-
- return res;
+ return (*con) != NULL;
}
/****************************************************************************
diff --git a/source/rpc_client/ncacn_np_use.c b/source/rpc_client/ncacn_np_use.c
index df0a6026fad..b3d7ad585a6 100644
--- a/source/rpc_client/ncacn_np_use.c
+++ b/source/rpc_client/ncacn_np_use.c
@@ -2,8 +2,8 @@
Unix SMB/Netbios implementation.
Version 1.9.
SMB client generic functions
- Copyright (C) Andrew Tridgell 1994-1999
- Copyright (C) Luke Kenneth Casson Leighton 1996-1999
+ Copyright (C) Andrew Tridgell 1994-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996-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
@@ -162,10 +162,6 @@ static struct ncacn_np_use *ncacn_np_find(const char *srv_name,
{
int i;
const char *sv_name = srv_name;
- struct ntuser_creds null_usr;
-
- copy_nt_creds(&null_usr, usr_creds);
- usr_creds = &null_usr;
if (strnequal("\\PIPE\\", pipe_name, 6))
{
@@ -177,8 +173,15 @@ static struct ncacn_np_use *ncacn_np_find(const char *srv_name,
sv_name = &sv_name[2];
}
- DEBUG(10, ("cli_find: %s %s %s",
- srv_name, usr_creds->user_name, usr_creds->domain));
+ if (usr_creds != NULL)
+ {
+ DEBUG(10, ("ncacn_np_find: %s %s %s",
+ srv_name, usr_creds->user_name, usr_creds->domain));
+ }
+ else
+ {
+ DEBUG(10,("ncacn_np_find: %s (no creds)\n", srv_name));
+ }
if (key != NULL)
{
@@ -228,12 +231,23 @@ static struct ncacn_np_use *ncacn_np_find(const char *srv_name,
{
continue;
}
- if (!strequal
- (usr_creds->user_name, c->cli->smb->usr.user_name))
+ if (key != NULL && (k.pid != key->pid || k.vuid != key->vuid))
{
continue;
}
- if (key != NULL && (k.pid != key->pid || k.vuid != key->vuid))
+ if (usr_creds == NULL)
+ {
+ if (reuse)
+ {
+ return c;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ if (!strequal
+ (usr_creds->user_name, c->cli->smb->usr.user_name))
{
continue;
}
diff --git a/source/rpcclient/cmd_netlogon.c b/source/rpcclient/cmd_netlogon.c
index 3a57bb034ed..9565c79df27 100644
--- a/source/rpcclient/cmd_netlogon.c
+++ b/source/rpcclient/cmd_netlogon.c
@@ -2,8 +2,8 @@
Unix SMB/Netbios implementation.
Version 1.9.
NT Domain Authentication SMB / MSRPC client
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1996-1997
+ Copyright (C) Andrew Tridgell 1994-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996-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
diff --git a/source/utils/rpctorture.c b/source/utils/rpctorture.c
index dd421bba80c..6980fb3d33a 100644
--- a/source/utils/rpctorture.c
+++ b/source/utils/rpctorture.c
@@ -548,5 +548,6 @@ struct command_set tor_commands[] =
int main(int argc, char *argv[])
{
add_command_set(tor_commands);
+ cmd_set_no_autoconnect();
return command_main(argc, argv);
}