summaryrefslogtreecommitdiff
path: root/apps/app_meetme.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2011-11-10 21:15:39 +0000
committerKinsey Moore <kmoore@digium.com>2011-11-10 21:15:39 +0000
commitdc05ce5e4f8ee8f5080b16d33728441c68482bb8 (patch)
treeefcf25d0f4d8bc2a2fcb1ac416877ea0a5a2aa77 /apps/app_meetme.c
parentc2258006461ccf9e2d258caa840e0c99acb00b82 (diff)
Fix another incorrect case with meetme's PIN logic and add documentation
This fixes an issue where a user of a dynamic conference was asked for a PIN twice. This also adds documentation to assist in future modifications to the piece of code responsible for PIN checking. (closes issue AST-670) ........ Merged revisions 344439 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 344440 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344441 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_meetme.c')
-rw-r--r--apps/app_meetme.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 469200e78..008341441 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -4458,14 +4458,27 @@ static int conf_exec(struct ast_channel *chan, const char *data)
res = -1;
}
} else {
- /* Check to see if the conference requires pin
- * validation and check for exemptions to that
- * requirement. */
- if ((!ast_strlen_zero(cnf->pin) ||
+ /* Conference requires a pin for specified access level */
+ int req_pin = !ast_strlen_zero(cnf->pin) ||
(!ast_strlen_zero(cnf->pinadmin) &&
- ast_test_flag64(&confflags, CONFFLAG_ADMIN))) &&
- (ast_test_flag64(&confflags, CONFFLAG_ALWAYSPROMPT) ||
- ast_strlen_zero(args.pin) || !cnf->isdynamic)) {
+ ast_test_flag64(&confflags, CONFFLAG_ADMIN));
+ /* The following logic was derived from a
+ * 4 variable truth table and defines which
+ * circumstances are not exempt from pin
+ * checking.
+ * If this needs to be modified, write the
+ * truth table back out from the boolean
+ * expression AB+A'D+C', change the erroneous
+ * result, and rederive the expression.
+ * Variables:
+ * A: pin provided?
+ * B: always prompt?
+ * C: dynamic?
+ * D: has users? */
+ int not_exempt = !cnf->isdynamic;
+ not_exempt = not_exempt || (!ast_strlen_zero(args.pin) && ast_test_flag64(&confflags, CONFFLAG_ALWAYSPROMPT));
+ not_exempt = not_exempt || (ast_strlen_zero(args.pin) && cnf->users);
+ if (req_pin && not_exempt) {
char pin[MAX_PIN] = "";
int j;