[svn-commits] kpfleming: trunk r51177 - in /trunk: ./
apps/app_voicemail.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue Jan 16 18:30:05 MST 2007
Author: kpfleming
Date: Tue Jan 16 19:30:04 2007
New Revision: 51177
URL: http://svn.digium.com/view/asterisk?view=rev&rev=51177
Log:
Merged revisions 51176 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r51176 | kpfleming | 2007-01-16 19:29:12 -0600 (Tue, 16 Jan 2007) | 2 lines
a few more coding style cleanups and one bug fix (from AnthonyL)
........
Modified:
trunk/ (props changed)
trunk/apps/app_voicemail.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=51177&r1=51176&r2=51177
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Tue Jan 16 19:30:04 2007
@@ -678,12 +678,11 @@
struct ast_variable *tmp;
tmp = var;
while (tmp) {
- if (!strcasecmp(tmp->name, "password") || !strcasecmp(tmp->name, "secret")) {
+ if (!strcasecmp(tmp->name, "vmpassword")) {
ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
- } else if (!strcasecmp(tmp->name, "secret")) {
- /* dont let secret override vmpassword */
+ } else if (!strcasecmp(tmp->name, "secret")) { /* don't overwrite vmpassword if it exists */
if (ast_strlen_zero(retval->password))
- ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
+ ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
} else if (!strcasecmp(tmp->name, "uniqueid")) {
ast_copy_string(retval->uniqueid, tmp->value, sizeof(retval->uniqueid));
} else if (!strcasecmp(tmp->name, "pager")) {
@@ -789,7 +788,6 @@
struct ast_category *cat=NULL;
char *category=NULL, *value=NULL, *new=NULL;
const char *tmp=NULL;
- int len;
if (!change_password_realtime(vmu, newpassword))
return;
@@ -808,14 +806,8 @@
ast_log(LOG_WARNING, "variable has bad format.\n");
break;
}
- len = (strlen(value) + strlen(newpassword));
-
- if (!(new = ast_calloc(1,len))) {
- ast_log(LOG_WARNING, "Memory Allocation Failed.\n");
- break;
- }
+ new = alloca((strlen(value)+strlen(newpassword)+1));
sprintf(new,"%s%s", newpassword, value);
-
if (!(cat = ast_category_get(cfg, category))) {
ast_log(LOG_WARNING, "Failed to get category structure.\n");
break;
@@ -827,8 +819,6 @@
reset_user_pw(vmu->context, vmu->mailbox, newpassword);
ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
config_text_file_save(VOICEMAIL_CONFIG, cfg, "AppVoicemail");
- if (new)
- free(new);
}
category = NULL;
var = NULL;
@@ -846,15 +836,12 @@
ast_log(LOG_DEBUG, "looks like we need to make vmpassword!\n");
var = ast_variable_new("vmpassword", newpassword);
}
- if (!(new = ast_calloc(1,strlen(newpassword)))) {
- if (option_debug > 3)
- ast_log(LOG_DEBUG, "Memory Allocation Failed.\n");
- break;
- }
+ new = alloca(strlen(newpassword)+1);
sprintf(new, "%s", newpassword);
if (!(cat = ast_category_get(cfg, category))) {
if (option_debug > 3)
ast_log(LOG_DEBUG, "failed to get category!\n");
+ break;
}
if (!var)
ast_variable_update(cat, "vmpassword", new, NULL);
@@ -866,10 +853,7 @@
reset_user_pw(vmu->context, vmu->mailbox, newpassword);
ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
config_text_file_save("users.conf", cfg, "AppVoicemail");
- if (new)
- free(new);
- }
-
+ }
}
static void vm_change_password_shell(struct ast_vm_user *vmu, char *newpassword)
More information about the svn-commits
mailing list