Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 35574) +++ apps/app_meetme.c (working copy) @@ -819,7 +819,7 @@ struct ast_app *app; char *agifile; char *agifiledefault = "conf-background.agi"; - char meetmesecs[30] = ""; + char meetmesecs[30] = "", confno[AST_MAX_EXTENSION]; char exitcontext[AST_MAX_CONTEXT] = ""; char recordingtmp[AST_MAX_EXTENSION] = ""; int dtmf; @@ -832,6 +832,16 @@ return ret; } + ast_mutex_lock(&conflock); + + /* Make sure we can still find the conference in the list */ + if (!build_conf(conf->confno, "", "", 0, 0)) { + ast_mutex_unlock(&conflock); + return -2; + } + + ast_copy_string(confno, conf->confno, sizeof(confno)); + if (confflags & CONFFLAG_RECORDCONF && conf->recording !=MEETME_RECORD_ACTIVE) { conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE"); if (!conf->recordingfilename) { @@ -856,13 +866,13 @@ /* Sorry, but this confernce is locked! */ if (!ast_streamfile(chan, "conf-locked", chan->language)) ast_waitstream(chan, ""); + ast_mutex_unlock(&conf_lock); goto outrun; } if (confflags & CONFFLAG_MARKEDUSER) conf->markedusers++; - ast_mutex_lock(&conflock); if (!conf->firstuser) { /* Fill the first new User struct */ user->user_no = 1; @@ -1035,6 +1045,12 @@ ast_mutex_lock(&conflock); + /* Make sure we can still find the conference in the list */ + if (!build_conf(confno, "", "", 0, 0)) { + ast_mutex_unlock(&conflock); + return -2; + } + if (!(confflags & CONFFLAG_QUIET) && (confflags & CONFFLAG_INTROUSER) && conf->users > 1) { if (conf->chan && ast_fileexists(user->namerecloc, NULL, NULL)) { if (!ast_streamfile(conf->chan, user->namerecloc, chan->language)) @@ -1548,6 +1564,13 @@ reset_volumes(user); ast_mutex_lock(&conflock); + + /* Make sure we can still find the conference in the list */ + if (!build_conf(confno, "", "", 0, 0)) { + ast_mutex_unlock(&conflock); + return -2; + } + if (!(confflags & CONFFLAG_QUIET) && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) conf_play(chan, conf, LEAVE); @@ -1567,6 +1590,12 @@ outrun: ast_mutex_lock(&conflock); + /* Make sure we can still find the conference in the list */ + if (!build_conf(confno, "", "", 0, 0)) { + ast_mutex_unlock(&conflock); + return -2; + } + if (confflags & CONFFLAG_MONITORTALKER && dsp) ast_dsp_free(dsp); @@ -1740,12 +1769,14 @@ return -1; } - confnum = strsep(&localdata,"|"); + confnum = strsep(&localdata, "|"); + ast_mutex_lock(&conf_lock); conf = find_conf(chan, confnum, 0, 0, NULL, NULL); if (conf) count = conf->users; else count = 0; + ast_mutex_unlock(&conf_lock); if (!ast_strlen_zero(localdata)){ /* have var so load it and exit */ @@ -1927,9 +1958,12 @@ } } if (!ast_strlen_zero(confno)) { +refind_conf: /* Check the validity of the conference */ + ast_mutex_lock(&conf_lock); cnf = find_conf(chan, confno, 1, dynamic, the_pin, &confflags); if (!cnf) { + ast_mutex_unlock(&conf_lock); res = ast_streamfile(chan, "conf-invalid", chan->language); if (!res) ast_waitstream(chan, ""); @@ -1937,6 +1971,12 @@ if (allowretry) confno[0] = '\0'; } else { + char cnfpin[AST_MAX_EXTENSION], cnfpinadmin[AST_MAX_EXTENSION]; + + ast_copy_string(cnfpin, cnf->pin, sizeof(cnfpin)); + ast_copy_string(cnfpinadmin, cnf->pinadmin, sizeof(cnfpinadmin)); + ast_mutex_unlock(&conf_lock); + if ((!ast_strlen_zero(cnf->pin) && !ast_test_flag(&confflags, CONFFLAG_ADMIN)) || (!ast_strlen_zero(cnf->pinadmin) && @@ -1954,15 +1994,19 @@ res = ast_app_getdata(chan, "conf-getpin", pin + strlen(pin), sizeof(pin) - 1 - strlen(pin), 0); } if (res >= 0) { - if (!strcasecmp(pin, cnf->pin) || - (!ast_strlen_zero(cnf->pinadmin) && - !strcasecmp(pin, cnf->pinadmin))) { + if (!strcasecmp(pin, cnfpin) || + (!ast_strlen_zero(cnfpinadmin) && + !strcasecmp(pin, cnfpinadmin))) { /* Pin correct */ allowretry = 0; - if (!ast_strlen_zero(cnf->pinadmin) && !strcasecmp(pin, cnf->pinadmin)) + if (!ast_strlen_zero(cnfpinadmin) && !strcasecmp(pin, cnfpinadmin)) ast_set_flag(&confflags, CONFFLAG_ADMIN); /* Run the conference */ res = conf_run(chan, cnf, confflags.flags); + if (res == -2) { + ast_copy_string(the_pin, pin, sizeof(the_pin)); + goto refind_conf; + } break; } else { /* Pin invalid */ @@ -2004,6 +2048,8 @@ /* Run the conference */ res = conf_run(chan, cnf, confflags.flags); + if (res == -2) + goto refind_conf; } } }