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 | |
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')
-rw-r--r-- | source3/include/byteorder.h | 34 | ||||
-rw-r--r-- | source3/include/proto.h | 23 | ||||
-rw-r--r-- | source3/lib/crc32.c | 2 | ||||
-rw-r--r-- | source3/lib/genrand.c | 4 | ||||
-rw-r--r-- | source3/lib/hmacmd5.c | 2 | ||||
-rw-r--r-- | source3/lib/membuffer.c | 8 | ||||
-rw-r--r-- | source3/lib/util_sid.c | 20 | ||||
-rw-r--r-- | source3/lib/util_str.c | 2 | ||||
-rw-r--r-- | source3/lib/util_unistr.c | 16 | ||||
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 6 | ||||
-rw-r--r-- | source3/rpc_client/cli_reg.c | 4 | ||||
-rw-r--r-- | source3/rpc_client/cli_svcctl.c | 2 | ||||
-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 | ||||
-rw-r--r-- | source3/rpcclient/cmd_lsarpc.c | 4 |
20 files changed, 133 insertions, 109 deletions
diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h index 23e4f33049..a3b1437dc2 100644 --- a/source3/include/byteorder.h +++ b/source3/include/byteorder.h @@ -176,10 +176,10 @@ it also defines lots of intermediate macros, just ignore those :-) /* macros for reading / writing arrays */ #define SMBMACRO(macro,buf,pos,val,len,size) \ -{ int l; for (l = 0; l < (len); l++) (val)[l] = macro((buf), (pos) + (size)*l); } +{ uint32 l; for (l = 0; l < (uint32)(len); l++) (val)[l] = macro((buf), (pos) + (size)*l); } #define SSMBMACRO(macro,buf,pos,val,len,size) \ -{ int l; for (l = 0; l < (len); l++) macro((buf), (pos) + (size)*l, (val)[l]); } +{ uint32 l; for (l = 0; l < (uint32)(len); l++) macro((buf), (pos) + (size)*l, (val)[l]); } /* reads multiple data from an SMB buffer */ #define PCVAL(buf,pos,val,len) SMBMACRO(CVAL,buf,pos,val,len,1) @@ -209,40 +209,40 @@ it also defines lots of intermediate macros, just ignore those :-) #define DBG_RW_PCVAL(charmode,string,depth,base,read,inbuf,outbuf,len) \ RW_PCVAL(read,inbuf,outbuf,len) \ - DEBUG(5,("%s%04x %s: ", \ + DEBUG(10,("%s%04x %s: ", \ tab_depth(depth), base,string)); \ - if (charmode) print_asc(5, (unsigned char*)(outbuf), (len)); else \ - { int idx; for (idx = 0; idx < len; idx++) { DEBUGADD(5,("%02x ", (outbuf)[idx])); } } \ - DEBUG(5,("\n")); + if (charmode) print_asc(10, (unsigned char*)(outbuf), (len)); else \ + { uint32 idx; for (idx = 0; idx < (uint32)(len); idx++) { DEBUGADD(10,("%02x ", (outbuf)[idx])); } } \ + DEBUG(10,("\n")); #define DBG_RW_PSVAL(charmode,string,depth,base,read,inbuf,outbuf,len) \ RW_PSVAL(read,inbuf,outbuf,len) \ - DEBUG(5,("%s%04x %s: ", \ + DEBUG(10,("%s%04x %s: ", \ tab_depth(depth), base,string)); \ - if (charmode) print_asc(5, (unsigned char*)(outbuf), 2*(len)); else \ - { int idx; for (idx = 0; idx < len; idx++) { DEBUGADD(5,("%04x ", (outbuf)[idx])); } } \ - DEBUG(5,("\n")); + if (charmode) print_asc(10, (unsigned char*)(outbuf), 2*(len)); else \ + { uint32 idx; for (idx = 0; idx < (uint32)(len); idx++) { DEBUGADD(10,("%04x ", (outbuf)[idx])); } } \ + DEBUG(10,("\n")); #define DBG_RW_PIVAL(charmode,string,depth,base,read,inbuf,outbuf,len) \ RW_PIVAL(read,inbuf,outbuf,len) \ - DEBUG(5,("%s%04x %s: ", \ + DEBUG(10,("%s%04x %s: ", \ tab_depth(depth), base,string)); \ - if (charmode) print_asc(5, (unsigned char*)(outbuf), 4*(len)); else \ - { int idx; for (idx = 0; idx < len; idx++) { DEBUGADD(5,("%08x ", (outbuf)[idx])); } } \ - DEBUG(5,("\n")); + if (charmode) print_asc(10, (unsigned char*)(outbuf), 4*(len)); else \ + { uint32 idx; for (idx = 0; idx < (uint32)(len); idx++) { DEBUGADD(10,("%08x ", (outbuf)[idx])); } } \ + DEBUG(10,("\n")); #define DBG_RW_CVAL(string,depth,base,read,inbuf,outbuf) \ RW_CVAL(read,inbuf,outbuf,0) \ - DEBUG(5,("%s%04x %s: %02x\n", \ + DEBUG(10,("%s%04x %s: %02x\n", \ tab_depth(depth), base, string, outbuf)); #define DBG_RW_SVAL(string,depth,base,read,inbuf,outbuf) \ RW_SVAL(read,inbuf,outbuf,0) \ - DEBUG(5,("%s%04x %s: %04x\n", \ + DEBUG(10,("%s%04x %s: %04x\n", \ tab_depth(depth), base, string, outbuf)); #define DBG_RW_IVAL(string,depth,base,read,inbuf,outbuf) \ RW_IVAL(read,inbuf,outbuf,0) \ - DEBUG(5,("%s%04x %s: %08x\n", \ + DEBUG(10,("%s%04x %s: %08x\n", \ tab_depth(depth), base, string, outbuf)); diff --git a/source3/include/proto.h b/source3/include/proto.h index 60ed7f721d..ade8866376 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -237,7 +237,7 @@ void hmac_md5_init_rfc2104(uchar* key, int key_len, HMACMD5Context *ctx); void hmac_md5_init_limK_to_64(const uchar* key, int key_len, HMACMD5Context *ctx); void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx); -void hmac_md5_final(caddr_t digest, HMACMD5Context *ctx); +void hmac_md5_final(uchar *digest, HMACMD5Context *ctx); /*The following definitions come from lib/interface.c */ @@ -280,7 +280,7 @@ BOOL mem_buf_copy(char *copy_into, struct mem_buf *buf, BOOL mem_buf_init(struct mem_buf **buf, uint32 margin); void mem_buf_free(struct mem_buf **buf); void mem_free_data(struct mem_buf *buf); -BOOL mem_realloc_data(struct mem_buf *buf, int new_size); +BOOL mem_realloc_data(struct mem_buf *buf, size_t new_size); BOOL mem_grow_data(struct mem_buf **buf, BOOL io, int new_size, BOOL force_grow); uint32 mem_buf_len(struct mem_buf *buf); char *mem_data(struct mem_buf **buf, uint32 offset); @@ -536,6 +536,7 @@ void sid_copy(DOM_SID *sid1, const DOM_SID *sid2); BOOL sid_front_equal(const DOM_SID *sid1, const DOM_SID *sid2); BOOL sid_equal(const DOM_SID *sid1, const DOM_SID *sid2); int sid_size(const DOM_SID *sid); +DOM_SID *sid_dup(DOM_SID *src); /*The following definitions come from lib/util_sock.c */ @@ -590,7 +591,7 @@ char *safe_strcpy(char *dest,const char *src, size_t maxlength); char *safe_strcat(char *dest, const char *src, size_t maxlength); char *StrCpy(char *dest,const char *src); char *StrnCpy(char *dest,const char *src,size_t n); -char *strncpyn(char *dest, const char *src,size_t n, char c); +char *strncpyn(char *dest, char *src,size_t n, char c); size_t strhex_to_str(char *p, size_t len, const char *strhex); BOOL in_list(char *s,char *list,BOOL casesensitive); BOOL string_init(char **dest,const char *src); @@ -605,14 +606,14 @@ char *enum_field_to_str(uint32 type, struct field_info *bs, BOOL first_default); /*The following definitions come from lib/util_unistr.c */ char *ascii_to_unibuf(char *dest, const char *src, int maxlen); -const char *unibuf_to_ascii(char *dest, const char *src, int maxlen); +const char* unibuf_to_ascii(char *dest, const char *src, int maxlen); void ascii_to_unistr(uint16 *dest, const char *src, int maxlen); void unistr_to_ascii(char *dest, const uint16 *src, int len); -void unistr2_to_ascii(char *dest, const UNISTR2 *str, int maxlen); +void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen); char *skip_unibuf(char *srcbuf, int len); char *uni_strncpy(char *destbuf, const char *srcbuf, int len); uint32 buffer2_to_uint32(const BUFFER2 *str); -void buffer2_to_multistr(char *dest, const BUFFER2 *str, int maxlen); +void buffer2_to_multistr(char *dest, const BUFFER2 *str, size_t maxlen); /*The following definitions come from libsmb/clientgen.c */ @@ -2120,14 +2121,14 @@ BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 status); BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth); BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth); -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); BOOL make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, int num_sids, DOM_SID **sids, uint16 level); BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth); BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth); BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names); + uint32 num_names, char **names); BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth); BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth); BOOL make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd); @@ -2163,7 +2164,7 @@ BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth); BOOL make_unistr(UNISTR *str, char *buf); BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth); BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val); -BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len); +BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len); BOOL make_buffer3_hex(BUFFER3 *str, char *buf); BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len); BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth); @@ -2931,11 +2932,11 @@ BOOL make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark); BOOL make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark); BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, char *net_name, char *remark, - char *path, char *passwd); + char *path, char *pass); 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); BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, char *srv_name, uint32 share_level, SRV_SHARE_INFO_CTR *ctr, diff --git a/source3/lib/crc32.c b/source3/lib/crc32.c index 9da5b4bfe1..39c01fa30f 100644 --- a/source3/lib/crc32.c +++ b/source3/lib/crc32.c @@ -59,7 +59,7 @@ static unsigned long CRCTable[256] = uint32 crc32_calc_buffer( uint32 count, char *buffer) { uint32 crc=0xffffffff; - int i; + uint32 i; for(i=0;i<count;i++) { crc = (crc>>8) ^ CRCTable[(buffer[i] ^ crc) & 0xff]; diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index a2fd1e0860..ab0dadebcf 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -58,8 +58,8 @@ static void do_dirrand(char *name, unsigned char *buf, int buf_len) { DIR *dp = opendir(name); pstring fullname; - int len_left; - int fullname_len; + size_t len_left; + size_t fullname_len; char *pos; pstrcpy(fullname, name); diff --git a/source3/lib/hmacmd5.c b/source3/lib/hmacmd5.c index d3c0d42d97..d017bba77d 100644 --- a/source3/lib/hmacmd5.c +++ b/source3/lib/hmacmd5.c @@ -106,7 +106,7 @@ void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx) /*********************************************************************** finish off hmac_md5 "inner" buffer and generate outer one. ***********************************************************************/ -void hmac_md5_final(caddr_t digest, HMACMD5Context *ctx) +void hmac_md5_final(uchar *digest, HMACMD5Context *ctx) { struct MD5Context ctx_o; diff --git a/source3/lib/membuffer.c b/source3/lib/membuffer.c index 92bc2be439..170433074f 100644 --- a/source3/lib/membuffer.c +++ b/source3/lib/membuffer.c @@ -107,7 +107,7 @@ BOOL mem_alloc_data(struct mem_buf *buf, int size) buf->data_size = size + buf->margin; buf->data_used = size; - buf->data = malloc(buf->data_size); + buf->data = (char*)malloc(buf->data_size); if (buf->data == NULL && size != 0) { @@ -176,7 +176,7 @@ BOOL mem_buf_init(struct mem_buf **buf, uint32 margin) if ((*buf) == NULL) { - (*buf) = malloc(sizeof(**buf)); + (*buf) = (struct mem_buf*)malloc(sizeof(**buf)); if ((*buf) != NULL) { mem_init((*buf), margin); @@ -236,7 +236,7 @@ void mem_free_data(struct mem_buf *buf) /******************************************************************* reallocate a memory buffer, including a safety margin ********************************************************************/ -BOOL mem_realloc_data(struct mem_buf *buf, int new_size) +BOOL mem_realloc_data(struct mem_buf *buf, size_t new_size) { char *new_data; @@ -252,7 +252,7 @@ BOOL mem_realloc_data(struct mem_buf *buf, int new_size) return True; } - new_data = Realloc(buf->data, new_size + buf->margin); + new_data = (char*)Realloc(buf->data, new_size + buf->margin); if (new_data != NULL) { diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index dce398f36f..3be81ce811 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -225,3 +225,23 @@ int sid_size(const DOM_SID *sid) } return sid->num_auths * sizeof(uint32) + 8; } + + +/***************************************************************** + Duplicates a sid - mallocs the target. +*****************************************************************/ + +DOM_SID *sid_dup(DOM_SID *src) +{ + DOM_SID *dst; + + if(!src) + return NULL; + + if((dst = (DOM_SID*)malloc(sizeof(DOM_SID))) != NULL) { + memset(dst, '\0', sizeof(DOM_SID)); + sid_copy( dst, src); + } + + return dst; +} diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 636be164ac..43e3224df4 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -842,7 +842,7 @@ char *StrnCpy(char *dest,const char *src,size_t n) like strncpy but copies up to the character marker. always null terminates. returns a pointer to the character marker in the source string (src). ****************************************************************************/ -char *strncpyn(char *dest, const char *src,size_t n, char c) +char *strncpyn(char *dest, char *src,size_t n, char c) { char *p; size_t str_len; diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index e047697a0f..1dff5964fd 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -51,7 +51,8 @@ char *ascii_to_unibuf(char *dest, const char *src, int maxlen) /******************************************************************* Pull an ASCII string out of a UNICODE buffer (little endian). ********************************************************************/ -const char *unibuf_to_ascii(char *dest, const char *src, int maxlen) + +const char* unibuf_to_ascii(char *dest, const char *src, int maxlen) { char *destend = dest + maxlen; register char c; @@ -126,11 +127,11 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len) Convert a UNISTR2 structure to an ASCII string ********************************************************************/ -void unistr2_to_ascii(char *dest, const UNISTR2 *str, int maxlen) +void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen) { char *destend; const uint16 *src; - int len; + size_t len; register uint16 c; src = str->buffer; @@ -204,7 +205,7 @@ uint32 buffer2_to_uint32(const BUFFER2 *str) { if (str->buf_len == 4) { - const char *src = str->buffer; + const uchar *src = str->buffer; return IVAL(src, 0); } else @@ -217,12 +218,11 @@ uint32 buffer2_to_uint32(const BUFFER2 *str) /******************************************************************* Convert a 'multi-string' buffer to space-separated ASCII. ********************************************************************/ - -void buffer2_to_multistr(char *dest, const BUFFER2 *str, int maxlen) +void buffer2_to_multistr(char *dest, const BUFFER2 *str, size_t maxlen) { char *destend; - const char *src; - int len; + const uchar *src; + size_t len; register uint16 c; src = str->buffer; diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 0c65231cef..2ceb34aad7 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -282,7 +282,7 @@ BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum, } if (valid_response) { - int i; + uint32 i; for (i = 0; i < r_l.num_entries; i++) { if (t_rids[i].rid_idx >= ref.num_ref_doms_1 && @@ -428,7 +428,7 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum, } if (valid_response) { - int i; + uint32 i; for (i = 0; i < t_names.num_entries; i++) { if (t_names.name[i].domain_idx >= ref.num_ref_doms_1) @@ -648,7 +648,7 @@ BOOL lsa_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd) if (p) { /* check that the returned policy handle is all zeros */ - int i; + uint32 i; valid_close = True; for (i = 0; i < sizeof(r_c.pol.data); i++) diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index c6466f4b4f..cbbd6e57bf 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -425,7 +425,7 @@ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, if (p) { valid_query = True; - unibuf_to_ascii(type, r_o.uni_type.buffer, + unibuf_to_ascii(type, (const char*)r_o.uni_type.buffer, MIN(r_o.uni_type.buf_len, sizeof(fstring)-1)); (*unk_0) = r_o.unknown_0; (*unk_1) = r_o.unknown_1; @@ -1018,7 +1018,7 @@ BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd) if (p) { /* check that the returned policy handle is all zeros */ - int i; + uint32 i; valid_close = True; for (i = 0; i < sizeof(r_c.pol.data); i++) diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c index e4312c5f33..292972eae2 100644 --- a/source3/rpc_client/cli_svcctl.c +++ b/source3/rpc_client/cli_svcctl.c @@ -337,7 +337,7 @@ BOOL svc_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd) if (p) { /* check that the returned policy handle is all zeros */ - int i; + uint32 i; valid_close = True; for (i = 0; i < sizeof(r_c.pol.data); i++) 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) { diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index d0e429801e..f68b323385 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -317,7 +317,7 @@ void cmd_lsa_query_secret(struct client_info *info) BOOL res = True; BOOL res1; BOOL res2; - int i; + uint32 i; POLICY_HND hnd_secret; fstring secret_name; @@ -360,7 +360,7 @@ void cmd_lsa_query_secret(struct client_info *info) /* close the session */ cli_nt_session_close(smb_cli, nt_pipe_fnum); - if (res2 && nt_decrypt_string2(&secret, &enc_secret, smb_cli->pwd.smb_nt_pwd)) + if (res2 && nt_decrypt_string2(&secret, &enc_secret, (char*)(smb_cli->pwd.smb_nt_pwd))) { report(out_hnd, "\tValue : "); for (i = 0; i < secret.str_str_len; i++) |