diff options
author | Luke Leighton <lkcl@samba.org> | 1999-10-25 19:03:27 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-10-25 19:03:27 +0000 |
commit | 56128244261f8e4c6e1144da66c736fbc2104665 (patch) | |
tree | 232c98fb3cd975522fa341af724bf1d05b16cae1 /source3/rpc_parse | |
parent | fdf6383cbec457e3e38b50bcc801661767fa4c0d (diff) | |
download | samba-56128244261f8e4c6e1144da66c736fbc2104665.tar.gz samba-56128244261f8e4c6e1144da66c736fbc2104665.tar.bz2 samba-56128244261f8e4c6e1144da66c736fbc2104665.zip |
- typecast malloc / Realloc issues.
- signed / unsigned issues.
(This used to be commit c8fd555179314baf1672a23db34dc8ad9f2d02bf)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 18 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 7 | ||||
-rw-r--r-- | source3/rpc_parse/parse_net.c | 16 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_sec.c | 14 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 49 | ||||
-rw-r--r-- | source3/rpc_parse/parse_svc.c | 7 |
7 files changed, 59 insertions, 56 deletions
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4053da0721..dbc110a55a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -66,7 +66,7 @@ reads or writes a DOM_R_REF structure. ********************************************************************/ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - int i, s, n; + uint32 i, s, n; prs_debug(ps, depth, desc, "smb_io_dom_r_ref"); depth++; @@ -716,9 +716,9 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int dept /******************************************************************* makes a LSA_SID_ENUM structure. ********************************************************************/ -BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) +BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, uint32 num_entries, DOM_SID **sids) { - int i, i2; + uint32 i, i2; if (sen == NULL || sids == NULL) return False; DEBUG(5,("make_lsa_sid_enum\n")); @@ -752,7 +752,7 @@ reads or writes a LSA_SID_ENUM structure. static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { - int i; + uint32 i; if (sen == NULL) return False; @@ -792,7 +792,7 @@ reads or writes a structure. static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { - int i; + uint32 i; if (trn == NULL) return False; @@ -906,9 +906,9 @@ BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i makes a structure. ********************************************************************/ BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names) + uint32 num_names, char **names) { - int i; + uint32 i; if (q_l == NULL) return False; DEBUG(5,("make_q_lookup_names\n")); @@ -941,7 +941,7 @@ reads or writes a structure. ********************************************************************/ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { - int i; + uint32 i; if (q_r == NULL) return False; @@ -981,7 +981,7 @@ reads or writes a structure. ********************************************************************/ BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_r == NULL) return False; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 31dc252187..5e83cfeaf3 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -489,7 +489,7 @@ BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val) /******************************************************************* creates a BUFFER3 structure. ********************************************************************/ -BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len) +BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -498,7 +498,7 @@ BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len) str->buf_len = len * 2; /* store the string (little endian buffer) */ - ascii_to_unibuf(str->buffer, buf, str->buf_len); + ascii_to_unibuf((char*)str->buffer, buf, str->buf_len); return True; } @@ -665,7 +665,8 @@ BOOL make_buffer2(BUFFER2 *str, const char *buf, int len) str->undoc = 0; /* store the string */ - ascii_to_unibuf(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer)-1)); + ascii_to_unibuf((char*)str->buffer, buf, + MIN(str->buf_len, sizeof(str->buffer)-1)); return True; } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9614af9b51..790556e8c2 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -296,7 +296,7 @@ makes an NET_R_TRUST_DOM_LIST structure. BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, char *dom_name) { - int i = 0; + uint32 i = 0; if (r_t == NULL) return False; @@ -329,7 +329,7 @@ reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_trust_dom"); @@ -939,7 +939,7 @@ BOOL make_net_user_info3(NET_USER_INFO_3 *usr, { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ - int i; + uint32 i; int num_other_sids = 0; int len_user_name = strlen(user_name ); @@ -1029,7 +1029,7 @@ reads or writes a structure. ********************************************************************/ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) { - int i; + uint32 i; if (usr == NULL) return False; @@ -1440,7 +1440,7 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) { BUFHDR2 hdr_priv_data; - int i; + uint32 i; if (info == NULL) return False; @@ -1567,7 +1567,7 @@ reads or writes a structure. ********************************************************************/ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (info == NULL) return False; @@ -1653,7 +1653,7 @@ reads or writes a structure. ********************************************************************/ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (info == NULL) return False; @@ -1767,7 +1767,7 @@ reads or writes a structure. BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_s == NULL) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c50b1d1567..bf4efbe527 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -163,7 +163,7 @@ BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) dump_data(100, sess_key, 16); dump_data(100, q, 68); #endif - SamOEMhash(q, sess_key, 2); + SamOEMhash((uchar*)q, sess_key, 2); #ifdef DEBUG_PASSWORD dump_data(100, q, 68); #endif @@ -393,7 +393,7 @@ BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) } RW_SVAL(ps->io, q, str->buffer[i],0); } - while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && + while ((((size_t)i) < sizeof(str->buffer) / sizeof(str->buffer[0])) && (str->buffer[i] != 0)); diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index c7d4d09612..161e42c9ff 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -138,7 +138,7 @@ first of the xx_io_xx functions that allocates its data structures ********************************************************************/ BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { - int i; + uint32 i; uint32 old_offset; uint32 offset_acl_size; @@ -158,7 +158,7 @@ BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) if (ps->io && t->num_aces != 0) { /* reading */ - t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); + t->ace = (SEC_ACE*)malloc(sizeof(t->ace[0]) * t->num_aces); ZERO_STRUCTP(t->ace); } @@ -328,7 +328,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->dacl = malloc(sizeof(*t->dacl)); + t->dacl = (SEC_ACL*)malloc(sizeof(*t->dacl)); ZERO_STRUCTP(t->dacl); } @@ -360,7 +360,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->sacl = malloc(sizeof(*t->sacl)); + t->sacl = (SEC_ACL*)malloc(sizeof(*t->sacl)); ZERO_STRUCTP(t->sacl); } @@ -395,7 +395,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->owner_sid = malloc(sizeof(*t->owner_sid)); + t->owner_sid = (DOM_SID*)malloc(sizeof(*t->owner_sid)); ZERO_STRUCTP(t->owner_sid); } @@ -425,7 +425,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->grp_sid = malloc(sizeof(*t->grp_sid)); + t->grp_sid = (DOM_SID*)malloc(sizeof(*t->grp_sid)); ZERO_STRUCTP(t->grp_sid); } @@ -502,7 +502,7 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) if (sec->len != 0 && ps->io) { /* reading */ - sec->sec = malloc(sizeof(*sec->sec)); + sec->sec = (SEC_DESC*)malloc(sizeof(*sec->sec)); ZERO_STRUCTP(sec->sec); if (sec->sec == NULL) diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index a282da6ca3..9890e0106d 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -116,8 +116,8 @@ static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru if (ctr->ptr_share_info != 0) { - int i; - int num_entries = ctr->num_entries_read; + uint32 i; + uint32 num_entries = ctr->num_entries_read; if (num_entries > MAX_SHARE_ENTRIES) { num_entries = MAX_SHARE_ENTRIES; /* report this! */ @@ -150,7 +150,7 @@ static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru ********************************************************************/ BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, char *net_name, char *remark, - char *path, char *passwd) + char *path, char *pass) { if (sh2 == NULL) return False; @@ -159,7 +159,7 @@ BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1); make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1); make_unistr2(&(sh2->uni_path ), path , strlen(path )+1); - make_unistr2(&(sh2->uni_passwd ), passwd , strlen(passwd )+1); + make_unistr2(&(sh2->uni_passwd ), pass , strlen(pass )+1); return True; } @@ -194,7 +194,7 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *ss2, SH_INFO_2 *s BOOL make_srv_share_info2(SH_INFO_2 *sh2, char *net_name, uint32 type, char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd) + char *path, char *pass) { if (sh2 == NULL) return False; @@ -208,7 +208,7 @@ BOOL make_srv_share_info2(SH_INFO_2 *sh2, sh2->num_uses = num_uses; sh2->type = type; sh2->ptr_path = path != NULL ? 1 : 0; - sh2->ptr_passwd = passwd != NULL ? 1 : 0; + sh2->ptr_passwd = pass != NULL ? 1 : 0; return True; } @@ -254,8 +254,8 @@ static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_stru if (ctr->ptr_share_info != 0) { - int i; - int num_entries = ctr->num_entries_read; + uint32 i; + uint32 num_entries = ctr->num_entries_read; if (num_entries > MAX_SHARE_ENTRIES) { num_entries = MAX_SHARE_ENTRIES; /* report this! */ @@ -368,7 +368,7 @@ BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct prs_uint32("share_level", ps, depth, &(q_n->share_level )); - if (q_n->share_level != -1) + if (((int)q_n->share_level) != -1) { srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth); } @@ -485,8 +485,8 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct if (ss0->ptr_sess_info != 0) { - int i; - int num_entries = ss0->num_entries_read; + uint32 i; + uint32 num_entries = ss0->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -610,8 +610,8 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct if (ss1->ptr_sess_info != 0) { - int i; - int num_entries = ss1->num_entries_read; + uint32 i; + uint32 num_entries = ss1->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -735,7 +735,7 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *p prs_uint32("sess_level", ps, depth, &(q_n->sess_level )); - if (q_n->sess_level != -1) + if (((int)q_n->sess_level) != -1) { srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth); } @@ -761,7 +761,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *p prs_uint32("sess_level", ps, depth, &(r_n->sess_level)); - if (r_n->sess_level != -1) + if (((int)r_n->sess_level) != -1) { srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth); } @@ -821,8 +821,8 @@ static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct if (ss0->ptr_conn_info != 0) { - int i; - int num_entries = ss0->num_entries_read; + uint32 i; + uint32 num_entries = ss0->num_entries_read; if (num_entries > MAX_CONN_ENTRIES) { num_entries = MAX_CONN_ENTRIES; /* report this! */ @@ -940,8 +940,8 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct if (ss1->ptr_conn_info != 0) { - int i; - int num_entries = ss1->num_entries_read; + uint32 i; + uint32 num_entries = ss1->num_entries_read; if (num_entries > MAX_CONN_ENTRIES) { num_entries = MAX_CONN_ENTRIES; /* report this! */ @@ -1058,7 +1058,7 @@ BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *p prs_uint32("conn_level", ps, depth, &(q_n->conn_level )); - if (q_n->conn_level != -1) + if (((int)q_n->conn_level) != -1) { srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth); } @@ -1084,7 +1084,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p prs_uint32("conn_level", ps, depth, &(r_n->conn_level)); - if (r_n->conn_level != -1) + if (((int)r_n->conn_level) != -1) { srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth); } @@ -1187,8 +1187,9 @@ static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info)); if (fl3->ptr_file_info != 0) { - int i; - int num_entries = fl3->num_entries_read; + uint32 i; + uint32 num_entries = fl3->num_entries_read; + if (num_entries > MAX_FILE_ENTRIES) { num_entries = MAX_FILE_ENTRIES; /* report this! */ @@ -1302,7 +1303,7 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *p prs_uint32("file_id ", ps, depth, &(q_n->file_id )); prs_uint32("file_level", ps, depth, &(q_n->file_level)); - if (q_n->file_level != -1) + if (((int)q_n->file_level) != -1) { srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth); } diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 955d8df595..6b1155a90b 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -197,7 +197,7 @@ BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps if (q_s->ptr_argv != 0) { - int i; + uint32 i; prs_uint32("argc2 ", ps, depth, &(q_s->argc2)); @@ -366,7 +366,7 @@ ARGH! ********************************************************************/ BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth) { - int i; + uint32 i; if (svc == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_enum_svcs_status"); @@ -404,7 +404,8 @@ BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru new_offset = ps->offset; ps->offset = buf_offset; - svc->svcs = Realloc(NULL, svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); + svc->svcs = (ENUM_SRVC_STATUS*)Realloc(NULL, + svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); if (svc->svcs == NULL) { |