Fixed loading of secrets with IDs.

Since the ID string is manually terminated by a null character, write
permission is required for the mmapped ipsec.secrets.
This commit is contained in:
Tobias Brunner
2010-08-04 16:03:46 +02:00
parent dca2d89209
commit 744b83c7c9
+1 -1
View File
@@ -1141,7 +1141,7 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
close(fd); close(fd);
return; return;
} }
addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); addr = mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (addr == MAP_FAILED) if (addr == MAP_FAILED)
{ {
DBG1(DBG_LIB, "mapping '%s' failed: %s", file, strerror(errno)); DBG1(DBG_LIB, "mapping '%s' failed: %s", file, strerror(errno));