acl: implement a centralized ACL output mechanism for HAs and ACLs.

named_acl.c (which is really a named_ha) now uses ast_ha_output.

I've also updated main/manager.c to output the actual ACL on "manager
show user <username>" if one is set.  If this works then we can add
similar to other modules as required.

Change-Id: I0ec9876a90dddd379c80ec078d48e3ee6991eb0f
This commit is contained in:
Jaco Kroon
2020-03-18 15:49:56 +02:00
committed by Joshua Colp
parent 1b6c58896f
commit d32e559e8a
4 changed files with 65 additions and 8 deletions

View File

@@ -430,6 +430,38 @@ struct ast_ha *ast_named_acl_find(const char *name, int *is_realtime, int *is_un
*/
struct stasis_message_type *ast_named_acl_change_type(void);
/*!
* \brief output an HA to the provided fd
*
* \details
* This function can be used centrally to output HAs as used in ACLs from other
* modules. It follows the format as originally used for named ACLs in
* named_acl.c.
*
* \param fd The file-descriptor to which to output the HA.
* \param ha The HA to output.
* \param prefix If you need a specific prefix output on each line, give it here, may be NULL.
*
* \since 13.33.0, 16.10.0, 17.4.0
*/
void ast_ha_output(int fd, const struct ast_ha *ha, const char *prefix);
/*!
* \brief output an ACL to the provided fd
*
* \details
* This function can be used centrally to output HAs as used in ACLs from other
* modules. It follows the format as originally used for named ACLs in
* named_acl.c.
*
* \param fd The file-descriptor to which to output the ACL.
* \param acl The ACL to output.
* \param prefix If you need a specific prefix output on each line, give it here, may be NULL.
*
* \since 13.33.0, 16.10.0, 17.4.0
*/
void ast_acl_output(int fd, struct ast_acl_list *acl, const char *prefix);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif