[Asterisk-cvs] asterisk/apps app_authenticate.c,1.11,1.12

markster markster
Fri Aug 5 17:40:22 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv10061/apps

Modified Files:
	app_authenticate.c 
Log Message:
Fix newline issue (bug #4632)


Index: app_authenticate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_authenticate.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- app_authenticate.c	1 Aug 2005 15:01:11 -0000	1.11
+++ app_authenticate.c	5 Aug 2005 21:44:19 -0000	1.12
@@ -125,6 +125,7 @@
 					while (!feof(f)) {
 						fgets(buf, sizeof(buf), f);
 						if (!feof(f) && !ast_strlen_zero(buf)) {
+							buf[strlen(buf) - 1] = '\0';
 							if (strchr(opts, 'm')) {
 								md5secret = strchr(buf, ':');
 								if (md5secret == NULL)
@@ -133,12 +134,16 @@
 								md5secret++;
 								ast_md5_hash(md5passwd, passwd);
 								if (!strcmp(md5passwd, md5secret)) {
-									ast_cdr_setaccount(chan, buf);
+									if (strchr(opts, 'a'))
+										ast_cdr_setaccount(chan, buf);
 									break;
 								}
 							} else {
-								if(!strcmp(passwd, buf))
+								if(!strcmp(passwd, buf)) {
+									if (strchr(opts, 'a'))
+										ast_cdr_setaccount(chan, buf);
 									break;
+								}
 							}
 						}
 					}




More information about the svn-commits mailing list