mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc
)
This commit is contained in:
parent
bdbc959a9a
commit
732d4ff7da
@ -111,9 +111,15 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_misc.o \
|
||||
rpc_parse/parse_samr.o rpc_parse/parse_srv.o \
|
||||
rpc_parse/parse_wks.o
|
||||
|
||||
RPC_CLIENT_OBJ = rpc_client/cli_login.o rpc_client/cli_netlogon.o \
|
||||
rpc_client/cli_pipe.o rpc_client/cli_lsarpc.o \
|
||||
rpc_client/cli_wkssvc.o rpc_client/cli_samr.o
|
||||
RPC_CLIENT_OBJ = \
|
||||
rpc_client/cli_login.o \
|
||||
rpc_client/cli_netlogon.o \
|
||||
rpc_client/cli_pipe.o \
|
||||
rpc_client/cli_lsarpc.o \
|
||||
rpc_client/cli_wkssvc.o \
|
||||
rpc_client/cli_srvsvc.o \
|
||||
rpc_client/cli_samr.o
|
||||
|
||||
|
||||
LOCKING_OBJ = locking/locking.o locking/locking_shm.o locking/locking_slow.o \
|
||||
locking/shmem.o locking/shmem_sysv.o
|
||||
|
@ -403,7 +403,7 @@ BOOL cli_session_request(struct cli_state *cli,
|
||||
BOOL cli_connect(struct cli_state *cli, char *host, struct in_addr *ip);
|
||||
BOOL cli_initialise(struct cli_state *cli);
|
||||
void cli_shutdown(struct cli_state *cli);
|
||||
void cli_error(struct cli_state *cli, int *eclass, int *num);
|
||||
BOOL 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);
|
||||
@ -1275,6 +1275,31 @@ BOOL do_samr_query_userinfo(struct cli_state *cli,
|
||||
POLICY_HND *pol, uint16 switch_value, void* usr);
|
||||
BOOL do_samr_close(struct cli_state *cli, POLICY_HND *hnd);
|
||||
|
||||
/*The following definitions come from rpc_client/cli_srvsvc.c */
|
||||
|
||||
BOOL do_srv_net_srv_conn_enum(struct cli_state *cli,
|
||||
char *server_name, char *qual_name,
|
||||
uint32 switch_value, SRV_CONN_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
BOOL do_srv_net_srv_sess_enum(struct cli_state *cli,
|
||||
char *server_name, char *qual_name,
|
||||
uint32 switch_value, SRV_SESS_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
BOOL do_srv_net_srv_share_enum(struct cli_state *cli,
|
||||
char *server_name,
|
||||
uint32 switch_value, SRV_SHARE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
BOOL do_srv_net_srv_file_enum(struct cli_state *cli,
|
||||
char *server_name, char *qual_name,
|
||||
uint32 switch_value, SRV_FILE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
BOOL do_srv_net_srv_get_info(struct cli_state *cli,
|
||||
char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr);
|
||||
|
||||
/*The following definitions come from rpc_client/cli_wkssvc.c */
|
||||
|
||||
BOOL do_wks_query_info(struct cli_state *cli,
|
||||
@ -1668,6 +1693,11 @@ void make_srv_share_info2(SH_INFO_2 *sh2,
|
||||
char *net_name, uint32 type, char *remark,
|
||||
uint32 perms, uint32 max_uses, uint32 num_uses,
|
||||
char *path, char *passwd);
|
||||
void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
|
||||
char *srv_name,
|
||||
uint32 share_level, SRV_SHARE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
void srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth);
|
||||
void srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth);
|
||||
void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name);
|
||||
@ -1677,6 +1707,11 @@ void make_srv_sess_info1(SESS_INFO_1 *ss1,
|
||||
char *name, char *user,
|
||||
uint32 num_opens, uint32 open_time, uint32 idle_time,
|
||||
uint32 user_flags);
|
||||
void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
|
||||
char *srv_name, char *qual_name,
|
||||
uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth);
|
||||
void srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth);
|
||||
void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id);
|
||||
@ -1685,12 +1720,22 @@ void make_srv_conn_info1(CONN_INFO_1 *ss1,
|
||||
uint32 id, uint32 type,
|
||||
uint32 num_opens, uint32 num_users, uint32 open_time,
|
||||
char *usr_name, char *net_name);
|
||||
void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
|
||||
char *srv_name, char *qual_name,
|
||||
uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
void srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth);
|
||||
void srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth);
|
||||
void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name);
|
||||
void make_srv_file_info3(FILE_INFO_3 *fl3,
|
||||
uint32 id, uint32 perms, uint32 num_locks,
|
||||
char *path_name, char *user_name);
|
||||
void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
|
||||
char *srv_name, char *qual_name,
|
||||
uint32 file_level, SRV_FILE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd);
|
||||
void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth);
|
||||
void srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth);
|
||||
void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name,
|
||||
@ -1701,6 +1746,8 @@ void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name,
|
||||
uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
|
||||
uint32 announce, uint32 ann_delta, uint32 licenses,
|
||||
char *usr_path);
|
||||
void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
|
||||
char *server_name, uint32 switch_value);
|
||||
void srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth);
|
||||
void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
|
||||
uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status);
|
||||
|
@ -63,51 +63,61 @@ static char *cli_smb_errstr(struct cli_state *cli)
|
||||
|
||||
char *cli_errstr(struct cli_state *cli)
|
||||
{
|
||||
static fstring error_message;
|
||||
int errclass;
|
||||
int errnum;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Errors are of three kinds - smb errors,
|
||||
* dealt with by cli_smb_errstr, NT errors,
|
||||
* whose code is in cli.nt_error, and rap
|
||||
* errors, whose error code is in cli.rap_error.
|
||||
*/
|
||||
static fstring error_message;
|
||||
uint8 errclass;
|
||||
uint32 errnum;
|
||||
int i;
|
||||
|
||||
cli_error(cli, &errclass, &errnum);
|
||||
if(errclass != 0)
|
||||
return cli_smb_errstr(cli);
|
||||
/*
|
||||
* Errors are of three kinds - smb errors,
|
||||
* dealt with by cli_smb_errstr, NT errors,
|
||||
* whose code is in cli.nt_error, and rap
|
||||
* errors, whose error code is in cli.rap_error.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Was it an NT error ?
|
||||
*/
|
||||
cli_error(cli, &errclass, &errnum);
|
||||
|
||||
if(cli->nt_error) {
|
||||
char *nt_msg = get_nt_error_msg(cli->nt_error);
|
||||
if (errclass != 0)
|
||||
{
|
||||
return cli_smb_errstr(cli);
|
||||
}
|
||||
|
||||
if(nt_msg == NULL)
|
||||
slprintf(error_message, sizeof(fstring) - 1, "NT code %d", cli->nt_error);
|
||||
else
|
||||
fstrcpy(error_message, nt_msg);
|
||||
/*
|
||||
* Was it an NT error ?
|
||||
*/
|
||||
|
||||
return error_message;
|
||||
}
|
||||
if (cli->nt_error)
|
||||
{
|
||||
char *nt_msg = get_nt_error_msg(cli->nt_error);
|
||||
|
||||
/*
|
||||
* Must have been a rap error.
|
||||
*/
|
||||
if (nt_msg == NULL)
|
||||
{
|
||||
slprintf(error_message, sizeof(fstring) - 1, "NT code %d", cli->nt_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
fstrcpy(error_message, nt_msg);
|
||||
}
|
||||
|
||||
slprintf(error_message, sizeof(error_message) - 1, "code %d", cli->rap_error);
|
||||
|
||||
for(i = 0; rap_errmap[i].message != NULL; i++) {
|
||||
if (rap_errmap[i].err == cli->rap_error) {
|
||||
fstrcpy( error_message, rap_errmap[i].message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return error_message;
|
||||
return error_message;
|
||||
}
|
||||
|
||||
/*
|
||||
* Must have been a rap error.
|
||||
*/
|
||||
|
||||
slprintf(error_message, sizeof(error_message) - 1, "code %d", cli->rap_error);
|
||||
|
||||
for (i = 0; rap_errmap[i].message != NULL; i++)
|
||||
{
|
||||
if (rap_errmap[i].err == cli->rap_error)
|
||||
{
|
||||
fstrcpy( error_message, rap_errmap[i].message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return error_message;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -262,8 +272,11 @@ static BOOL cli_receive_trans(struct cli_state *cli,int trans,
|
||||
CVAL(cli->inbuf,smb_com)));
|
||||
return(False);
|
||||
}
|
||||
if (CVAL(cli->inbuf,smb_rcls) != 0)
|
||||
|
||||
if (cli_error(cli, NULL, NULL))
|
||||
{
|
||||
return(False);
|
||||
}
|
||||
|
||||
/* parse out the lengths */
|
||||
total_data = SVAL(cli->inbuf,smb_tdrcnt);
|
||||
@ -313,8 +326,10 @@ static BOOL cli_receive_trans(struct cli_state *cli,int trans,
|
||||
CVAL(cli->inbuf,smb_com)));
|
||||
return(False);
|
||||
}
|
||||
if (CVAL(cli->inbuf,smb_rcls) != 0)
|
||||
if (cli_error(cli, NULL, NULL))
|
||||
{
|
||||
return(False);
|
||||
}
|
||||
}
|
||||
|
||||
return(True);
|
||||
@ -330,7 +345,7 @@ BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
|
||||
char **rparam, uint32 *rparam_count,
|
||||
char **rdata, uint32 *rdata_count)
|
||||
{
|
||||
if(pipe_name_len == 0)
|
||||
if (pipe_name_len == 0)
|
||||
pipe_name_len = strlen(pipe_name);
|
||||
|
||||
cli_send_trans(cli, SMBtrans,
|
||||
@ -602,7 +617,7 @@ BOOL cli_session_setup(struct cli_state *cli,
|
||||
return False;
|
||||
}
|
||||
|
||||
if(((passlen == 0) || (passlen == 1)) && (pass[0] == '\0')) {
|
||||
if (((passlen == 0) || (passlen == 1)) && (pass[0] == '\0')) {
|
||||
/* Null session connect. */
|
||||
pword[0] = '\0';
|
||||
} else {
|
||||
@ -620,7 +635,8 @@ BOOL cli_session_setup(struct cli_state *cli,
|
||||
/* send a session setup command */
|
||||
bzero(cli->outbuf,smb_size);
|
||||
|
||||
if (cli->protocol < PROTOCOL_NT1) {
|
||||
if (cli->protocol < PROTOCOL_NT1)
|
||||
{
|
||||
set_message(cli->outbuf,10,1 + strlen(user) + passlen,True);
|
||||
CVAL(cli->outbuf,smb_com) = SMBsesssetupX;
|
||||
cli_setup_packet(cli);
|
||||
@ -636,7 +652,9 @@ BOOL cli_session_setup(struct cli_state *cli,
|
||||
p += passlen;
|
||||
pstrcpy(p,user);
|
||||
strupper(p);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_message(cli->outbuf,13,0,True);
|
||||
CVAL(cli->outbuf,smb_com) = SMBsesssetupX;
|
||||
cli_setup_packet(cli);
|
||||
@ -648,11 +666,15 @@ BOOL cli_session_setup(struct cli_state *cli,
|
||||
SIVAL(cli->outbuf,smb_vwv5,cli->sesskey);
|
||||
SSVAL(cli->outbuf,smb_vwv7,passlen);
|
||||
SSVAL(cli->outbuf,smb_vwv8,ntpasslen);
|
||||
SSVAL(cli->outbuf,smb_vwv11,CAP_STATUS32);
|
||||
p = smb_buf(cli->outbuf);
|
||||
memcpy(p,pword,passlen);
|
||||
p += SVAL(cli->outbuf,smb_vwv7);
|
||||
memcpy(p,ntpass,ntpasslen);
|
||||
p += SVAL(cli->outbuf,smb_vwv8);
|
||||
if (ntpasslen != 0)
|
||||
{
|
||||
memcpy(p,ntpass,ntpasslen);
|
||||
p += SVAL(cli->outbuf,smb_vwv8);
|
||||
}
|
||||
pstrcpy(p,user);
|
||||
strupper(p);
|
||||
p = skip_string(p,1);
|
||||
@ -1718,12 +1740,12 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
|
||||
char *rdata = NULL;
|
||||
int rprcnt, rdrcnt;
|
||||
|
||||
if(strlen(user) >= sizeof(fstring)-1) {
|
||||
if (strlen(user) >= sizeof(fstring)-1) {
|
||||
DEBUG(0,("cli_oem_change_password: user name %s is too long.\n", user));
|
||||
return False;
|
||||
}
|
||||
|
||||
if(new_pw_len > 512) {
|
||||
if (new_pw_len > 512) {
|
||||
DEBUG(0,("cli_oem_change_password: new password for user %s is too long.\n", user));
|
||||
return False;
|
||||
}
|
||||
@ -1775,7 +1797,7 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
|
||||
|
||||
data_len = 532;
|
||||
|
||||
if(cli_send_trans(cli,SMBtrans,
|
||||
if (cli_send_trans(cli,SMBtrans,
|
||||
PIPE_LANMAN,strlen(PIPE_LANMAN), /* name, length */
|
||||
0,0, /* fid, flags */
|
||||
NULL,0,0, /* setup, length, max */
|
||||
@ -1787,10 +1809,10 @@ BOOL cli_oem_change_password(struct cli_state *cli, char *user, char *new_passwo
|
||||
return False;
|
||||
}
|
||||
|
||||
if(cli_receive_trans(cli,SMBtrans,
|
||||
if (cli_receive_trans(cli,SMBtrans,
|
||||
&rparam, &rprcnt,
|
||||
&rdata, &rdrcnt)) {
|
||||
if(rparam)
|
||||
if (rparam)
|
||||
cli->rap_error = SVAL(rparam,0);
|
||||
}
|
||||
|
||||
@ -1919,9 +1941,9 @@ retry:
|
||||
return False;
|
||||
|
||||
#ifdef WITH_SSL
|
||||
if(CVAL(cli->inbuf,0) == 0x83 && CVAL(cli->inbuf,4) == 0x8e){ /* use ssl */
|
||||
if(!sslutil_fd_is_ssl(cli->fd)){
|
||||
if(sslutil_connect(cli->fd) == 0)
|
||||
if (CVAL(cli->inbuf,0) == 0x83 && CVAL(cli->inbuf,4) == 0x8e){ /* use ssl */
|
||||
if (!sslutil_fd_is_ssl(cli->fd)){
|
||||
if (sslutil_connect(cli->fd) == 0)
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
@ -1947,7 +1969,7 @@ BOOL cli_connect(struct cli_state *cli, char *host, struct in_addr *ip)
|
||||
fstrcpy(cli->desthost, host);
|
||||
|
||||
if (!ip || ip_equal(*ip, ipzero)) {
|
||||
if(!resolve_name( cli->desthost, &dest_ip)) {
|
||||
if (!resolve_name( cli->desthost, &dest_ip)) {
|
||||
return False;
|
||||
}
|
||||
} else {
|
||||
@ -2007,13 +2029,37 @@ void cli_shutdown(struct cli_state *cli)
|
||||
memset(cli, 0, sizeof(*cli));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
return error codes for the last packet
|
||||
****************************************************************************/
|
||||
void cli_error(struct cli_state *cli, int *eclass, int *num)
|
||||
BOOL cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num)
|
||||
{
|
||||
*eclass = CVAL(cli->inbuf,smb_rcls);
|
||||
*num = SVAL(cli->inbuf,smb_err);
|
||||
int flgs2 = SVAL(cli->inbuf,smb_flg2);
|
||||
|
||||
if (eclass) *eclass = 0;
|
||||
if (num ) *num = 0;
|
||||
|
||||
if (flgs2 & FLAGS2_32_BIT_ERROR_CODES)
|
||||
{
|
||||
/* 32 bit error codes detected */
|
||||
uint32 nt_err = IVAL(cli->inbuf,smb_rcls);
|
||||
if (num) *num = nt_err;
|
||||
DEBUG(10,("cli_error: 32 bit codes: code=%08x\n", nt_err));
|
||||
return (IS_BITS_SET_ALL(nt_err, 0xc0000000));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* dos 16 bit error codes detected */
|
||||
char rcls = CVAL(cli->inbuf,smb_rcls);
|
||||
if (rcls != 0)
|
||||
{
|
||||
if (eclass) *eclass = rcls;
|
||||
if (num ) *num = SVAL(cli->inbuf,smb_err);
|
||||
return True;
|
||||
}
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ extern int DEBUGLEVEL;
|
||||
/****************************************************************************
|
||||
do a server net conn enum
|
||||
****************************************************************************/
|
||||
BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
BOOL do_srv_net_srv_conn_enum(struct cli_state *cli,
|
||||
char *server_name, char *qual_name,
|
||||
uint32 switch_value, SRV_CONN_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
@ -70,7 +70,7 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
srv_io_q_net_conn_enum("", &q_o, &data, 0);
|
||||
|
||||
/* send the data on \PIPE\ */
|
||||
if (rpc_api_pipe_req(cli, t_idx, fnum, SRV_NETCONNENUM, &data, &rdata))
|
||||
if (rpc_api_pipe_req(cli, SRV_NETCONNENUM, &data, &rdata))
|
||||
{
|
||||
SRV_R_NET_CONN_ENUM r_o;
|
||||
BOOL p;
|
||||
@ -111,7 +111,7 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
/****************************************************************************
|
||||
do a server net sess enum
|
||||
****************************************************************************/
|
||||
BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
BOOL do_srv_net_srv_sess_enum(struct cli_state *cli,
|
||||
char *server_name, char *qual_name,
|
||||
uint32 switch_value, SRV_SESS_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
@ -147,7 +147,7 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
srv_io_q_net_sess_enum("", &q_o, &data, 0);
|
||||
|
||||
/* send the data on \PIPE\ */
|
||||
if (rpc_api_pipe_req(cli, t_idx, fnum, SRV_NETSESSENUM, &data, &rdata))
|
||||
if (rpc_api_pipe_req(cli, SRV_NETSESSENUM, &data, &rdata))
|
||||
{
|
||||
SRV_R_NET_SESS_ENUM r_o;
|
||||
BOOL p;
|
||||
@ -188,7 +188,7 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
/****************************************************************************
|
||||
do a server net share enum
|
||||
****************************************************************************/
|
||||
BOOL do_srv_net_srv_share_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
BOOL do_srv_net_srv_share_enum(struct cli_state *cli,
|
||||
char *server_name,
|
||||
uint32 switch_value, SRV_SHARE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
@ -226,7 +226,7 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
srv_io_q_net_share_enum("", &q_o, &data, 0);
|
||||
|
||||
/* send the data on \PIPE\ */
|
||||
if (rpc_api_pipe_req(cli, t_idx, fnum, SRV_NETSHAREENUM, &data, &rdata))
|
||||
if (rpc_api_pipe_req(cli, SRV_NETSHAREENUM, &data, &rdata))
|
||||
{
|
||||
SRV_R_NET_SHARE_ENUM r_o;
|
||||
BOOL p;
|
||||
@ -267,7 +267,7 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
/****************************************************************************
|
||||
do a server net file enum
|
||||
****************************************************************************/
|
||||
BOOL do_srv_net_srv_file_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
BOOL do_srv_net_srv_file_enum(struct cli_state *cli,
|
||||
char *server_name, char *qual_name,
|
||||
uint32 switch_value, SRV_FILE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
@ -305,7 +305,7 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
srv_io_q_net_file_enum("", &q_o, &data, 0);
|
||||
|
||||
/* send the data on \PIPE\ */
|
||||
if (rpc_api_pipe_req(cli, t_idx, fnum, SRV_NETFILEENUM, &data, &rdata))
|
||||
if (rpc_api_pipe_req(cli, SRV_NETFILEENUM, &data, &rdata))
|
||||
{
|
||||
SRV_R_NET_FILE_ENUM r_o;
|
||||
BOOL p;
|
||||
@ -346,7 +346,7 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
/****************************************************************************
|
||||
do a server get info
|
||||
****************************************************************************/
|
||||
BOOL do_srv_net_srv_get_info(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
BOOL do_srv_net_srv_get_info(struct cli_state *cli,
|
||||
char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr)
|
||||
{
|
||||
prs_struct data;
|
||||
@ -370,7 +370,7 @@ BOOL do_srv_net_srv_get_info(struct cli_state *cli, int t_idx, uint16 fnum,
|
||||
srv_io_q_net_srv_get_info("", &q_o, &data, 0);
|
||||
|
||||
/* send the data on \PIPE\ */
|
||||
if (rpc_api_pipe_req(cli, t_idx, fnum, SRV_NET_SRV_GET_INFO, &data, &rdata))
|
||||
if (rpc_api_pipe_req(cli, SRV_NET_SRV_GET_INFO, &data, &rdata))
|
||||
{
|
||||
SRV_R_NET_SRV_GET_INFO r_o;
|
||||
BOOL p;
|
||||
|
@ -41,7 +41,7 @@ BOOL do_wks_query_info(struct cli_state *cli,
|
||||
prs_struct rbuf;
|
||||
prs_struct buf;
|
||||
WKS_Q_QUERY_INFO q_o;
|
||||
BOOL valid_info = False;
|
||||
BOOL valid_info = False;
|
||||
|
||||
if (server_name == 0 || wks100 == NULL) return False;
|
||||
|
||||
|
@ -295,6 +295,29 @@ static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n,
|
||||
char *srv_name,
|
||||
uint32 share_level, SRV_SHARE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd)
|
||||
{
|
||||
if (q_n == NULL || ctr == NULL || hnd == NULL) return;
|
||||
|
||||
q_n->ctr = ctr;
|
||||
|
||||
DEBUG(5,("make_q_net_share_enum\n"));
|
||||
|
||||
make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
|
||||
|
||||
q_n->share_level = share_level;
|
||||
q_n->preferred_len = preferred_len;
|
||||
|
||||
memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
@ -600,6 +623,30 @@ static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n,
|
||||
char *srv_name, char *qual_name,
|
||||
uint32 sess_level, SRV_SESS_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd)
|
||||
{
|
||||
if (q_n == NULL || ctr == NULL || hnd == NULL) return;
|
||||
|
||||
q_n->ctr = ctr;
|
||||
|
||||
DEBUG(5,("make_q_net_sess_enum\n"));
|
||||
|
||||
make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
|
||||
make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
|
||||
|
||||
q_n->sess_level = sess_level;
|
||||
q_n->preferred_len = preferred_len;
|
||||
|
||||
memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
@ -875,6 +922,30 @@ static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n,
|
||||
char *srv_name, char *qual_name,
|
||||
uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd)
|
||||
{
|
||||
if (q_n == NULL || ctr == NULL || hnd == NULL) return;
|
||||
|
||||
q_n->ctr = ctr;
|
||||
|
||||
DEBUG(5,("make_q_net_conn_enum\n"));
|
||||
|
||||
make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name );
|
||||
make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
|
||||
|
||||
q_n->conn_level = conn_level;
|
||||
q_n->preferred_len = preferred_len;
|
||||
|
||||
memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
@ -1075,6 +1146,30 @@ static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n,
|
||||
char *srv_name, char *qual_name,
|
||||
uint32 file_level, SRV_FILE_INFO_CTR *ctr,
|
||||
uint32 preferred_len,
|
||||
ENUM_HND *hnd)
|
||||
{
|
||||
if (q_n == NULL || ctr == NULL || hnd == NULL) return;
|
||||
|
||||
q_n->ctr = ctr;
|
||||
|
||||
DEBUG(5,("make_q_net_file_enum\n"));
|
||||
|
||||
make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name);
|
||||
make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name);
|
||||
|
||||
q_n->file_level = file_level;
|
||||
q_n->preferred_len = preferred_len;
|
||||
|
||||
memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
@ -1285,6 +1380,20 @@ static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
makes a SRV_Q_NET_SRV_GET_INFO structure.
|
||||
********************************************************************/
|
||||
void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
|
||||
char *server_name, uint32 switch_value)
|
||||
{
|
||||
if (srv == NULL) return;
|
||||
|
||||
DEBUG(5,("make_srv_q_net_srv_get_info\n"));
|
||||
|
||||
make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name);
|
||||
|
||||
srv->switch_value = switch_value;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
|
@ -34,7 +34,6 @@ extern int DEBUGLEVEL;
|
||||
#define DEBUG_TESTING
|
||||
|
||||
extern struct cli_state *smb_cli;
|
||||
extern int smb_tidx;
|
||||
|
||||
extern FILE* out_hnd;
|
||||
|
||||
@ -53,11 +52,11 @@ void cmd_srv_query_info(struct client_info *info)
|
||||
|
||||
bzero(&ctr, sizeof(ctr));
|
||||
|
||||
strcpy(dest_srv, "\\\\");
|
||||
strcat(dest_srv, info->dest_host);
|
||||
fstrcpy(dest_srv, "\\\\");
|
||||
fstrcat(dest_srv, info->dest_host);
|
||||
strupper(dest_srv);
|
||||
|
||||
if (next_token(NULL, tmp, NULL))
|
||||
if (next_token(NULL, tmp, NULL, sizeof(tmp)-1))
|
||||
{
|
||||
info_level = strtoul(tmp, (char**)NULL, 10);
|
||||
}
|
||||
@ -68,14 +67,14 @@ void cmd_srv_query_info(struct client_info *info)
|
||||
DEBUG(5, ("cmd_srv_query_info: smb_cli->fd:%d\n", smb_cli->fd));
|
||||
|
||||
/* open LSARPC session. */
|
||||
res = res ? do_session_open(smb_cli, smb_tidx, PIPE_SRVSVC, &(info->dom.srvsvc_fnum)) : False;
|
||||
res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, False) : False;
|
||||
|
||||
/* send info level: receive requested info. hopefully. */
|
||||
res = res ? do_srv_net_srv_get_info(smb_cli, smb_tidx, info->dom.srvsvc_fnum,
|
||||
res = res ? do_srv_net_srv_get_info(smb_cli,
|
||||
dest_srv, info_level, &ctr) : False;
|
||||
|
||||
/* close the session */
|
||||
do_session_close(smb_cli, smb_tidx, info->dom.srvsvc_fnum);
|
||||
cli_nt_session_close(smb_cli);
|
||||
|
||||
if (res)
|
||||
{
|
||||
@ -107,15 +106,15 @@ void cmd_srv_enum_conn(struct client_info *info)
|
||||
|
||||
bzero(&ctr, sizeof(ctr));
|
||||
|
||||
strcpy(qual_srv, "\\\\");
|
||||
strcat(qual_srv, info->myhostname);
|
||||
fstrcpy(qual_srv, "\\\\");
|
||||
fstrcat(qual_srv, info->myhostname);
|
||||
strupper(qual_srv);
|
||||
|
||||
strcpy(dest_srv, "\\\\");
|
||||
strcat(dest_srv, info->dest_host);
|
||||
fstrcpy(dest_srv, "\\\\");
|
||||
fstrcat(dest_srv, info->dest_host);
|
||||
strupper(dest_srv);
|
||||
|
||||
if (next_token(NULL, tmp, NULL))
|
||||
if (next_token(NULL, tmp, NULL, sizeof(tmp)-1))
|
||||
{
|
||||
info_level = strtoul(tmp, (char**)NULL, 10);
|
||||
}
|
||||
@ -126,13 +125,13 @@ void cmd_srv_enum_conn(struct client_info *info)
|
||||
DEBUG(5, ("cmd_srv_enum_conn: smb_cli->fd:%d\n", smb_cli->fd));
|
||||
|
||||
/* open srvsvc session. */
|
||||
res = res ? do_session_open(smb_cli, smb_tidx, PIPE_SRVSVC, &(info->dom.srvsvc_fnum)) : False;
|
||||
res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, False) : False;
|
||||
|
||||
hnd.ptr_hnd = 1;
|
||||
hnd.handle = 0;
|
||||
|
||||
/* enumerate connections on server */
|
||||
res = res ? do_srv_net_srv_conn_enum(smb_cli, smb_tidx, info->dom.srvsvc_fnum,
|
||||
res = res ? do_srv_net_srv_conn_enum(smb_cli,
|
||||
dest_srv, qual_srv,
|
||||
info_level, &ctr, 0xffffffff, &hnd) : False;
|
||||
|
||||
@ -144,7 +143,7 @@ void cmd_srv_enum_conn(struct client_info *info)
|
||||
}
|
||||
|
||||
/* close the session */
|
||||
do_session_close(smb_cli, smb_tidx, info->dom.srvsvc_fnum);
|
||||
cli_nt_session_close(smb_cli);
|
||||
|
||||
if (res)
|
||||
{
|
||||
@ -171,11 +170,11 @@ void cmd_srv_enum_shares(struct client_info *info)
|
||||
|
||||
bzero(&ctr, sizeof(ctr));
|
||||
|
||||
strcpy(dest_srv, "\\\\");
|
||||
strcat(dest_srv, info->dest_host);
|
||||
fstrcpy(dest_srv, "\\\\");
|
||||
fstrcat(dest_srv, info->dest_host);
|
||||
strupper(dest_srv);
|
||||
|
||||
if (next_token(NULL, tmp, NULL))
|
||||
if (next_token(NULL, tmp, NULL, sizeof(tmp)-1))
|
||||
{
|
||||
info_level = strtoul(tmp, (char**)NULL, 10);
|
||||
}
|
||||
@ -186,13 +185,13 @@ void cmd_srv_enum_shares(struct client_info *info)
|
||||
DEBUG(5, ("cmd_srv_enum_shares: smb_cli->fd:%d\n", smb_cli->fd));
|
||||
|
||||
/* open srvsvc session. */
|
||||
res = res ? do_session_open(smb_cli, smb_tidx, PIPE_SRVSVC, &(info->dom.srvsvc_fnum)) : False;
|
||||
res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, False) : False;
|
||||
|
||||
hnd.ptr_hnd = 0;
|
||||
hnd.handle = 0;
|
||||
|
||||
/* enumerate shares_files on server */
|
||||
res = res ? do_srv_net_srv_share_enum(smb_cli, smb_tidx, info->dom.srvsvc_fnum,
|
||||
res = res ? do_srv_net_srv_share_enum(smb_cli,
|
||||
dest_srv,
|
||||
info_level, &ctr, 0xffffffff, &hnd) : False;
|
||||
|
||||
@ -204,7 +203,7 @@ void cmd_srv_enum_shares(struct client_info *info)
|
||||
}
|
||||
|
||||
/* close the session */
|
||||
do_session_close(smb_cli, smb_tidx, info->dom.srvsvc_fnum);
|
||||
cli_nt_session_close(smb_cli);
|
||||
|
||||
if (res)
|
||||
{
|
||||
@ -231,11 +230,11 @@ void cmd_srv_enum_sess(struct client_info *info)
|
||||
|
||||
bzero(&ctr, sizeof(ctr));
|
||||
|
||||
strcpy(dest_srv, "\\\\");
|
||||
strcat(dest_srv, info->dest_host);
|
||||
fstrcpy(dest_srv, "\\\\");
|
||||
fstrcat(dest_srv, info->dest_host);
|
||||
strupper(dest_srv);
|
||||
|
||||
if (next_token(NULL, tmp, NULL))
|
||||
if (next_token(NULL, tmp, NULL, sizeof(tmp)-1))
|
||||
{
|
||||
info_level = strtoul(tmp, (char**)NULL, 10);
|
||||
}
|
||||
@ -246,17 +245,17 @@ void cmd_srv_enum_sess(struct client_info *info)
|
||||
DEBUG(5, ("cmd_srv_enum_sess: smb_cli->fd:%d\n", smb_cli->fd));
|
||||
|
||||
/* open srvsvc session. */
|
||||
res = res ? do_session_open(smb_cli, smb_tidx, PIPE_SRVSVC, &(info->dom.srvsvc_fnum)) : False;
|
||||
res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, False) : False;
|
||||
|
||||
hnd.ptr_hnd = 1;
|
||||
hnd.handle = 0;
|
||||
|
||||
/* enumerate sessions on server */
|
||||
res = res ? do_srv_net_srv_sess_enum(smb_cli, smb_tidx, info->dom.srvsvc_fnum,
|
||||
res = res ? do_srv_net_srv_sess_enum(smb_cli,
|
||||
dest_srv, NULL, info_level, &ctr, 0x1000, &hnd) : False;
|
||||
|
||||
/* close the session */
|
||||
do_session_close(smb_cli, smb_tidx, info->dom.srvsvc_fnum);
|
||||
cli_nt_session_close(smb_cli);
|
||||
|
||||
if (res)
|
||||
{
|
||||
@ -283,11 +282,11 @@ void cmd_srv_enum_files(struct client_info *info)
|
||||
|
||||
bzero(&ctr, sizeof(ctr));
|
||||
|
||||
strcpy(dest_srv, "\\\\");
|
||||
strcat(dest_srv, info->dest_host);
|
||||
fstrcpy(dest_srv, "\\\\");
|
||||
fstrcat(dest_srv, info->dest_host);
|
||||
strupper(dest_srv);
|
||||
|
||||
if (next_token(NULL, tmp, NULL))
|
||||
if (next_token(NULL, tmp, NULL, sizeof(tmp)-1))
|
||||
{
|
||||
info_level = strtoul(tmp, (char**)NULL, 10);
|
||||
}
|
||||
@ -298,13 +297,13 @@ void cmd_srv_enum_files(struct client_info *info)
|
||||
DEBUG(5, ("cmd_srv_enum_files: smb_cli->fd:%d\n", smb_cli->fd));
|
||||
|
||||
/* open srvsvc session. */
|
||||
res = res ? do_session_open(smb_cli, smb_tidx, PIPE_SRVSVC, &(info->dom.srvsvc_fnum)) : False;
|
||||
res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, False) : False;
|
||||
|
||||
hnd.ptr_hnd = 1;
|
||||
hnd.handle = 0;
|
||||
|
||||
/* enumerate files on server */
|
||||
res = res ? do_srv_net_srv_file_enum(smb_cli, smb_tidx, info->dom.srvsvc_fnum,
|
||||
res = res ? do_srv_net_srv_file_enum(smb_cli,
|
||||
dest_srv, NULL, info_level, &ctr, 0x1000, &hnd) : False;
|
||||
|
||||
if (res)
|
||||
@ -315,7 +314,7 @@ void cmd_srv_enum_files(struct client_info *info)
|
||||
}
|
||||
|
||||
/* close the session */
|
||||
do_session_close(smb_cli, smb_tidx, info->dom.srvsvc_fnum);
|
||||
cli_nt_session_close(smb_cli);
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
@ -107,13 +107,11 @@ struct
|
||||
{"ntlogin", cmd_netlogon_login_test, "<username> NT Domain login test"},
|
||||
#endif
|
||||
{"wksinfo", cmd_wks_query_info, "DCE/RPC - Workstation Query Info"},
|
||||
#if 0
|
||||
{"srvinfo", cmd_srv_query_info, "DCE/RPC - Server Query Info"},
|
||||
{"srvsessions",cmd_srv_enum_sess, "DCE/RPC - List sessions on a server"},
|
||||
{"srvshares", cmd_srv_enum_shares, "DCE/RPC - List shares on a server"},
|
||||
{"srvconnections",cmd_srv_enum_conn, "DCE/RPC - List connections on a server"},
|
||||
{"srvfiles", cmd_srv_enum_files, "DCE/RPC - List files on a server"},
|
||||
#endif
|
||||
{"lsaquery", cmd_lsa_query_info, "Query Info Policy (domain member or server)"},
|
||||
{"lookupsids", cmd_lsa_lookup_sids, "Resolve names from SIDs"},
|
||||
{"enumusers", cmd_sam_enum_users, "SAM User Database Query (experimental!)"},
|
||||
|
Loading…
Reference in New Issue
Block a user