[Asterisk-cvs] asterisk/channels chan_iax2.c,1.120,1.121
citats at lists.digium.com
citats at lists.digium.com
Sun Apr 18 17:49:23 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/home/citats/cvs/asterisk/channels
Modified Files:
chan_iax2.c
Log Message:
Make 'iax2 show users' print key if a key is used (bug 1253)
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- chan_iax2.c 14 Apr 2004 18:15:16 -0000 1.120
+++ chan_iax2.c 18 Apr 2004 21:53:13 -0000 1.121
@@ -2823,15 +2823,22 @@
static int iax2_show_users(int fd, int argc, char *argv[])
{
-#define FORMAT "%-15.15s %-15.15s %-15.15s %-15.15s %-5.5s\n"
-#define FORMAT2 "%-15.15s %-15.15s %-15.15d %-15.15s %-5.5s\n"
+#define FORMAT "%-15.15s %-20.20s %-15.15s %-15.15s %-5.5s\n"
+#define FORMAT2 "%-15.15s %-20.20s %-15.15d %-15.15s %-5.5s\n"
struct iax2_user *user;
+ char auth[90];
if (argc != 3)
return RESULT_SHOWUSAGE;
ast_mutex_lock(&userl.lock);
ast_cli(fd, FORMAT, "Username", "Secret", "Authen", "Def.Context", "A/C");
for(user=userl.users;user;user=user->next) {
- ast_cli(fd, FORMAT2, user->name, user->secret, user->authmethods,
+ if (strlen(user->secret)) {
+ strncpy(auth,user->secret,strlen(auth)-1);
+ } else if (strlen(user->inkeys)) {
+ sprintf(auth,"Key: %-15.15s ",user->inkeys);
+ } else
+ strcpy(auth,"-no secret-");
+ ast_cli(fd, FORMAT2, user->name, auth, user->authmethods,
user->contexts ? user->contexts->context : context,
user->ha ? "Yes" : "No");
}
More information about the svn-commits
mailing list