提交 f02d6504 编写于 作者: D Daniel P. Berrange

Add access control filtering of secret objects

Ensure that all APIs which list secret objects filter
them against the access control system.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 323049a0
...@@ -566,8 +566,11 @@ secretConnectNumOfSecrets(virConnectPtr conn) ...@@ -566,8 +566,11 @@ secretConnectNumOfSecrets(virConnectPtr conn)
secretDriverLock(driver); secretDriverLock(driver);
i = 0; i = 0;
for (secret = driver->secrets; secret != NULL; secret = secret->next) for (secret = driver->secrets; secret != NULL; secret = secret->next) {
i++; if (virConnectNumOfSecretsCheckACL(conn,
secret->def))
i++;
}
secretDriverUnlock(driver); secretDriverUnlock(driver);
return i; return i;
...@@ -590,6 +593,9 @@ secretConnectListSecrets(virConnectPtr conn, char **uuids, int maxuuids) ...@@ -590,6 +593,9 @@ secretConnectListSecrets(virConnectPtr conn, char **uuids, int maxuuids)
i = 0; i = 0;
for (secret = driver->secrets; secret != NULL; secret = secret->next) { for (secret = driver->secrets; secret != NULL; secret = secret->next) {
char *uuidstr; char *uuidstr;
if (!virConnectListSecretsCheckACL(conn,
secret->def))
continue;
if (i == maxuuids) if (i == maxuuids)
break; break;
if (VIR_ALLOC_N(uuidstr, VIR_UUID_STRING_BUFLEN) < 0) { if (VIR_ALLOC_N(uuidstr, VIR_UUID_STRING_BUFLEN) < 0) {
...@@ -666,6 +672,10 @@ secretConnectListAllSecrets(virConnectPtr conn, ...@@ -666,6 +672,10 @@ secretConnectListAllSecrets(virConnectPtr conn,
} }
for (entry = driver->secrets; entry != NULL; entry = entry->next) { for (entry = driver->secrets; entry != NULL; entry = entry->next) {
if (!virConnectListAllSecretsCheckACL(conn,
entry->def))
continue;
/* filter by whether it's ephemeral */ /* filter by whether it's ephemeral */
if (MATCH(VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL) && if (MATCH(VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL) &&
!((MATCH(VIR_CONNECT_LIST_SECRETS_EPHEMERAL) && !((MATCH(VIR_CONNECT_LIST_SECRETS_EPHEMERAL) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册