PERFORCE change 76269 for review

Robert Watson rwatson at FreeBSD.org
Sat Apr 30 13:03:37 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=76269

Change 76269 by rwatson at rwatson_paprika on 2005/04/30 13:03:04

	Return errno values when failing au_to_*() library calls due to
	invalid arguments or unimplemented calls.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#8 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#8 (text+ko) ====

@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2004, Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, Apple Computer, Inc.
+ * Copyright (c) 2005 Robert N. M. Watson
+ * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,6 +39,7 @@
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 
+#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -81,6 +84,7 @@
 	u_int16_t textlen;
 	
 	if(text == NULL) {
+		errno = EINVAL;
 		return NULL;	
 	}
 	
@@ -109,6 +113,7 @@
 	u_int16_t textlen;
 	
 	if(text == NULL) {
+		errno = EINVAL;
 		return NULL;	
 	}
 	
@@ -153,6 +158,7 @@
 	u_int16_t pad0_32 = 0;
 
 	if(attr == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -189,6 +195,7 @@
 
 token_t *au_to_attr64(struct vattr *attr)
 {
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -214,6 +221,7 @@
 	size_t datasize, totdata;
 	
 	if(p == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -228,7 +236,9 @@
 		case AUR_LONG:	datasize = AUR_LONG_SIZE;
 						break;
 				
-		default: return NULL;
+		default:
+			errno = EINVAL;
+ 			return NULL;
 	}
 
 	totdata = datasize * unit_count;
@@ -289,6 +299,7 @@
 	int i;
    	
 	if(groups == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -319,6 +330,7 @@
 	u_char *dptr = NULL;
 		 
 	if(internet_addr == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -345,6 +357,7 @@
 	u_int32_t type = AF_INET6;
 	
 	if(internet_addr == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -373,6 +386,7 @@
 	u_char *dptr = NULL;
 
 	if(ip == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -431,6 +445,7 @@
 	
 	
 	if(perm == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -503,6 +518,7 @@
 	u_char *dptr = NULL;
 			 
 	if((data == NULL) || (bytes <= 0)) {
+		errno = EINVAL;
 		return NULL;
 	}
  
@@ -539,6 +555,7 @@
 	}
 	
 	if(file == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	filelen = strlen(file);
@@ -573,6 +590,7 @@
 	u_int16_t textlen;
 	
 	if(text == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	textlen = strlen(text);
@@ -602,6 +620,7 @@
 	u_int16_t textlen;
 	
 	if(text == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	textlen = strlen(text);
@@ -640,6 +659,7 @@
 	u_char *dptr = NULL;
 	
 	if(tid == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -666,6 +686,8 @@
 		               uid_t ruid, gid_t rgid, pid_t pid,
 		               au_asid_t sid, au_tid_t *tid)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -699,6 +721,7 @@
 	u_char *dptr = NULL;
 	
 	if(tid == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -729,6 +752,8 @@
 		               	   uid_t ruid, gid_t rgid, pid_t pid,
 		                   au_asid_t sid, au_tid_addr_t *tid)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -816,6 +841,8 @@
  * remote Internet address 4 bytes
  */
 token_t *au_to_socket(struct socket *so) {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -832,12 +859,16 @@
 token_t *au_to_socket_ex_32(u_int16_t lp, u_int16_t rp, 
 	struct sockaddr *la, struct sockaddr *ra)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
 token_t *au_to_socket_ex_128(u_int16_t lp, u_int16_t rp, 
 	struct sockaddr *la, struct sockaddr *ra)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -854,6 +885,7 @@
 	u_char *dptr = NULL;
 
 	if(so == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}	
 
@@ -882,6 +914,7 @@
 	u_char *dptr = NULL;
 
 	if(so == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}	
 
@@ -934,6 +967,7 @@
 	u_char *dptr = NULL;
 	
 	if(tid == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -960,6 +994,8 @@
 						uid_t ruid, gid_t rgid, pid_t pid,
 						au_asid_t sid, au_tid_t *tid)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -993,6 +1029,7 @@
 	u_char *dptr = NULL;
 	
 	if(tid == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 
@@ -1023,6 +1060,8 @@
 	                       gid_t egid, uid_t ruid, gid_t rgid, pid_t pid,
 		                   au_asid_t sid, au_tid_addr_t *tid)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -1067,6 +1106,7 @@
 	size_t totlen = 0;
 	
 	if(args == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -1113,6 +1153,7 @@
 	const char *nextenv;
 	
 	if(env == NULL) {
+		errno = EINVAL;
 		return NULL;
 	}
 	
@@ -1187,6 +1228,8 @@
 
 token_t *au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod)
 {
+
+	errno = ENOTSUP;
 	return NULL;
 }
 
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list