Comments on breaking shares apart from server in cli_ routines

Richard Sharpe sharpe at ns.aus.com
Sat Jan 27 03:33:55 GMT 2001


These are all the routines in libsmb that take a cli_state struct. I will 
have to change many of them so they take a cli_share_struct.

However, some of them I do not know anything about, and am wondering if 
they need changing. See below.

These routines can be broken into three groups:

  - Those that must continue to receive a struct cli_state

  - Those that must change to receive a struct cli_share_struct

  - Those that I don't know about.

Below I allocate these routines to these three groups, and I would appreciate
advice on whether or not I am right and what to do about those I don't
understand.

DONT CHANGE

These routines don't changs because they are setting up connections or 
relate to a connection in some direct way.

clientgen.c:struct cli_state *cli_initialise(struct cli_state *cli)
cliconnect.c:BOOL cli_session_setup(struct cli_state *cli, 
cliconnect.c:BOOL cli_ulogoff(struct cli_state *cli)
cliconnect.c:cli_send_tconX(struct cli_state *cli

  Should return a struct cli_share_struct now.  It updates both the
  cli_state and the cli_share_struct with share info, like cnum. This 
  allows existing routines to continue to work under some circumstances.
 
clientgen.c:void cli_shutdown(struct cli_state *cli)
clientgen.c:void cli_sockopt(struct cli_state *cli, char *options)
clientgen.c:uint16 cli_setpid(struct cli_state *cli, uint16 pid)
clierror.c:static char *cli_smb_errstr(struct cli_state *cli)
clierror.c:char *cli_errstr(struct cli_state *cli)
clierror.c:int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num,
uint32 *nt_rpc_error)cliconnect.c:void cli_negprot_send(struct cli_state *cli)
cliconnect.c:BOOL cli_negprot(struct cli_state *cli)
cliconnect.c:BOOL cli_session_request(struct cli_state *cli,
cliconnect.c:BOOL cli_connect(struct cli_state *cli, const char *host,
struct in_addr *ip)
cliconnect.c:BOOL cli_reestablish_connection(struct cli_state *cli)
cliconnect.c:BOOL cli_establish_connection(struct cli_state *cli, 
cliconnect.c:BOOL attempt_netbios_session_request(struct cli_state *cli,
char *srchost, char *desthost,
clientgen.c:int cli_set_port(struct cli_state *cli, int port)
clientgen.c:BOOL cli_receive_smb(struct cli_state *cli)
clientgen.c:BOOL cli_send_smb(struct cli_state *cli)
clientgen.c:void cli_setup_packet(struct cli_state *cli)
clitrans.c:BOOL cli_send_trans(struct cli_state *cli, int trans, 
clitrans.c:BOOL cli_receive_trans(struct cli_state *cli,int trans,
clitrans.c:BOOL cli_send_nt_trans(struct cli_state *cli, 
clitrans.c:BOOL cli_receive_nt_trans(struct cli_state *cli,
clirap.c:BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char
*workstation)
clirap.c:int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char
*, uint32, const char *, void *), void *state)

CHANGE

cliconnect.c:BOOL cli_tdis(struct cli_state *cli)
clifile.c:BOOL cli_rename(struct cli_state *cli, char *fname_src, char
*fname_dst)
clifile.c:BOOL cli_unlink(struct cli_state *cli, char *fname)
clifile.c:BOOL cli_mkdir(struct cli_state *cli, char *dname)
clifile.c:BOOL cli_rmdir(struct cli_state *cli, char *dname)
clirap.c:BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, 
clirap.c:BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
clirap.c:BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
clireadwrite.c:static void cli_issue_read(struct cli_state *cli, int fnum,
off_t offset, 
clireadwrite.c:size_t cli_read(struct cli_state *cli, int fnum, char *buf,
off_t offset, size_t size)
clireadwrite.c:static void cli_issue_write(struct cli_state *cli, int fnum,
off_t offset, uint16 mode, char *buf,
clireadwrite.c:ssize_t cli_write(struct cli_state *cli,
clireadwrite.c:ssize_t cli_smbwrite(struct cli_state *cli,
clifile.c:int cli_open(struct cli_state *cli, char *fname, int flags, int
share_mode)
clifile.c:BOOL cli_close(struct cli_state *cli, int fnum)
clifile.c:BOOL cli_lock(struct cli_state *cli, int fnum, 
clifile.c:BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset,
uint32 len)
clifile.c:BOOL cli_lock64(struct cli_state *cli, int fnum, 
clifile.c:BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT
offset, SMB_BIG_UINT len)
clifile.c:BOOL cli_getattrE(struct cli_state *cli, int fd, 
clifile.c:BOOL cli_getatr(struct cli_state *cli, char *fname, 
clifile.c:BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr,
time_t t)
clifile.c:BOOL cli_chkpath(struct cli_state *cli, char *path)
clifile.c:BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total,
int *avail)
clilist.c:int cli_list(struct cli_state *cli,const char *Mask,uint16
attribute, 
clilist.c:int cli_list_old(struct cli_state *cli,const char *Mask,uint16
attribute, 
clirap.c:BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup,
uint32 stype,
clirap.c:BOOL cli_oem_change_password(struct cli_state *cli, const char
*user, const char *new_password,

DONT KNOW

These routines currently receive a struct cli_state, but they probably are 
acessing an IPC$ share or some other share ...

They could potentially stay this way for now, but if libsmbclient ever comes
to use these routines, they will have to be fixed. Also, if cli_send_tconX 
is ever changed so it no longer writes the cnum in the struct cli_state, they
will no longer work, I imagine.

clientgen.c:static void cli_process_oplock(struct cli_state *cli);
cli_samr.c:struct cli_state *cli_samr_initialise(struct cli_state *cli,
char *system_name,
cli_samr.c:void cli_samr_shutdown(struct cli_state *cli)
cli_samr.c:uint32 cli_samr_connect(struct cli_state *cli, char *srv_name,
cli_samr.c:uint32 cli_samr_close(struct cli_state *cli, POLICY_HND
*connect_pol)
cli_samr.c:uint32 cli_samr_open_domain(struct cli_state *cli, POLICY_HND
*connect_pol,
cli_samr.c:uint32 cli_samr_open_user(struct cli_state *cli, POLICY_HND
*domain_pol,
cli_samr.c:uint32 cli_samr_open_group(struct cli_state *cli, POLICY_HND
*domain_pol,
cli_samr.c:uint32 cli_samr_query_userinfo(struct cli_state *cli, POLICY_HND
*user_pol, 
cli_samr.c:uint32 cli_samr_query_groupinfo(struct cli_state *cli,
POLICY_HND *group_pol,
cli_samr.c:uint32 cli_samr_query_usergroups(struct cli_state *cli,
POLICY_HND *user_pol,
cli_samr.c:uint32 cli_samr_query_groupmem(struct cli_state *cli, POLICY_HND
*group_pol,
clisecdesc.c:SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
clisecdesc.c:BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd)
cli_spoolss.c:struct cli_state *cli_spoolss_initialise(struct cli_state *cli, 
cli_spoolss.c:void cli_spoolss_shutdown(struct cli_state *cli)
cli_spoolss.c:uint32 cli_spoolss_open_printer_ex(struct cli_state *cli,
char *printername,
cli_spoolss.c:uint32 cli_spoolss_closeprinter(struct cli_state *cli,
POLICY_HND *pol)
cli_spoolss.c:uint32 cli_spoolss_enum_printers(struct cli_state *cli,
uint32 flags,
cli_spoolss.c:uint32 cli_spoolss_enum_ports(struct cli_state *cli, uint32
level, 
cli_spoolss.c:uint32 cli_spoolss_getprinter(struct cli_state *cli,
POLICY_HND *pol,
clientgen.c:static void cli_process_oplock(struct cli_state *cli)
clientgen.c:void cli_init_creds(struct cli_state *cli, const struct
ntuser_creds *usr)
cli_lsarpc.c:void cli_lsa_shutdown(struct cli_state *cli)
cli_lsarpc.c:uint32 cli_lsa_open_policy(struct cli_state *cli, BOOL sec_qos, 
cli_lsarpc.c:uint32 cli_lsa_close(struct cli_state *cli, POLICY_HND *pol)
cli_lsarpc.c:uint32 cli_lsa_lookup_sids(struct cli_state *cli, POLICY_HND
*pol,
cli_lsarpc.c:uint32 cli_lsa_lookup_names(struct cli_state *cli, POLICY_HND
*pol,
cli_lsarpc.c:uint32 cli_lsa_query_info_policy(struct cli_state *cli,
POLICY_HND *pol, 
cli_lsarpc.c:uint32 cli_lsa_enum_trust_dom(struct cli_state *cli,
POLICY_HND *pol, 
climessage.c:BOOL cli_message_start(struct cli_state *cli, char *host, char
*username, 
climessage.c:BOOL cli_message_text(struct cli_state *cli, char *msg, int
len, int grp)
climessage.c:BOOL cli_message_end(struct cli_state *cli, int grp)
cliprint.c:int cli_print_queue(struct cli_state *cli, 
cliprint.c:int cli_printjob_del(struct cli_state *cli, int job)
clirap.c:BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int
pipe_name_len,
clirap.c:BOOL cli_api(struct cli_state *cli,
cli_lsarpc.c:struct cli_state *cli_lsa_initialise(struct cli_state *cli,
char *system_name,
clifile.c:int cli_nt_create(struct cli_state *cli, char *fname, uint32
DesiredAccess)
clifile.c:int cli_nt_create_uni(struct cli_state *cli, char *fname, uint32
DesiredAccess)


Regards
-------
Richard Sharpe, sharpe at ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba






More information about the samba-technical mailing list