Skip to contentSkip to conversation

newrole patch

PATCH Daniel J Walsh 2 participants 2 messages Jan 9, 2007 – Jan 11, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

Only uses file descriptor = 0

Reads securetty_context file for matches

newrole/newrole.c +10 -0
@@ -741,6 +741,7 @@
 	char *level_s = NULL;	/* level spec'd by user in argv[] */
 	char *range_ptr = NULL;
 	security_context_t new_con = NULL;
+	security_context_t tty_con = NULL;
 	context_t context = NULL; /* manipulatable form of new_context */
 	const struct option long_options[] = {
 		{"role", 1, 0, 'r'},
@@ -793,6 +794,15 @@
 					"specified\n"));
 				return -1;
 			}
+			if (fgetfilecon(0,&tty_con) >= 0) {
+				if (selinux_check_securetty_context(tty_con) != 1) {
+					fprintf(stderr, "Error: you are not allowed to change levels on a non secure terminal\n");
+					freecon(tty_con);
+					return -1;
+				}
+				freecon(tty_con);
+			}
+
 			level_s = optarg;
 			break;
 		default:
#1 lore raw
Quoted 3 lines · Daniel J Walsh

Only uses file descriptor = 0

Reads securetty_context file for matches

Corrected version (to match the return value convention) merged in policycoreutils 1.33.12.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.