Summary:ASTERISK-04340: successful pin change on permission error
Reporter:drmac (drmac)Labels:
Date Opened:2005-06-03 15:55:42Date Closed:2008-01-15 15:40:49.000-0600
Versions:Frequency of
Environment:Attachments:( 0) vmrealtimepw.patch
( 1) voicemail.txt
Description:Using VM with realtime, I attempted change my pin number:

   -- Executing Voicemailmain("SIP/3044-f76c", "@cytel")
   -- Playing 'vm-login' (language 'en')
   -- Playing 'vm-password' (language 'en')
   -- Playing 'vm-youhave' (language 'en')
   -- Playing 'vm-no' (language 'en')
   -- Playing 'vm-messages' (language 'en')
   -- Playing 'vm-opts' (language 'en')
   -- Playing 'vm-options' (language 'en')
   -- Playing 'vm-newpassword' (language 'en')
   -- Playing 'vm-reenterpassword' (language 'en')
Jun  3 15:34:31 WARNING[14277]: app_voicemail.c:564 vm_change_password: Warning: Unable to open '/etc/asterisk/voicemail.conf.new' for writing: Permission denied
   -- Playing 'vm-passchanged' (language 'en')

The pin number 'was' changed via RealTime. But it was also attempted via config file. Seems to me that if VM is successful in changing the pin via RT that it should not attempt to do it via config.

We don't have any users defined in our conf anyway so doing so would be pointless.

I will look into doing a patch over the weekend if it seems necessary.
Comments:By: Kevin P. Fleming (kpfleming) 2005-06-03 17:22:22

That would be an indication that ast_update_realtime() did not return 0 (zero) as expected, so vm_change_password did not return before trying to update the config file.

I believe there were some recent changes to the way that ast_update_realtime works in this regard, so it's likely that app_voicemail needs to be updated to take those changes into account.

By: Michael Jerris (mikej) 2005-06-28 00:56:28

drmac-  It seems that if you don't make that patch, no one is going too...

By: drmac (drmac) 2005-06-28 08:33:52

yes, i know but it has been amazingly hectic here. I will do it. soon.

By: drmac (drmac) 2005-06-29 14:47:40

well, i finally got some time to sit down and remove that exclimation mark.

Basically, ast_update_realtime returns the number of rows affected by the update. Previously, the query was executing successful and returning 1. The ! was changing this to false, therefor the voicemail pin code was continuing on changing the pin in text file.

Removeing the ! allows the return of 1 to be evaluated as true and therefor the voicemail pin change function returns correctly without continuing.

By: Russell Bryant (russell) 2005-07-06 17:36:27

Which realtime module are you using?

In res_config_odbc, the update function returns the rowcount upon success.  Using this patch, change_password_realtime will still be allowed to return an error if there really was one.  :)

By: drmac (drmac) 2005-07-06 19:41:21

I'm looking at both odbc and mysql drivers. Both return number of rows affected on successfull realtime update and -1 otherwise.

Technically, change_password_realtime shouldn't return "success pin change" if realtime returns 0 because that means no rows where updated thus nothing was changed right?

By: Russell Bryant (russell) 2005-07-11 18:59:17

Yeah, you're right.  new patch uploaded ...

By: Russell Bryant (russell) 2005-07-11 19:05:14

fixed in CVS HEAD

By: Digium Subversion (svnbot) 2008-01-15 15:40:49.000-0600

Repository: asterisk
Revision: 6089

U   trunk/apps/app_voicemail.c

r6089 | russell | 2008-01-15 15:40:48 -0600 (Tue, 15 Jan 2008) | 2 lines

properly handle the return of the rowcount from ast_update_realtime (bug ASTERISK-4340)