Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2002 15:08:49 -0800 (PST)
From:      Brian Feldman <green@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22432 for review
Message-ID:  <200212172308.gBHN8nI8039956@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22432

Change 22432 by green@green_laptop_2 on 2002/12/17 15:07:52

	Make negative errno values positive on FreeBSD.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/security/sebsd/ss/services.c#7 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/security/sebsd/ss/services.c#7 (text+ko) ====

@@ -169,7 +169,7 @@
 	if (!tclass || tclass > policydb.p_classes.nprim) {
 		printf("security_compute_av:  unrecognized class %d\n",
 		       tclass);
-		return -EINVAL;
+		return EINVAL;
 	}
 	tclass_datum = policydb.class_val_to_struct[tclass - 1];
 
@@ -262,13 +262,13 @@
 	scontext = sidtab_search(&sidtab, ssid);
 	if (!scontext) {
 		printf("security_compute_av:  unrecognized SID %d\n", ssid);
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 	tcontext = sidtab_search(&sidtab, tsid);
 	if (!tcontext) {
 		printf("security_compute_av:  unrecognized SID %d\n", tsid);
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 
@@ -308,7 +308,7 @@
 	scontextp = (char *) sebsd_malloc(*scontext_len+1, M_SEBSD_SS, 
 					  M_NOWAIT);
 	if (!scontextp) {
-		return -ENOMEM;
+		return ENOMEM;
 	}
 	*scontext = (security_context_t) scontextp;
 
@@ -358,13 +358,13 @@
 			return 0;
 		}
 		printf("security_sid_to_context:  called before initial load_policy on unknown SID %d\n", sid);
-		return -EINVAL;
+		return EINVAL;
 	}
 	POLICY_RDLOCK;
 	context = sidtab_search(&sidtab, sid);
 	if (!context) {
 		printf("security_sid_to_context:  unrecognized SID %d\n", sid);
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 	rc = context_struct_to_string(context, scontext, scontext_len);
@@ -412,14 +412,14 @@
 			}
 		}
 		printf("security_context_to_sid: called before initial load_policy on unknown context %s\n", scontext);
-		return -EINVAL;
+		return EINVAL;
 	}
 	*sid = SECSID_NULL;
 
 	/* copy the string so that we can modify the copy as we parse it */
 	scontext2 = sebsd_malloc(scontext_len, M_SEBSD_SS, M_WAITOK);
 	if (!scontext2) {
-		return -ENOMEM;
+		return ENOMEM;
 	}
 	memcpy(scontext2, scontext, scontext_len);
 
@@ -430,7 +430,7 @@
 
 	/* Parse the security context. */
 
-	rc = -EINVAL;
+	rc = EINVAL;
 	scontextp = (char *) scontext2;
 	if (scontextp[scontext_len - 1])
 		/* Security context is not null-terminated. */
@@ -490,7 +490,7 @@
 
 	/* Check the validity of the new context. */
 	if (!policydb_context_isvalid(&policydb, &context)) {
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 	/* Obtain the new sid. */
@@ -532,13 +532,13 @@
 	scontext = sidtab_search(&sidtab, ssid);
 	if (!scontext) {
 		printf("security_compute_sid:  unrecognized SID %d\n", ssid);
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 	tcontext = sidtab_search(&sidtab, tsid);
 	if (!tcontext) {
 		printf("security_compute_sid:  unrecognized SID %d\n", tsid);
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 
@@ -792,12 +792,12 @@
 	user_datum_t *usrdatum;
 	security_context_t s;
 	__u32 len;
-	int rc = -EINVAL;
+	int rc = EINVAL;
        
 	args = (convert_context_args_t *) p;
 
 	if (context_cpy(&oldc, c))
-		return -ENOMEM;
+		return ENOMEM;
 
 	/* Convert the user. */
 	usrdatum = (user_datum_t *) hashtab_search(args->newp->p_users.table,
@@ -875,11 +875,11 @@
 
 	if (!ss_initialized) {
 		if (policydb_read(&policydb, fp)) {
-			return -EINVAL;
+			return EINVAL;
 		}
 		if (policydb_load_isids(&policydb, &sidtab)) {
 			policydb_destroy(&policydb);
-			return -EINVAL;
+			return EINVAL;
 		}
 		ss_initialized = 1;
 		return 0;
@@ -890,7 +890,7 @@
 #endif 
 
 	if (policydb_read(&newpolicydb, fp)) {
-		return -EINVAL;
+		return EINVAL;
 	}
 
 	sidtab_init(&newsidtab);
@@ -900,13 +900,13 @@
 	/* Verify that the existing classes did not change. */
 	if (hashtab_map(policydb.p_classes.table, validate_class, &newpolicydb)) {
 		printf("security:  the definition of an existing class changed\n");
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto err;
 	}
 
 	/* Clone the SID table. */
 	if (sidtab_map(&sidtab, clone_sid, &newsidtab)) {
-		rc = -ENOMEM;
+		rc = ENOMEM;
 		goto err;
 	}
 
@@ -1177,14 +1177,14 @@
 
 	fromcon = sidtab_search(&sidtab, fromsid);
 	if (!fromcon) {
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 
 	user = (user_datum_t *) hashtab_search(policydb.p_users.table,
 					       username);
 	if (!user) {
-		rc = -EINVAL;
+		rc = EINVAL;
 		goto out;
 	}
 	usercon.user = user->value;
@@ -1192,7 +1192,7 @@
 	mysids = sebsd_malloc(maxnel*sizeof(security_id_t), M_SEBSD_SS, 
 			      M_WAITOK | M_ZERO);
 	if (!mysids) {
-		rc = -ENOMEM;
+		rc = ENOMEM;
 		goto out;
 	}
 /* 	memset(mysids, 0, maxnel*sizeof(security_id_t)); */
@@ -1228,7 +1228,7 @@
 					maxnel += SIDS_NEL;
 					mysids2 = sebsd_malloc(maxnel*sizeof(security_id_t), M_SEBSD_SS, M_WAITOK | M_ZERO);
 					if (!mysids2) {
-						rc = -ENOMEM;
+						rc = ENOMEM;
 						sebsd_free(mysids, M_SEBSD_SS);
 						goto out;
 					}
@@ -1276,7 +1276,7 @@
 
 	if (!genfs || cmp) {
 		*sid = SECINITSID_UNLABELED;
-		rc = -ENOENT;
+		rc = ENOENT;
 		goto out;
 	}
 
@@ -1289,7 +1289,7 @@
 
 	if (!c) {
 		*sid = SECINITSID_UNLABELED;
-		rc = -ENOENT;
+		rc = ENOENT;
 		goto out;
 	}
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212172308.gBHN8nI8039956>