[asterisk-commits] dhubbard: branch group/http_mods r59772 - in
/team/group/http_mods: include/a...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Apr 2 14:40:21 MST 2007
Author: dhubbard
Date: Mon Apr 2 16:40:21 2007
New Revision: 59772
URL: http://svn.digium.com/view/asterisk?view=rev&rev=59772
Log:
created verify_session_readpermissions() and verify_session_writepermissions()
Modified:
team/group/http_mods/include/asterisk/manager.h
team/group/http_mods/main/manager.c
Modified: team/group/http_mods/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/include/asterisk/manager.h?view=diff&rev=59772&r1=59771&r2=59772
==============================================================================
--- team/group/http_mods/include/asterisk/manager.h (original)
+++ team/group/http_mods/include/asterisk/manager.h Mon Apr 2 16:40:21 2007
@@ -105,6 +105,20 @@
*/
int ast_manager_unregister( char *action );
+/*! Verify a session's read permissions against a permission mask.
+ * returns a non-zero response if the session has the permission mask capabilities */
+/*! \param ident session identity
+ * \param perm permission mask to verify
+ */
+int verify_session_readpermissions(unsigned long ident, int perm);
+
+/*! Verify a session's write permissions against a permission mask.
+ * returns a non-zero response if the session has the permission mask capabilities */
+/*! \param ident session identity
+ * \param perm permission mask to verify
+ */
+int verify_session_writepermissions(unsigned long ident, int perm);
+
/*! External routines may send asterisk manager events this way */
/*! \param category Event category, matches manager authorization
\param event Event name
Modified: team/group/http_mods/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/manager.c?view=diff&rev=59772&r1=59771&r2=59772
==============================================================================
--- team/group/http_mods/main/manager.c (original)
+++ team/group/http_mods/main/manager.c Mon Apr 2 16:40:21 2007
@@ -2448,6 +2448,43 @@
return s;
}
+int verify_session_readpermissions(unsigned long ident, int perm)
+{
+ int result = 0;
+ struct mansession *s;
+
+ AST_LIST_LOCK(&sessions);
+ AST_LIST_TRAVERSE(&sessions, s, list) {
+ ast_mutex_lock(&s->__lock);
+ if ((s->managerid == ident) && (s->readperm & perm)) {
+ result = 1;
+ ast_mutex_unlock(&s->__lock);
+ break;
+ }
+ ast_mutex_unlock(&s->__lock);
+ }
+ AST_LIST_UNLOCK(&sessions);
+ return result;
+}
+
+int verify_session_writepermissions(unsigned long ident, int perm)
+{
+ int result = 0;
+ struct mansession *s;
+
+ AST_LIST_LOCK(&sessions);
+ AST_LIST_TRAVERSE(&sessions, s, list) {
+ ast_mutex_lock(&s->__lock);
+ if ((s->managerid == ident) && (s->writeperm & perm)) {
+ result = 1;
+ ast_mutex_unlock(&s->__lock);
+ break;
+ }
+ ast_mutex_unlock(&s->__lock);
+ }
+ AST_LIST_UNLOCK(&sessions);
+ return result;
+}
enum {
FORMAT_RAW,
More information about the asterisk-commits
mailing list