This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
amtu/amtu-memsep.patch

68 lines
1.7 KiB
Diff

--- amtu/src/memsep.c.orig 2004-08-18 11:18:42.000000000 -0400
+++ amtu/src/memsep.c 2004-08-18 11:19:18.000000000 -0400
@@ -165,8 +165,6 @@
/************************************************************************/
int memsep(int argc, char *argv[])
{
- struct passwd *pwd;
- uid_t id;
FILE *fp;
char line[200];
char flags[10];
@@ -175,29 +173,6 @@
printf("Executing Memory Separation Test...\n");
- // First, get the UID of the unprivileged user nobody.
- pwd = getpwnam("nobody");
-
- if (pwd == NULL) { // Error
- fprintf(stderr, "Could not obtain info for user nobody");
- LAUS_LOG(("amtu memory separation test: could not"
- " obtain info for user nobody"))
- return -1;
- }
- else {
- id = pwd->pw_uid;
- }
-
- // Now set the effective UID to the unprivileged user nobody.
- if (debug) {
- fprintf(stderr, "Setting effective UID of user nobody to:"
- " %d\n", id);
- }
- seteuid(id);
- if (debug) {
- fprintf(stderr, "Effective UID is now: %d\n", geteuid());
- }
-
// Check that reading and writing to memory addresses is not allowed.
fp = fopen("/proc/self/maps", "r");
if (fp == NULL) {
@@ -258,25 +233,6 @@
last_end = end;
}
- // Reset the UID to root.
- pwd = getpwnam("root");
-
- if (pwd == NULL) { // Error
- fprintf(stderr, "Could not reset UID to root");
- LAUS_LOG(("amtu memory separation test: could not"
- " reset UID to root"))
- return -1;
- }
- else {
- id = pwd->pw_uid;
- }
-
- seteuid(id);
- if (debug) {
- fprintf(stderr, "Reset Effective UID to root: %d\n",
- geteuid());
- }
-
fprintf(stderr, "Memory Separation Test SUCCESS!\n");
LAUS_LOG(("amtu - Memory Separation Test succeeded"))
return 0;