Summary:ASTERISK-04685: [patch] app_authenticate.c:123: warning: `md5secret' might be used uninitialized in this function
Reporter:Paul Belanger (pabelanger)Labels:
Date Opened:2005-07-26 13:13:44Date Closed:2008-01-15 15:43:18.000-0600
Versions:Frequency of
Environment:Attachments:( 0) app_authenicate.c.patch
( 1) app_authenicate.c.patch-v2
( 2) app_authenticate.c.patch-v3
Description:A trivial patch to clean up a compiling warnings.  Plus some formatting.


gcc -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE  -O6 -march=i686  -DZAPTEL_OPTIMIZATIONS          -fomit-frame-pointer  -fPIC   -c -o app_authenticate.o app_authenticate.c
app_authenticate.c: In function `auth_exec':
app_authenticate.c:123: warning: `md5secret' might be used uninitialized in this function
gcc -shared -Xlinker -x -o app_authenticate.so app_authenticate.o
Comments:By: Olle Johansson (oej) 2005-07-26 13:40:09

Better to change to char *opts = ""; in the initialization. Otherwise, nice patch!

By: Paul Belanger (pabelanger) 2005-07-26 14:19:40

Your refering to:

if (opts) {
       *opts = 0;
} else {
       opts = "";

right?  My original patch did not address this, but I don't have a problem clean it up! ;)  Also, I'm going to take the liberty of attempting to remove the n+101, per http://dev.asteriskdocs.org/index.php/Janitor_projects .I may have some questions though.

By: Paul Belanger (pabelanger) 2005-07-26 15:18:11

Ok, this is an untested patch.  I would like to get some feedback first to see if my logic is correct for handling result AUTHENICATESTATUS and option_priority_jumping.  Thanks.

By: Olle Johansson (oej) 2005-07-26 15:28:09

That would be great!

By: Kevin P. Fleming (kpfleming) 2005-07-26 17:57:38


- 'deprecated' is the proper word

- you have misspelled AUTHENTICATESTATUS in a number of places

- this is incorrect formatting:

+ } else {
+ ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", password, strerror(errno)); }

- why is status set to SUCCESS only if the jump is going to occur? I think the logic is wrong there.

- please use ast_goto_if_exists to make the jump; see app_dial for an example

By: Paul Belanger (pabelanger) 2005-07-26 19:26:25

1). Doh! Thats what I get from copying from Oej! hehe ;-)
2). Can't blam anybody but myself.
3). Not sure what happen there, typo I guess.
4). Thanks, will remove.
5). Will do.

Will submit something later today.

By: Paul Belanger (pabelanger) 2005-07-26 19:46:27

Quick question:  Looking at app_Dial.c for the jump here is what I came up with.

               if (option_priority_jumping || jump) {
                       ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
                       chan->priority += 100;
                       res = 0;

The original code had chan->priority += 100; Is this still required?  Or can it safely removed?

By: twisted (twisted) 2005-07-26 20:02:09

this bug appears to be about a compile time option, let's make new bug entry for the n+101 removal and keep the discussion here about the compiler warning.

By: Kevin P. Fleming (kpfleming) 2005-07-26 20:27:01

No, ast_goto_if_exists does exactly what the function name says... if it can, it updates the channel to go to the requested context/extension/priority. There is no need to manipulate chan->priority afterwards.

By: Paul Belanger (pabelanger) 2005-07-26 20:37:34

Ok, submitted patch for compile warning, and will create new issue for n+101 removal.

By: Russell Bryant (russell) 2005-08-01 10:56:39

fixed warning by initializing to NULL.  Don't forget to open a new bug for the n+101 fixes!  :)

By: Digium Subversion (svnbot) 2008-01-15 15:43:18.000-0600

Repository: asterisk
Revision: 6254

U   trunk/apps/app_authenticate.c

r6254 | russell | 2008-01-15 15:43:18 -0600 (Tue, 15 Jan 2008) | 2 lines

fix warning (bug ASTERISK-4685)