summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/ntdomain.h49
-rw-r--r--source3/include/proto.h63
-rw-r--r--source3/include/rpc_creds.h6
-rwxr-xr-xsource3/include/rpc_spoolss.h2
-rw-r--r--source3/include/smb.h7
-rw-r--r--source3/lib/membuffer.c14
-rw-r--r--source3/lib/msrpc-client.c11
-rw-r--r--source3/lib/passcheck.c18
-rw-r--r--source3/lib/util.c7
-rw-r--r--source3/lib/vuser.c88
-rw-r--r--source3/libsmb/clientgen.c7
-rw-r--r--source3/lsarpcd/lsarpcd.c3
-rw-r--r--source3/lsarpcd/lsarpcd_process.c58
-rw-r--r--source3/lsarpcd/srv_lsa.c20
-rw-r--r--source3/printing/nt_printing.c13
-rw-r--r--source3/printing/printing.c58
-rw-r--r--source3/rpc_client/cli_pipe.c4
-rw-r--r--source3/rpc_client/cli_samr.c4
-rw-r--r--source3/rpc_parse/parse_at.c2
-rw-r--r--source3/rpc_parse/parse_creds.c87
-rw-r--r--source3/rpc_parse/parse_net.c4
-rw-r--r--source3/rpc_parse/parse_prs.c92
-rw-r--r--source3/rpc_parse/parse_rpc.c4
-rw-r--r--source3/rpc_parse/parse_samr.c34
-rw-r--r--source3/rpc_parse/parse_spoolss.c2
-rw-r--r--source3/rpc_parse/parse_srv.c15
-rw-r--r--source3/rpc_server/srv_brs.c4
-rw-r--r--source3/rpc_server/srv_lsa.c20
-rw-r--r--source3/rpc_server/srv_netlog.c136
-rw-r--r--source3/rpc_server/srv_pipe.c703
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c111
-rw-r--r--source3/rpc_server/srv_reg.c10
-rw-r--r--source3/rpc_server/srv_samr.c86
-rwxr-xr-xsource3/rpc_server/srv_spoolss.c236
-rw-r--r--source3/rpc_server/srv_srvsvc.c14
-rw-r--r--source3/rpc_server/srv_svcctl.c14
-rw-r--r--source3/rpc_server/srv_wkssvc.c4
-rw-r--r--source3/rpcclient/cmd_samr.c4
-rw-r--r--source3/smbd/close.c2
-rw-r--r--source3/smbd/ipc.c27
-rw-r--r--source3/smbd/password.c10
-rw-r--r--source3/smbd/uid.c124
42 files changed, 1308 insertions, 869 deletions
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index 95ba141b10..096e7cd66c 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -62,20 +62,8 @@ typedef struct
} prs_struct;
-typedef struct pipes_struct
+typedef struct rpcsrv_struct
{
- struct pipes_struct *next, *prev;
- int pnum;
- connection_struct *conn;
- uint16 vuid;
- BOOL open; /* open connection */
- uint16 device_state;
- uint16 priority;
- fstring name;
- fstring pipe_srv_name;
-
- struct msrpc_state *m;
-
prs_struct rhdr; /* output header */
prs_struct rfault; /* fault */
prs_struct rdata; /* output data */
@@ -107,6 +95,39 @@ typedef struct pipes_struct
fstring domain;
fstring wks;
+ uchar user_sess_key[16];
+
+ /* per-user authentication info. hmm, this not appropriate, but
+ it will do for now. dcinfo contains NETLOGON-specific info,
+ so have to think of a better method.
+ */
+ struct dcinfo dc;
+
+} rpcsrv_struct;
+
+typedef struct pipes_struct
+{
+ struct pipes_struct *next, *prev;
+ int pnum;
+ connection_struct *conn;
+ uint16 vuid;
+ BOOL open; /* open connection */
+ uint16 device_state;
+ uint16 priority;
+ fstring name;
+ fstring pipe_srv_name;
+
+ /* remote, server-side rpc redirection */
+ struct msrpc_state *m;
+
+ /* local, server-side rpc state processing */
+ rpcsrv_struct *l;
+
+ /* to store pdus being constructed / communicated from smb to msrpc */
+ prs_struct smb_pdu;
+ prs_struct rsmb_pdu;
+
+ /* state-based info used in processing smbs to/from msrpc pdus */
uint32 file_offset;
uint32 prev_pdu_file_offset;
uint32 hdr_offsets;
@@ -117,7 +138,7 @@ struct api_struct
{
char *name;
uint8 opnum;
- void (*fn) (pipes_struct*, prs_struct*, prs_struct*);
+ void (*fn) (rpcsrv_struct*, prs_struct*, prs_struct*);
};
struct mem_desc
diff --git a/source3/include/proto.h b/source3/include/proto.h
index a18b498ba5..db5aa0b9b4 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -325,7 +325,7 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar challenge[8],
const char *user, const char *domain,
uchar *lm_pass, size_t lm_pwd_len,
uchar *nt_pass, size_t nt_pwd_len,
- uchar sess_key[16]);
+ uchar user_sess_key[16]);
BOOL pass_check_smb(struct smb_passwd *smb_pass, char *domain, uchar *chal,
uchar *lm_pwd, size_t lm_pwd_len,
uchar *nt_pwd, size_t nt_pwd_len,
@@ -728,6 +728,10 @@ void start_agent(struct vagent_ops *va);
user_struct *get_valid_user_struct(uint16 vuid);
void invalidate_vuid(uint16 vuid);
char *validated_username(uint16 vuid);
+uint16 create_vuid(uid_t uid, gid_t gid, int n_groups, gid_t *groups,
+ char *unix_name, char *requested_name,
+ char *real_name,
+ BOOL guest, uchar user_sess_key[16]);
uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest, uchar user_sess_key[16]);
/*The following definitions come from libsmb/clientgen.c */
@@ -1810,7 +1814,7 @@ int get_ntforms(nt_forms_struct **list);
int write_ntforms(nt_forms_struct **list, int number);
void add_a_form(nt_forms_struct **list, FORM form, int *count);
void update_a_form(nt_forms_struct **list, FORM form, int count);
-int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture);
+int get_ntdrivers(fstring **list, char *architecture);
void get_short_archi(char *short_archi, char *long_archi);
void dump_a_param(NT_PRINTER_PARAM *param);
BOOL add_a_specific_param(NT_PRINTER_INFO_LEVEL_2 *info_2, NT_PRINTER_PARAM *param);
@@ -1841,9 +1845,8 @@ int sysv_printername_ok(char *name);
/*The following definitions come from printing/printing.c */
void lpq_reset(int snum);
-void print_file(connection_struct *conn, files_struct *file);
-int get_printqueue(int snum,
- connection_struct *conn,print_queue_struct **queue,
+void print_file(connection_struct *conn, int snum, files_struct *file);
+int get_printqueue(int snum, connection_struct *conn, print_queue_struct **queue,
print_status_struct *status);
void del_printqueue(connection_struct *conn,int snum,int jobid);
void status_printjob(connection_struct *conn,int snum,int jobid,int status);
@@ -2470,13 +2473,18 @@ BOOL brs_io_r_query_info(char *desc, BRS_R_QUERY_INFO *r_u, prs_struct *ps, int
/*The following definitions come from rpc_parse/parse_creds.c */
-BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name);
+BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
+ const char* requested_name,
+ const char* real_name,
+ BOOL guest);
BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth);
void creds_free_unix(CREDS_UNIX *r_u);
BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
- uint32 uid, uint32 gid, uint32 num_grps, uint32 *grps);
+ uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps);
BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth);
void creds_free_unix_sec(CREDS_UNIX_SEC *r_u);
+BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u,
+ DOM_SID *sid, uint32 num_grps, uint32 *grps);
BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth);
void creds_free_nt_sec(CREDS_NT_SEC *r_u);
BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth);
@@ -2755,14 +2763,16 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16],
/*The following definitions come from rpc_parse/parse_prs.c */
void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name);
-void prs_debug_out(prs_struct *ps, int level);
+void prs_debug_out(prs_struct *ps, char *msg, int level);
void prs_init(prs_struct *ps, uint32 size,
uint8 align, uint32 margin,
BOOL io);
+BOOL prs_copy(prs_struct *ps, const prs_struct *from);
void prs_mem_free(prs_struct *ps);
void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next);
void prs_align(prs_struct *ps);
-BOOL prs_grow(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_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]);
@@ -2879,7 +2889,7 @@ BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc,
BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth);
BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc,
uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
- char *pipe_addr,
+ const char *pipe_addr,
uint8 num_results, uint16 result, uint16 reason,
RPC_IFACE *transfer);
BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth);
@@ -3646,7 +3656,7 @@ BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int
/*The following definitions come from rpc_server/srv_brs.c */
-BOOL api_brs_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_brs_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_lookup.c */
@@ -3671,23 +3681,26 @@ uint32 lookup_name(char *name, DOM_SID *sid, uint8 *type);
/*The following definitions come from rpc_server/srv_lsa.c */
-BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_ntlsa_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_netlog.c */
-BOOL api_netlog_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_netlog_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_pipe.c */
-BOOL create_rpc_reply(pipes_struct *p,
- uint32 data_start, uint32 data_end);
+void rpcsrv_free_temp(rpcsrv_struct *l);
+BOOL create_rpc_reply(rpcsrv_struct *l, uint32 data_start);
void close_msrpc_command_processor(void);
void add_msrpc_command_processor(char* pipe_name,
char* process_name,
- BOOL (*fn) (pipes_struct *, prs_struct *));
-BOOL rpc_command(pipes_struct *p, prs_struct *pd);
-BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds,
+ BOOL (*fn) (rpcsrv_struct *, prs_struct *));
+BOOL rpc_add_to_pdu(prs_struct *ps, const char *data, int len);
+BOOL rpc_send_and_rcv_pdu(pipes_struct *p);
+BOOL rpc_to_smb(pipes_struct *p, char *data, int len);
+BOOL api_rpcTNP(rpcsrv_struct *l, char *rpc_name, struct api_struct *api_rpc_cmds,
prs_struct *data);
+BOOL is_complete_pdu(prs_struct *ps);
/*The following definitions come from rpc_server/srv_pipe_hnd.c */
@@ -3706,30 +3719,30 @@ pipes_struct *get_rpc_pipe(int pnum);
/*The following definitions come from rpc_server/srv_reg.c */
-BOOL api_reg_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_reg_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_samr.c */
-BOOL api_samr_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_samr_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_spoolss.c */
void init_printer_hnd(void);
uint32 size_of_notify_info_data(uint16 type, uint16 field);
BOOL type_of_notify_info_data(uint16 type, uint16 field);
-BOOL api_spoolss_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_spoolss_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_srvsvc.c */
-BOOL api_srvsvc_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_srvsvc_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_svcctl.c */
-BOOL api_svcctl_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_svcctl_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_wkssvc.c */
-BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data);
+BOOL api_wkssvc_rpc(rpcsrv_struct *p, prs_struct *data);
/*The following definitions come from rpcclient/cmd_atsvc.c */
@@ -4396,6 +4409,8 @@ int reply_trans2(connection_struct *conn,
void init_uid(void);
BOOL become_guest(void);
+BOOL become_vuser(uint16 vuid);
+BOOL unbecome_vuser(void);
BOOL become_user(connection_struct *conn, uint16 vuid);
BOOL unbecome_user(void );
void become_root(BOOL save_dir) ;
diff --git a/source3/include/rpc_creds.h b/source3/include/rpc_creds.h
index 54293a67d0..c389c64d1d 100644
--- a/source3/include/rpc_creds.h
+++ b/source3/include/rpc_creds.h
@@ -36,6 +36,9 @@ typedef struct ntuser_creds
typedef struct unixuser_creds
{
fstring user_name;
+ fstring requested_name;
+ fstring real_name;
+ BOOL guest;
} CREDS_UNIX;
@@ -51,7 +54,8 @@ typedef struct unixsec_creds
typedef struct ntsec_creds
{
DOM_SID sid;
- SEC_DESC_BUF sd ;
+ uint32 num_grps;
+ uint32 *grp_rids;
} CREDS_NT_SEC;
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index 65975e4754..5143b389fc 100755
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -850,7 +850,7 @@ struct s_notify_info_data_table
uint16 field;
char *name;
uint32 size;
- void (*fn) (connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer);
+ void (*fn) (int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer);
};
typedef struct spool_q_getprinterdriver2
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 22bba17e62..b06cfe2b7b 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -613,7 +613,6 @@ struct dcinfo
uchar sess_key[8]; /* Session key */
uchar md4pw[16]; /* md4(machine password) */
- uchar user_sess_key[16]; /* user session key (md4 nt#) */
};
typedef struct
@@ -631,11 +630,7 @@ typedef struct
int n_groups;
gid_t *groups;
- int n_sids;
- int *sids;
-
- /* per-user authentication information on NT RPCs */
- struct dcinfo dc;
+ uchar user_sess_key[16];
} user_struct;
diff --git a/source3/lib/membuffer.c b/source3/lib/membuffer.c
index 170433074f..e228503643 100644
--- a/source3/lib/membuffer.c
+++ b/source3/lib/membuffer.c
@@ -70,7 +70,7 @@ void mem_init(struct mem_buf *buf, int margin)
buf->next = NULL;
buf->offset.start = 0;
- buf->offset.end = 0;
+ buf->offset.end = 0x0;
}
/*******************************************************************
@@ -119,6 +119,7 @@ BOOL mem_alloc_data(struct mem_buf *buf, int size)
}
bzero(buf->data, buf->data_size);
+ buf->offset.end = buf->offset.start + size;
return True;
}
@@ -229,6 +230,7 @@ void mem_free_data(struct mem_buf *buf)
if (buf->data != NULL && buf->dynamic)
{
free(buf->data); /* delete data in this structure */
+ buf->data = NULL;
}
mem_init(buf, buf->margin);
}
@@ -276,6 +278,10 @@ BOOL mem_realloc_data(struct mem_buf *buf, size_t new_size)
return False;
}
+ buf->offset.end = buf->offset.start + new_size;
+
+ DEBUG(150,("mem_realloc_data: size: %d start: %d end: %d\n",
+ new_size, buf->offset.start, buf->offset.end));
return True;
}
@@ -286,13 +292,13 @@ BOOL mem_grow_data(struct mem_buf **buf, BOOL io, int new_size, BOOL force_grow)
{
if (new_size + (*buf)->margin >= (*buf)->data_size)
{
- if (io && !force_grow)
+ if (!io || force_grow)
{
- DEBUG(3,("mem_grow_data: cannot resize when reading from a data stream\n"));
+ /* writing or forge realloc */
+ return mem_realloc_data((*buf), new_size);
}
else
{
- return mem_realloc_data((*buf), new_size);
}
}
return True;
diff --git a/source3/lib/msrpc-client.c b/source3/lib/msrpc-client.c
index 6e80063862..e13850a9e2 100644
--- a/source3/lib/msrpc-client.c
+++ b/source3/lib/msrpc-client.c
@@ -41,6 +41,9 @@ BOOL msrpc_send_prs(struct msrpc_state *msrpc, prs_struct *ps)
{
size_t len = mem_buf_len(ps->data);
+ DEBUG(10,("msrpc_send_prs: len %d\n", len));
+ dbgflush();
+
_smb_setlen(msrpc->outbuf, len);
mem_buf_copy(&msrpc->outbuf[4], ps->data, 0, len);
@@ -176,14 +179,6 @@ static BOOL msrpc_authenticate(struct msrpc_state *msrpc,
command = usr != NULL ? AGENT_CMD_CON : AGENT_CMD_CON_ANON;
- if (usr != NULL)
- {
- usr->ptr_ntc = 1;
- usr->ptr_uxc = 1;
- usr->ptr_nts = 0;
- usr->ptr_uxs = 0;
- }
-
if (!create_user_creds(&ps, msrpc->pipe_name, 0x0, command, usr))
{
DEBUG(0,("could not parse credentials\n"));
diff --git a/source3/lib/passcheck.c b/source3/lib/passcheck.c
index 195a404ff3..bec6455059 100644
--- a/source3/lib/passcheck.c
+++ b/source3/lib/passcheck.c
@@ -35,7 +35,7 @@ core of smb password checking routine.
****************************************************************************/
static BOOL smb_pwd_check_ntlmv1(char *password, unsigned char *part_passwd,
unsigned char *c8,
- uchar sess_key[16])
+ uchar user_sess_key[16])
{
/* Finish the encryption of part_passwd. */
unsigned char p24[24];
@@ -47,9 +47,9 @@ static BOOL smb_pwd_check_ntlmv1(char *password, unsigned char *part_passwd,
return True;
SMBOWFencrypt(part_passwd, c8, p24);
- if (sess_key != NULL)
+ if (user_sess_key != NULL)
{
- SMBsesskeygen_ntv1(part_passwd, NULL, sess_key);
+ SMBsesskeygen_ntv1(part_passwd, NULL, user_sess_key);
}
#if DEBUG_PASSWORD
@@ -72,7 +72,7 @@ static BOOL smb_pwd_check_ntlmv2(char *password, size_t pwd_len,
unsigned char *part_passwd,
unsigned char const *c8,
const char *user, const char *domain,
- char *sess_key)
+ char *user_sess_key)
{
/* Finish the encryption of part_passwd. */
unsigned char kr[16];
@@ -90,9 +90,9 @@ static BOOL smb_pwd_check_ntlmv2(char *password, size_t pwd_len,
ntv2_owf_gen(part_passwd, user, domain, kr);
SMBOWFencrypt_ntv2(kr, c8, 8, password+16, pwd_len-16, resp);
- if (sess_key != NULL)
+ if (user_sess_key != NULL)
{
- SMBsesskeygen_ntv2(kr, resp, sess_key);
+ SMBsesskeygen_ntv2(kr, resp, user_sess_key);
}
#if DEBUG_PASSWORD
@@ -117,7 +117,7 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar challenge[8],
const char *user, const char *domain,
uchar *lm_pass, size_t lm_pwd_len,
uchar *nt_pass, size_t nt_pwd_len,
- uchar sess_key[16])
+ uchar user_sess_key[16])
{
if (smb_pass == NULL)
{
@@ -151,7 +151,7 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar challenge[8],
if (smb_pwd_check_ntlmv2(nt_pass, nt_pwd_len,
(uchar *)smb_pass->smb_nt_passwd,
challenge, user, domain,
- sess_key))
+ user_sess_key))
{
return True;
}
@@ -162,7 +162,7 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar challenge[8],
if (smb_pwd_check_ntlmv1((char *)nt_pass,
(uchar *)smb_pass->smb_nt_passwd,
challenge,
- sess_key))
+ user_sess_key))
{
DEBUG(4,("NT MD4 password check succeeded\n"));
return True;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 65908ff19e..22adee49df 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3012,7 +3012,12 @@ void dump_data(int level, const char *buf1, int len)
{
unsigned char const *buf = (unsigned char const *)buf1;
int i=0;
- if (len<=0) return;
+ if (len<0) return;
+ if (len == 0)
+ {
+ DEBUG(level,("\n"));
+ return;
+ }
DEBUG(level,("[%03X] ",i));
for (i=0;i<len;)
diff --git a/source3/lib/vuser.c b/source3/lib/vuser.c
index dfad258152..09a553e4e6 100644
--- a/source3/lib/vuser.c
+++ b/source3/lib/vuser.c
@@ -55,18 +55,12 @@ void invalidate_vuid(uint16 vuid)
vuser->uid = (uid_t)-1;
vuser->gid = (gid_t)-1;
- vuser->n_sids = 0;
-
/* same number of igroups as groups */
vuser->n_groups = 0;
if (vuser->groups)
free((char *)vuser->groups);
- if (vuser->sids)
- free((char *)vuser->sids);
-
- vuser->sids = NULL;
vuser->groups = NULL;
}
@@ -89,9 +83,53 @@ register a uid/name pair as being valid and that a valid password
has been given. vuid is biased by an offset. This allows us to
tell random client vuid's (normally zero) from valid vuids.
****************************************************************************/
-uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest, uchar user_sess_key[16])
+uint16 create_vuid(uid_t uid, gid_t gid, int n_groups, gid_t *groups,
+ char *unix_name, char *requested_name,
+ char *real_name,
+ BOOL guest, uchar user_sess_key[16])
{
user_struct *vuser;
+
+ validated_users = (user_struct *)Realloc(validated_users,
+ sizeof(user_struct)*
+ (num_validated_users+1));
+
+ if (!validated_users)
+ {
+ DEBUG(0,("Failed to realloc users struct!\n"));
+ num_validated_users = 0;
+ return UID_FIELD_INVALID;
+ }
+
+ vuser = &validated_users[num_validated_users];
+ num_validated_users++;
+
+ vuser->uid = uid;
+ vuser->gid = gid;
+ vuser->guest = guest;
+ fstrcpy(vuser->name,unix_name);
+ fstrcpy(vuser->requested_name,requested_name);
+ fstrcpy(vuser->real_name,real_name);
+ memcpy(vuser->user_sess_key, user_sess_key, sizeof(vuser->user_sess_key));
+
+ vuser->n_groups = n_groups;
+ vuser->groups = groups;
+
+ DEBUG(3,("uid %d registered to name %s\n",(int)uid,unix_name));
+
+ return (uint16)((num_validated_users - 1) + VUID_OFFSET);
+}
+
+/****************************************************************************
+register a uid/name pair as being valid and that a valid password
+has been given. vuid is biased by an offset. This allows us to
+tell random client vuid's (normally zero) from valid vuids.
+****************************************************************************/
+uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest, uchar user_sess_key[16])
+{
+ int n_groups;
+ gid_t *groups;
+ fstring real_name;
struct passwd *pwfile; /* for getting real name from passwd file */
/* Ensure no vuid gets registered in share level security. */
@@ -130,40 +168,28 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
return UID_FIELD_INVALID;
}
- vuser = &validated_users[num_validated_users];
- num_validated_users++;
-
- vuser->uid = uid;
- vuser->gid = gid;
- vuser->guest = guest;
- fstrcpy(vuser->name,unix_name);
- fstrcpy(vuser->requested_name,requested_name);
- memcpy(vuser->dc.user_sess_key, user_sess_key, sizeof(vuser->dc.user_sess_key));
-
- vuser->n_sids = 0;
- vuser->sids = NULL;
-
- vuser->n_groups = 0;
- vuser->groups = NULL;
-
/* Find all the groups this uid is in and store them.
Used by become_user() */
get_unixgroups(unix_name,uid,gid,
- &vuser->n_groups,
- &vuser->groups);
+ &n_groups,
+ &groups);
DEBUG(3,("uid %d registered to name %s\n",(int)uid,unix_name));
DEBUG(3, ("Clearing default real name\n"));
- fstrcpy(vuser->real_name, "<Full Name>\0");
- if (lp_unix_realname()) {
- if ((pwfile=hashed_getpwnam(vuser->name))!= NULL)
+ fstrcpy(real_name, "<Full Name>\0");
+ if (lp_unix_realname())
+ {
+ if ((pwfile=hashed_getpwnam(unix_name))!= NULL)
{
- DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos));
- fstrcpy(vuser->real_name, pwfile->pw_gecos);
+ DEBUG(3, ("User name: %s\tReal name: %s\n",unix_name,pwfile->pw_gecos));
+ fstrcpy(real_name, pwfile->pw_gecos);
}
}
- return (uint16)((num_validated_users - 1) + VUID_OFFSET);
+ return create_vuid(uid, gid, n_groups, groups,
+ unix_name, requested_name,
+ real_name,
+ guest, user_sess_key);
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 50bf54d02c..27efc132c0 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -2926,7 +2926,7 @@ BOOL cli_reestablish_connection(struct cli_state *cli)
return False;
}
-static int cli_init_redirect(struct cli_state *cli,
+static BOOL cli_init_redirect(struct cli_state *cli,
const char* srv_name, struct in_addr *destip,
const struct ntuser_creds *usr)
{
@@ -2955,7 +2955,7 @@ static int cli_init_redirect(struct cli_state *cli,
if (sock < 0)
{
- return sock;
+ return False;
}
command = usr != NULL ? AGENT_CMD_CON : AGENT_CMD_CON_ANON;
@@ -3038,8 +3038,7 @@ BOOL cli_establish_connection(struct cli_state *cli,
}
else
{
- DEBUG(10,("redirect FAILED\n"));
- return False;
+ DEBUG(10,("redirect FAILED, make direct connection\n"));
}
}
if (cli->fd == -1)
diff --git a/source3/lsarpcd/lsarpcd.c b/source3/lsarpcd/lsarpcd.c
index 3c883029f0..ed665e85c5 100644
--- a/source3/lsarpcd/lsarpcd.c
+++ b/source3/lsarpcd/lsarpcd.c
@@ -40,6 +40,7 @@ extern int DEBUGLEVEL;
extern fstring remote_machine;
extern pstring myhostname;
+extern pstring OriginalDir;
/****************************************************************************
when exiting, take the whole family
@@ -456,6 +457,8 @@ static void usage(char *pname)
so set our umask to 0 */
umask(0);
+ dos_GetWd(OriginalDir);
+
init_uid();
/* this is for people who can't start the program correctly */
diff --git a/source3/lsarpcd/lsarpcd_process.c b/source3/lsarpcd/lsarpcd_process.c
index 47a4f9a86c..e33de5ce57 100644
--- a/source3/lsarpcd/lsarpcd_process.c
+++ b/source3/lsarpcd/lsarpcd_process.c
@@ -181,7 +181,7 @@ do a switch on the message type, and return the response size
****************************************************************************/
static int do_message(char *inbuf,char *outbuf,int size,int bufsize)
{
- static int pid= -1;
+ static int pid= -1;
pipes_struct *p = &static_pipe;
prs_struct pd;
@@ -195,24 +195,16 @@ static int do_message(char *inbuf,char *outbuf,int size,int bufsize)
pid = getpid();
/* dce/rpc command */
- if (rpc_command(p, &pd))
+ if (rpc_to_smb(p, smb_base(inbuf), smb_len(inbuf)))
{
char *copy_into = smb_base(outbuf);
- outsize = mem_buf_len(p->rhdr.data);
- if (!mem_buf_copy(copy_into, p->rhdr.data, 0, outsize))
+ outsize = mem_buf_len(p->rsmb_pdu.data);
+ if (!mem_buf_copy(copy_into, p->rsmb_pdu.data, 0, outsize))
{
return -1;
}
+ mem_free_data(p->rsmb_pdu.data);
}
- mem_free_data(pd.data);
-
- mem_free_data(p->rhdr .data);
- mem_free_data(p->rfault .data);
- mem_free_data(p->rdata .data);
- mem_free_data(p->rdata_i.data);
- mem_free_data(p->rauth .data);
- mem_free_data(p->rverf .data);
- mem_free_data(p->rntlm .data);
return outsize;
}
@@ -393,6 +385,7 @@ BOOL get_user_creds(struct user_creds *usr)
void lsarpcd_process(void)
{
struct user_creds usr;
+ gid_t *groups = NULL;
ZERO_STRUCT(static_pipe);
@@ -405,8 +398,45 @@ void lsarpcd_process(void)
return;
}
+ if (usr.uxs.num_grps != 0)
+ {
+ int i;
+ groups = malloc(usr.uxs.num_grps * sizeof(groups[0]));
+ if (groups == NULL)
+ {
+ return;
+ }
+ for (i = 0; i < usr.uxs.num_grps; i++)
+ {
+ groups[i] = (gid_t)usr.uxs.grps[i];
+ }
+ }
+
+ static_pipe.vuid = create_vuid(usr.uxs.uid, usr.uxs.gid,
+ usr.uxs.num_grps, groups,
+ usr.uxc.user_name,
+ usr.uxc.requested_name,
+ usr.uxc.real_name,
+ usr.uxc.guest,
+ usr.ntc.pwd.sess_key);
+
+ if (static_pipe.vuid == UID_FIELD_INVALID)
+ {
+ return;
+ }
+
free_user_creds(&usr);
+ become_vuser(static_pipe.vuid);
+
+ static_pipe.l = malloc(sizeof(*static_pipe.l));
+ if (static_pipe.l == NULL)
+ {
+ return;
+ }
+
+ ZERO_STRUCTP(static_pipe.l);
+
InBuffer = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
OutBuffer = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
if ((InBuffer == NULL) || (OutBuffer == NULL))
@@ -457,7 +487,7 @@ void lsarpcd_process(void)
t = time(NULL);
/* become root again if waiting */
- unbecome_user();
+ unbecome_vuser();
/* check for smb.conf reload */
if (counter >= service_load_counter + SMBD_RELOAD_CHECK)
diff --git a/source3/lsarpcd/srv_lsa.c b/source3/lsarpcd/srv_lsa.c
index 9b6a98e9a6..fbe83b02c8 100644
--- a/source3/lsarpcd/srv_lsa.c
+++ b/source3/lsarpcd/srv_lsa.c
@@ -140,7 +140,7 @@ static void lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata,
{
/* set up the LSA QUERY INFO response */
- r_q.undoc_buffer = 0x1; /* bizarre */
+ r_q.undoc_buffer = 0x1;
r_q.info_class = q_q->info_class;
make_dom_query(&r_q.dom.id5, dom_name, dom_sid);
@@ -448,7 +448,7 @@ static void lsa_reply_lookup_names(prs_struct *rdata,
/***************************************************************************
api_lsa_open_policy
***************************************************************************/
-static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data,
+static void api_lsa_open_policy2( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_OPEN_POL2 q_o;
@@ -467,7 +467,7 @@ static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_open_policy
***************************************************************************/
-static void api_lsa_open_policy( pipes_struct *p, prs_struct *data,
+static void api_lsa_open_policy( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_OPEN_POL q_o;
@@ -486,7 +486,7 @@ static void api_lsa_open_policy( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_enum_trust_dom
***************************************************************************/
-static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data,
+static void api_lsa_enum_trust_dom( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_ENUM_TRUST_DOM q_e;
@@ -503,7 +503,7 @@ static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_query_info
***************************************************************************/
-static void api_lsa_query_info( pipes_struct *p, prs_struct *data,
+static void api_lsa_query_info( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_QUERY_INFO q_i;
@@ -545,7 +545,7 @@ static void api_lsa_query_info( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_lookup_sids
***************************************************************************/
-static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data,
+static void api_lsa_lookup_sids( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_LOOKUP_SIDS q_l;
@@ -561,7 +561,7 @@ static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_lookup_names
***************************************************************************/
-static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data,
+static void api_lsa_lookup_names( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_LOOKUP_NAMES q_l;
@@ -578,7 +578,7 @@ static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_close
***************************************************************************/
-static void api_lsa_close( pipes_struct *p, prs_struct *data,
+static void api_lsa_close( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
LSA_R_CLOSE r_c;
@@ -607,7 +607,7 @@ static void api_lsa_close( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_open_secret
***************************************************************************/
-static void api_lsa_open_secret( pipes_struct *p, prs_struct *data,
+static void api_lsa_open_secret( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
/* XXXX this is NOT good */
@@ -648,7 +648,7 @@ static struct api_struct api_lsa_cmds[] =
/***************************************************************************
api_ntLsarpcTNP
***************************************************************************/
-BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_ntlsa_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_ntlsa_rpc", api_lsa_cmds, data);
}
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 90a53f1f7c..d58ead0f93 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -199,9 +199,9 @@ get the nt drivers list
open the directory and look-up the matching names
****************************************************************************/
-int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture)
+int get_ntdrivers(fstring **list, char *architecture)
{
- void *dirp;
+ DIR *dirp;
char *dpname;
fstring name_match;
fstring short_archi;
@@ -212,9 +212,9 @@ int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture)
DEBUG(5,("Getting the driver list from directory: [%s]\n", lp_nt_drivers_file()));
*list=NULL;
- dirp = OpenDir(conn, lp_nt_drivers_file(), False);
+ dirp = opendir(lp_nt_drivers_file());
- if (!dirp)
+ if (dirp == NULL)
{
DEBUG(0,("Error opening driver directory [%s]\n",lp_nt_drivers_file()));
return(-1);
@@ -224,8 +224,7 @@ int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture)
slprintf(name_match, sizeof(name_match)-1, "NTdriver_%s_", short_archi);
match_len=strlen(name_match);
-
- while ((dpname = ReadDirName(dirp)) != NULL)
+ while ((dpname = readdirname(dirp)) != NULL)
{
if (strncmp(dpname, name_match, match_len)==0)
{
@@ -240,7 +239,7 @@ int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture)
}
}
- CloseDir(dirp);
+ closedir(dirp);
return(total);
}
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index dc28f17615..e1fb53f40d 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -49,11 +49,10 @@ Build the print command in the supplied buffer. This means getting the
print command for the service and inserting the printer name and the
print file name. Return NULL on error, else the passed buffer pointer.
****************************************************************************/
-static char *build_print_command(connection_struct *conn,
+static char *build_print_command(connection_struct *conn, int snum,
char *command,
char *syscmd, char *filename1)
{
- int snum = SNUM(conn);
char *tstr;
pstring filename;
@@ -93,8 +92,15 @@ static char *build_print_command(connection_struct *conn,
string_sub(syscmd, "%p", tstr);
- standard_sub(conn,syscmd);
-
+ if (conn != NULL)
+ {
+ standard_sub(conn, syscmd);
+ }
+ else
+ {
+ standard_sub_basic(syscmd);
+ }
+
return (syscmd);
}
@@ -102,10 +108,9 @@ static char *build_print_command(connection_struct *conn,
/****************************************************************************
print a file - called on closing the file
****************************************************************************/
-void print_file(connection_struct *conn, files_struct *file)
+void print_file(connection_struct *conn, int snum, files_struct *file)
{
pstring syscmd;
- int snum = SNUM(conn);
char *tempstr;
*syscmd = 0;
@@ -116,7 +121,7 @@ void print_file(connection_struct *conn, files_struct *file)
return;
}
- tempstr = build_print_command(conn,
+ tempstr = build_print_command(conn, snum,
PRINTCOMMAND(snum),
syscmd, file->fsp_name);
if (tempstr != NULL) {
@@ -959,8 +964,7 @@ static BOOL parse_lpq_entry(int snum,char *line,
/****************************************************************************
get a printer queue
****************************************************************************/
-int get_printqueue(int snum,
- connection_struct *conn,print_queue_struct **queue,
+int get_printqueue(int snum, connection_struct *conn, print_queue_struct **queue,
print_status_struct *status)
{
char *lpq_command = lp_lpqcommand(snum);
@@ -991,7 +995,14 @@ int get_printqueue(int snum,
pstrcpy(syscmd,lpq_command);
string_sub(syscmd,"%p",printername);
- standard_sub(conn,syscmd);
+ if (conn != NULL)
+ {
+ standard_sub(conn, syscmd);
+ }
+ else
+ {
+ standard_sub_basic(syscmd);
+ }
slprintf(outfile,sizeof(outfile)-1, "%s/lpq.%08x",tmpdir(),str_checksum(syscmd));
@@ -1080,7 +1091,14 @@ void del_printqueue(connection_struct *conn,int snum,int jobid)
pstrcpy(syscmd,lprm_command);
string_sub(syscmd,"%p",printername);
string_sub(syscmd,"%j",jobstr);
- standard_sub(conn,syscmd);
+ if (conn != NULL)
+ {
+ standard_sub(conn, syscmd);
+ }
+ else
+ {
+ standard_sub_basic(syscmd);
+ }
ret = smbrun(syscmd,NULL,False);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
@@ -1118,7 +1136,14 @@ void status_printjob(connection_struct *conn,int snum,int jobid,int status)
pstrcpy(syscmd,lpstatus_command);
string_sub(syscmd,"%p",printername);
string_sub(syscmd,"%j",jobstr);
- standard_sub(conn,syscmd);
+ if (conn != NULL)
+ {
+ standard_sub(conn, syscmd);
+ }
+ else
+ {
+ standard_sub_basic(syscmd);
+ }
ret = smbrun(syscmd,NULL,False);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
@@ -1173,7 +1198,14 @@ void status_printqueue(connection_struct *conn,int snum,int status)
pstrcpy(syscmd,queuestatus_command);
string_sub(syscmd,"%p",printername);
- standard_sub(conn,syscmd);
+ if (conn != NULL)
+ {
+ standard_sub(conn, syscmd);
+ }
+ else
+ {
+ standard_sub_basic(syscmd);
+ }
ret = smbrun(syscmd,NULL,False);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index f8216cb1e0..a8debd87fd 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -695,13 +695,11 @@ BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 fnum, uint8 op_num,
prs_link(&hdr, data, NULL);
}
- mem_realloc_data(hdr.data, data_len);
-
DEBUG(100,("data_len: %x data_calc_len: %x\n",
data_len, mem_buf_len(data->data)));
/* this is a hack due to limitations in rpc_api_pipe */
- prs_init(&dataa, mem_buf_len(hdr.data), 4, 0x0, False);
+ prs_init(&dataa, data_len, 4, 0x0, False);
mem_buf_copy(dataa.data->data, hdr.data, 0, mem_buf_len(hdr.data));
ret = rpc_api_pipe(cli, fnum, False, 0x0026, NULL, &dataa, &rparam, rdata);
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index a0cb48969d..9a68016c66 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -60,6 +60,8 @@ BOOL samr_chgpasswd_user( struct cli_connection *con,
/* turn parameters into data stream */
samr_io_q_chgpasswd_user("", &q_e, &data, 0);
+ dbgflush();
+
/* send the data on \PIPE\ */
if (rpc_con_pipe_req(con, SAMR_CHGPASSWD_USER, &data, &rdata))
{
@@ -85,8 +87,6 @@ BOOL samr_chgpasswd_user( struct cli_connection *con,
prs_mem_free(&data );
prs_mem_free(&rdata );
- cli_connection_unlink(con);
-
return valid_pwc;
}
diff --git a/source3/rpc_parse/parse_at.c b/source3/rpc_parse/parse_at.c
index 87507230c0..a03a8cfad9 100644
--- a/source3/rpc_parse/parse_at.c
+++ b/source3/rpc_parse/parse_at.c
@@ -221,14 +221,12 @@ BOOL at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int dept
for (i = 0; i < r_e->num_entries2; i++)
{
- prs_grow(ps);
prs_uint32("jobid", ps, depth, &(r_e->info[i].jobid));
at_io_job_info("", &(r_e->info[i].info), ps, depth);
}
for (i = 0; i < r_e->num_entries2; i++)
{
- prs_grow(ps);
smb_io_unistr2("", &(r_e->command[i]),
r_e->info[i].info.ptr_command, ps, depth);
}
diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c
index 127557d1b8..c661d5a3c6 100644
--- a/source3/rpc_parse/parse_creds.c
+++ b/source3/rpc_parse/parse_creds.c
@@ -30,13 +30,19 @@ extern int DEBUGLEVEL;
/*******************************************************************
makes a CREDS_UNIX structure.
********************************************************************/
-BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name)
+BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
+ const char* requested_name,
+ const char* real_name,
+ BOOL guest)
{
if (r_u == NULL) return False;
DEBUG(5,("make_creds_unix\n"));
- fstrcpy(r_u->user_name, user_name);
+ fstrcpy(r_u->user_name , user_name);
+ fstrcpy(r_u->requested_name, requested_name);
+ fstrcpy(r_u->real_name , real_name);
+ r_u->guest = guest;
return True;
}
@@ -54,7 +60,11 @@ BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth)
prs_align(ps);
prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name));
prs_align(ps);
-
+ prs_string("requested_name", ps, depth, r_u->requested_name, strlen(r_u->requested_name), sizeof(r_u->requested_name));
+ prs_align(ps);
+ prs_string("real_name", ps, depth, r_u->real_name, strlen(r_u->real_name), sizeof(r_u->real_name));
+ prs_align(ps);
+ prs_uint32("guest", ps, depth, &(r_u->guest));
return True;
}
@@ -70,8 +80,9 @@ void creds_free_unix(CREDS_UNIX *r_u)
makes a CREDS_UNIX_SEC structure.
********************************************************************/
BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
- uint32 uid, uint32 gid, uint32 num_grps, uint32 *grps)
+ uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps)
{
+ int i;
if (r_u == NULL) return False;
DEBUG(5,("make_creds_unix_sec\n"));
@@ -79,7 +90,16 @@ BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
r_u->uid = uid;
r_u->gid = gid;
r_u->num_grps = num_grps;
- r_u->grps = grps;
+ r_u->grps = (uint32*)Realloc(NULL, sizeof(r_u->grps[0]) *
+ r_u->num_grps);
+ if (r_u->grps == NULL && num_grps != 0)
+ {
+ return False;
+ }
+ for (i = 0; i < num_grps; i++)
+ {
+ r_u->grps[i] = (gid_t)grps[i];
+ }
return True;
}
@@ -114,7 +134,6 @@ BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int dept
}
for (i = 0; i < r_u->num_grps; i++)
{
- prs_grow(ps);
prs_uint32("", ps, depth, &(r_u->grps[i]));
}
return True;
@@ -134,10 +153,39 @@ void creds_free_unix_sec(CREDS_UNIX_SEC *r_u)
}
/*******************************************************************
+makes a CREDS_NT_SEC structure.
+********************************************************************/
+BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u,
+ DOM_SID *sid, uint32 num_grps, uint32 *grps)
+{
+ int i;
+ if (r_u == NULL) return False;
+
+ DEBUG(5,("make_creds_unix_sec\n"));
+
+ sid_copy(&r_u->sid, sid);
+ r_u->num_grps = num_grps;
+ r_u->grp_rids = (uint32*)Realloc(NULL, sizeof(r_u->grp_rids[0]) *
+ r_u->num_grps);
+
+ if (r_u->grp_rids == NULL && num_grps != 0)
+ {
+ return False;
+ }
+ for (i = 0; i < num_grps; i++)
+ {
+ r_u->grp_rids[i] = grps[i];
+ }
+
+ return True;
+}
+
+/*******************************************************************
reads or writes a structure.
********************************************************************/
BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth)
{
+ int i;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "creds_io_nt");
@@ -148,8 +196,22 @@ BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth)
smb_io_dom_sid ("sid", &r_u->sid, ps, depth);
prs_align(ps);
- sec_io_desc_buf("sd ", &r_u->sd , ps, depth);
- prs_align(ps);
+ prs_uint32("num_grps", ps, depth, &(r_u->num_grps));
+ if (r_u->num_grps != 0)
+ {
+ r_u->grp_rids = (uint32*)Realloc(r_u->grp_rids,
+ sizeof(r_u->grp_rids[0]) *
+ r_u->num_grps);
+ if (r_u->grp_rids == NULL)
+ {
+ creds_free_nt_sec(r_u);
+ return False;
+ }
+ }
+ for (i = 0; i < r_u->num_grps; i++)
+ {
+ prs_uint32("", ps, depth, &(r_u->grp_rids[i]));
+ }
return True;
}
@@ -159,6 +221,11 @@ frees a structure.
********************************************************************/
void creds_free_nt_sec(CREDS_NT_SEC *r_u)
{
+ if (r_u->grp_rids != NULL)
+ {
+ free(r_u->grp_rids);
+ r_u->grp_rids = NULL;
+ }
}
/*******************************************************************
@@ -265,6 +332,8 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth)
prs_uint32("reuse", ps, depth, &(r_u->reuse));
prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc));
prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc));
+ prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts));
+ prs_uint32("ptr_uxs", ps, depth, &(r_u->ptr_uxs));
if (r_u->ptr_ntc != 0)
{
if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False;
@@ -321,7 +390,7 @@ void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from)
if (from->num_grps != 0)
{
- size_t size = to->num_grps * sizeof(to->grps[0]);
+ size_t size = from->num_grps * sizeof(from->grps[0]);
to->grps = (uint32*)malloc(size);
if (to->grps == NULL)
{
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index 455129b6f9..277c2331b4 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -1669,7 +1669,6 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_
for (i = 0; i < info->num_members2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i);
prs_uint32(tmp, ps, depth, &(info->rids[i]));
}
@@ -1688,7 +1687,6 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_
for (i = 0; i < info->num_members3; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i);
prs_uint32(tmp, ps, depth, &(info->attribs[i]));
}
@@ -1754,7 +1752,6 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_
for (i = 0; i < info->num_sids; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i);
prs_uint32(tmp, ps, depth, &(info->ptr_sids[i]));
}
@@ -1765,7 +1762,6 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_
{
if (info->ptr_sids[i] != 0)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", i);
smb_io_dom_sid2(tmp, &(info->sids[i]), ps, depth);
}
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 4c52e15769..d9c07e3885 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -39,10 +39,11 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name)
/*******************************************************************
debug a parse structure
********************************************************************/
-void prs_debug_out(prs_struct *ps, int level)
+void prs_debug_out(prs_struct *ps, char *msg, int level)
{
- DEBUG(level,("ps: io %s align %d offset %d err %d data %p len %d\n",
- BOOLSTR(ps->io), ps->align, ps->offset, ps->error, ps->data,
+ DEBUG(level,("%s ps: io %s align %d offset %d err %d data %p len %d\n",
+ msg, BOOLSTR(ps->io), ps->align, ps->offset, ps->error,
+ ps->data,
ps->data != NULL ? mem_buf_len(ps->data) : 0));
}
@@ -70,6 +71,22 @@ void prs_init(prs_struct *ps, uint32 size,
}
/*******************************************************************
+ copy a parse structure
+ ********************************************************************/
+BOOL prs_copy(prs_struct *ps, const prs_struct *from)
+{
+ int len = mem_buf_len(from->data);
+ prs_init(ps, len, from->align, from->data->margin, from->io);
+ if (!mem_buf_copy(mem_data(&ps->data, 0), from->data, 0, len))
+ {
+ return False;
+ }
+ ps->offset = len;
+ prs_link(NULL, ps, NULL);
+ return True;
+}
+
+/*******************************************************************
initialise a parse structure
********************************************************************/
void prs_mem_free(prs_struct *ps)
@@ -85,6 +102,10 @@ void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next)
ps->data->offset.start = prev != NULL ? prev->data->offset.end : 0;
ps->data->offset.end = ps->data->offset.start + ps->offset;
ps->data->next = next != NULL ? next->data : NULL;
+
+ DEBUG(150,("prs_link: start %d end %d\n",
+ ps->data->offset.start,
+ ps->data->offset.end));
}
/*******************************************************************
@@ -107,12 +128,31 @@ void prs_align(prs_struct *ps)
depends on the data stream mode (io)
********************************************************************/
-BOOL prs_grow(prs_struct *ps)
+BOOL prs_grow(prs_struct *ps, uint32 new_size)
{
if (ps->error) return False;
- return mem_grow_data(&(ps->data), ps->io, ps->offset, False);
+ return mem_grow_data(&(ps->data), ps->io, new_size, False);
}
+/*******************************************************************
+ lengthens a buffer by len bytes and copies data into it.
+ ********************************************************************/
+BOOL prs_append_data(prs_struct *ps, const char *data, int len)
+{
+ int prev_size = ps->data->data_used;
+ int new_size = prev_size + len;
+ char *to;
+
+ mem_realloc_data(ps->data, new_size);
+ to = mem_data(&ps->data, prev_size);
+ if (to == NULL || ps->data->data_used != new_size)
+ {
+ return False;
+ }
+ memcpy(to, data, len);
+
+ return True;
+}
/*******************************************************************
stream a uint8
@@ -121,16 +161,19 @@ BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8)
{
char *q;
if (ps->error) return False;
+ prs_grow(ps, ps->offset + 1);
q = mem_data(&(ps->data), ps->offset);
if (q == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_uint8 error", 5);
return False;
}
DBG_RW_CVAL(name, depth, ps->offset, ps->io, q, *data8)
ps->offset += 1;
+
return True;
}
@@ -141,10 +184,12 @@ BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16)
{
char *q;
if (ps->error) return False;
+ prs_grow(ps, ps->offset + 2);
q = mem_data(&(ps->data), ps->offset);
if (q == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_uint16 error", 5);
return False;
}
@@ -165,6 +210,7 @@ BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16])
if (q == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_hash1 error", 5);
return False;
}
@@ -188,10 +234,12 @@ BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32)
{
char *q;
if (ps->error) return False;
+ prs_grow(ps, ps->offset + 4);
q = mem_data(&(ps->data), ps->offset);
if (q == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_uint32 error", 5);
return False;
}
@@ -211,13 +259,15 @@ BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *da
int end_offset;
char *e;
if (ps->error) return False;
- q = mem_data(&(ps->data), ps->offset);
end_offset = ps->offset + len * sizeof(uint8);
+ prs_grow(ps, end_offset);
+ q = mem_data(&(ps->data), ps->offset);
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_uint8s error", 5);
return False;
}
@@ -236,13 +286,15 @@ BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *
int end_offset;
char *e;
if (ps->error) return False;
- q = mem_data(&(ps->data), ps->offset);
end_offset = ps->offset + len * sizeof(uint16);
+ prs_grow(ps, end_offset);
+ q = mem_data(&(ps->data), ps->offset);
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_uint16s error", 5);
return False;
}
@@ -261,13 +313,15 @@ BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *
int end_offset;
char *e;
if (ps->error) return False;
- q = mem_data(&(ps->data), ps->offset);
end_offset = ps->offset + len * sizeof(uint32);
+ prs_grow(ps, end_offset);
+ q = mem_data(&(ps->data), ps->offset);
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_uint32s error", 5);
return False;
}
@@ -287,13 +341,15 @@ BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2
int end_offset;
char *e;
if (ps->error) return False;
+ end_offset = ps->offset + str->buf_len * sizeof(uint8);
+ prs_grow(ps, end_offset);
q = mem_data(&(ps->data), ps->offset);
- end_offset = ps->offset + str->buf_len;
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_buffer2 error", 5);
return False;
}
@@ -313,13 +369,15 @@ BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2
int end_offset;
char *e;
if (ps->error) return False;
- q = mem_data(&(ps->data), ps->offset);
end_offset = ps->offset + str->str_str_len * sizeof(uint8);
+ prs_grow(ps, end_offset);
+ q = mem_data(&(ps->data), ps->offset);
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_string2 error", 5);
return False;
}
@@ -339,13 +397,15 @@ BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2
int end_offset;
char *e;
if (ps->error) return False;
- q = mem_data(&(ps->data), ps->offset);
end_offset = ps->offset + str->uni_str_len * sizeof(uint16);
+ prs_grow(ps, end_offset);
+ q = mem_data(&(ps->data), ps->offset);
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_unistr2 error", 5);
return False;
}
@@ -365,13 +425,15 @@ BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int d
int end_offset;
char *e;
if (ps->error) return False;
- q = mem_data(&(ps->data), ps->offset);
end_offset = ps->offset + str->uni_str_len * sizeof(uint16);
+ prs_grow(ps, end_offset);
+ q = mem_data(&(ps->data), ps->offset);
e = mem_data(&(ps->data), end_offset-1);
if (q == NULL || e == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_unistr3 error", 5);
return False;
}
@@ -395,10 +457,12 @@ BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
{
char *q;
i++;
+ prs_grow(ps, ps->offset + i*2);
q = mem_data(&(ps->data), ps->offset + i*2);
if (q == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_unistr error", 5);
return False;
}
RW_SVAL(ps->io, q, str->buffer[i],0);
@@ -432,15 +496,19 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u
DEBUG(120,("_prs_string: string %s len %d max %d\n",
str, len, max_buf_size));
+ DEBUG(10,("%s%04x %s: ", tab_depth(depth), ps->offset, name != NULL ? name : ""));
+
do
{
char *q;
i++;
+ prs_grow(ps, ps->offset + i);
q = mem_data(&(ps->data), ps->offset + i);
if (q == NULL)
{
ps->error = True;
+ prs_debug_out(ps, "_prs_string error", 5);
return False;
}
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index 819e441742..ac6ea8ea7e 100644
--- a/source3/rpc_parse/parse_rpc.c
+++ b/source3/rpc_parse/parse_rpc.c
@@ -270,7 +270,7 @@ creates an RPC_ADDR_STR structure.
The name can be null (RPC Alter-Context)
********************************************************************/
-static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, char *name)
+static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, const char *name)
{
if (str == NULL ) return False;
if (name == NULL)
@@ -434,7 +434,7 @@ jfm: nope two ! The pipe_addr can be NULL !
********************************************************************/
BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc,
uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
- char *pipe_addr,
+ const char *pipe_addr,
uint8 num_results, uint16 result, uint16 reason,
RPC_IFACE *transfer)
{
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 8ce5275bae..cedfbdebd3 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -1314,13 +1314,11 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
}
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
prs_align(ps);
}
@@ -1444,13 +1442,11 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_en
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_entry1("", &(sam->sam[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_str1 ("", &(sam->str[i]),
sam->sam[i].hdr_acct_name.buffer,
sam->sam[i].hdr_user_name.buffer,
@@ -1521,13 +1517,11 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_en
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_entry2("", &(sam->sam[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_str2 ("", &(sam->str[i]),
sam->sam[i].hdr_srv_name.buffer,
sam->sam[i].hdr_srv_desc.buffer,
@@ -1597,13 +1591,11 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, uint32 num_en
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_entry3("", &(sam->sam[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_str3 ("", &(sam->str[i]),
sam->sam[i].hdr_grp_name.buffer,
sam->sam[i].hdr_grp_desc.buffer,
@@ -1672,13 +1664,11 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, uint32 num_en
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_entry4("", &(sam->sam[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
smb_io_string2("acct_name", &(sam->str[i].acct_name),
sam->sam[i].hdr_acct_name.buffer, ps, depth);
}
@@ -1744,13 +1734,11 @@ static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, uint32 num_en
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
sam_io_sam_entry5("", &(sam->sam[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
smb_io_string2("grp_name", &(sam->str[i].grp_name),
sam->sam[i].hdr_grp_name.buffer, ps, depth);
}
@@ -2599,7 +2587,6 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc
}
for (i = 0; i < r_u->num_rids; i++)
{
- prs_grow(ps);
prs_uint32("", ps, depth, &(r_u->rid[i]));
}
}
@@ -2621,7 +2608,6 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc
}
for (i = 0; i < r_u->num_attrs; i++)
{
- prs_grow(ps);
prs_uint32("", ps, depth, &(r_u->attr[i]));
}
}
@@ -2753,7 +2739,6 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
smb_io_gid("", &(r_u->gid[i]), ps, depth);
}
}
@@ -2903,7 +2888,6 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps
{
fstring tmp;
slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i);
- prs_grow(ps);
sam_io_sam_entry(tmp, &(r_u->sam[i]), ps, depth);
}
@@ -2911,7 +2895,6 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps
{
fstring tmp;
slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i);
- prs_grow(ps);
smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
prs_align(ps);
}
@@ -3066,13 +3049,11 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
}
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
prs_align(ps);
}
@@ -3227,13 +3208,11 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_st
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
}
for (i = 0; i < r_u->num_entries2; i++)
{
- prs_grow(ps);
smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
prs_align(ps);
}
@@ -3528,7 +3507,6 @@ BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs
{
if (q_u->ptr_sid[i] != 0)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i);
smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth);
}
@@ -3767,7 +3745,6 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps,
for (i = 0; i < q_u->num_rids2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
prs_uint32(tmp, ps, depth, &(q_u->rid[i]));
}
@@ -3902,13 +3879,11 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps,
}
for (i = 0; i < r_u->num_names2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth);
}
for (i = 0; i < r_u->num_names2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth);
prs_align(ps);
@@ -3940,7 +3915,6 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps,
for (i = 0; i < r_u->num_types2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
prs_uint32(tmp, ps, depth, &(r_u->type[i]));
}
@@ -4375,13 +4349,11 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc
for (i = 0; i < r_u->num_sids1; i++)
{
- prs_grow(ps);
ptr_sid[i] = 1;
prs_uint32("", ps, depth, &(ptr_sid[i]));
}
for (i = 0; i < r_u->num_sids1; i++)
{
- prs_grow(ps);
if (ptr_sid[i] != 0)
{
smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth);
@@ -4450,12 +4422,10 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p
for (i = 0; i < q_u->num_names2; i++)
{
- prs_grow(ps);
smb_io_unihdr ("", &(q_u->hdr_name[i]), ps, depth);
}
for (i = 0; i < q_u->num_names2; i++)
{
- prs_grow(ps);
smb_io_unistr2("", &(q_u->uni_name[i]), q_u->hdr_name[i].buffer, ps, depth);
prs_align(ps);
}
@@ -4541,7 +4511,6 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p
for (i = 0; i < r_u->num_rids2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
prs_uint32(tmp, ps, depth, &(r_u->rid[i]));
}
@@ -4562,7 +4531,6 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p
for (i = 0; i < r_u->num_types2; i++)
{
- prs_grow(ps);
slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
prs_uint32(tmp, ps, depth, &(r_u->type[i]));
}
@@ -6289,13 +6257,11 @@ BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct
prs_align(ps);
samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth);
- prs_grow(ps);
samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth);
prs_uint32("unknown", ps, depth, &(q_u->unknown));
samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth);
- prs_grow(ps);
samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth);
return True;
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index d5490553a2..b28b2dcc75 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -376,14 +376,12 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info,
for (i=0;i<info->count;i++)
{
- prs_grow(ps);
smb_io_notify_info_data(desc, &(info->data[i]), ps, depth);
}
/* now do the strings at the end of the stream */
for (i=0;i<info->count;i++)
{
- prs_grow(ps);
smb_io_notify_info_data_strings(desc, &(info->data[i]),
ps, depth);
}
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c
index 8ad275229e..63d27c8c91 100644
--- a/source3/rpc_parse/parse_srv.c
+++ b/source3/rpc_parse/parse_srv.c
@@ -129,13 +129,11 @@ static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_share_info1("", &(ctr->info_1[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth);
}
@@ -267,13 +265,11 @@ static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_stru
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False;
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False;
}
@@ -499,13 +495,11 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_sess_info0_str("", &(ss0->info_0_str[i]),
&(ss0->info_0[i]),
ps, depth);
@@ -628,13 +622,11 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_sess_info1_str("", &(ss1->info_1_str[i]),
&(ss1->info_1[i]),
ps, depth);
@@ -839,7 +831,6 @@ static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth);
}
@@ -959,13 +950,11 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_conn_info1_str("", &(ss1->info_1_str[i]),
&(ss1->info_1[i]),
ps, depth);
@@ -1228,13 +1217,11 @@ static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_tprt_info0_str("", &(tp0->info_0_str[i]),
&(tp0->info_0[i]),
ps, depth);
@@ -1511,13 +1498,11 @@ static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_file_info3("", &(fl3->info_3[i]), ps, depth);
}
for (i = 0; i < num_entries; i++)
{
- prs_grow(ps);
srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth);
}
diff --git a/source3/rpc_server/srv_brs.c b/source3/rpc_server/srv_brs.c
index c2abd28cf8..cde5a79beb 100644
--- a/source3/rpc_server/srv_brs.c
+++ b/source3/rpc_server/srv_brs.c
@@ -66,7 +66,7 @@ static void brs_reply_query_info(BRS_Q_QUERY_INFO *q_u,
/*******************************************************************
api_brs_query_info
********************************************************************/
-static void api_brs_query_info( pipes_struct *p, prs_struct *data,
+static void api_brs_query_info( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
BRS_Q_QUERY_INFO q_u;
@@ -91,7 +91,7 @@ struct api_struct api_brs_cmds[] =
/*******************************************************************
receives a browser pipe and responds.
********************************************************************/
-BOOL api_brs_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_brs_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_brssvc_rpc", api_brs_cmds, data);
}
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index 9b6a98e9a6..fbe83b02c8 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -140,7 +140,7 @@ static void lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata,
{
/* set up the LSA QUERY INFO response */
- r_q.undoc_buffer = 0x1; /* bizarre */
+ r_q.undoc_buffer = 0x1;
r_q.info_class = q_q->info_class;
make_dom_query(&r_q.dom.id5, dom_name, dom_sid);
@@ -448,7 +448,7 @@ static void lsa_reply_lookup_names(prs_struct *rdata,
/***************************************************************************
api_lsa_open_policy
***************************************************************************/
-static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data,
+static void api_lsa_open_policy2( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_OPEN_POL2 q_o;
@@ -467,7 +467,7 @@ static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_open_policy
***************************************************************************/
-static void api_lsa_open_policy( pipes_struct *p, prs_struct *data,
+static void api_lsa_open_policy( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_OPEN_POL q_o;
@@ -486,7 +486,7 @@ static void api_lsa_open_policy( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_enum_trust_dom
***************************************************************************/
-static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data,
+static void api_lsa_enum_trust_dom( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_ENUM_TRUST_DOM q_e;
@@ -503,7 +503,7 @@ static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_query_info
***************************************************************************/
-static void api_lsa_query_info( pipes_struct *p, prs_struct *data,
+static void api_lsa_query_info( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_QUERY_INFO q_i;
@@ -545,7 +545,7 @@ static void api_lsa_query_info( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_lookup_sids
***************************************************************************/
-static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data,
+static void api_lsa_lookup_sids( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_LOOKUP_SIDS q_l;
@@ -561,7 +561,7 @@ static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_lookup_names
***************************************************************************/
-static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data,
+static void api_lsa_lookup_names( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
LSA_Q_LOOKUP_NAMES q_l;
@@ -578,7 +578,7 @@ static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_close
***************************************************************************/
-static void api_lsa_close( pipes_struct *p, prs_struct *data,
+static void api_lsa_close( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
LSA_R_CLOSE r_c;
@@ -607,7 +607,7 @@ static void api_lsa_close( pipes_struct *p, prs_struct *data,
/***************************************************************************
api_lsa_open_secret
***************************************************************************/
-static void api_lsa_open_secret( pipes_struct *p, prs_struct *data,
+static void api_lsa_open_secret( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
/* XXXX this is NOT good */
@@ -648,7 +648,7 @@ static struct api_struct api_lsa_cmds[] =
/***************************************************************************
api_ntLsarpcTNP
***************************************************************************/
-BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_ntlsa_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_ntlsa_rpc", api_lsa_cmds, data);
}
diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c
index f8d7fe5718..22788508eb 100644
--- a/source3/rpc_server/srv_netlog.c
+++ b/source3/rpc_server/srv_netlog.c
@@ -341,7 +341,7 @@ static BOOL get_md4pw(char *md4pw, char *mach_name, char *mach_acct)
/*************************************************************************
api_net_req_chal:
*************************************************************************/
-static void api_net_req_chal( pipes_struct *p,
+static void api_net_req_chal( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -351,12 +351,7 @@ static void api_net_req_chal( pipes_struct *p,
fstring mach_acct;
fstring mach_name;
- user_struct *vuser;
-
- DEBUG(5,("api_net_req_chal(%d): vuid %d\n", __LINE__, (int)p->vuid));
-
- if ((vuser = get_valid_user_struct(p->vuid)) == NULL)
- return;
+ DEBUG(5,("api_net_req_chal(%d)\n", __LINE__));
/* grab the challenge... */
net_io_q_req_chal("", &q_r, data, 0);
@@ -368,23 +363,23 @@ static void api_net_req_chal( pipes_struct *p,
fstrcat(mach_acct, "$");
- if (get_md4pw((char *)vuser->dc.md4pw, mach_name, mach_acct))
+ if (get_md4pw((char *)p->dc.md4pw, mach_name, mach_acct))
{
/* copy the client credentials */
- memcpy(vuser->dc.clnt_chal.data , q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data));
- memcpy(vuser->dc.clnt_cred.challenge.data, q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data));
+ memcpy(p->dc.clnt_chal.data , q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data));
+ memcpy(p->dc.clnt_cred.challenge.data, q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data));
/* create a server challenge for the client */
/* Set these to random values. */
- generate_random_buffer(vuser->dc.srv_chal.data, 8, False);
+ generate_random_buffer(p->dc.srv_chal.data, 8, False);
- memcpy(vuser->dc.srv_cred.challenge.data, vuser->dc.srv_chal.data, 8);
+ memcpy(p->dc.srv_cred.challenge.data, p->dc.srv_chal.data, 8);
- bzero(vuser->dc.sess_key, sizeof(vuser->dc.sess_key));
+ bzero(p->dc.sess_key, sizeof(p->dc.sess_key));
/* from client / server challenges and md4 password, generate sess key */
- cred_session_key(&(vuser->dc.clnt_chal), &(vuser->dc.srv_chal),
- (char *)vuser->dc.md4pw, vuser->dc.sess_key);
+ cred_session_key(&(p->dc.clnt_chal), &(p->dc.srv_chal),
+ (char *)p->dc.md4pw, p->dc.sess_key);
}
else
{
@@ -394,14 +389,14 @@ static void api_net_req_chal( pipes_struct *p,
/* construct reply. */
net_reply_req_chal(&q_r, rdata,
- &(vuser->dc.srv_chal), status);
+ &(p->dc.srv_chal), status);
}
/*************************************************************************
api_net_auth:
*************************************************************************/
-static void api_net_auth( pipes_struct *p,
+static void api_net_auth( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -411,27 +406,22 @@ static void api_net_auth( pipes_struct *p,
DOM_CHAL srv_cred;
UTIME srv_time;
- user_struct *vuser;
-
- if ((vuser = get_valid_user_struct(p->vuid)) == NULL)
- return;
-
srv_time.time = 0;
/* grab the challenge... */
net_io_q_auth("", &q_a, data, 0);
/* check that the client credentials are valid */
- if (cred_assert(&(q_a.clnt_chal), vuser->dc.sess_key,
- &(vuser->dc.clnt_cred.challenge), srv_time))
+ if (cred_assert(&(q_a.clnt_chal), p->dc.sess_key,
+ &(p->dc.clnt_cred.challenge), srv_time))
{
/* create server challenge for inclusion in the reply */
- cred_create(vuser->dc.sess_key, &(vuser->dc.srv_cred.challenge), srv_time, &srv_cred);
+ cred_create(p->dc.sess_key, &(p->dc.srv_cred.challenge), srv_time, &srv_cred);
/* copy the received client credentials for use next time */
- memcpy(vuser->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
- memcpy(vuser->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
+ memcpy(p->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
+ memcpy(p->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
}
else
{
@@ -445,7 +435,7 @@ static void api_net_auth( pipes_struct *p,
/*************************************************************************
api_net_auth_2:
*************************************************************************/
-static void api_net_auth_2( pipes_struct *p,
+static void api_net_auth_2( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -455,27 +445,22 @@ static void api_net_auth_2( pipes_struct *p,
DOM_CHAL srv_cred;
UTIME srv_time;
- user_struct *vuser;
-
- if ((vuser = get_valid_user_struct(p->vuid)) == NULL)
- return;
-
srv_time.time = 0;
/* grab the challenge... */
net_io_q_auth_2("", &q_a, data, 0);
/* check that the client credentials are valid */
- if (cred_assert(&(q_a.clnt_chal), vuser->dc.sess_key,
- &(vuser->dc.clnt_cred.challenge), srv_time))
+ if (cred_assert(&(q_a.clnt_chal), p->dc.sess_key,
+ &(p->dc.clnt_cred.challenge), srv_time))
{
/* create server challenge for inclusion in the reply */
- cred_create(vuser->dc.sess_key, &(vuser->dc.srv_cred.challenge), srv_time, &srv_cred);
+ cred_create(p->dc.sess_key, &(p->dc.srv_cred.challenge), srv_time, &srv_cred);
/* copy the received client credentials for use next time */
- memcpy(vuser->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
- memcpy(vuser->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
+ memcpy(p->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
+ memcpy(p->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
}
else
{
@@ -489,7 +474,7 @@ static void api_net_auth_2( pipes_struct *p,
/*************************************************************************
api_net_srv_pwset:
*************************************************************************/
-static void api_net_srv_pwset( pipes_struct *p,
+static void api_net_srv_pwset( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -499,19 +484,15 @@ static void api_net_srv_pwset( pipes_struct *p,
pstring mach_acct;
struct smb_passwd *smb_pass;
BOOL ret;
- user_struct *vuser;
-
- if ((vuser = get_valid_user_struct(p->vuid)) == NULL)
- return;
/* grab the challenge and encrypted password ... */
net_io_q_srv_pwset("", &q_a, data, 0);
/* checks and updates credentials. creates reply credentials */
- if (deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred),
+ if (deal_with_creds(p->dc.sess_key, &(p->dc.clnt_cred),
&(q_a.clnt_id.cred), &srv_cred))
{
- memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred));
+ memcpy(&(p->dc.srv_cred), &(p->dc.clnt_cred), sizeof(p->dc.clnt_cred));
DEBUG(5,("api_net_srv_pwset: %d\n", __LINE__));
@@ -536,7 +517,7 @@ static void api_net_srv_pwset( pipes_struct *p,
}
DEBUG(100,("\n"));
- cred_hash3( pwd, q_a.pwd, vuser->dc.sess_key, 0);
+ cred_hash3( pwd, q_a.pwd, p->dc.sess_key, 0);
/* lies! nt and lm passwords are _not_ the same: don't care */
smb_pass->smb_passwd = pwd;
@@ -571,7 +552,7 @@ static void api_net_srv_pwset( pipes_struct *p,
/*************************************************************************
api_net_sam_logoff:
*************************************************************************/
-static void api_net_sam_logoff( pipes_struct *p,
+static void api_net_sam_logoff( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -580,11 +561,6 @@ static void api_net_sam_logoff( pipes_struct *p,
DOM_CRED srv_cred;
- user_struct *vuser;
-
- if ((vuser = get_valid_user_struct(p->vuid)) == NULL)
- return;
-
/* the DOM_ID_INFO_1 structure is a bit big. plus we might want to
dynamically allocate it inside net_io_q_sam_logon, at some point */
q_l.sam_id.ctr = &ctr;
@@ -593,9 +569,9 @@ static void api_net_sam_logoff( pipes_struct *p,
net_io_q_sam_logoff("", &q_l, data, 0);
/* checks and updates credentials. creates reply credentials */
- deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred),
+ deal_with_creds(p->dc.sess_key, &(p->dc.clnt_cred),
&(q_l.sam_id.client.cred), &srv_cred);
- memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred));
+ memcpy(&(p->dc.srv_cred), &(p->dc.clnt_cred), sizeof(p->dc.clnt_cred));
/* construct reply. always indicate success */
net_reply_sam_logoff(&q_l, rdata, &srv_cred, 0x0);
@@ -604,27 +580,23 @@ static void api_net_sam_logoff( pipes_struct *p,
/*************************************************************************
api_net_sam_sync:
*************************************************************************/
-static void api_net_sam_sync( pipes_struct *p,
+static void api_net_sam_sync( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
NET_Q_SAM_SYNC q_s;
DOM_CRED srv_creds;
- user_struct *vuser;
uint32 status = 0x0;
- if ((vuser = get_valid_user_struct(p->vuid)) == NULL)
- return;
-
/* grab the challenge... */
net_io_q_sam_sync("", &q_s, data, 0);
/* checks and updates credentials. creates reply credentials */
- if (deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred),
+ if (deal_with_creds(p->dc.sess_key, &(p->dc.clnt_cred),
&(q_s.cli_creds), &srv_creds))
{
- memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred),
- sizeof(vuser->dc.clnt_cred));
+ memcpy(&(p->dc.srv_cred), &(p->dc.clnt_cred),
+ sizeof(p->dc.clnt_cred));
}
else
{
@@ -632,7 +604,7 @@ static void api_net_sam_sync( pipes_struct *p,
}
/* construct reply. */
- net_reply_sam_sync(&q_s, rdata, vuser->dc.sess_key, &srv_creds, status);
+ net_reply_sam_sync(&q_s, rdata, p->dc.sess_key, &srv_creds, status);
}
@@ -641,7 +613,7 @@ static void api_net_sam_sync( pipes_struct *p,
*************************************************************************/
static uint32 net_login_interactive(NET_ID_INFO_1 *id1,
struct sam_passwd *smb_pass,
- user_struct *vuser)
+ struct dcinfo *dc)
{
uint32 status = 0x0;
@@ -650,7 +622,7 @@ static uint32 net_login_interactive(NET_ID_INFO_1 *id1,
unsigned char key[16];
memset(key, 0, 16);
- memcpy(key, vuser->dc.sess_key, 8);
+ memcpy(key, dc->sess_key, 8);
memcpy(lm_pwd, id1->lm_owf.data, 16);
memcpy(nt_pwd, id1->nt_owf.data, 16);
@@ -698,7 +670,7 @@ static uint32 net_login_interactive(NET_ID_INFO_1 *id1,
*************************************************************************/
static uint32 net_login_network(NET_ID_INFO_2 *id2,
struct sam_passwd *sam_pass,
- user_struct *vuser,
+ struct dcinfo *dc,
char sess_key[16])
{
fstring user;
@@ -723,7 +695,7 @@ static uint32 net_login_network(NET_ID_INFO_2 *id2,
unsigned char key[16];
memset(key, 0, 16);
- memcpy(key, vuser->dc.sess_key, 8);
+ memcpy(key, dc->sess_key, 8);
#ifdef DEBUG_PASSWORD
DEBUG(100,("key:"));
@@ -749,8 +721,9 @@ static uint32 net_login_network(NET_ID_INFO_2 *id2,
/*************************************************************************
api_net_sam_logon:
*************************************************************************/
-static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser,
- DOM_CRED *srv_cred, NET_USER_INFO_3 *usr_info)
+static uint32 reply_net_sam_logon(NET_Q_SAM_LOGON *q_l,
+ struct dcinfo *dc,
+ DOM_CRED *srv_cred, NET_USER_INFO_3 *usr_info)
{
struct sam_passwd *sam_pass = NULL;
UNISTR2 *uni_samusr = NULL;
@@ -781,13 +754,13 @@ static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser,
DOM_GID *gids = NULL;
/* checks and updates credentials. creates reply credentials */
- if (!deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred),
+ if (!deal_with_creds(dc->sess_key, &(dc->clnt_cred),
&(q_l->sam_id.client.cred), srv_cred))
{
return 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
- memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred));
+ memcpy(&(dc->srv_cred), &(dc->clnt_cred), sizeof(dc->clnt_cred));
/* find the username */
@@ -864,13 +837,13 @@ static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser,
case INTERACTIVE_LOGON_TYPE:
{
/* interactive login. */
- status = net_login_interactive(&q_l->sam_id.ctr->auth.id1, sam_pass, vuser);
+ status = net_login_interactive(&q_l->sam_id.ctr->auth.id1, sam_pass, dc);
break;
}
case NET_LOGON_TYPE:
{
/* network login. lm challenge and 24 byte responses */
- status = net_login_network(&q_l->sam_id.ctr->auth.id2, sam_pass, vuser, sess_key);
+ status = net_login_network(&q_l->sam_id.ctr->auth.id2, sam_pass, dc, sess_key);
enc_user_sess_key = sess_key;
break;
}
@@ -941,7 +914,7 @@ static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser,
/*************************************************************************
api_net_sam_logon:
*************************************************************************/
-static void api_net_sam_logon( pipes_struct *p,
+static void api_net_sam_logon( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -951,17 +924,10 @@ static void api_net_sam_logon( pipes_struct *p,
uint32 status = 0x0;
DOM_CRED srv_cred;
- user_struct *vuser = get_valid_user_struct(p->vuid);
-
- if (vuser == NULL)
- {
- return;
- }
-
q_l.sam_id.ctr = &ctr;
net_io_q_sam_logon("", &q_l, data, 0);
- status = reply_net_sam_logon(&q_l, vuser, &srv_cred, &usr_info);
+ status = reply_net_sam_logon(&q_l, &p->dc, &srv_cred, &usr_info);
net_reply_sam_logon(&q_l, rdata, &srv_cred, &usr_info, status);
}
@@ -969,7 +935,7 @@ static void api_net_sam_logon( pipes_struct *p,
/*************************************************************************
api_net_trust_dom_list:
*************************************************************************/
-static void api_net_trust_dom_list( pipes_struct *p,
+static void api_net_trust_dom_list( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -1003,7 +969,7 @@ static void api_net_trust_dom_list( pipes_struct *p,
/*************************************************************************
api_net_logon_ctrl2:
*************************************************************************/
-static void api_net_logon_ctrl2( pipes_struct *p,
+static void api_net_logon_ctrl2( rpcsrv_struct *p,
prs_struct *data,
prs_struct *rdata)
{
@@ -1049,7 +1015,7 @@ static struct api_struct api_net_cmds [] =
/*******************************************************************
receives a netlogon pipe and responds.
********************************************************************/
-BOOL api_netlog_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_netlog_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_netlog_rpc", api_net_cmds, data);
}
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index ca87cafcf7..73a06b208c 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -43,7 +43,7 @@
extern int DEBUGLEVEL;
-static void NTLMSSPcalc_p( pipes_struct *p, unsigned char *data, int len)
+static void NTLMSSPcalc_p( rpcsrv_struct *p, unsigned char *data, int len)
{
unsigned char *hash = p->ntlmssp_hash;
unsigned char index_i = hash[256];
@@ -71,27 +71,40 @@ static void NTLMSSPcalc_p( pipes_struct *p, unsigned char *data, int len)
}
/*******************************************************************
+ frees all temporary data used in construction of pdu
+ ********************************************************************/
+void rpcsrv_free_temp(rpcsrv_struct *l)
+{
+ mem_free_data(l->rhdr .data);
+ mem_free_data(l->rfault .data);
+ mem_free_data(l->rdata_i.data);
+ mem_free_data(l->rauth .data);
+ mem_free_data(l->rverf .data);
+ mem_free_data(l->rntlm .data);
+}
+
+/*******************************************************************
turns a DCE/RPC request into a DCE/RPC reply
this is where the data really should be split up into an array of
headers and data sections.
********************************************************************/
-BOOL create_rpc_reply(pipes_struct *p,
- uint32 data_start, uint32 data_end)
+BOOL create_rpc_reply(rpcsrv_struct *l, uint32 data_start)
{
char *data;
- BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN);
- BOOL auth_seal = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL);
+ BOOL auth_verify = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN);
+ BOOL auth_seal = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL);
uint32 data_len;
uint32 auth_len;
+ uint32 data_end = l->rdata.offset + (l->ntlmssp_auth ? (8 + 16) : 0);
DEBUG(5,("create_rpc_reply: data_start: %d data_end: %d max_tsize: %d\n",
- data_start, data_end, p->hdr_ba.bba.max_tsize));
+ data_start, data_end, l->hdr_ba.bba.max_tsize));
- auth_len = p->hdr.auth_len;
+ auth_len = l->hdr.auth_len;
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
DEBUG(10,("create_rpc_reply: auth\n"));
if (auth_len != 16)
@@ -100,63 +113,63 @@ BOOL create_rpc_reply(pipes_struct *p,
}
}
- prs_init(&p->rhdr , 0x18, 4, 0, False);
- prs_init(&p->rauth, 1024, 4, 0, False);
- prs_init(&p->rverf, 0x10, 4, 0, False);
+ prs_init(&l->rhdr , 0x18, 4, 0, False);
+ prs_init(&l->rauth, 1024, 4, 0, False);
+ prs_init(&l->rverf, 0x10, 4, 0, False);
- p->hdr.pkt_type = RPC_RESPONSE; /* mark header as an rpc response */
+ l->hdr.pkt_type = RPC_RESPONSE; /* mark header as an rpc response */
/* set up rpc header (fragmentation issues) */
if (data_start == 0)
{
- p->hdr.flags = RPC_FLG_FIRST;
+ l->hdr.flags = RPC_FLG_FIRST;
}
else
{
- p->hdr.flags = 0;
+ l->hdr.flags = 0;
}
- p->hdr_resp.alloc_hint = data_end - data_start; /* calculate remaining data to be sent */
+ l->hdr_resp.alloc_hint = data_end - data_start; /* calculate remaining data to be sent */
- if (p->hdr_resp.alloc_hint + 0x18 <= p->hdr_ba.bba.max_tsize)
+ if (l->hdr_resp.alloc_hint + 0x18 <= l->hdr_ba.bba.max_tsize)
{
- p->hdr.flags |= RPC_FLG_LAST;
- p->hdr.frag_len = p->hdr_resp.alloc_hint + 0x18;
+ l->hdr.flags |= RPC_FLG_LAST;
+ l->hdr.frag_len = l->hdr_resp.alloc_hint + 0x18;
}
else
{
- p->hdr.frag_len = p->hdr_ba.bba.max_tsize;
+ l->hdr.frag_len = l->hdr_ba.bba.max_tsize;
}
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
- p->hdr_resp.alloc_hint -= auth_len + 8;
+ l->hdr_resp.alloc_hint -= auth_len + 8;
}
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
- data_len = p->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18;
+ data_len = l->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18;
}
else
{
- data_len = p->hdr.frag_len - 0x18;
+ data_len = l->hdr.frag_len - 0x18;
}
- p->rhdr.data->offset.start = 0;
- p->rhdr.data->offset.end = 0x18;
+ l->rhdr.data->offset.start = 0;
+ l->rhdr.data->offset.end = 0x18;
/* store the header in the data stream */
- smb_io_rpc_hdr ("hdr" , &(p->hdr ), &(p->rhdr), 0);
- smb_io_rpc_hdr_resp("resp", &(p->hdr_resp), &(p->rhdr), 0);
+ smb_io_rpc_hdr ("hdr" , &(l->hdr ), &(l->rhdr), 0);
+ smb_io_rpc_hdr_resp("resp", &(l->hdr_resp), &(l->rhdr), 0);
/* don't use rdata: use rdata_i instead, which moves... */
/* make a pointer to the rdata data, NOT A COPY */
- p->rdata_i.data = NULL;
- prs_init(&p->rdata_i, 0, p->rdata.align, p->rdata.data->margin, p->rdata.io);
- data = mem_data(&(p->rdata.data), data_start);
- mem_create(p->rdata_i.data, data, 0, data_len, 0, False);
- p->rdata_i.offset = data_len;
+ l->rdata_i.data = NULL;
+ prs_init(&l->rdata_i, 0, l->rdata.align, l->rdata.data->margin, l->rdata.io);
+ data = mem_data(&(l->rdata.data), data_start);
+ mem_create(l->rdata_i.data, data, 0, data_len, 0, False);
+ l->rdata_i.offset = data_len;
if (auth_len > 0)
{
@@ -168,44 +181,44 @@ BOOL create_rpc_reply(pipes_struct *p,
if (auth_seal)
{
crc32 = crc32_calc_buffer(data_len, data);
- NTLMSSPcalc_p(p, (uchar*)data, data_len);
+ NTLMSSPcalc_p(l, (uchar*)data, data_len);
}
if (auth_seal || auth_verify)
{
- make_rpc_hdr_auth(&p->auth_info, 0x0a, 0x06, 0x08, (auth_verify ? 1 : 0));
- smb_io_rpc_hdr_auth("hdr_auth", &p->auth_info, &p->rauth, 0);
+ make_rpc_hdr_auth(&l->auth_info, 0x0a, 0x06, 0x08, (auth_verify ? 1 : 0));
+ smb_io_rpc_hdr_auth("hdr_auth", &l->auth_info, &l->rauth, 0);
}
if (auth_verify)
{
char *auth_data;
- p->ntlmssp_seq_num++;
- make_rpc_auth_ntlmssp_chk(&p->ntlmssp_chk, NTLMSSP_SIGN_VERSION, crc32, p->ntlmssp_seq_num++);
- smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(p->ntlmssp_chk), &p->rverf, 0);
- auth_data = mem_data(&p->rverf.data, 4);
- NTLMSSPcalc_p(p, (uchar*)auth_data, 12);
+ l->ntlmssp_seq_num++;
+ make_rpc_auth_ntlmssp_chk(&l->ntlmssp_chk, NTLMSSP_SIGN_VERSION, crc32, l->ntlmssp_seq_num++);
+ smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(l->ntlmssp_chk), &l->rverf, 0);
+ auth_data = mem_data(&l->rverf.data, 4);
+ NTLMSSPcalc_p(l, (uchar*)auth_data, 12);
}
}
/* set up the data chain */
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
- prs_link(NULL , &p->rhdr , &p->rdata_i);
- prs_link(&p->rhdr , &p->rdata_i, &p->rauth );
- prs_link(&p->rdata_i, &p->rauth , &p->rverf );
- prs_link(&p->rauth , &p->rverf , NULL );
+ prs_link(NULL , &l->rhdr , &l->rdata_i);
+ prs_link(&l->rhdr , &l->rdata_i, &l->rauth );
+ prs_link(&l->rdata_i, &l->rauth , &l->rverf );
+ prs_link(&l->rauth , &l->rverf , NULL );
}
else
{
- prs_link(NULL , &p->rhdr , &p->rdata_i);
- prs_link(&p->rhdr, &p->rdata_i, NULL );
+ prs_link(NULL , &l->rhdr , &l->rdata_i);
+ prs_link(&l->rhdr, &l->rdata_i, NULL );
}
- return p->rhdr.data != NULL && p->rhdr.offset == 0x18;
+ return l->rhdr.data != NULL && l->rhdr.offset == 0x18;
}
-static BOOL api_pipe_ntlmssp_verify(pipes_struct *p)
+static BOOL api_pipe_ntlmssp_verify(rpcsrv_struct *l)
{
uchar *pwd = NULL;
uchar null_pwd[16];
@@ -220,23 +233,15 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p)
struct smb_passwd *smb_pass = NULL;
- user_struct *vuser = get_valid_user_struct(p->vuid);
-
memset(null_pwd, 0, sizeof(null_pwd));
DEBUG(5,("api_pipe_ntlmssp_verify: checking user details\n"));
- if (vuser == NULL)
- {
- DEBUG(0,("get user struct %d failed\n", p->vuid));
- return False;
- }
-
- lm_owf_len = p->ntlmssp_resp.hdr_lm_resp.str_str_len;
- nt_owf_len = p->ntlmssp_resp.hdr_nt_resp.str_str_len;
- usr_len = p->ntlmssp_resp.hdr_usr .str_str_len;
- dom_len = p->ntlmssp_resp.hdr_domain .str_str_len;
- wks_len = p->ntlmssp_resp.hdr_wks .str_str_len;
+ lm_owf_len = l->ntlmssp_resp.hdr_lm_resp.str_str_len;
+ nt_owf_len = l->ntlmssp_resp.hdr_nt_resp.str_str_len;
+ usr_len = l->ntlmssp_resp.hdr_usr .str_str_len;
+ dom_len = l->ntlmssp_resp.hdr_domain .str_str_len;
+ wks_len = l->ntlmssp_resp.hdr_wks .str_str_len;
if (lm_owf_len == 0 && nt_owf_len == 0 &&
usr_len == 0 && dom_len == 0 && wks_len == 0)
@@ -247,65 +252,65 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p)
{
if (lm_owf_len == 0) return False;
if (nt_owf_len == 0) return False;
- if (p->ntlmssp_resp.hdr_usr .str_str_len == 0) return False;
- if (p->ntlmssp_resp.hdr_domain .str_str_len == 0) return False;
- if (p->ntlmssp_resp.hdr_wks .str_str_len == 0) return False;
+ if (l->ntlmssp_resp.hdr_usr .str_str_len == 0) return False;
+ if (l->ntlmssp_resp.hdr_domain .str_str_len == 0) return False;
+ if (l->ntlmssp_resp.hdr_wks .str_str_len == 0) return False;
}
if (lm_owf_len > sizeof(lm_owf)) return False;
if (nt_owf_len > sizeof(nt_owf)) return False;
- memcpy(lm_owf, p->ntlmssp_resp.lm_resp, sizeof(lm_owf));
- memcpy(nt_owf, p->ntlmssp_resp.nt_resp, sizeof(nt_owf));
+ memcpy(lm_owf, l->ntlmssp_resp.lm_resp, sizeof(lm_owf));
+ memcpy(nt_owf, l->ntlmssp_resp.nt_resp, sizeof(nt_owf));
#ifdef DEBUG_PASSWORD
DEBUG(100,("lm, nt owfs, chal\n"));
dump_data(100, lm_owf, sizeof(lm_owf));
dump_data(100, nt_owf, sizeof(nt_owf));
- dump_data(100, p->ntlmssp_chal.challenge, 8);
+ dump_data(100, l->ntlmssp_chal.challenge, 8);
#endif
- memset(p->user_name, 0, sizeof(p->user_name));
- memset(p->domain , 0, sizeof(p->domain ));
- memset(p->wks , 0, sizeof(p->wks ));
+ memset(l->user_name, 0, sizeof(l->user_name));
+ memset(l->domain , 0, sizeof(l->domain ));
+ memset(l->wks , 0, sizeof(l->wks ));
- if (IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_UNICODE))
+ if (IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_UNICODE))
{
- unibuf_to_ascii(p->user_name, p->ntlmssp_resp.user,
- MIN(p->ntlmssp_resp.hdr_usr .str_str_len/2,
- sizeof(p->user_name)-1));
- unibuf_to_ascii(p->domain , p->ntlmssp_resp.domain,
- MIN(p->ntlmssp_resp.hdr_domain.str_str_len/2,
- sizeof(p->domain )-1));
- unibuf_to_ascii(p->wks , p->ntlmssp_resp.wks,
- MIN(p->ntlmssp_resp.hdr_wks .str_str_len/2,
- sizeof(p->wks )-1));
+ unibuf_to_ascii(l->user_name, l->ntlmssp_resp.user,
+ MIN(l->ntlmssp_resp.hdr_usr .str_str_len/2,
+ sizeof(l->user_name)-1));
+ unibuf_to_ascii(l->domain , l->ntlmssp_resp.domain,
+ MIN(l->ntlmssp_resp.hdr_domain.str_str_len/2,
+ sizeof(l->domain )-1));
+ unibuf_to_ascii(l->wks , l->ntlmssp_resp.wks,
+ MIN(l->ntlmssp_resp.hdr_wks .str_str_len/2,
+ sizeof(l->wks )-1));
}
else
{
- fstrcpy(p->user_name, p->ntlmssp_resp.user );
- fstrcpy(p->domain , p->ntlmssp_resp.domain);
- fstrcpy(p->wks , p->ntlmssp_resp.wks );
+ fstrcpy(l->user_name, l->ntlmssp_resp.user );
+ fstrcpy(l->domain , l->ntlmssp_resp.domain);
+ fstrcpy(l->wks , l->ntlmssp_resp.wks );
}
if (anonymous)
{
DEBUG(5,("anonymous user session\n"));
- mdfour(vuser->dc.user_sess_key, null_pwd, 16);
+ mdfour(l->user_sess_key, null_pwd, 16);
pwd = null_pwd;
- p->ntlmssp_validated = True;
+ l->ntlmssp_validated = True;
}
else
{
- DEBUG(5,("user: %s domain: %s wks: %s\n", p->user_name, p->domain, p->wks));
+ DEBUG(5,("user: %s domain: %s wks: %s\n", l->user_name, l->domain, l->wks));
become_root(True);
- smb_pass = getsmbpwnam(p->user_name);
- p->ntlmssp_validated = pass_check_smb(smb_pass, p->domain,
- (uchar*)p->ntlmssp_chal.challenge,
+ smb_pass = getsmbpwnam(l->user_name);
+ l->ntlmssp_validated = pass_check_smb(smb_pass, l->domain,
+ (uchar*)l->ntlmssp_chal.challenge,
lm_owf, lm_owf_len,
nt_owf, nt_owf_len,
- NULL, vuser->dc.user_sess_key);
+ NULL, l->user_sess_key);
unbecome_root(True);
if (smb_pass != NULL)
@@ -314,7 +319,7 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p)
}
}
- if (p->ntlmssp_validated && pwd != NULL)
+ if (l->ntlmssp_validated && pwd != NULL)
{
uchar p24[24];
NTLMSSPOWFencrypt(pwd, lm_owf, p24);
@@ -331,47 +336,47 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p)
for (ind = 0; ind < 256; ind++)
{
- p->ntlmssp_hash[ind] = (unsigned char)ind;
+ l->ntlmssp_hash[ind] = (unsigned char)ind;
}
for( ind = 0; ind < 256; ind++)
{
unsigned char tc;
- j += (p->ntlmssp_hash[ind] + k2[ind%8]);
+ j += (l->ntlmssp_hash[ind] + k2[ind%8]);
- tc = p->ntlmssp_hash[ind];
- p->ntlmssp_hash[ind] = p->ntlmssp_hash[j];
- p->ntlmssp_hash[j] = tc;
+ tc = l->ntlmssp_hash[ind];
+ l->ntlmssp_hash[ind] = l->ntlmssp_hash[j];
+ l->ntlmssp_hash[j] = tc;
}
- p->ntlmssp_hash[256] = 0;
- p->ntlmssp_hash[257] = 0;
+ l->ntlmssp_hash[256] = 0;
+ l->ntlmssp_hash[257] = 0;
}
- p->ntlmssp_seq_num = 0;
+ l->ntlmssp_seq_num = 0;
}
else
{
- p->ntlmssp_validated = False;
+ l->ntlmssp_validated = False;
}
- return p->ntlmssp_validated;
+ return l->ntlmssp_validated;
}
-static BOOL api_pipe_ntlmssp(pipes_struct *p, prs_struct *pd)
+static BOOL api_pipe_ntlmssp(rpcsrv_struct *l, prs_struct *pd)
{
/* receive a negotiate; send a challenge; receive a response */
- switch (p->auth_verifier.msg_type)
+ switch (l->auth_verifier.msg_type)
{
case NTLMSSP_NEGOTIATE:
{
- smb_io_rpc_auth_ntlmssp_neg("", &p->ntlmssp_neg, pd, 0);
+ smb_io_rpc_auth_ntlmssp_neg("", &l->ntlmssp_neg, pd, 0);
break;
}
case NTLMSSP_AUTH:
{
- smb_io_rpc_auth_ntlmssp_resp("", &p->ntlmssp_resp, pd, 0);
- if (!api_pipe_ntlmssp_verify(p))
+ smb_io_rpc_auth_ntlmssp_resp("", &l->ntlmssp_resp, pd, 0);
+ if (!api_pipe_ntlmssp_verify(l))
{
pd->offset = 0;
}
@@ -381,7 +386,7 @@ static BOOL api_pipe_ntlmssp(pipes_struct *p, prs_struct *pd)
{
/* NTLMSSP expected: unexpected message type */
DEBUG(3,("unexpected message type in NTLMSSP %d\n",
- p->auth_verifier.msg_type));
+ l->auth_verifier.msg_type));
return False;
}
}
@@ -393,7 +398,7 @@ struct api_cmd
{
char * pipe_clnt_name;
char * pipe_srv_name;
- BOOL (*fn) (pipes_struct *, prs_struct *);
+ BOOL (*fn) (rpcsrv_struct *, prs_struct *);
};
static struct api_cmd **api_fd_commands = NULL;
@@ -480,7 +485,7 @@ void close_msrpc_command_processor(void)
void add_msrpc_command_processor(char* pipe_name,
char* process_name,
- BOOL (*fn) (pipes_struct *, prs_struct *))
+ BOOL (*fn) (rpcsrv_struct *, prs_struct *))
{
struct api_cmd cmd;
cmd.pipe_clnt_name = pipe_name;
@@ -490,269 +495,281 @@ void add_msrpc_command_processor(char* pipe_name,
add_api_cmd_to_array(&num_cmds, &api_fd_commands, &cmd);
}
-static BOOL api_pipe_bind_auth_resp(pipes_struct *p, prs_struct *pd)
+static BOOL api_pipe_bind_auth_resp(rpcsrv_struct *l, prs_struct *pd)
{
DEBUG(5,("api_pipe_bind_auth_resp: decode request. %d\n", __LINE__));
- if (p->hdr.auth_len == 0) return False;
+ if (l->hdr.auth_len == 0) return False;
/* decode the authentication verifier response */
- smb_io_rpc_hdr_autha("", &p->autha_info, pd, 0);
+ smb_io_rpc_hdr_autha("", &l->autha_info, pd, 0);
if (pd->offset == 0) return False;
- if (!rpc_hdr_auth_chk(&(p->auth_info))) return False;
+ if (!rpc_hdr_auth_chk(&(l->auth_info))) return False;
- smb_io_rpc_auth_ntlmssp_verifier("", &p->auth_verifier, pd, 0);
+ smb_io_rpc_auth_ntlmssp_verifier("", &l->auth_verifier, pd, 0);
if (pd->offset == 0) return False;
- if (!rpc_auth_ntlmssp_verifier_chk(&(p->auth_verifier), "NTLMSSP", NTLMSSP_AUTH)) return False;
+ if (!rpc_auth_ntlmssp_verifier_chk(&(l->auth_verifier), "NTLMSSP", NTLMSSP_AUTH)) return False;
- return api_pipe_ntlmssp(p, pd);
+ return api_pipe_ntlmssp(l, pd);
}
-static BOOL api_pipe_fault_resp(pipes_struct *p, prs_struct *pd, uint32 status)
+static BOOL api_pipe_fault_resp(rpcsrv_struct *l, prs_struct *pd, uint32 status)
{
DEBUG(5,("api_pipe_fault_resp: make response\n"));
- prs_init(&(p->rhdr ), 0x18, 4, 0, False);
- prs_init(&(p->rfault ), 0x8 , 4, 0, False);
+ prs_init(&(l->rhdr ), 0x18, 4, 0, False);
+ prs_init(&(l->rfault ), 0x8 , 4, 0, False);
/***/
/*** set up the header, response header and fault status ***/
/***/
- p->hdr_fault.status = status;
- p->hdr_fault.reserved = 0x0;
+ l->hdr_fault.status = status;
+ l->hdr_fault.reserved = 0x0;
- p->hdr_resp.alloc_hint = 0x0;
- p->hdr_resp.cancel_count = 0x0;
- p->hdr_resp.reserved = 0x0;
+ l->hdr_resp.alloc_hint = 0x0;
+ l->hdr_resp.cancel_count = 0x0;
+ l->hdr_resp.reserved = 0x0;
- make_rpc_hdr(&p->hdr, RPC_FAULT, RPC_FLG_NOCALL | RPC_FLG_FIRST | RPC_FLG_LAST,
- p->hdr.call_id,
+ make_rpc_hdr(&l->hdr, RPC_FAULT, RPC_FLG_NOCALL | RPC_FLG_FIRST | RPC_FLG_LAST,
+ l->hdr.call_id,
0x20,
0);
- smb_io_rpc_hdr ("hdr" , &(p->hdr ), &(p->rhdr), 0);
- smb_io_rpc_hdr_resp ("resp" , &(p->hdr_resp ), &(p->rhdr), 0);
- smb_io_rpc_hdr_fault("fault", &(p->hdr_fault), &(p->rfault), 0);
- mem_realloc_data(p->rhdr.data, p->rhdr.offset);
- mem_realloc_data(p->rfault.data, p->rfault.offset);
+ smb_io_rpc_hdr ("hdr" , &(l->hdr ), &(l->rhdr), 0);
+ smb_io_rpc_hdr_resp ("resp" , &(l->hdr_resp ), &(l->rhdr), 0);
+ smb_io_rpc_hdr_fault("fault", &(l->hdr_fault), &(l->rfault), 0);
+ mem_realloc_data(l->rhdr.data, l->rhdr.offset);
+ mem_realloc_data(l->rfault.data, l->rfault.offset);
/***/
/*** link rpc header and fault together ***/
/***/
- prs_link(NULL , &p->rhdr , &p->rfault);
- prs_link(&p->rhdr, &p->rfault, NULL );
+ prs_link(NULL , &l->rhdr , &l->rfault);
+ prs_link(&l->rhdr, &l->rfault, NULL );
return True;
}
-static BOOL api_pipe_bind_and_alt_req(pipes_struct *p, prs_struct *pd, enum RPC_PKT_TYPE pkt_type)
+static BOOL srv_pipe_bind_and_alt_req(rpcsrv_struct *l, prs_struct *pd,
+ const char* ack_pipe_name,
+ enum RPC_PKT_TYPE pkt_type)
{
uint16 assoc_gid;
- fstring ack_pipe_name;
- int i = 0;
-
- p->ntlmssp_auth = False;
-
- DEBUG(5,("api_pipe_bind_req: decode request. %d\n", __LINE__));
-
- for (i = 0; i < num_cmds; i++)
- {
- if (strequal(api_fd_commands[i]->pipe_clnt_name, p->name) &&
- api_fd_commands[i]->fn != NULL)
- {
- DEBUG(3,("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n",
- api_fd_commands[i]->pipe_clnt_name,
- api_fd_commands[i]->pipe_srv_name));
- fstrcpy(p->pipe_srv_name, api_fd_commands[i]->pipe_srv_name);
- break;
- }
- }
- if (api_fd_commands[i]->fn == NULL) return False;
+ l->ntlmssp_auth = False;
/* decode the bind request */
- smb_io_rpc_hdr_rb("", &p->hdr_rb, pd, 0);
+ smb_io_rpc_hdr_rb("", &l->hdr_rb, pd, 0);
if (pd->offset == 0) return False;
- if (p->hdr.auth_len != 0)
+ if (l->hdr.auth_len != 0)
{
/* decode the authentication verifier */
- smb_io_rpc_hdr_auth ("", &p->auth_info , pd, 0);
+ smb_io_rpc_hdr_auth ("", &l->auth_info , pd, 0);
if (pd->offset == 0) return False;
- p->ntlmssp_auth = p->auth_info.auth_type = 0x0a;
+ l->ntlmssp_auth = l->auth_info.auth_type = 0x0a;
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
- smb_io_rpc_auth_ntlmssp_verifier("", &p->auth_verifier, pd, 0);
+ smb_io_rpc_auth_ntlmssp_verifier("", &l->auth_verifier, pd, 0);
if (pd->offset == 0) return False;
- p->ntlmssp_auth = strequal(p->auth_verifier.signature, "NTLMSSP");
+ l->ntlmssp_auth = strequal(l->auth_verifier.signature, "NTLMSSP");
}
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
- if (!api_pipe_ntlmssp(p, pd)) return False;
- }
- }
-
- switch (pkt_type)
- {
- case RPC_BINDACK:
- {
- /* name has to be \PIPE\xxxxx */
- fstrcpy(ack_pipe_name, "\\PIPE\\");
- fstrcat(ack_pipe_name, p->pipe_srv_name);
- break;
- }
- case RPC_ALTCONTRESP:
- {
- /* secondary address CAN be NULL
- * as the specs says it's ignored.
- * It MUST NULL to have the spoolss working.
- */
- fstrcpy(ack_pipe_name, "");
- break;
- }
- default:
- {
- return False;
+ if (!api_pipe_ntlmssp(l, pd)) return False;
}
}
DEBUG(5,("api_pipe_bind_req: make response. %d\n", __LINE__));
- prs_init(&(p->rdata), 1024, 4, 0, False);
- prs_init(&(p->rhdr ), 0x18, 4, 0, False);
- prs_init(&(p->rauth), 1024, 4, 0, False);
- prs_init(&(p->rverf), 0x08, 4, 0, False);
- prs_init(&(p->rntlm), 1024, 4, 0, False);
+ prs_init(&(l->rdata), 1024, 4, 0, False);
+ prs_init(&(l->rhdr ), 0x18, 4, 0, False);
+ prs_init(&(l->rauth), 1024, 4, 0, False);
+ prs_init(&(l->rverf), 0x08, 4, 0, False);
+ prs_init(&(l->rntlm), 1024, 4, 0, False);
/***/
/*** do the bind ack first ***/
/***/
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
assoc_gid = 0x7a77;
}
else
{
- assoc_gid = p->hdr_rb.bba.assoc_gid;
+ assoc_gid = l->hdr_rb.bba.assoc_gid;
}
- make_rpc_hdr_ba(&p->hdr_ba,
- p->hdr_rb.bba.max_tsize,
- p->hdr_rb.bba.max_rsize,
+ make_rpc_hdr_ba(&l->hdr_ba,
+ l->hdr_rb.bba.max_tsize,
+ l->hdr_rb.bba.max_rsize,
assoc_gid,
ack_pipe_name,
0x1, 0x0, 0x0,
- &(p->hdr_rb.transfer));
+ &(l->hdr_rb.transfer));
- smb_io_rpc_hdr_ba("", &p->hdr_ba, &p->rdata, 0);
- mem_realloc_data(p->rdata.data, p->rdata.offset);
+ smb_io_rpc_hdr_ba("", &l->hdr_ba, &l->rdata, 0);
+ mem_realloc_data(l->rdata.data, l->rdata.offset);
/***/
/*** now the authentication ***/
/***/
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
uint8 challenge[8];
generate_random_buffer(challenge, 8, False);
/*** authentication info ***/
- make_rpc_hdr_auth(&p->auth_info, 0x0a, 0x06, 0, 1);
- smb_io_rpc_hdr_auth("", &p->auth_info, &p->rverf, 0);
- mem_realloc_data(p->rverf.data, p->rverf.offset);
+ make_rpc_hdr_auth(&l->auth_info, 0x0a, 0x06, 0, 1);
+ smb_io_rpc_hdr_auth("", &l->auth_info, &l->rverf, 0);
+ mem_realloc_data(l->rverf.data, l->rverf.offset);
/*** NTLMSSP verifier ***/
- make_rpc_auth_ntlmssp_verifier(&p->auth_verifier,
+ make_rpc_auth_ntlmssp_verifier(&l->auth_verifier,
"NTLMSSP", NTLMSSP_CHALLENGE);
- smb_io_rpc_auth_ntlmssp_verifier("", &p->auth_verifier, &p->rauth, 0);
- mem_realloc_data(p->rauth.data, p->rauth.offset);
+ smb_io_rpc_auth_ntlmssp_verifier("", &l->auth_verifier, &l->rauth, 0);
+ mem_realloc_data(l->rauth.data, l->rauth.offset);
/* NTLMSSP challenge ***/
- make_rpc_auth_ntlmssp_chal(&p->ntlmssp_chal,
+ make_rpc_auth_ntlmssp_chal(&l->ntlmssp_chal,
0x000082b1, challenge);
- smb_io_rpc_auth_ntlmssp_chal("", &p->ntlmssp_chal, &p->rntlm, 0);
- mem_realloc_data(p->rntlm.data, p->rntlm.offset);
+ smb_io_rpc_auth_ntlmssp_chal("", &l->ntlmssp_chal, &l->rntlm, 0);
+ mem_realloc_data(l->rntlm.data, l->rntlm.offset);
}
/***/
/*** then do the header, now we know the length ***/
/***/
- make_rpc_hdr(&p->hdr, pkt_type, RPC_FLG_FIRST | RPC_FLG_LAST,
- p->hdr.call_id,
- p->rdata.offset + p->rverf.offset + p->rauth.offset + p->rntlm.offset + 0x10,
- p->rauth.offset + p->rntlm.offset);
+ make_rpc_hdr(&l->hdr, pkt_type, RPC_FLG_FIRST | RPC_FLG_LAST,
+ l->hdr.call_id,
+ l->rdata.offset + l->rverf.offset + l->rauth.offset + l->rntlm.offset + 0x10,
+ l->rauth.offset + l->rntlm.offset);
- smb_io_rpc_hdr("", &p->hdr, &p->rhdr, 0);
- mem_realloc_data(p->rhdr.data, p->rdata.offset);
+ smb_io_rpc_hdr("", &l->hdr, &l->rhdr, 0);
+ mem_realloc_data(l->rhdr.data, l->rdata.offset);
/***/
/*** link rpc header, bind acknowledgment and authentication responses ***/
/***/
- if (p->ntlmssp_auth)
+ if (l->ntlmssp_auth)
{
- prs_link(NULL , &p->rhdr , &p->rdata);
- prs_link(&p->rhdr , &p->rdata, &p->rverf);
- prs_link(&p->rdata, &p->rverf, &p->rauth);
- prs_link(&p->rverf, &p->rauth, &p->rntlm);
- prs_link(&p->rauth, &p->rntlm, NULL );
+ prs_link(NULL , &l->rhdr , &l->rdata);
+ prs_link(&l->rhdr , &l->rdata, &l->rverf);
+ prs_link(&l->rdata, &l->rverf, &l->rauth);
+ prs_link(&l->rverf, &l->rauth, &l->rntlm);
+ prs_link(&l->rauth, &l->rntlm, NULL );
}
else
{
- prs_link(NULL , &p->rhdr , &p->rdata);
- prs_link(&p->rhdr, &p->rdata, NULL );
+ prs_link(NULL , &l->rhdr , &l->rdata);
+ prs_link(&l->rhdr, &l->rdata, NULL );
}
return True;
}
+static BOOL api_pipe_bind_and_alt_req(rpcsrv_struct *l, prs_struct *pd,
+ const char* name,
+ enum RPC_PKT_TYPE pkt_type)
+{
+ fstring ack_pipe_name;
+ fstring pipe_srv_name;
+ int i = 0;
+
+ DEBUG(5,("api_pipe_bind_req: decode request. %d\n", __LINE__));
+
+ for (i = 0; i < num_cmds; i++)
+ {
+ if (strequal(api_fd_commands[i]->pipe_clnt_name, name) &&
+ api_fd_commands[i]->fn != NULL)
+ {
+ DEBUG(3,("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n",
+ api_fd_commands[i]->pipe_clnt_name,
+ api_fd_commands[i]->pipe_srv_name));
+ fstrcpy(pipe_srv_name, api_fd_commands[i]->pipe_srv_name);
+ break;
+ }
+ }
+
+ if (api_fd_commands[i]->fn == NULL) return False;
+
+ switch (pkt_type)
+ {
+ case RPC_BINDACK:
+ {
+ /* name has to be \PIPE\xxxxx */
+ fstrcpy(ack_pipe_name, "\\PIPE\\");
+ fstrcat(ack_pipe_name, pipe_srv_name);
+ break;
+ }
+ case RPC_ALTCONTRESP:
+ {
+ /* secondary address CAN be NULL
+ * as the specs says it's ignored.
+ * It MUST NULL to have the spoolss working.
+ */
+ fstrcpy(ack_pipe_name, "");
+ break;
+ }
+ default:
+ {
+ return False;
+ }
+ }
+ return srv_pipe_bind_and_alt_req(l, pd, ack_pipe_name, pkt_type);
+}
+
/*
* The RPC Alter-Context call is used only by the spoolss pipe
* simply because there is a bug (?) in the MS unmarshalling code
* or in the marshalling code. If it's in the later, then Samba
* have the same bug.
*/
-static BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *pd)
+static BOOL api_pipe_bind_req(rpcsrv_struct *l, prs_struct *pd,
+ const char* name)
{
- return api_pipe_bind_and_alt_req(p, pd, RPC_BINDACK);
+ return api_pipe_bind_and_alt_req(l, pd, name, RPC_BINDACK);
}
-static BOOL api_pipe_alt_req(pipes_struct *p, prs_struct *pd)
+static BOOL api_pipe_alt_req(rpcsrv_struct *l, prs_struct *pd,
+ const char* name)
{
- return api_pipe_bind_and_alt_req(p, pd, RPC_ALTCONTRESP);
+ return api_pipe_bind_and_alt_req(l, pd, name, RPC_ALTCONTRESP);
}
-static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd)
+static BOOL api_pipe_auth_process(rpcsrv_struct *l, prs_struct *pd)
{
- BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN);
- BOOL auth_seal = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL);
+ BOOL auth_verify = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN);
+ BOOL auth_seal = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL);
int data_len;
int auth_len;
uint32 old_offset;
uint32 crc32 = 0;
- auth_len = p->hdr.auth_len;
+ auth_len = l->hdr.auth_len;
if (auth_len != 16 && auth_verify)
{
return False;
}
- data_len = p->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18;
+ data_len = l->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18;
DEBUG(5,("api_pipe_auth_process: sign: %s seal: %s data %d auth %d\n",
BOOLSTR(auth_verify), BOOLSTR(auth_seal), data_len, auth_len));
@@ -761,7 +778,7 @@ static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd)
{
char *data = mem_data(&pd->data, pd->offset);
DEBUG(5,("api_pipe_auth_process: data %d\n", pd->offset));
- NTLMSSPcalc_p(p, (uchar*)data, data_len);
+ NTLMSSPcalc_p(l, (uchar*)data, data_len);
crc32 = crc32_calc_buffer(data_len, data);
}
@@ -771,18 +788,18 @@ static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd)
if (auth_seal || auth_verify)
{
pd->offset += data_len;
- smb_io_rpc_hdr_auth("hdr_auth", &p->auth_info, pd, 0);
+ smb_io_rpc_hdr_auth("hdr_auth", &l->auth_info, pd, 0);
}
if (auth_verify)
{
char *req_data = mem_data(&pd->data, pd->offset + 4);
DEBUG(5,("api_pipe_auth_process: auth %d\n", pd->offset + 4));
- NTLMSSPcalc_p(p, (uchar*)req_data, 12);
- smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(p->ntlmssp_chk), pd, 0);
+ NTLMSSPcalc_p(l, (uchar*)req_data, 12);
+ smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(l->ntlmssp_chk), pd, 0);
- if (!rpc_auth_ntlmssp_chk(&(p->ntlmssp_chk), crc32,
- p->ntlmssp_seq_num))
+ if (!rpc_auth_ntlmssp_chk(&(l->ntlmssp_chk), crc32,
+ l->ntlmssp_seq_num))
{
return False;
}
@@ -793,13 +810,13 @@ static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd)
return True;
}
-static BOOL api_pipe_request(pipes_struct *p, prs_struct *pd)
+static BOOL api_pipe_request(rpcsrv_struct *l, prs_struct *pd, const char* name)
{
int i = 0;
- if (p->ntlmssp_auth && p->ntlmssp_validated)
+ if (l->ntlmssp_auth && l->ntlmssp_validated)
{
- if (!api_pipe_auth_process(p, pd)) return False;
+ if (!api_pipe_auth_process(l, pd)) return False;
DEBUG(0,("api_pipe_request: **** MUST CALL become_user() HERE **** \n"));
#if 0
@@ -809,61 +826,116 @@ static BOOL api_pipe_request(pipes_struct *p, prs_struct *pd)
for (i = 0; i < num_cmds; i++)
{
- if (strequal(api_fd_commands[i]->pipe_clnt_name, p->name) &&
+ if (strequal(api_fd_commands[i]->pipe_clnt_name, name) &&
api_fd_commands[i]->fn != NULL)
{
DEBUG(3,("Doing \\PIPE\\%s\n", api_fd_commands[i]->pipe_clnt_name));
- return api_fd_commands[i]->fn(p, pd);
+ return api_fd_commands[i]->fn(l, pd);
}
}
return False;
}
-BOOL rpc_command(pipes_struct *p, prs_struct *pd)
+BOOL rpc_add_to_pdu(prs_struct *ps, const char *data, int len)
{
- BOOL reply = False;
- DEBUG(10,("rpc_command\n"));
+ int prev_size;
+ int new_size;
+ char *to = NULL;
- if (p->m != NULL)
+ ps->offset = 0;
+
+ if (ps->data == NULL)
{
- DEBUG(10,("msrpc redirect\n"));
- if (!msrpc_send_prs(p->m, pd))
+ DEBUG(10,("rpc_add_to_pdu: new_size: %d\n", len));
+ prs_init(ps, len, 4, 0, True);
+ prev_size = 0;
+ new_size = len;
+ if (ps->data == NULL)
{
- DEBUG(2,("msrpc redirect send failed\n"));
return False;
}
- if (!msrpc_receive_prs(p->m, &p->rhdr))
+ }
+ else
+ {
+ prev_size = ps->data->data_used;
+ new_size = prev_size + len;
+ DEBUG(10,("rpc_add_to_pdu: prev_size: %d new_size: %d\n",
+ prev_size, new_size));
+ if (!mem_realloc_data(ps->data, new_size))
{
- DEBUG(2,("msrpc redirect receive failed\n"));
return False;
}
- prs_link(NULL, &p->rhdr, NULL);
- prs_debug_out(&p->rhdr, 10);
- return True;
}
- if (pd->data == NULL) return False;
+ DEBUG(10,("ps->data->start: %d\n", ps->data->offset.start));
+ ps->data->offset.start = 0x0;
+
+ to = mem_data(&ps->data, prev_size);
+ if (to == NULL)
+ {
+ DEBUG(10,("rpc_add_to_pdu: data could not be found\n"));
+ return False;
+ }
+ if (ps->data->data_used != new_size)
+ {
+ DEBUG(10,("rpc_add_to_pdu: ERROR: data used %d new_size %d\n",
+ ps->data->data_used, new_size));
+ return False;
+ }
+ memcpy(to, data, len);
+ return True;
+}
+
+static BOOL rpc_redir_remote(pipes_struct *p, prs_struct *req, prs_struct *resp)
+{
+ DEBUG(10,("rpc_redirect\n"));
+
+ if (!msrpc_send_prs(p->m, req))
+ {
+ DEBUG(2,("msrpc redirect send failed\n"));
+ return False;
+ }
+ if (!msrpc_receive_prs(p->m, resp))
+ {
+ DEBUG(2,("msrpc redirect receive failed\n"));
+ return False;
+ }
+ prs_link(NULL, resp, NULL);
+ prs_debug_out(resp, "redirect", 100);
+ return True;
+}
+static BOOL rpc_redir_local(rpcsrv_struct *l, prs_struct *req, prs_struct *resp,
+ const char* name)
+{
+ BOOL reply = False;
+
+ if (req->data == NULL) return False;
+
+ /* lkclXXXX still assume that the first complete PDU is always
+ in a single request!!!
+ */
/* process the rpc header */
- smb_io_rpc_hdr("", &p->hdr, pd, 0);
+ req->offset = 0x0;
+ smb_io_rpc_hdr("", &l->hdr, req, 0);
- if (pd->offset == 0) return False;
+ if (req->offset == 0) return False;
- switch (p->hdr.pkt_type)
+ switch (l->hdr.pkt_type)
{
case RPC_BIND :
{
- reply = api_pipe_bind_req(p, pd);
+ reply = api_pipe_bind_req(l, req, name);
break;
}
case RPC_ALTCONT:
{
- reply = api_pipe_alt_req(p, pd);
+ reply = api_pipe_alt_req(l, req, name);
break;
}
case RPC_REQUEST:
{
- if (p->ntlmssp_auth && !p->ntlmssp_validated)
+ if (l->ntlmssp_auth && !l->ntlmssp_validated)
{
/* authentication _was_ requested
and it failed. sorry, no deal!
@@ -873,41 +945,87 @@ BOOL rpc_command(pipes_struct *p, prs_struct *pd)
else
{
/* read the rpc header */
- smb_io_rpc_hdr_req("req", &(p->hdr_req), pd, 0);
- reply = api_pipe_request(p, pd);
+ smb_io_rpc_hdr_req("req", &(l->hdr_req), req, 0);
+ reply = api_pipe_request(l, req, name);
}
break;
}
case RPC_BINDRESP: /* not the real name! */
{
- reply = api_pipe_bind_auth_resp(p, pd);
- p->ntlmssp_auth = reply;
+ reply = api_pipe_bind_auth_resp(l, req);
+ l->ntlmssp_auth = reply;
break;
}
}
if (!reply)
{
- reply = api_pipe_fault_resp(p, pd, 0x1c010002);
+ reply = api_pipe_fault_resp(l, req, 0x1c010002);
+ }
+
+ if (reply)
+ {
+ /* flatten the data into a single pdu */
+ reply = prs_copy(resp, &l->rhdr);
}
+ /* delete intermediate data used to set up the pdu. leave
+ rdata alone because that's got the rest of the data in it */
+ rpcsrv_free_temp(l);
+
return reply;
}
+BOOL rpc_send_and_rcv_pdu(pipes_struct *p)
+{
+ DEBUG(10,("rpc_send_and_rcv_pdu\n"));
+
+ if (p->m != NULL)
+ {
+ return rpc_redir_remote(p, &p->smb_pdu, &p->rsmb_pdu);
+ }
+ else if (p->l != NULL)
+ {
+ return rpc_redir_local(p->l, &p->smb_pdu, &p->rsmb_pdu,
+ p->name);
+ }
+ return False;
+}
+
+/*******************************************************************
+ entry point from msrpc to smb. adds data received to pdu; checks
+ pdu; hands pdu off to msrpc, which gets a pdu back (except in the
+ case of the RPC_BINDCONT pdu).
+ ********************************************************************/
+BOOL rpc_to_smb(pipes_struct *p, char *data, int len)
+{
+ BOOL reply = rpc_add_to_pdu(&p->smb_pdu, data, len);
+
+ if (reply && is_complete_pdu(&p->smb_pdu))
+ {
+ p->smb_pdu.offset = p->smb_pdu.data->data_size;
+ prs_link(NULL, &p->smb_pdu, NULL);
+ reply = rpc_send_and_rcv_pdu(p);
+ mem_free_data(p->smb_pdu.data);
+ prs_init(&p->smb_pdu, 0, 4, 0, True);
+
+ }
+ return reply;
+}
/*******************************************************************
receives a netlogon pipe and responds.
********************************************************************/
-static BOOL api_rpc_command(pipes_struct *p,
+static BOOL api_rpc_command(rpcsrv_struct *l,
char *rpc_name, struct api_struct *api_rpc_cmds,
prs_struct *data)
{
int fn_num;
- DEBUG(4,("api_rpc_command: %s op 0x%x - ", rpc_name, p->hdr_req.opnum));
+ DEBUG(4,("api_rpc_command: %s op 0x%x - ", rpc_name, l->hdr_req.opnum));
for (fn_num = 0; api_rpc_cmds[fn_num].name; fn_num++)
{
- if (api_rpc_cmds[fn_num].opnum == p->hdr_req.opnum && api_rpc_cmds[fn_num].fn != NULL)
+ if (api_rpc_cmds[fn_num].opnum == l->hdr_req.opnum && api_rpc_cmds[fn_num].fn != NULL)
{
DEBUG(3,("api_rpc_command: %s\n", api_rpc_cmds[fn_num].name));
break;
@@ -921,18 +1039,18 @@ static BOOL api_rpc_command(pipes_struct *p,
}
/* start off with 1024 bytes, and a large safety margin too */
- prs_init(&p->rdata, 1024, 4, SAFETY_MARGIN, False);
+ prs_init(&l->rdata, 1024, 4, SAFETY_MARGIN, False);
/* do the actual command */
- api_rpc_cmds[fn_num].fn(p, data, &(p->rdata));
+ api_rpc_cmds[fn_num].fn(l, data, &(l->rdata));
- if (p->rdata.data == NULL || p->rdata.offset == 0)
+ if (l->rdata.data == NULL || l->rdata.offset == 0)
{
- mem_free_data(p->rdata.data);
+ mem_free_data(l->rdata.data);
return False;
}
- mem_realloc_data(p->rdata.data, p->rdata.offset);
+ mem_realloc_data(l->rdata.data, l->rdata.offset);
DEBUG(10,("called %s\n", rpc_name));
@@ -943,7 +1061,7 @@ static BOOL api_rpc_command(pipes_struct *p,
/*******************************************************************
receives a netlogon pipe and responds.
********************************************************************/
-BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds,
+BOOL api_rpcTNP(rpcsrv_struct *l, char *rpc_name, struct api_struct *api_rpc_cmds,
prs_struct *data)
{
if (data == NULL || data->data == NULL)
@@ -953,16 +1071,39 @@ BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds
}
/* interpret the command */
- if (!api_rpc_command(p, rpc_name, api_rpc_cmds, data))
+ if (!api_rpc_command(l, rpc_name, api_rpc_cmds, data))
{
return False;
}
/* create the rpc header */
- if (!create_rpc_reply(p, 0, p->rdata.offset + (p->ntlmssp_auth ? (16 + 8) : 0)))
+ if (!create_rpc_reply(l, 0))
{
return False;
}
return True;
}
+
+BOOL is_complete_pdu(prs_struct *ps)
+{
+ RPC_HDR hdr;
+ int len = ps->data->data_size;
+
+ DEBUG(10,("is_complete_pdu - len %d\n", len));
+ ps->offset = 0x0;
+
+ if (!ps->io)
+ {
+ /* writing. oops!! */
+ DEBUG(4,("is_complete_pdu: write set, not read!\n"));
+ return False;
+ }
+
+ if (!smb_io_rpc_hdr("hdr", &hdr, ps, 0))
+ {
+ return False;
+ }
+ /* check that the fragment length is equal to the data length so far */
+ return hdr.frag_len == len;
+}
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index a7e451e6da..8a28674d3d 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -84,14 +84,40 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
pipes_struct *p;
static int next_pipe;
struct msrpc_state *m = NULL;
+ struct rpcsrv_struct *l = NULL;
+ user_struct *vuser = get_valid_user_struct(vuid);
+ struct user_creds usr;
+
+ ZERO_STRUCT(usr);
DEBUG(4,("Open pipe requested %s (pipes_open=%d)\n",
pipe_name, pipes_open));
+ if (vuser == NULL)
+ {
+ DEBUG(4,("invalid vuid %d\n", vuid));
+ return NULL;
+ }
+
+ /* set up unix credentials from the smb side, to feed over the pipe */
+ make_creds_unix(&usr.uxc, vuser->name, vuser->requested_name,
+ vuser->real_name, vuser->guest);
+ usr.ptr_uxc = 1;
+ make_creds_unix_sec(&usr.uxs, vuser->uid, vuser->gid,
+ vuser->n_groups, vuser->groups);
+ usr.ptr_uxs = 1;
+
+ /* set up nt credentials from the smb side, to feed over the pipe */
+ /* lkclXXXX todo!
+ make_creds_nt(&usr.ntc);
+ make_creds_nt_sec(&usr.nts);
+ */
+
/* not repeating pipe numbers makes it easier to track things in
log files and prevents client bugs where pipe numbers are reused
over connection restarts */
- if (next_pipe == 0) {
+ if (next_pipe == 0)
+ {
next_pipe = (getpid() ^ time(NULL)) % MAX_OPEN_PIPES;
}
@@ -111,13 +137,33 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
if (strequal(pipe_name, "lsarpc"))
{
- m = msrpc_use_add(pipe_name, NULL, False);
+ m = msrpc_use_add(pipe_name, &usr, False);
if (m == NULL)
{
DEBUG(5,("open pipes: msrpc redirect failed\n"));
return NULL;
}
}
+ else
+ {
+ l = malloc(sizeof(*l));
+ if (l == NULL)
+ {
+ DEBUG(5,("open pipes: local msrpc malloc failed\n"));
+ return NULL;
+ }
+ ZERO_STRUCTP(l);
+ l->rhdr.data = NULL;
+ l->rdata.data = NULL;
+ l->rhdr.offset = 0;
+ l->rdata.offset = 0;
+
+ l->ntlmssp_validated = False;
+ l->ntlmssp_auth = False;
+
+ memcpy(l->user_sess_key, vuser->user_sess_key,
+ sizeof(l->user_sess_key));
+ }
p = (pipes_struct *)malloc(sizeof(*p));
if (!p) return NULL;
@@ -132,6 +178,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
p->pnum = i;
p->m = m;
+ p->l = l;
p->open = True;
p->device_state = 0;
@@ -139,20 +186,15 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
p->conn = conn;
p->vuid = vuid;
- p->rhdr.data = NULL;
- p->rdata.data = NULL;
- p->rhdr.offset = 0;
- p->rdata.offset = 0;
-
p->file_offset = 0;
p->prev_pdu_file_offset = 0;
p->hdr_offsets = 0;
- p->ntlmssp_validated = False;
- p->ntlmssp_auth = False;
-
fstrcpy(p->name, pipe_name);
+ prs_init(&p->smb_pdu, 0, 4, 0, True);
+ prs_init(&p->rsmb_pdu, 0, 4, 0, False);
+
DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n",
pipe_name, i, pipes_open));
@@ -175,29 +217,13 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
****************************************************************************/
ssize_t write_pipe(pipes_struct *p, char *data, size_t n)
{
- prs_struct pd;
- struct mem_buf data_buf;
-
DEBUG(6,("write_pipe: %x", p->pnum));
-
DEBUG(6,("name: %s open: %s len: %d",
p->name, BOOLSTR(p->open), n));
dump_data(50, data, n);
- /* fake up a data buffer from the write_pipe data parameters */
- mem_create(&data_buf, data, 0, n, 0, False);
- data_buf.offset.start = 0;
- data_buf.offset.end = n;
-
- /* fake up a parsing structure */
- pd.data = &data_buf;
- pd.align = 4;
- pd.io = True;
- pd.error = False;
- pd.offset = 0;
-
- return rpc_command(p, &pd) ? ((ssize_t)n) : -1;
+ return rpc_to_smb(p, data, n) ? ((ssize_t)n) : -1;
}
@@ -232,8 +258,8 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n)
}
- if (p->rhdr.data == NULL || p->rhdr.data->data == NULL ||
- p->rhdr.data->data_used == 0)
+ if (p->rsmb_pdu.data == NULL || p->rsmb_pdu.data->data == NULL ||
+ p->rsmb_pdu.data->data_used == 0)
{
return 0;
}
@@ -246,12 +272,12 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n)
pdu_data_sent = p->file_offset - p->prev_pdu_file_offset;
this_pdu_data_pos = (pdu_data_sent == 0) ? 0 : (pdu_data_sent - 0x18);
- if (!IS_BITS_SET_ALL(p->hdr.flags, RPC_FLG_LAST))
+ if (!IS_BITS_SET_ALL(p->l->hdr.flags, RPC_FLG_LAST))
{
/* intermediate fragment - possibility of another header */
DEBUG(5,("read_pipe: frag_len: %d data_pos: %d pdu_data_sent: %d\n",
- p->hdr.frag_len, data_pos, pdu_data_sent));
+ p->l->hdr.frag_len, data_pos, pdu_data_sent));
if (pdu_data_sent == 0)
{
@@ -263,11 +289,11 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n)
data_pos -= 0x18;
/* create and copy in a new header. */
- create_rpc_reply(p, data_pos, p->rdata.offset);
+ create_rpc_reply(p->l, data_pos);
}
}
- pdu_len = mem_buf_len(p->rhdr.data);
+ pdu_len = mem_buf_len(p->rsmb_pdu.data);
num = pdu_len - this_pdu_data_pos;
DEBUG(6,("read_pipe: pdu_len: %d num: %d n: %d\n", pdu_len, num, n));
@@ -284,7 +310,7 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n)
DEBUG(5,("read_pipe: warning - data read only part of a header\n"));
}
- mem_buf_copy(data, p->rhdr.data, pdu_data_sent, num);
+ mem_buf_copy(data, p->rsmb_pdu.data, pdu_data_sent, num);
p->file_offset += num;
pdu_data_sent += num;
@@ -294,7 +320,7 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n)
DEBUG(6,("read_pipe: just header read\n"));
}
- if (pdu_data_sent == p->hdr.frag_len)
+ if (pdu_data_sent == p->l->hdr.frag_len)
{
DEBUG(6,("read_pipe: next fragment expected\n"));
p->prev_pdu_file_offset = p->file_offset;
@@ -359,8 +385,8 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn)
return False;
}
- mem_buf_free(&(p->rdata.data));
- mem_buf_free(&(p->rhdr .data));
+ mem_buf_free(&(p->smb_pdu .data));
+ mem_buf_free(&(p->rsmb_pdu.data));
bitmap_clear(bmap, p->pnum - pipe_handle_offset);
@@ -384,8 +410,17 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn)
}
}
- ZERO_STRUCTP(p);
+ if (p->l != NULL)
+ {
+ DEBUG(4,("closed msrpc local: OK\n"));
+
+ mem_free_data(p->l->rdata .data);
+ rpcsrv_free_temp(p->l);
+ free(p->l);
+ }
+
+ ZERO_STRUCTP(p);
free(p);
return True;
diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c
index 22314d9c5e..ea3150fd3c 100644
--- a/source3/rpc_server/srv_reg.c
+++ b/source3/rpc_server/srv_reg.c
@@ -61,7 +61,7 @@ static void reg_reply_close(REG_Q_CLOSE *q_r,
/*******************************************************************
api_reg_close
********************************************************************/
-static void api_reg_close( pipes_struct *p, prs_struct *data,
+static void api_reg_close( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
REG_Q_CLOSE q_r;
@@ -100,7 +100,7 @@ static void reg_reply_open(REG_Q_OPEN_HKLM *q_r,
/*******************************************************************
api_reg_open
********************************************************************/
-static void api_reg_open( pipes_struct *p, prs_struct *data,
+static void api_reg_open( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
REG_Q_OPEN_HKLM q_u;
@@ -165,7 +165,7 @@ static void reg_reply_open_entry(REG_Q_OPEN_ENTRY *q_u,
/*******************************************************************
api_reg_open_entry
********************************************************************/
-static void api_reg_open_entry( pipes_struct *p, prs_struct *data,
+static void api_reg_open_entry( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
REG_Q_OPEN_ENTRY q_u;
@@ -223,7 +223,7 @@ static void reg_reply_info(REG_Q_INFO *q_u,
/*******************************************************************
api_reg_info
********************************************************************/
-static void api_reg_info( pipes_struct *p, prs_struct *data,
+static void api_reg_info( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
REG_Q_INFO q_u;
@@ -251,7 +251,7 @@ static struct api_struct api_reg_cmds[] =
/*******************************************************************
receives a reg pipe and responds.
********************************************************************/
-BOOL api_reg_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_reg_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_reg_rpc", api_reg_cmds, data);
}
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 894e8f2e2c..738623ec4d 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -145,7 +145,7 @@ static void samr_reply_close_hnd(SAMR_Q_CLOSE_HND *q_u,
/*******************************************************************
api_samr_close_hnd
********************************************************************/
-static void api_samr_close_hnd( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_close_hnd( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CLOSE_HND q_u;
samr_io_q_close_hnd("", &q_u, data, 0);
@@ -200,7 +200,7 @@ static void samr_reply_open_domain(SAMR_Q_OPEN_DOMAIN *q_u,
/*******************************************************************
api_samr_open_domain
********************************************************************/
-static void api_samr_open_domain( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_open_domain( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_OPEN_DOMAIN q_u;
samr_io_q_open_domain("", &q_u, data, 0);
@@ -243,7 +243,7 @@ static void samr_reply_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u,
/*******************************************************************
api_samr_unknown_2c
********************************************************************/
-static void api_samr_unknown_2c( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_unknown_2c( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_UNKNOWN_2C q_u;
samr_io_q_unknown_2c("", &q_u, data, 0);
@@ -312,7 +312,7 @@ static void samr_reply_unknown_3(SAMR_Q_UNKNOWN_3 *q_u,
/*******************************************************************
api_samr_unknown_3
********************************************************************/
-static void api_samr_unknown_3( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_unknown_3( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_UNKNOWN_3 q_u;
samr_io_q_unknown_3("", &q_u, data, 0);
@@ -370,7 +370,7 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u,
/*******************************************************************
api_samr_enum_dom_users
********************************************************************/
-static void api_samr_enum_dom_users( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_enum_dom_users( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_ENUM_DOM_USERS q_e;
samr_io_q_enum_dom_users("", &q_e, data, 0);
@@ -429,7 +429,7 @@ static void samr_reply_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_u,
/*******************************************************************
api_samr_add_groupmem
********************************************************************/
-static void api_samr_add_groupmem( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_add_groupmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_ADD_GROUPMEM q_e;
samr_io_q_add_groupmem("", &q_e, data, 0);
@@ -487,7 +487,7 @@ static void samr_reply_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_u,
/*******************************************************************
api_samr_del_groupmem
********************************************************************/
-static void api_samr_del_groupmem( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_del_groupmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_DEL_GROUPMEM q_e;
samr_io_q_del_groupmem("", &q_e, data, 0);
@@ -553,7 +553,7 @@ static void samr_reply_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u,
/*******************************************************************
api_samr_add_aliasmem
********************************************************************/
-static void api_samr_add_aliasmem( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_add_aliasmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_ADD_ALIASMEM q_e;
samr_io_q_add_aliasmem("", &q_e, data, 0);
@@ -619,7 +619,7 @@ static void samr_reply_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u,
/*******************************************************************
api_samr_del_aliasmem
********************************************************************/
-static void api_samr_del_aliasmem( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_del_aliasmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_DEL_ALIASMEM q_e;
samr_io_q_del_aliasmem("", &q_e, data, 0);
@@ -684,7 +684,7 @@ static void samr_reply_enum_domains(SAMR_Q_ENUM_DOMAINS *q_u,
/*******************************************************************
api_samr_enum_domains
********************************************************************/
-static void api_samr_enum_domains( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_enum_domains( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_ENUM_DOMAINS q_e;
@@ -764,7 +764,7 @@ static void samr_reply_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_u,
/*******************************************************************
api_samr_enum_dom_groups
********************************************************************/
-static void api_samr_enum_dom_groups( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_enum_dom_groups( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_ENUM_DOM_GROUPS q_e;
@@ -861,7 +861,7 @@ static void samr_reply_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_u,
/*******************************************************************
api_samr_enum_dom_aliases
********************************************************************/
-static void api_samr_enum_dom_aliases( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_enum_dom_aliases( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_ENUM_DOM_ALIASES q_e;
@@ -1033,7 +1033,7 @@ static void samr_reply_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_u,
/*******************************************************************
api_samr_query_dispinfo
********************************************************************/
-static void api_samr_query_dispinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_dispinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_DISPINFO q_e;
@@ -1095,7 +1095,7 @@ static void samr_reply_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_u,
/*******************************************************************
api_samr_delete_dom_group
********************************************************************/
-static void api_samr_delete_dom_group( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_delete_dom_group( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_DELETE_DOM_GROUP q_u;
samr_io_q_delete_dom_group("", &q_u, data, 0);
@@ -1190,7 +1190,7 @@ static void samr_reply_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_u,
/*******************************************************************
api_samr_query_groupmem
********************************************************************/
-static void api_samr_query_groupmem( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_groupmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_GROUPMEM q_u;
samr_io_q_query_groupmem("", &q_u, data, 0);
@@ -1253,7 +1253,7 @@ static void samr_reply_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_u,
/*******************************************************************
api_samr_query_groupinfo
********************************************************************/
-static void api_samr_query_groupinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_groupinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_GROUPINFO q_e;
samr_io_q_query_groupinfo("", &q_e, data, 0);
@@ -1307,7 +1307,7 @@ static void samr_reply_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_u,
/*******************************************************************
api_samr_query_aliasinfo
********************************************************************/
-static void api_samr_query_aliasinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_aliasinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_ALIASINFO q_e;
samr_io_q_query_aliasinfo("", &q_e, data, 0);
@@ -1429,7 +1429,7 @@ static void samr_reply_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u,
/*******************************************************************
api_samr_query_useraliases
********************************************************************/
-static void api_samr_query_useraliases( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_useraliases( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_USERALIASES q_u;
ZERO_STRUCT(q_u);
@@ -1492,7 +1492,7 @@ static void samr_reply_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u,
/*******************************************************************
api_samr_delete_dom_alias
********************************************************************/
-static void api_samr_delete_dom_alias( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_delete_dom_alias( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_DELETE_DOM_ALIAS q_u;
samr_io_q_delete_dom_alias("", &q_u, data, 0);
@@ -1587,7 +1587,7 @@ static void samr_reply_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_u,
/*******************************************************************
api_samr_query_aliasmem
********************************************************************/
-static void api_samr_query_aliasmem( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_aliasmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_ALIASMEM q_u;
samr_io_q_query_aliasmem("", &q_u, data, 0);
@@ -1659,7 +1659,7 @@ static void samr_reply_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u,
/*******************************************************************
api_samr_lookup_names
********************************************************************/
-static void api_samr_lookup_names( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_lookup_names( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_LOOKUP_NAMES q_u;
samr_io_q_lookup_names("", &q_u, data, 0);
@@ -1700,7 +1700,7 @@ static void samr_reply_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u,
/*******************************************************************
api_samr_chgpasswd_user
********************************************************************/
-static void api_samr_chgpasswd_user( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_chgpasswd_user( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CHGPASSWD_USER q_u;
samr_io_q_chgpasswd_user("", &q_u, data, 0);
@@ -1729,7 +1729,7 @@ static void samr_reply_unknown_38(SAMR_Q_UNKNOWN_38 *q_u,
/*******************************************************************
api_samr_unknown_38
********************************************************************/
-static void api_samr_unknown_38( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_unknown_38( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_UNKNOWN_38 q_u;
samr_io_q_unknown_38("", &q_u, data, 0);
@@ -1795,7 +1795,7 @@ static void samr_reply_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u,
/*******************************************************************
api_samr_lookup_rids
********************************************************************/
-static void api_samr_lookup_rids( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_lookup_rids( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_LOOKUP_RIDS q_u;
ZERO_STRUCT(q_u);
@@ -1867,7 +1867,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
/*******************************************************************
api_samr_open_user
********************************************************************/
-static void api_samr_open_user( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_open_user( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_OPEN_USER q_u;
samr_io_q_open_user("", &q_u, data, 0);
@@ -2151,7 +2151,7 @@ static BOOL set_user_info_16(SAM_USER_INFO_16 *id16, uint32 rid)
/*******************************************************************
api_samr_query_userinfo
********************************************************************/
-static void api_samr_query_userinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_userinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_USERINFO q_u;
samr_io_q_query_userinfo("", &q_u, data, 0);
@@ -2224,14 +2224,13 @@ static void samr_reply_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u,
/*******************************************************************
api_samr_set_userinfo2
********************************************************************/
-static void api_samr_set_userinfo2( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_set_userinfo2( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
- user_struct *vuser = get_valid_user_struct(p->vuid);
SAMR_Q_SET_USERINFO2 q_u;
ZERO_STRUCT(q_u);
samr_io_q_set_userinfo2("", &q_u, data, 0);
- samr_reply_set_userinfo2(&q_u, rdata, vuser->dc.user_sess_key);
+ samr_reply_set_userinfo2(&q_u, rdata, p->user_sess_key);
if (q_u.info.id != NULL)
{
@@ -2321,18 +2320,17 @@ static void samr_reply_set_userinfo(SAMR_Q_SET_USERINFO *q_u,
/*******************************************************************
api_samr_set_userinfo
********************************************************************/
-static void api_samr_set_userinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_set_userinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
- user_struct *vuser = get_valid_user_struct(p->vuid);
SAMR_Q_SET_USERINFO q_u;
ZERO_STRUCT(q_u);
#ifdef DEBUG_PASSWORD
DEBUG(100,("set user info: sess_key: "));
- dump_data(100, vuser->dc.user_sess_key, 16);
+ dump_data(100, p->user_sess_key, 16);
#endif
samr_io_q_set_userinfo("", &q_u, data, 0);
- samr_reply_set_userinfo(&q_u, rdata, vuser->dc.user_sess_key);
+ samr_reply_set_userinfo(&q_u, rdata, p->user_sess_key);
if (q_u.info.id != NULL)
{
@@ -2416,7 +2414,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
/*******************************************************************
api_samr_query_usergroups
********************************************************************/
-static void api_samr_query_usergroups( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_usergroups( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_USERGROUPS q_u;
samr_io_q_query_usergroups("", &q_u, data, 0);
@@ -2527,7 +2525,7 @@ static void samr_reply_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u,
/*******************************************************************
api_samr_create_dom_alias
********************************************************************/
-static void api_samr_create_dom_alias( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_create_dom_alias( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CREATE_DOM_ALIAS q_u;
samr_io_q_create_dom_alias("", &q_u, data, 0);
@@ -2639,7 +2637,7 @@ static void samr_reply_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_u,
/*******************************************************************
api_samr_create_dom_group
********************************************************************/
-static void api_samr_create_dom_group( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_create_dom_group( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CREATE_DOM_GROUP q_u;
samr_io_q_create_dom_group("", &q_u, data, 0);
@@ -2731,7 +2729,7 @@ static void samr_reply_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u,
/*******************************************************************
api_samr_query_dom_info
********************************************************************/
-static void api_samr_query_dom_info( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_query_dom_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_QUERY_DOMAIN_INFO q_e;
samr_io_q_query_dom_info("", &q_e, data, 0);
@@ -2839,7 +2837,7 @@ static void samr_reply_create_user(SAMR_Q_CREATE_USER *q_u,
/*******************************************************************
api_samr_create_user
********************************************************************/
-static void api_samr_create_user( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_create_user( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CREATE_USER q_u;
@@ -2893,7 +2891,7 @@ static void samr_reply_connect_anon(SAMR_Q_CONNECT_ANON *q_u,
/*******************************************************************
api_samr_connect_anon
********************************************************************/
-static void api_samr_connect_anon( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_connect_anon( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CONNECT_ANON q_u;
samr_io_q_connect_anon("", &q_u, data, 0);
@@ -2942,7 +2940,7 @@ static void samr_reply_connect(SAMR_Q_CONNECT *q_u,
/*******************************************************************
api_samr_connect
********************************************************************/
-static void api_samr_connect( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_connect( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_CONNECT q_u;
samr_io_q_connect("", &q_u, data, 0);
@@ -3008,7 +3006,7 @@ static void samr_reply_open_alias(SAMR_Q_OPEN_ALIAS *q_u,
/*******************************************************************
api_samr_open_alias
********************************************************************/
-static void api_samr_open_alias( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_open_alias( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_OPEN_ALIAS q_u;
@@ -3055,7 +3053,7 @@ static void samr_reply_open_group(SAMR_Q_OPEN_GROUP *q_u,
/*******************************************************************
api_samr_open_group
********************************************************************/
-static void api_samr_open_group( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_open_group( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_OPEN_GROUP q_u;
@@ -3114,7 +3112,7 @@ static void samr_reply_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u,
/*******************************************************************
api_samr_lookup_domain
********************************************************************/
-static void api_samr_lookup_domain( pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_samr_lookup_domain( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SAMR_Q_LOOKUP_DOMAIN q_u;
samr_io_q_lookup_domain("", &q_u, data, 0);
@@ -3172,7 +3170,7 @@ static struct api_struct api_samr_cmds [] =
/*******************************************************************
receives a samr pipe and responds.
********************************************************************/
-BOOL api_samr_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_samr_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_samr_rpc", api_samr_cmds, data);
}
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index a3760587cd..aff896edfd 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -428,7 +428,7 @@ static void spoolss_reply_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_stru
*
* called from the spoolss dispatcher
********************************************************************/
-static void api_spoolss_open_printer_ex(pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_spoolss_open_printer_ex(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SPOOL_Q_OPEN_PRINTER_EX q_u;
@@ -653,7 +653,7 @@ static void spoolss_reply_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, prs_struct
*
* called from the spoolss dispatcher
********************************************************************/
-static void api_spoolss_getprinterdata(pipes_struct *p, prs_struct *data,
+static void api_spoolss_getprinterdata(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_GETPRINTERDATA q_u;
@@ -696,7 +696,7 @@ static void spoolss_reply_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *rd
*
* called from the spoolss dispatcher
********************************************************************/
-static void api_spoolss_closeprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_closeprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_CLOSEPRINTER q_u;
@@ -731,7 +731,7 @@ static void spoolss_reply_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, prs_struct *rdata)
*
* in fact ReplyOpenPrinter is the changenotify equivalent on the spoolss pipe
********************************************************************/
-static void api_spoolss_rffpcnex(pipes_struct *p, prs_struct *data,
+static void api_spoolss_rffpcnex(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_RFFPCNEX q_u;
@@ -767,7 +767,7 @@ static void api_spoolss_rffpcnex(pipes_struct *p, prs_struct *data,
/*******************************************************************
* fill a notify_info_data with the servername
********************************************************************/
-static void spoolss_notify_server_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_server_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
pstring temp_name;
@@ -781,7 +781,7 @@ static void spoolss_notify_server_name(connection_struct *conn, int snum, SPOOL_
* fill a notify_info_data with the servicename
* jfmxxxx: it's incorrect should be long_printername
********************************************************************/
-static void spoolss_notify_printer_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_printer_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
/*
data->notify_data.data.length=strlen(lp_servicename(snum));
@@ -796,7 +796,7 @@ static void spoolss_notify_printer_name(connection_struct *conn, int snum, SPOOL
/*******************************************************************
* fill a notify_info_data with the servicename
********************************************************************/
-static void spoolss_notify_share_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_share_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(lp_servicename(snum));
ascii_to_unistr(data->notify_data.data.string,
@@ -807,7 +807,7 @@ static void spoolss_notify_share_name(connection_struct *conn, int snum, SPOOL_N
/*******************************************************************
* fill a notify_info_data with the port name
********************************************************************/
-static void spoolss_notify_port_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_port_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
/* even if it's strange, that's consistant in all the code */
@@ -822,7 +822,7 @@ static void spoolss_notify_port_name(connection_struct *conn, int snum, SPOOL_NO
* jfmxxxx: it's incorrect, should be lp_printerdrivername()
* but it doesn't exist, have to see what to do
********************************************************************/
-static void spoolss_notify_driver_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_driver_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(printer->info_2->drivername);
ascii_to_unistr(data->notify_data.data.string,
@@ -833,7 +833,7 @@ static void spoolss_notify_driver_name(connection_struct *conn, int snum, SPOOL_
/*******************************************************************
* fill a notify_info_data with the comment
********************************************************************/
-static void spoolss_notify_comment(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_comment(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(lp_comment(snum));
ascii_to_unistr(data->notify_data.data.string,
@@ -846,7 +846,7 @@ static void spoolss_notify_comment(connection_struct *conn, int snum, SPOOL_NOTI
* jfm:xxxx incorrect, have to create a new smb.conf option
* location = "Room 1, floor 2, building 3"
********************************************************************/
-static void spoolss_notify_location(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_location(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(printer->info_2->location);
ascii_to_unistr(data->notify_data.data.string,
@@ -858,7 +858,7 @@ static void spoolss_notify_location(connection_struct *conn, int snum, SPOOL_NOT
* fill a notify_info_data with the device mode
* jfm:xxxx don't to it for know but that's a real problem !!!
********************************************************************/
-static void spoolss_notify_devmode(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_devmode(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
}
@@ -867,7 +867,7 @@ static void spoolss_notify_devmode(connection_struct *conn, int snum, SPOOL_NOTI
* jfm:xxxx just return no file could add an option to smb.conf
* separator file = "separator.txt"
********************************************************************/
-static void spoolss_notify_sepfile(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_sepfile(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(printer->info_2->sepfile);
ascii_to_unistr(data->notify_data.data.string,
@@ -879,7 +879,7 @@ static void spoolss_notify_sepfile(connection_struct *conn, int snum, SPOOL_NOTI
* fill a notify_info_data with the print processor
* jfm:xxxx return always winprint to indicate we don't do anything to it
********************************************************************/
-static void spoolss_notify_print_processor(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_print_processor(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(printer->info_2->printprocessor);
ascii_to_unistr(data->notify_data.data.string,
@@ -891,7 +891,7 @@ static void spoolss_notify_print_processor(connection_struct *conn, int snum, SP
* fill a notify_info_data with the print processor options
* jfm:xxxx send an empty string
********************************************************************/
-static void spoolss_notify_parameters(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_parameters(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(printer->info_2->parameters);
ascii_to_unistr(data->notify_data.data.string,
@@ -903,7 +903,7 @@ static void spoolss_notify_parameters(connection_struct *conn, int snum, SPOOL_N
* fill a notify_info_data with the data type
* jfm:xxxx always send RAW as data type
********************************************************************/
-static void spoolss_notify_datatype(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_datatype(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(printer->info_2->datatype);
ascii_to_unistr(data->notify_data.data.string,
@@ -916,7 +916,7 @@ static void spoolss_notify_datatype(connection_struct *conn, int snum, SPOOL_NOT
* jfm:xxxx send an null pointer to say no security desc
* have to implement security before !
********************************************************************/
-static void spoolss_notify_security_desc(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_security_desc(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=0;
data->notify_data.data.string[0]=0x00;
@@ -926,7 +926,7 @@ static void spoolss_notify_security_desc(connection_struct *conn, int snum, SPOO
* fill a notify_info_data with the attributes
* jfm:xxxx a samba printer is always shared
********************************************************************/
-static void spoolss_notify_attributes(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_attributes(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0] = PRINTER_ATTRIBUTE_SHARED \
| PRINTER_ATTRIBUTE_NETWORK \
@@ -936,7 +936,7 @@ static void spoolss_notify_attributes(connection_struct *conn, int snum, SPOOL_N
/*******************************************************************
* fill a notify_info_data with the priority
********************************************************************/
-static void spoolss_notify_priority(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_priority(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0] = printer->info_2->priority;
}
@@ -944,7 +944,7 @@ static void spoolss_notify_priority(connection_struct *conn, int snum, SPOOL_NOT
/*******************************************************************
* fill a notify_info_data with the default priority
********************************************************************/
-static void spoolss_notify_default_priority(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_default_priority(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0] = printer->info_2->default_priority;
}
@@ -952,7 +952,7 @@ static void spoolss_notify_default_priority(connection_struct *conn, int snum, S
/*******************************************************************
* fill a notify_info_data with the start time
********************************************************************/
-static void spoolss_notify_start_time(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_start_time(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0] = printer->info_2->starttime;
}
@@ -960,7 +960,7 @@ static void spoolss_notify_start_time(connection_struct *conn, int snum, SPOOL_N
/*******************************************************************
* fill a notify_info_data with the until time
********************************************************************/
-static void spoolss_notify_until_time(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_until_time(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0] = printer->info_2->untiltime;
}
@@ -968,7 +968,7 @@ static void spoolss_notify_until_time(connection_struct *conn, int snum, SPOOL_N
/*******************************************************************
* fill a notify_info_data with the status
********************************************************************/
-static void spoolss_notify_status(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
int count;
print_queue_struct *q=NULL;
@@ -976,7 +976,7 @@ static void spoolss_notify_status(connection_struct *conn, int snum, SPOOL_NOTIF
bzero(&status,sizeof(status));
- count=get_printqueue(snum, conn, &q, &status);
+ count=get_printqueue(snum, NULL, &q, &status);
data->notify_data.value[0]=(uint32) status.status;
if (q) free(q);
@@ -985,21 +985,21 @@ static void spoolss_notify_status(connection_struct *conn, int snum, SPOOL_NOTIF
/*******************************************************************
* fill a notify_info_data with the number of jobs queued
********************************************************************/
-static void spoolss_notify_cjobs(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_cjobs(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
print_queue_struct *q=NULL;
print_status_struct status;
bzero(&status,sizeof(status));
- data->notify_data.value[0]=get_printqueue(snum, conn, &q, &status);
+ data->notify_data.value[0]=get_printqueue(snum, NULL, &q, &status);
if (q) free(q);
}
/*******************************************************************
* fill a notify_info_data with the average ppm
********************************************************************/
-static void spoolss_notify_average_ppm(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_average_ppm(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
/* always respond 8 pages per minutes */
/* a little hard ! */
@@ -1009,7 +1009,7 @@ static void spoolss_notify_average_ppm(connection_struct *conn, int snum, SPOOL_
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_username(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_username(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(queue->user);
ascii_to_unistr(data->notify_data.data.string, queue->user, sizeof(data->notify_data.data.string)-1);
@@ -1018,7 +1018,7 @@ static void spoolss_notify_username(connection_struct *conn, int snum, SPOOL_NOT
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_job_status(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_job_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0]=queue->status;
}
@@ -1026,7 +1026,7 @@ static void spoolss_notify_job_status(connection_struct *conn, int snum, SPOOL_N
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_job_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_job_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen(queue->file);
ascii_to_unistr(data->notify_data.data.string, queue->file, sizeof(data->notify_data.data.string)-1);
@@ -1035,7 +1035,7 @@ static void spoolss_notify_job_name(connection_struct *conn, int snum, SPOOL_NOT
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_job_status_string(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_job_status_string(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.data.length=strlen("En attente");
ascii_to_unistr(data->notify_data.data.string, "En attente", sizeof(data->notify_data.data.string)-1);
@@ -1044,7 +1044,7 @@ static void spoolss_notify_job_status_string(connection_struct *conn, int snum,
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_job_time(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_job_time(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0]=0x0;
}
@@ -1052,7 +1052,7 @@ static void spoolss_notify_job_time(connection_struct *conn, int snum, SPOOL_NOT
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_job_size(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_job_size(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0]=queue->size;
}
@@ -1060,7 +1060,7 @@ static void spoolss_notify_job_size(connection_struct *conn, int snum, SPOOL_NOT
/*******************************************************************
* fill a notify_info_data with
********************************************************************/
-static void spoolss_notify_job_position(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
+static void spoolss_notify_job_position(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
data->notify_data.value[0]=queue->job;
}
@@ -1219,7 +1219,7 @@ static void construct_info_data(SPOOL_NOTIFY_INFO_DATA *info_data, uint16 type,
*
********************************************************************/
static void construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int pnum,
- int snum, int i, uint32 id, connection_struct *conn)
+ int snum, int i, uint32 id)
{
int k,j;
@@ -1252,7 +1252,7 @@ static void construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int pnum,
construct_info_data(info_data, type, field, id);
DEBUGADD(4,("notify_info_data_table: in\n"));
- notify_info_data_table[j].fn(conn,snum, info_data, queue, &printer);
+ notify_info_data_table[j].fn(snum, info_data, queue, &printer);
DEBUGADD(4,("notify_info_data_table: out\n"));
info->count++;
info_data=&(info->data[info->count]);
@@ -1269,7 +1269,7 @@ static void construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int pnum,
*
********************************************************************/
static void construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_INFO *info,
- int pnum, int snum, int i, uint32 id, connection_struct *conn)
+ int pnum, int snum, int i, uint32 id)
{
int k,j;
@@ -1298,7 +1298,7 @@ static void construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_I
DEBUGADD(4,("j=[%d]:%s\n", j, notify_info_data_table[j].name));
construct_info_data(info_data, type, field, id);
DEBUGADD(4,("notify_info_data_table: in\n"));
- notify_info_data_table[j].fn(conn, snum, info_data, queue, &printer);
+ notify_info_data_table[j].fn(snum, info_data, queue, &printer);
DEBUGADD(4,("notify_info_data_table: out\n"));
info->count++;
info_data=&(info->data[info->count]);
@@ -1315,7 +1315,7 @@ static void construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_I
* fill a notify_info struct with info asked
*
********************************************************************/
-static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connection_struct *conn)
+static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info)
{
int snum;
int pnum=find_printer_index_by_hnd(hnd);
@@ -1334,7 +1334,7 @@ static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, co
{
if ( lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) )
{
- construct_notify_printer_info(info, pnum, snum, i, id, conn);
+ construct_notify_printer_info(info, pnum, snum, i, id);
id++;
}
}
@@ -1348,7 +1348,7 @@ static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, co
* fill a notify_info struct with info asked
*
********************************************************************/
-static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connection_struct *conn)
+static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info)
{
int snum;
int pnum=find_printer_index_by_hnd(hnd);
@@ -1365,7 +1365,7 @@ static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connec
{
case PRINTER_NOTIFY_TYPE:
{
- construct_notify_printer_info(info, pnum, snum, i, id, conn);
+ construct_notify_printer_info(info, pnum, snum, i, id);
id--;
break;
}
@@ -1375,10 +1375,10 @@ static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connec
print_queue_struct *queue=NULL;
print_status_struct status;
bzero(&status, sizeof(status));
- count=get_printqueue(snum, conn, &queue, &status);
+ count=get_printqueue(snum, NULL, &queue, &status);
for (j=0; j<count; j++)
{
- construct_notify_jobs_info(&(queue[j]), info, pnum, snum, i, queue[j].job, conn);
+ construct_notify_jobs_info(&(queue[j]), info, pnum, snum, i, queue[j].job);
}
if (queue) free(queue);
break;
@@ -1393,7 +1393,7 @@ static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connec
*
* called from api_spoolss_rfnpcnex (see this to understand)
********************************************************************/
-static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata)
{
SPOOL_R_RFNPCNEX r_u;
int pnum=find_printer_index_by_hnd(&(q_u->handle));
@@ -1404,10 +1404,10 @@ static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata, con
switch (Printer[pnum].printer_type)
{
case PRINTER_HANDLE_IS_PRINTSERVER:
- printserver_notify_info(&(q_u->handle), &(r_u.info), conn);
+ printserver_notify_info(&(q_u->handle), &(r_u.info));
break;
case PRINTER_HANDLE_IS_PRINTER:
- printer_notify_info(&(q_u->handle), &(r_u.info), conn);
+ printer_notify_info(&(q_u->handle), &(r_u.info));
break;
}
@@ -1421,21 +1421,21 @@ static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata, con
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_rfnpcnex(pipes_struct *p, prs_struct *data,
+static void api_spoolss_rfnpcnex(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_RFNPCNEX q_u;
spoolss_io_q_rfnpcnex("", &q_u, data, 0);
- spoolss_reply_rfnpcnex(&q_u, rdata, p->conn);
+ spoolss_reply_rfnpcnex(&q_u, rdata);
}
/********************************************************************
* construct_printer_info_0
* fill a printer_info_1 struct
********************************************************************/
-static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring servername, connection_struct *conn)
+static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring servername)
{
pstring chaine;
int count;
@@ -1450,7 +1450,7 @@ static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring s
return (False);
}
- count=get_printqueue(snum, conn ,&queue,&status);
+ count=get_printqueue(snum, NULL, &queue, &status);
/* the description and the name are of the form \\server\share */
slprintf(chaine,sizeof(chaine)-1,"\\\\%s\\%s",servername, ntprinter.info_2->printername);
@@ -1501,7 +1501,7 @@ static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring s
* construct_printer_info_1
* fill a printer_info_1 struct
********************************************************************/
-static BOOL construct_printer_info_1(PRINTER_INFO_1 *printer,int snum, pstring servername, connection_struct *conn)
+static BOOL construct_printer_info_1(PRINTER_INFO_1 *printer,int snum, pstring servername)
{
pstring chaine;
NT_PRINTER_INFO_LEVEL ntprinter;
@@ -1593,7 +1593,7 @@ static void construct_dev_mode(DEVICEMODE *devmode, int snum, char *servername)
* construct_printer_info_2
* fill a printer_info_2 struct
********************************************************************/
-static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring servername, connection_struct *conn)
+static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring servername)
{
pstring chaine;
int count;
@@ -1603,7 +1603,7 @@ static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring
print_queue_struct *queue=NULL;
print_status_struct status;
bzero(&status, sizeof(status));
- count=get_printqueue(snum, conn, &queue, &status);
+ count=get_printqueue(snum, NULL, &queue, &status);
if (get_a_printer(&ntprinter, 2, lp_servicename(snum)) !=0 )
{
@@ -1654,14 +1654,14 @@ static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring
* enum_printer_info_1
* glue between spoolss_reply_enumprinters and construct_printer_info_1
********************************************************************/
-static BOOL enum_printer_info_1(PRINTER_INFO_1 **printer, int snum, int number, connection_struct *conn)
+static BOOL enum_printer_info_1(PRINTER_INFO_1 **printer, int snum, int number)
{
pstring servername;
*printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1));
DEBUG(4,("Allocated memory for ONE PRINTER_INFO_1 at [%p]\n", *printer));
pstrcpy(servername, global_myname);
- if (!construct_printer_info_1(*printer, snum, servername, conn))
+ if (!construct_printer_info_1(*printer, snum, servername))
{
free(*printer);
return (False);
@@ -1676,14 +1676,14 @@ static BOOL enum_printer_info_1(PRINTER_INFO_1 **printer, int snum, int number,
* enum_printer_info_2
* glue between spoolss_reply_enumprinters and construct_printer_info_2
********************************************************************/
-static BOOL enum_printer_info_2(PRINTER_INFO_2 **printer, int snum, int number, connection_struct *conn)
+static BOOL enum_printer_info_2(PRINTER_INFO_2 **printer, int snum, int number)
{
pstring servername;
*printer=(PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2));
DEBUG(4,("Allocated memory for ONE PRINTER_INFO_2 at [%p]\n", *printer));
pstrcpy(servername, global_myname);
- if (!construct_printer_info_2(*printer, snum, servername, conn))
+ if (!construct_printer_info_2(*printer, snum, servername))
{
free(*printer);
return (False);
@@ -1699,7 +1699,7 @@ static BOOL enum_printer_info_2(PRINTER_INFO_2 **printer, int snum, int number,
*
* called from api_spoolss_enumprinters (see this to understand)
********************************************************************/
-static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number, connection_struct *conn)
+static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number)
{
int snum;
int n_services=lp_numservices();
@@ -1713,7 +1713,7 @@ static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number,
DEBUG(4,("Found a printer: %s[%x]\n",lp_servicename(snum),snum));
*printers=Realloc(*printers, (*number+1)*sizeof(PRINTER_INFO_1 *));
DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1 pointers at [%p]\n", *number+1, *printers));
- if (enum_printer_info_1( &((*printers)[*number]), snum, *number, conn) )
+ if (enum_printer_info_1( &((*printers)[*number]), snum, *number) )
{
(*number)++;
}
@@ -1726,7 +1726,7 @@ static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number,
*
* called from api_spoolss_enumprinters (see this to understand)
********************************************************************/
-static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number, connection_struct *conn)
+static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number)
{
int snum;
int n_services=lp_numservices();
@@ -1740,7 +1740,7 @@ static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number,
DEBUG(4,("Found a printer: %s[%x]\n",lp_servicename(snum),snum));
*printers=Realloc(*printers, (*number+1)*sizeof(PRINTER_INFO_2 *));
DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2 pointers at [%p]\n", *number+1, *printers));
- if (enum_printer_info_2( &((*printers)[*number]), snum, *number, conn) )
+ if (enum_printer_info_2( &((*printers)[*number]), snum, *number) )
{
(*number)++;
}
@@ -1753,7 +1753,7 @@ static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number,
*
* called from api_spoolss_enumprinters (see this to understand)
********************************************************************/
-static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rdata)
{
SPOOL_R_ENUMPRINTERS r_u;
@@ -1768,14 +1768,14 @@ static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rd
case 1:
if ( (q_u->flags==PRINTER_ENUM_NAME) || (q_u->flags==PRINTER_ENUM_NETWORK) )
/*if (is_a_printerserver(q_u->servername))*/
- enum_all_printers_info_1(&(r_u.printer.printers_1), &(r_u.returned), conn );
+ enum_all_printers_info_1(&(r_u.printer.printers_1), &(r_u.returned) );
/*else
enum_one_printer_info_1(&r_u);*/
break;
case 2:
if ( (q_u->flags==PRINTER_ENUM_NAME) || (q_u->flags==PRINTER_ENUM_NETWORK) )
/*if (is_a_printerserver(q_u->servername))*/
- enum_all_printers_info_2(&(r_u.printer.printers_2), &(r_u.returned), conn );
+ enum_all_printers_info_2(&(r_u.printer.printers_2), &(r_u.returned) );
/*else
enum_one_printer_info_2(&r_u);*/
break;
@@ -1800,14 +1800,14 @@ static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rd
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_enumprinters(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumprinters(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMPRINTERS q_u;
spoolss_io_q_enumprinters("", &q_u, data, 0);
- spoolss_reply_enumprinters(&q_u, rdata, p->conn);
+ spoolss_reply_enumprinters(&q_u, rdata);
spoolss_io_free_buffer(&(q_u.buffer));
}
@@ -1815,7 +1815,7 @@ static void api_spoolss_enumprinters(pipes_struct *p, prs_struct *data,
/****************************************************************************
****************************************************************************/
-static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata)
{
SPOOL_R_GETPRINTER r_u;
int snum;
@@ -1833,7 +1833,7 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata,
printer=(PRINTER_INFO_0 *)malloc(sizeof(PRINTER_INFO_0));
- construct_printer_info_0(printer, snum, servername, conn);
+ construct_printer_info_0(printer, snum, servername);
r_u.printer.info0=printer;
r_u.status=0x0000;
r_u.offered=q_u->offered;
@@ -1851,7 +1851,7 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata,
printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1));
- construct_printer_info_1(printer, snum, servername, conn);
+ construct_printer_info_1(printer, snum, servername);
r_u.printer.info1=printer;
r_u.status=0x0000;
@@ -1868,7 +1868,7 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata,
PRINTER_INFO_2 *printer;
printer=(PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2));
- construct_printer_info_2(printer, snum, servername, conn);
+ construct_printer_info_2(printer, snum, servername);
r_u.printer.info2=printer;
r_u.status=0x0000;
@@ -1888,14 +1888,14 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata,
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_getprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_getprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_GETPRINTER q_u;
spoolss_io_q_getprinter("", &q_u, data, 0);
- spoolss_reply_getprinter(&q_u, rdata, p->conn);
+ spoolss_reply_getprinter(&q_u, rdata);
}
/********************************************************************
@@ -2149,7 +2149,7 @@ static void spoolss_reply_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_getprinterdriver2(pipes_struct *p, prs_struct *data,
+static void api_spoolss_getprinterdriver2(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_GETPRINTERDRIVER2 q_u;
@@ -2186,7 +2186,7 @@ static void spoolss_reply_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, prs_st
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_startpageprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_startpageprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_STARTPAGEPRINTER q_u;
@@ -2221,7 +2221,7 @@ static void spoolss_reply_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_endpageprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_endpageprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENDPAGEPRINTER q_u;
@@ -2236,7 +2236,7 @@ static void api_spoolss_endpageprinter(pipes_struct *p, prs_struct *data,
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_startdocprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_startdocprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_STARTDOCPRINTER q_u;
@@ -2331,7 +2331,7 @@ static void spoolss_reply_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_enddocprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enddocprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENDDOCPRINTER q_u;
@@ -2431,7 +2431,7 @@ static void spoolss_reply_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, prs_struct *rd
* called from the spoolss dispatcher
*
********************************************************************/
-static void api_spoolss_writeprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_writeprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_WRITEPRINTER q_u;
@@ -2458,7 +2458,7 @@ static void api_spoolss_writeprinter(pipes_struct *p, prs_struct *data,
* called from the spoolss dispatcher
*
********************************************************************/
-static void control_printer(POLICY_HND handle, uint32 command, connection_struct *conn)
+static void control_printer(POLICY_HND handle, uint32 command)
{
int pnum;
int snum;
@@ -2470,13 +2470,13 @@ static void control_printer(POLICY_HND handle, uint32 command, connection_struct
{
case PRINTER_CONTROL_PAUSE:
/* pause the printer here */
- status_printqueue(conn, snum, LPSTAT_STOPPED);
+ status_printqueue(NULL, snum, LPSTAT_STOPPED);
break;
case PRINTER_CONTROL_RESUME:
case PRINTER_CONTROL_UNPAUSE:
/* UN-pause the printer here */
- status_printqueue(conn, snum, LPSTAT_OK);
+ status_printqueue(NULL, snum, LPSTAT_OK);
break;
case PRINTER_CONTROL_PURGE:
/* Envoi des dragées FUCA dans l'imprimante */
@@ -2573,7 +2573,7 @@ static void spoolss_reply_setprinter(SPOOL_Q_SETPRINTER *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_setprinter(pipes_struct *p, prs_struct *data,
+static void api_spoolss_setprinter(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_SETPRINTER q_u;
@@ -2588,7 +2588,7 @@ static void api_spoolss_setprinter(pipes_struct *p, prs_struct *data,
switch (q_u.level)
{
case 0:
- control_printer(q_u.handle, q_u.command, p->conn);
+ control_printer(q_u.handle, q_u.command);
break;
case 2:
update_printer(q_u.handle, q_u.level, q_u.info, q_u.devmode);
@@ -2611,7 +2611,7 @@ static void spoolss_reply_fcpn(SPOOL_Q_FCPN *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_fcpn(pipes_struct *p, prs_struct *data,
+static void api_spoolss_fcpn(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_FCPN q_u;
@@ -2634,7 +2634,7 @@ static void spoolss_reply_addjob(SPOOL_Q_ADDJOB *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_addjob(pipes_struct *p, prs_struct *data,
+static void api_spoolss_addjob(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ADDJOB q_u;
@@ -2734,7 +2734,7 @@ static BOOL fill_job_info_2(JOB_INFO_2 *job_info, print_queue_struct *queue,
/****************************************************************************
****************************************************************************/
-static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata)
{
SPOOL_R_ENUMJOBS r_u;
int snum;
@@ -2754,7 +2754,7 @@ static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata, con
if (get_printer_snum(&(q_u->handle), &snum))
{
- count=get_printqueue(snum, conn, &queue, &status);
+ count=get_printqueue(snum, NULL, &queue, &status);
r_u.numofjobs=0;
r_u.level=q_u->level;
@@ -2801,14 +2801,14 @@ static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata, con
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumjobs(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumjobs(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMJOBS q_u;
spoolss_io_q_enumjobs("", &q_u, data, 0);
- spoolss_reply_enumjobs(&q_u, rdata, p->conn);
+ spoolss_reply_enumjobs(&q_u, rdata);
spoolss_io_free_buffer(&(q_u.buffer));
}
@@ -2826,7 +2826,7 @@ static void spoolss_reply_schedulejob(SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *rdat
/****************************************************************************
****************************************************************************/
-static void api_spoolss_schedulejob(pipes_struct *p, prs_struct *data,
+static void api_spoolss_schedulejob(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_SCHEDULEJOB q_u;
@@ -2838,7 +2838,7 @@ static void api_spoolss_schedulejob(pipes_struct *p, prs_struct *data,
/****************************************************************************
****************************************************************************/
-static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata)
{
SPOOL_R_SETJOB r_u;
int snum;
@@ -2852,7 +2852,7 @@ static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connect
if (get_printer_snum(&(q_u->handle), &snum))
{
- count=get_printqueue(snum, conn, &queue, &status);
+ count=get_printqueue(snum, NULL, &queue, &status);
while ( (i<count) && found==False )
{
if ( q_u->jobid == queue[i].job )
@@ -2869,17 +2869,17 @@ static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connect
case JOB_CONTROL_CANCEL:
case JOB_CONTROL_DELETE:
{
- del_printqueue(conn, snum, q_u->jobid);
+ del_printqueue(NULL, snum, q_u->jobid);
break;
}
case JOB_CONTROL_PAUSE:
{
- status_printjob(conn, snum, q_u->jobid, LPQ_PAUSED);
+ status_printjob(NULL, snum, q_u->jobid, LPQ_PAUSED);
break;
}
case JOB_CONTROL_RESUME:
{
- status_printjob(conn, snum, q_u->jobid, LPQ_QUEUED);
+ status_printjob(NULL, snum, q_u->jobid, LPQ_QUEUED);
break;
}
}
@@ -2893,19 +2893,19 @@ static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connect
/****************************************************************************
****************************************************************************/
-static void api_spoolss_setjob(pipes_struct *p, prs_struct *data,
+static void api_spoolss_setjob(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_SETJOB q_u;
spoolss_io_q_setjob("", &q_u, data, 0);
- spoolss_reply_setjob(&q_u, rdata, p->conn);
+ spoolss_reply_setjob(&q_u, rdata);
}
/****************************************************************************
****************************************************************************/
-static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *rdata)
{
SPOOL_R_ENUMPRINTERDRIVERS r_u;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
@@ -2922,7 +2922,7 @@ static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, pr
fstrcpy(servername, global_myname);
unistr2_to_ascii(architecture, &(q_u->environment), sizeof(architecture));
- count=get_ntdrivers(conn, &list, architecture);
+ count=get_ntdrivers(&list, architecture);
DEBUGADD(4,("we have: [%d] drivers on archi [%s]\n",count, architecture));
for (i=0; i<count; i++)
@@ -3018,14 +3018,14 @@ static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, pr
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumprinterdrivers(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumprinterdrivers(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMPRINTERDRIVERS q_u;
spoolss_io_q_enumprinterdrivers("", &q_u, data, 0);
- spoolss_reply_enumprinterdrivers(&q_u, rdata, p->conn);
+ spoolss_reply_enumprinterdrivers(&q_u, rdata);
spoolss_io_free_buffer(&(q_u.buffer));
}
@@ -3095,7 +3095,7 @@ static void spoolss_reply_enumforms(SPOOL_Q_ENUMFORMS *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumforms(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumforms(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMFORMS q_u;
@@ -3167,7 +3167,7 @@ static void spoolss_reply_enumports(SPOOL_Q_ENUMPORTS *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumports(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumports(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMPORTS q_u;
@@ -3213,7 +3213,7 @@ static void spoolss_reply_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *rd
/****************************************************************************
****************************************************************************/
-static void api_spoolss_addprinterex(pipes_struct *p, prs_struct *data, prs_struct *rdata)
+static void api_spoolss_addprinterex(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata)
{
SPOOL_Q_ADDPRINTEREX q_u;
NT_PRINTER_INFO_LEVEL printer;
@@ -3250,7 +3250,7 @@ static void spoolss_reply_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_st
/****************************************************************************
****************************************************************************/
-static void api_spoolss_addprinterdriver(pipes_struct *p, prs_struct *data,
+static void api_spoolss_addprinterdriver(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ADDPRINTERDRIVER q_u;
@@ -3293,7 +3293,7 @@ static void spoolss_reply_getprinterdriverdirectory(SPOOL_Q_GETPRINTERDRIVERDIR
/****************************************************************************
****************************************************************************/
-static void api_spoolss_getprinterdriverdirectory(pipes_struct *p, prs_struct *data,
+static void api_spoolss_getprinterdriverdirectory(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_GETPRINTERDRIVERDIR q_u;
@@ -3405,7 +3405,7 @@ static void spoolss_reply_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, prs_stru
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumprinterdata(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumprinterdata(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMPRINTERDATA q_u;
@@ -3451,7 +3451,7 @@ static void spoolss_reply_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, prs_struct
/****************************************************************************
****************************************************************************/
-static void api_spoolss_setprinterdata(pipes_struct *p, prs_struct *data,
+static void api_spoolss_setprinterdata(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_SETPRINTERDATA q_u;
@@ -3493,7 +3493,7 @@ static void spoolss_reply_addform(SPOOL_Q_ADDFORM *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_addform(pipes_struct *p, prs_struct *data,
+static void api_spoolss_addform(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ADDFORM q_u;
@@ -3532,7 +3532,7 @@ static void spoolss_reply_setform(SPOOL_Q_SETFORM *q_u, prs_struct *rdata)
/****************************************************************************
****************************************************************************/
-static void api_spoolss_setform(pipes_struct *p, prs_struct *data,
+static void api_spoolss_setform(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_SETFORM q_u;
@@ -3577,7 +3577,7 @@ static void spoolss_reply_enumprintprocessors(SPOOL_Q_ENUMPRINTPROCESSORS *q_u,
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumprintprocessors(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumprintprocessors(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMPRINTPROCESSORS q_u;
@@ -3624,7 +3624,7 @@ static void spoolss_reply_enumprintmonitors(SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_
/****************************************************************************
****************************************************************************/
-static void api_spoolss_enumprintmonitors(pipes_struct *p, prs_struct *data,
+static void api_spoolss_enumprintmonitors(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_ENUMPRINTMONITORS q_u;
@@ -3638,7 +3638,7 @@ static void api_spoolss_enumprintmonitors(pipes_struct *p, prs_struct *data,
/****************************************************************************
****************************************************************************/
-static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata, connection_struct *conn)
+static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata)
{
SPOOL_R_GETJOB r_u;
int snum;
@@ -3657,7 +3657,7 @@ static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata, connect
if (get_printer_snum(&(q_u->handle), &snum))
{
- count=get_printqueue(snum, conn, &queue, &status);
+ count=get_printqueue(snum, NULL, &queue, &status);
r_u.level=q_u->level;
@@ -3719,14 +3719,14 @@ static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata, connect
/****************************************************************************
****************************************************************************/
-static void api_spoolss_getjob(pipes_struct *p, prs_struct *data,
+static void api_spoolss_getjob(rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata)
{
SPOOL_Q_GETJOB q_u;
spoolss_io_q_getjob("", &q_u, data, 0);
- spoolss_reply_getjob(&q_u, rdata, p->conn);
+ spoolss_reply_getjob(&q_u, rdata);
spoolss_io_free_buffer(&(q_u.buffer));
}
@@ -3774,7 +3774,7 @@ struct api_struct api_spoolss_cmds[] =
/*******************************************************************
receives a spoolss pipe and responds.
********************************************************************/
-BOOL api_spoolss_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_spoolss_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_spoolss_rpc", api_spoolss_cmds, data);
}
diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c
index 35f1676232..8dd99cccc6 100644
--- a/source3/rpc_server/srv_srvsvc.c
+++ b/source3/rpc_server/srv_srvsvc.c
@@ -972,7 +972,7 @@ static void srv_reply_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *q_n,
/*******************************************************************
********************************************************************/
-static void api_srv_net_srv_get_info( pipes_struct *p, prs_struct *data,
+static void api_srv_net_srv_get_info( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SRV_Q_NET_SRV_GET_INFO q_n;
@@ -987,7 +987,7 @@ static void api_srv_net_srv_get_info( pipes_struct *p, prs_struct *data,
/*******************************************************************
********************************************************************/
-static void api_srv_net_file_enum( pipes_struct *p, prs_struct *data,
+static void api_srv_net_file_enum( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SRV_Q_NET_FILE_ENUM q_n;
@@ -1005,7 +1005,7 @@ static void api_srv_net_file_enum( pipes_struct *p, prs_struct *data,
/*******************************************************************
********************************************************************/
-static void api_srv_net_conn_enum( pipes_struct *p, prs_struct *data,
+static void api_srv_net_conn_enum( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SRV_Q_NET_CONN_ENUM q_n;
@@ -1023,7 +1023,7 @@ static void api_srv_net_conn_enum( pipes_struct *p, prs_struct *data,
/*******************************************************************
********************************************************************/
-static void api_srv_net_sess_enum( pipes_struct *p, prs_struct *data,
+static void api_srv_net_sess_enum( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SRV_Q_NET_SESS_ENUM q_n;
@@ -1041,7 +1041,7 @@ static void api_srv_net_sess_enum( pipes_struct *p, prs_struct *data,
/*******************************************************************
********************************************************************/
-static void api_srv_net_share_enum( pipes_struct *p, prs_struct *data,
+static void api_srv_net_share_enum( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SRV_Q_NET_SHARE_ENUM q_n;
@@ -1097,7 +1097,7 @@ static void srv_reply_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_n,
}
/*******************************************************************
********************************************************************/
-static void api_srv_net_remote_tod( pipes_struct *p, prs_struct *data,
+static void api_srv_net_remote_tod( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SRV_Q_NET_REMOTE_TOD q_n;
@@ -1127,7 +1127,7 @@ struct api_struct api_srv_cmds[] =
/*******************************************************************
receives a srvsvc pipe and responds.
********************************************************************/
-BOOL api_srvsvc_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_srvsvc_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_srvsvc_rpc", api_srv_cmds, data);
}
diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c
index e67cafb9df..12f0bdf3b3 100644
--- a/source3/rpc_server/srv_svcctl.c
+++ b/source3/rpc_server/srv_svcctl.c
@@ -61,7 +61,7 @@ static void svc_reply_close(SVC_Q_CLOSE *q_r,
/*******************************************************************
api_svc_close
********************************************************************/
-static void api_svc_close( pipes_struct *p, prs_struct *data,
+static void api_svc_close( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SVC_Q_CLOSE q_r;
@@ -117,7 +117,7 @@ static void svc_reply_open_service(SVC_Q_OPEN_SERVICE *q_u,
/*******************************************************************
api_svc_open_service
********************************************************************/
-static void api_svc_open_service( pipes_struct *p, prs_struct *data,
+static void api_svc_open_service( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SVC_Q_OPEN_SERVICE q_u;
@@ -153,7 +153,7 @@ static void svc_reply_start_service(SVC_Q_START_SERVICE *q_s,
/*******************************************************************
api_svc_start_service
********************************************************************/
-static void api_svc_start_service( pipes_struct *p, prs_struct *data,
+static void api_svc_start_service( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SVC_Q_START_SERVICE q_u;
@@ -203,7 +203,7 @@ static void svc_reply_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u,
/*******************************************************************
api_svc_open_sc_man
********************************************************************/
-static void api_svc_open_sc_man( pipes_struct *p, prs_struct *data,
+static void api_svc_open_sc_man( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SVC_Q_OPEN_SC_MAN q_u;
@@ -318,7 +318,7 @@ static void svc_reply_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_u,
/*******************************************************************
api_svc_enum_svcs_status
********************************************************************/
-static void api_svc_enum_svcs_status( pipes_struct *p, prs_struct *data,
+static void api_svc_enum_svcs_status( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SVC_Q_ENUM_SVCS_STATUS q_u;
@@ -356,7 +356,7 @@ static void svc_reply_query_disp_name(SVC_Q_QUERY_DISP_NAME *q_u,
/*******************************************************************
api_svc_query_disp_name
********************************************************************/
-static void api_svc_query_disp_name( pipes_struct *p, prs_struct *data,
+static void api_svc_query_disp_name( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
SVC_Q_QUERY_DISP_NAME q_u;
@@ -381,7 +381,7 @@ static struct api_struct api_svc_cmds[] =
/*******************************************************************
receives a svcctl pipe and responds.
********************************************************************/
-BOOL api_svcctl_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_svcctl_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_svc_rpc", api_svc_cmds, data);
}
diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c
index 9b0b0a3ca8..e97ae1ee6e 100644
--- a/source3/rpc_server/srv_wkssvc.c
+++ b/source3/rpc_server/srv_wkssvc.c
@@ -80,7 +80,7 @@ static void wks_reply_query_info(WKS_Q_QUERY_INFO *q_u,
/*******************************************************************
api_wks_query_info
********************************************************************/
-static void api_wks_query_info( pipes_struct *p, prs_struct *data,
+static void api_wks_query_info( rpcsrv_struct *p, prs_struct *data,
prs_struct *rdata )
{
WKS_Q_QUERY_INFO q_u;
@@ -105,7 +105,7 @@ struct api_struct api_wks_cmds[] =
/*******************************************************************
receives a wkssvc pipe and responds.
********************************************************************/
-BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data)
+BOOL api_wkssvc_rpc(rpcsrv_struct *p, prs_struct *data)
{
return api_rpcTNP(p, "api_wkssvc_rpc", api_wks_cmds, data);
}
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 9d15699532..a03393fbbd 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -2020,14 +2020,14 @@ void cmd_sam_query_dispinfo(struct client_info *info, int argc, char *argv[])
sid_to_string(sid, &info->dom.level5_sid);
fstrcpy(domain, info->dom.level5_dom);
+ string_to_sid(&sid1, sid);
+
if (sid1.num_auths == 0)
{
fprintf(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n");
return;
}
- string_to_sid(&sid1, sid);
-
fstrcpy(srv_name, "\\\\");
fstrcat(srv_name, info->dest_host);
strupper(srv_name);
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 024a3c03e4..c37c2ceab2 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -129,7 +129,7 @@ void close_file(files_struct *fsp, BOOL normal_close)
/* NT uses smbclose to start a print - weird */
if (normal_close && fsp->print_file)
- print_file(conn, fsp);
+ print_file(conn, SNUM(conn), fsp);
/* check for magic scripts */
if (normal_close) {
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index a3e7932529..eeb367bcb5 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -3118,21 +3118,14 @@ static BOOL api_WPrintPortEnum(connection_struct *conn,uint16 vuid, char *param,
}
static void api_rpc_trans_reply(char *outbuf,
- pipes_struct *p,
- prs_struct *pd)
+ pipes_struct *p)
{
- send_trans_reply(outbuf, p->rhdr.data, NULL, NULL, 0, p->file_offset);
+ send_trans_reply(outbuf, p->rsmb_pdu.data, NULL, NULL, 0, p->file_offset);
- if (mem_buf_len(p->rhdr.data) <= p->file_offset)
+ if (mem_buf_len(p->rsmb_pdu.data) <= p->file_offset)
{
/* all of data was sent: no need to wait for SMBreadX calls */
- mem_free_data(p->rhdr .data);
- mem_free_data(p->rfault .data);
- mem_free_data(p->rdata .data);
- mem_free_data(p->rdata_i.data);
- mem_free_data(p->rauth .data);
- mem_free_data(p->rverf .data);
- mem_free_data(p->rntlm .data);
+ mem_free_data(p->rsmb_pdu.data);
}
}
@@ -3221,14 +3214,9 @@ static int api_fd_reply(connection_struct *conn,uint16 vuid,char *outbuf,
uint16 pnum;
uint16 subcommand;
pipes_struct *p = NULL;
- prs_struct pd;
DEBUG(5,("api_fd_reply\n"));
- /* make a static data parsing structure from the api_fd_reply data */
- prs_init(&pd, 0, 4, 0, True);
- mem_create(pd.data, data, 0, tdscnt, 0, False);
-
/* First find out the name of this file. */
if (suwcnt != 2)
{
@@ -3257,11 +3245,10 @@ static int api_fd_reply(connection_struct *conn,uint16 vuid,char *outbuf,
{
case 0x26:
{
- /* dce/rpc command */
- reply = rpc_command(p, &pd);
+ reply = rpc_to_smb(p, data, tdscnt);
if (reply)
{
- api_rpc_trans_reply(outbuf, p, &pd);
+ api_rpc_trans_reply(outbuf, p);
}
break;
}
@@ -3284,8 +3271,6 @@ static int api_fd_reply(connection_struct *conn,uint16 vuid,char *outbuf,
DEBUG(1,("api_fd_reply: INVALID PIPE HANDLE: %x\n", pnum));
}
- mem_free_data(pd.data);
-
if (!reply)
{
return api_no_reply(outbuf, mdrcnt);
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 240ec30c3f..91f727701c 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -221,14 +221,14 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen,
/* check the given username and password */
if (!ok && (*user) && user_ok(user,snum)) {
- ok = password_ok(user,password, pwlen, NULL, vuser->dc.user_sess_key);
+ ok = password_ok(user,password, pwlen, NULL, vuser->user_sess_key);
if (ok) DEBUG(3,("ACCEPTED: given username password ok\n"));
}
/* check for a previously registered guest username */
if (!ok && (vuser != 0) && vuser->guest) {
if (user_ok(vuser->name,snum) &&
- password_ok(vuser->name, password, pwlen, NULL, vuser->dc.user_sess_key)) {
+ password_ok(vuser->name, password, pwlen, NULL, vuser->user_sess_key)) {
fstrcpy(user, vuser->name);
vuser->guest = False;
DEBUG(3,("ACCEPTED: given password with registered user %s\n", user));
@@ -252,7 +252,7 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen,
fstrcpy(user2,auser);
if (!user_ok(user2,snum)) continue;
- if (password_ok(user2,password, pwlen, NULL, vuser->dc.user_sess_key)) {
+ if (password_ok(user2,password, pwlen, NULL, vuser->user_sess_key)) {
ok = True;
fstrcpy(user,user2);
DEBUG(3,("ACCEPTED: session list username and given password ok\n"));
@@ -291,7 +291,7 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen,
{
if (*auser == '@')
{
- auser = validate_group(auser+1,password,pwlen,snum, vuser->dc.user_sess_key);
+ auser = validate_group(auser+1,password,pwlen,snum, vuser->user_sess_key);
if (auser)
{
ok = True;
@@ -304,7 +304,7 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen,
fstring user2;
fstrcpy(user2,auser);
if (user_ok(user2,snum) &&
- password_ok(user2,password,pwlen,NULL, vuser->dc.user_sess_key))
+ password_ok(user2,password,pwlen,NULL, vuser->user_sess_key))
{
ok = True;
fstrcpy(user,user2);
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 92565b7507..3501879d5f 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -25,6 +25,7 @@ extern int DEBUGLEVEL;
static uid_t initial_uid;
static gid_t initial_gid;
+static struct uid_cache vcache;
/* what user is current? */
extern struct current_user current_user;
@@ -54,6 +55,8 @@ void init_uid(void)
current_user.conn = NULL;
current_user.vuid = UID_FIELD_INVALID;
+ vcache.entries = 0;
+
dos_ChDir(OriginalDir);
}
@@ -192,19 +195,19 @@ BOOL become_guest(void)
/*******************************************************************
check if a username is OK
********************************************************************/
-static BOOL check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
+static BOOL check_vuser_ok(struct uid_cache *cache, user_struct *vuser,int snum)
{
int i;
- for (i=0;i<conn->uid_cache.entries;i++)
- if (conn->uid_cache.list[i] == vuser->uid) return(True);
+ for (i=0;i<cache->entries;i++)
+ if (cache->list[i] == vuser->uid) return(True);
if (!user_ok(vuser->name,snum)) return(False);
- i = conn->uid_cache.entries % UID_CACHE_SIZE;
- conn->uid_cache.list[i] = vuser->uid;
+ i = cache->entries % UID_CACHE_SIZE;
+ cache->list[i] = vuser->uid;
- if (conn->uid_cache.entries < UID_CACHE_SIZE)
- conn->uid_cache.entries++;
+ if (cache->entries < UID_CACHE_SIZE)
+ cache->entries++;
return(True);
}
@@ -213,11 +216,114 @@ static BOOL check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
/****************************************************************************
become the user of a connection number
****************************************************************************/
+BOOL become_vuser(uint16 vuid)
+{
+ user_struct *vuser = get_valid_user_struct(vuid);
+ gid_t gid;
+ uid_t uid;
+
+ unbecome_vuser();
+
+ if((vuser != NULL) && !check_vuser_ok(&vcache, vuser, -1))
+ return False;
+
+ if ( vuser != 0 &&
+ current_user.vuid == vuid &&
+ current_user.uid == vuser->uid)
+ {
+ DEBUG(4,("Skipping become_vuser - already user\n"));
+ return(True);
+ }
+ uid = vuser->uid;
+ gid = vuser->gid;
+ current_user.ngroups = vuser->n_groups;
+ current_user.groups = vuser->groups;
+
+ if (initial_uid == 0)
+ {
+ if (!become_gid(gid)) return(False);
+
+#ifdef HAVE_SETGROUPS
+ /* groups stuff added by ih/wreu */
+ if (current_user.ngroups > 0)
+ {
+ if (setgroups(current_user.ngroups,
+ current_user.groups)<0) {
+ DEBUG(0,("setgroups call failed!\n"));
+ }
+ }
+#endif
+
+ if (!become_uid(uid)) return(False);
+ }
+
+ current_user.conn = NULL;
+ current_user.vuid = vuid;
+
+ DEBUG(5,("become_vuser uid=(%d,%d) gid=(%d,%d)\n",
+ (int)getuid(),(int)geteuid(),(int)getgid(),(int)getegid()));
+
+ return(True);
+}
+
+/****************************************************************************
+ unbecome a user
+****************************************************************************/
+BOOL unbecome_vuser(void)
+{
+ dos_ChDir(OriginalDir);
+
+ if (initial_uid == 0)
+ {
+#ifdef HAVE_SETRESUID
+ setresuid(-1,getuid(),-1);
+ setresgid(-1,getgid(),-1);
+#else
+ if (seteuid(initial_uid) != 0)
+ setuid(initial_uid);
+ setgid(initial_gid);
+#endif
+ }
+
+#ifdef NO_EID
+ if (initial_uid == 0)
+ DEBUG(2,("Running with no EID\n"));
+ initial_uid = getuid();
+ initial_gid = getgid();
+#else
+ if (geteuid() != initial_uid) {
+ DEBUG(0,("Warning: You appear to have a trapdoor uid system\n"));
+ initial_uid = geteuid();
+ }
+ if (getegid() != initial_gid) {
+ DEBUG(0,("Warning: You appear to have a trapdoor gid system\n"));
+ initial_gid = getegid();
+ }
+#endif
+
+ current_user.uid = initial_uid;
+ current_user.gid = initial_gid;
+
+ if (dos_ChDir(OriginalDir) != 0)
+ DEBUG( 0, ( "chdir(%s) failed in unbecome_vuser\n", OriginalDir ) );
+
+ DEBUG(5,("unbecome_vuser now uid=(%d,%d) gid=(%d,%d)\n",
+ (int)getuid(),(int)geteuid(),(int)getgid(),(int)getegid()));
+
+ current_user.conn = NULL;
+ current_user.vuid = UID_FIELD_INVALID;
+
+ return(True);
+}
+
+/****************************************************************************
+ become the user of a connection number
+****************************************************************************/
BOOL become_user(connection_struct *conn, uint16 vuid)
{
user_struct *vuser = get_valid_user_struct(vuid);
int snum;
- gid_t gid;
+ gid_t gid;
uid_t uid;
/*
@@ -247,7 +353,7 @@ BOOL become_user(connection_struct *conn, uint16 vuid)
snum = SNUM(conn);
- if((vuser != NULL) && !check_user_ok(conn, vuser, snum))
+ if((vuser != NULL) && !check_vuser_ok(&conn->uid_cache, vuser, snum))
return False;
if (conn->force_user ||