version 1.15, 2018/09/25 06:43:20 |
version 1.16, 2018/09/25 06:48:48 |
|
|
const char *name; |
const char *name; |
int (*fn)(int, char *[]); |
int (*fn)(int, char *[]); |
const char *pledge; |
const char *pledge; |
|
const char *unveil; |
} databases[] = { |
} databases[] = { |
{ "ethers", ethers, "stdio rpath" }, |
{ "ethers", ethers, "stdio rpath", "/etc/ethers" }, |
{ "group", group, "stdio getpw" }, |
{ "group", group, "stdio getpw", NULL }, |
{ "hosts", hosts, "stdio dns" }, |
{ "hosts", hosts, "stdio dns", NULL }, |
{ "passwd", passwd, "stdio getpw" }, |
{ "passwd", passwd, "stdio getpw", NULL }, |
{ "protocols", protocols, "stdio rpath" }, |
{ "protocols", protocols, "stdio rpath", "/etc/protocols" }, |
{ "rpc", rpc, "stdio rpath" }, |
{ "rpc", rpc, "stdio rpath", "/etc/rpc" }, |
{ "services", services, "stdio rpath" }, |
{ "services", services, "stdio rpath", "/etc/services" }, |
{ "shells", shells, "stdio rpath" }, |
{ "shells", shells, "stdio rpath", "/etc/shells" }, |
|
|
{ NULL, NULL, }, |
{ NULL, NULL, }, |
}; |
}; |
|
|
usage(); |
usage(); |
for (curdb = databases; curdb->name != NULL; curdb++) { |
for (curdb = databases; curdb->name != NULL; curdb++) { |
if (strcmp(curdb->name, argv[1]) == 0) { |
if (strcmp(curdb->name, argv[1]) == 0) { |
|
if (curdb->unveil != NULL) { |
|
if (unveil(curdb->unveil, "r") == -1) |
|
err(1, "unveil"); |
|
} |
if (pledge(curdb->pledge, NULL) == -1) |
if (pledge(curdb->pledge, NULL) == -1) |
err(1, "pledge"); |
err(1, "pledge"); |
|
|