PERFORCE change 111727 for review
Robert Watson
rwatson at FreeBSD.org
Fri Dec 15 00:29:55 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=111727
Change 111727 by rwatson at rwatson_peppercorn on 2006/12/15 08:24:15
Correct gcc41 and Mac OS X build warnings: consistently use signed
and unsigned types for token buffers, constify some string
function arguments.
Submitted by: Diego Giagio <dgiagio at gmail dot com>
Affected files ...
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#44 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#13 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#57 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#44 (text+ko) ====
@@ -32,7 +32,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#43 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#44 $
*/
#include <sys/types.h>
@@ -201,7 +201,7 @@
* Prints the given data bytes as a string.
*/
static void
-print_string(FILE *fp, u_char *str, size_t len)
+print_string(FILE *fp, const char *str, size_t len)
{
int i;
@@ -217,7 +217,7 @@
* Prints the beggining of attribute.
*/
static void
-open_attr(FILE *fp, u_char *str)
+open_attr(FILE *fp, const char *str)
{
fprintf(fp,"%s=\"", str);
@@ -833,7 +833,7 @@
* milliseconds of time 4 bytes/8 bytes (32-bit/64-bit value)
*/
static int
-fetch_header32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_header32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -922,7 +922,7 @@
* nanoseconds of time 4 bytes/8 bytes (32/64-bits)
*/
static int
-fetch_header32_ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_header32_ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1029,7 +1029,7 @@
* version #
*/
static int
-fetch_header64_tok(tokenstr_t *tok, char *buf, int len)
+fetch_header64_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1114,7 +1114,7 @@
* accuracy of the BSM spec.
*/
static int
-fetch_header64_ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_header64_ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1217,7 +1217,7 @@
* record size 4 bytes
*/
static int
-fetch_trailer_tok(tokenstr_t *tok, char *buf, int len)
+fetch_trailer_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1251,7 +1251,7 @@
* text N bytes + 1 terminating NULL byte
*/
static int
-fetch_arg32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_arg32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1267,8 +1267,8 @@
if (err)
return (-1);
- SET_PTR(buf, len, tok->tt.arg32.text, tok->tt.arg32.len, tok->len,
- err);
+ SET_PTR((char*)buf, len, tok->tt.arg32.text, tok->tt.arg32.len,
+ tok->len, err);
if (err)
return (-1);
@@ -1302,7 +1302,7 @@
}
static int
-fetch_arg64_tok(tokenstr_t *tok, char *buf, int len)
+fetch_arg64_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1318,8 +1318,8 @@
if (err)
return (-1);
- SET_PTR(buf, len, tok->tt.arg64.text, tok->tt.arg64.len, tok->len,
- err);
+ SET_PTR((char*)buf, len, tok->tt.arg64.text, tok->tt.arg64.len,
+ tok->len, err);
if (err)
return (-1);
@@ -1360,7 +1360,7 @@
* data items (depends on basic unit)
*/
static int
-fetch_arb_tok(tokenstr_t *tok, char *buf, int len)
+fetch_arb_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
int datasize;
@@ -1589,7 +1589,7 @@
* device 4 bytes/8 bytes (32-bit/64-bit)
*/
static int
-fetch_attr32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_attr32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1671,7 +1671,7 @@
* device 4 bytes/8 bytes (32-bit/64-bit)
*/
static int
-fetch_attr64_tok(tokenstr_t *tok, char *buf, int len)
+fetch_attr64_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1749,7 +1749,7 @@
* return value 4 bytes
*/
static int
-fetch_exit_tok(tokenstr_t *tok, char *buf, int len)
+fetch_exit_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1791,11 +1791,11 @@
* text count null-terminated string(s)
*/
static int
-fetch_execarg_tok(tokenstr_t *tok, char *buf, int len)
+fetch_execarg_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
int i;
- char *bptr;
+ u_char *bptr;
READ_TOKEN_U_INT32(buf, len, tok->tt.execarg.count, tok->len, err);
if (err)
@@ -1804,7 +1804,7 @@
for (i = 0; i < tok->tt.execarg.count; i++) {
bptr = buf + tok->len;
if (i < AUDIT_MAX_ARGS)
- tok->tt.execarg.text[i] = bptr;
+ tok->tt.execarg.text[i] = (char*)bptr;
/* Look for a null terminated string. */
while (bptr && (*bptr != '\0')) {
@@ -1850,11 +1850,11 @@
* text count null-terminated string(s)
*/
static int
-fetch_execenv_tok(tokenstr_t *tok, char *buf, int len)
+fetch_execenv_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
int i;
- char *bptr;
+ u_char *bptr;
READ_TOKEN_U_INT32(buf, len, tok->tt.execenv.count, tok->len, err);
if (err)
@@ -1863,7 +1863,7 @@
for (i = 0; i < tok->tt.execenv.count; i++) {
bptr = buf + tok->len;
if (i < AUDIT_MAX_ENV)
- tok->tt.execenv.text[i] = bptr;
+ tok->tt.execenv.text[i] = (char*)bptr;
/* Look for a null terminated string. */
while (bptr && (*bptr != '\0')) {
@@ -1911,7 +1911,7 @@
* file pathname N bytes + 1 terminating NULL byte
*/
static int
-fetch_file_tok(tokenstr_t *tok, char *buf, int len)
+fetch_file_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -1927,7 +1927,8 @@
if (err)
return (-1);
- SET_PTR(buf, len, tok->tt.file.name, tok->tt.file.len, tok->len, err);
+ SET_PTR((char*)buf, len, tok->tt.file.name, tok->tt.file.len, tok->len,
+ err);
if (err)
return (-1);
@@ -1965,7 +1966,7 @@
* group list count * 4 bytes
*/
static int
-fetch_newgroups_tok(tokenstr_t *tok, char *buf, int len)
+fetch_newgroups_tok(tokenstr_t *tok, u_char *buf, int len)
{
int i;
int err = 0;
@@ -2008,7 +2009,7 @@
* Internet addr 4 bytes
*/
static int
-fetch_inaddr_tok(tokenstr_t *tok, char *buf, int len)
+fetch_inaddr_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2041,7 +2042,7 @@
* address 16 bytes
*/
static int
-fetch_inaddr_ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_inaddr_ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2086,7 +2087,7 @@
* ip header 20 bytes
*/
static int
-fetch_ip_tok(tokenstr_t *tok, char *buf, int len)
+fetch_ip_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2208,7 +2209,7 @@
* Object ID 4 bytes
*/
static int
-fetch_ipc_tok(tokenstr_t *tok, char *buf, int len)
+fetch_ipc_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2255,7 +2256,7 @@
* key 4 bytes
*/
static int
-fetch_ipcperm_tok(tokenstr_t *tok, char *buf, int len)
+fetch_ipcperm_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2341,7 +2342,7 @@
* port Ip address 2 bytes
*/
static int
-fetch_iport_tok(tokenstr_t *tok, char *buf, int len)
+fetch_iport_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2373,7 +2374,7 @@
* data size bytes
*/
static int
-fetch_opaque_tok(tokenstr_t *tok, char *buf, int len)
+fetch_opaque_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2381,8 +2382,8 @@
if (err)
return (-1);
- SET_PTR(buf, len, tok->tt.opaque.data, tok->tt.opaque.size, tok->len,
- err);
+ SET_PTR((char*)buf, len, tok->tt.opaque.data, tok->tt.opaque.size,
+ tok->len, err);
if (err)
return (-1);
@@ -2396,13 +2397,15 @@
print_tok_type(fp, tok->id, "opaque", raw, xml);
if (xml) {
- print_mem(fp, tok->tt.opaque.data, tok->tt.opaque.size);
+ print_mem(fp, (u_char*)tok->tt.opaque.data,
+ tok->tt.opaque.size);
close_tag(fp, tok->id);
} else {
print_delim(fp, del);
print_2_bytes(fp, tok->tt.opaque.size, "%u");
print_delim(fp, del);
- print_mem(fp, tok->tt.opaque.data, tok->tt.opaque.size);
+ print_mem(fp, (u_char*)tok->tt.opaque.data,
+ tok->tt.opaque.size);
}
}
@@ -2411,7 +2414,7 @@
* data size bytes
*/
static int
-fetch_path_tok(tokenstr_t *tok, char *buf, int len)
+fetch_path_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2419,7 +2422,8 @@
if (err)
return (-1);
- SET_PTR(buf, len, tok->tt.path.path, tok->tt.path.len, tok->len, err);
+ SET_PTR((char*)buf, len, tok->tt.path.path, tok->tt.path.len, tok->len,
+ err);
if (err)
return (-1);
@@ -2455,7 +2459,7 @@
* machine id 4 bytes
*/
static int
-fetch_process32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_process32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2568,7 +2572,7 @@
* machine id 4 bytes
*/
static int
-fetch_process64_tok(tokenstr_t *tok, char *buf, int len)
+fetch_process64_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2681,7 +2685,7 @@
* machine address 16 bytes
*/
static int
-fetch_process32ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_process32ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2811,7 +2815,7 @@
* machine address 16 bytes
*/
static int
-fetch_process64ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_process64ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2930,7 +2934,7 @@
* return value 4 bytes
*/
static int
-fetch_return32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_return32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -2968,7 +2972,7 @@
}
static int
-fetch_return64_tok(tokenstr_t *tok, char *buf, int len)
+fetch_return64_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3009,7 +3013,7 @@
* seq 4 bytes
*/
static int
-fetch_seq_tok(tokenstr_t *tok, char *buf, int len)
+fetch_seq_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3043,7 +3047,7 @@
* socket address 4 bytes
*/
static int
-fetch_sock_inet32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_sock_inet32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3097,7 +3101,7 @@
* path 104 bytes
*/
static int
-fetch_sock_unix_tok(tokenstr_t *tok, char *buf, int len)
+fetch_sock_unix_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3147,7 +3151,7 @@
* remote address 4 bytes
*/
static int
-fetch_socket_tok(tokenstr_t *tok, char *buf, int len)
+fetch_socket_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3228,7 +3232,7 @@
* machine id 4 bytes
*/
static int
-fetch_subject32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_subject32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3340,7 +3344,7 @@
* machine id 4 bytes
*/
static int
-fetch_subject64_tok(tokenstr_t *tok, char *buf, int len)
+fetch_subject64_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3453,7 +3457,7 @@
* machine id 16 bytes
*/
static int
-fetch_subject32ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_subject32ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3582,7 +3586,7 @@
* machine id 16 bytes
*/
static int
-fetch_subject64ex_tok(tokenstr_t *tok, char *buf, int len)
+fetch_subject64ex_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3701,7 +3705,7 @@
* data size bytes
*/
static int
-fetch_text_tok(tokenstr_t *tok, char *buf, int len)
+fetch_text_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3709,7 +3713,7 @@
if (err)
return (-1);
- SET_PTR(buf, len, tok->tt.text.text, tok->tt.text.len, tok->len,
+ SET_PTR((char*)buf, len, tok->tt.text.text, tok->tt.text.len, tok->len,
err);
if (err)
return (-1);
@@ -3742,7 +3746,7 @@
* remote Internet address 4 bytes
*/
static int
-fetch_socketex32_tok(tokenstr_t *tok, char *buf, int len)
+fetch_socketex32_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
@@ -3822,7 +3826,7 @@
}
static int
-fetch_invalid_tok(tokenstr_t *tok, char *buf, int len)
+fetch_invalid_tok(tokenstr_t *tok, u_char *buf, int len)
{
int err = 0;
int recoversize;
@@ -3833,7 +3837,8 @@
tok->tt.invalid.length = recoversize;
- SET_PTR(buf, len, tok->tt.invalid.data, recoversize, tok->len, err);
+ SET_PTR((char*)buf, len, tok->tt.invalid.data, recoversize, tok->len,
+ err);
if (err)
return (-1);
@@ -3848,7 +3853,8 @@
if (!xml) {
print_tok_type(fp, tok->id, "unknown", raw, 0);
print_delim(fp, del);
- print_mem(fp, tok->tt.invalid.data, tok->tt.invalid.length);
+ print_mem(fp, (u_char*)tok->tt.invalid.data,
+ tok->tt.invalid.length);
}
}
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#13 (text+ko) ====
@@ -26,7 +26,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#12 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_notify.c#13 $
*/
/*
@@ -66,7 +66,8 @@
au_notify_initialize(void)
{
#if AUDIT_NOTIFICATION_ENABLED
- uint32_t status, ignore_first;
+ uint32_t status;
+ int ignore_first;
status = notify_register_check(__BSM_INTERNAL_NOTIFY_KEY, &token);
if (status != NOTIFY_STATUS_OK)
@@ -108,7 +109,7 @@
au_get_state(void)
{
#if AUDIT_NOTIFICATION_ENABLED
- uint32_t did_notify;
+ int did_notify;
#endif
int status;
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#57 (text+ko) ====
@@ -30,7 +30,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#56 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#57 $
*/
#include <sys/types.h>
@@ -345,7 +345,7 @@
au_to_groups(int *groups)
{
- return (au_to_newgroups(AUDIT_MAX_GROUPS, groups));
+ return (au_to_newgroups(AUDIT_MAX_GROUPS, (gid_t*)groups));
}
/*
More information about the trustedbsd-cvs
mailing list