Project "FreeSWITCH user-contributed scripts, etc" received a push.

branch: master updated

       via: a4349bbeba56858b0c17f8b69ed69ecebba0bc58 (commit)
       via: d6ded2bd476117e0c7e39621c0a6a95454157310 (commit)
       via: 44b8a8f178ebb09b2fe16ca1708e3c8446d14e20 (commit)
       via: 64b9f3a914fb371d42c574b70214efb89ef838fd (commit)
       via: c8a8da3aa2582b706740a30306b0ecdc9affc04e (commit)
       via: 597108e000837ecbcaca0e65df59a486b896c97a (commit)
       via: 56a3cbb570354567ca5913ca0770261453767605 (commit)
       via: 36b4392111daa9ea604887a77a8e3a49eba66584 (commit)
       via: 461d85e717ffe2afa687c6b69771033ff5e2eb78 (commit)
       via: cb7e89da288c3b6a9a673ad266da3701881e1f70 (commit)
       via: 4990dd940ad380a4d7ff6222397582e6384f002c (commit)
       via: 927ad712718b071435d0033f7e94e78db0a56500 (commit)
       via: fc7c364691b5d756b44a4e97dd7b20e072bccc29 (commit)
       via: 7435ba814b094f1be499a101df196a38738bc821 (commit)
       via: 5dd65f9693f8abd0a3692674607d5e27c7815a20 (commit)
       via: ef2e4bddf8333b9fe49c0f7e42df015f003220d2 (commit)
       via: 236ab231e43a931930d8536ff0ec43f829f67258 (commit)
       via: 9be34a8280f1725f6a2e03a78488a6fa4267e11f (commit)
       via: ed44070766b5280de0f324d5d3a44e079da816fa (commit)
       via: 0b65cd12d9f6fe8279d647be34144e8229bcfc77 (commit)
       via: 90d087c7e58bccef773954f91ec95348b8979aeb (commit)
       via: 709375847fc8265fc1398e68b4b1bfd8a33e90bb (commit)
       via: 1ae0de5a8a501996eb06595d57f6f63308fa8a59 (commit)
       via: 5bc837fb4b23978921fa491977c711e786c204d7 (commit)
       via: beb50f4d4a6b4029e0659f429b5ebec02fea85dd (commit)
       via: 90a6cf59dde3f0d8ba5fcff422a70444f59a8489 (commit)
       via: 5842b4b76d8834980c4fe1de575aa131a2f840b9 (commit)
       via: 6b536b430435cdf26939dc2e5c7601faa54b3df4 (commit)
       via: ba720fed0ac4ceb8a96c74058b23d32d9397559c (commit)
       via: 12afec666a5e2da9c214a13dc4de17b17cbed2b6 (commit)
       via: 8593c1de9a8a85b235d34d03790ca5f1aace3655 (commit)
       via: 21bc78cbd2bad7dd11db339aa5a37f01c79fe9ab (commit)
       via: d72a5c8982ac39a11583fb188ad7d53be5bcbcd6 (commit)
       via: b815b2c170a14e7cdad9c1da1f766aa1b17ff0b5 (commit)
       via: 4f549b24bbde5af0e5f51ea639a27be856afb1d2 (commit)
       via: fc466382a7073ee9c72712cc9ab4a136734d27a6 (commit)
      from: d93d8a0e353b8a112167961178bffda485356ee7 (commit)


= COMMIT LOG ===========================================================
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Michael S Collins
comments: 
Add 'nopunct' option to randomize passwords script so you can have alphanumeric auth passwds

diff --git a/mcollins/randomize-passwords.pl b/mcollins/randomize-passwords.pl
index ef0f664..d792f2b 100755
--- a/mcollins/randomize-passwords.pl
+++ b/mcollins/randomize-passwords.pl
@@ -21,13 +21,19 @@ use File::Copy;
 
 $|++;
 
+## 'CHARACTERS' contains punctuation marks
 use constant CHARACTERS => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=+?></.,!@#$%^&*();:';
 my $numchars = length(CHARACTERS);
 
+## 'ALPHACHARS' contains upper and lower case letters and digits but no punctuation
+use constant ALPHACHARS => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
+my $numalphas = length(ALPHACHARS);
+
 my $vmlen = 4;         # Length of VM password
 my $authlen = 10;      # Length of auth password
 my $filespec;          # File specification 
 my $delbak;            # Flag - delete backups (default = keep backups)
+my $nopunct;           # Flag - set to true to disable punction marks (i.e. alphanumerics only) in auth passwords
 
 my $opts_ok = GetOptions ("h"         => \&usage,
                           "help"      => \&usage,
@@ -35,6 +41,7 @@ my $opts_ok = GetOptions ("h"         => \&usage,
                           "authlen=i" => \$authlen,
                           "files=s"   => \$filespec,
                           "D"         => \$delbak,
+			  "nopunct"   => \$nopunct,
 			  );
 
 ## Confirm that a file spec was provided
@@ -110,9 +117,18 @@ sub get_random_chars () {
     my $length = shift;
     if ( ! $length ) { $length = $authlen; }
     my $chars;
-    foreach my $i (1 .. $length) {
-	my $nextchar = substr( CHARACTERS,int(rand $numchars),1);
-        $chars .= $nextchar;
+
+    if ( $nopunct ) {
+	foreach my $i (1 .. $length) {
+	    my $nextchar = substr( ALPHACHARS,int(rand $numalphas),1 );
+	    $chars .= $nextchar;
+	}
+
+    } else {
+	foreach my $i (1 .. $length) {
+	    my $nextchar = substr( CHARACTERS,int(rand $numchars),1 );
+	    $chars .= $nextchar;
+	}
     }
     return $chars;
 }
@@ -150,6 +166,8 @@ Options:
 
   --authlen        Set length of auth password. (Default is 10 characters)
 
+  --nopunct        Disable punction marks in auth passwords, i.e. alphanumerics only
+
 Example:
   To randomize all the passwords for a default Linux install, with 6 digit VM passwords, use this command:
 
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://scratch/usr/local/src/freeswitch-contrib
committer: Chad Phillips
comments: 
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch-contrib
committer: Michael S Collins
comments: 
Update chan vars scripts to be git repo friendly

diff --git a/mcollins/create-chanvars-html-page.pl b/mcollins/create-chanvars-html-page.pl
index 5737a4d..a9191ac 100755
--- a/mcollins/create-chanvars-html-page.pl
+++ b/mcollins/create-chanvars-html-page.pl
@@ -65,7 +65,7 @@ my $htmldir = '/usr/local/freeswitch/htdocs';
 ## Use these as defaults unless command line args are supplied
 GetOptions( 'srcdir=s' => \$srcdir,
             'tmpdir=s' => \$tmpdir,
-            'htmldir=s' => \$htmldir,
+	    'htmldir=s' => \$htmldir,
 );
 
 my $srcdirlen = length $srcdir;  # calculate this once since it doesn't change
@@ -74,7 +74,7 @@ my $headerfile = $tmpdir . "/header-defs.txt";
 my $datafile   = $tmpdir . "/get-set-vars.txt";
 my $htmlfile   = $htmldir . "/chanvars.html";
 
-my $site = 'http://fisheye.freeswitch.org/browse/freeswitch.git';
+my $site = 'http://fisheye.freeswitch.org/browse/FreeSWITCH.git';
 
 my $obvious_exceptions; # regex match for channel variable names we don't care about
 $obvious_exceptions = '^(|argv|v?var|var_?name|v?buf|char.*|inner_var_array.*|arg.*|string|tmp_name|[^_]*_var|\(char \*\) vvar)$';
@@ -105,9 +105,11 @@ open(FILEIN,"<",$datafile) or die "$datafile - $!\n";
 while(<FILEIN>) {
     chomp;
     next if m/switch_channel_get_variables/;  # get variables != what we want
-    next unless m/switch_channel_(s|g)et_variable\s?\(/;
+    next unless ( m/switch_channel_(s|g)et_variable\s?\(/ or m/switch_channel_(s|g)et_variable_partner\s?\(/ );
+
     next if m/#define|SWITCH_DECLARE/;
     next unless m/\.c(pp)?:/;    # only c and cpp files for now
+
     ## Extract source file name
     my @RECIN = split /(\.c(pp)?)/,$_;  # split on file name.c or name.cpp
     my ($filename,$dir,$ext) = fileparse($RECIN[0]);
@@ -118,7 +120,7 @@ while(<FILEIN>) {
     my $reldir = substr $dir, $srcdirlen;
     #print "$filename $dir $ext ($reldir)\n";
     if ( ! exists( $source_files{$filename} ) ) {
-        $source_files{ $filename } = $site . $reldir . $filename;
+        $source_files{ $filename } = $site . $reldir . $filename . '?r=HEAD';
     }
     
     ## Extract line number for this occurrence in this source file
@@ -159,10 +161,56 @@ while(<FILEIN>) {
     ## Skip obvious exceptions...
     next if $channel_variable_name =~ m/$obvious_exceptions/;
     
-    ## populate the hash for this variable, filename and line num & get/set val
+    ## populate the hash for this variable, filename and line num & set/get
     push @{ $channel_vars{$channel_variable_name}{$filename} }, [$linenum, $setget]; 
     push @{ $source_idx{$filename}{$channel_variable_name} }, [$linenum, $setget];
 }
+
+close(FILEIN);
+
+## Handle the event header vars...
+$datafile   = $tmpdir . "/event-vars.txt";
+open(FILEIN,'<',$datafile) or die "$datafile - $!\n";
+while(<FILEIN>){
+    chomp;
+    next unless m/\.c(pp)?:/;    # only c and cpp files for now
+    my @RECIN = split /(\.c(pp)?)/,$_;  # split on file name.c or name.cpp
+    my ($filename,$dir,$ext) = fileparse($RECIN[0]);
+    $filename .= $RECIN[1];    # append .c or .cpp
+
+    # debug 
+    #print "$filename\n";
+    # trim off the srcdir from beginning of string
+    my $reldir = substr $dir, $srcdirlen;
+    #print "$filename $dir $ext ($reldir)\n";
+    if ( ! exists( $source_files{$filename} ) ) {
+        $source_files{ $filename } = $site . $reldir . $filename . '?r=HEAD';
+    }
+    
+    ## Extract line number for this occurrence in this source file
+    my $linenum = 0;
+    if ( $RECIN[3] =~ m/:(\d+):/ ) {
+        $linenum = $1;
+    }
+
+    ## Extract variable name
+    ## if ((var = switch_event_get_header(var_event, "freetdm_outbound_ton")) || (var = switch_core_get_variable("freetdm_outbound_ton")))
+    ## Need a little loop, in case there are more than one per line...
+    while ( m/switch_event_get_header\(var_event,\s+"(.*?)"/g ) {
+	## $1 *should* have the name of the variable...
+	#print "Var name is $1...\n";
+	my $channel_variable_name = $1;
+
+	## Skip obvious exceptions...
+	next if $channel_variable_name =~ m/$obvious_exceptions/;
+	
+	## populate the hash for this variable, filename and line num & 'event_var'
+	push @{ $channel_vars{$channel_variable_name}{$filename} }, [$linenum, 'event_var']; 
+	push @{ $source_idx{$filename}{$channel_variable_name} }, [$linenum, 'event_var'];
+	
+    }
+}
+
 close(FILEIN);
 
 #debug
@@ -200,7 +248,7 @@ foreach my $chanvar ( sort {lc $a cmp lc $b} keys %channel_vars ) {
             #$row[2] .= "@{ $_ }" . "<br/>";
             my $linkname = "@{ $_ }";
             my $linenum = @{ $_ }[0];
-            my $url = $source_files{$sourcename};
+            my $url = $source_files{$sourcename} . '#to' . $linenum;
             $row[2] .= $h->a( { href => $url, target => '_blank' },
                 $linkname
             ) . '<br/>';
diff --git a/mcollins/extract-fs-vars-from-source-tree.sh b/mcollins/extract-fs-vars-from-source-tree.sh
index c3205a2..70e09e5 100755
--- a/mcollins/extract-fs-vars-from-source-tree.sh
+++ b/mcollins/extract-fs-vars-from-source-tree.sh
@@ -12,17 +12,21 @@
 # MC 2009-04-02
 
 # Change these vars if your directories are different
-SRCDIR=/usr/src/freeswitch.trunk
+SRCDIR=/usr/src/freeswitch.git
 TMPDIR=/tmp
 HTMLDIR=/usr/local/freeswitch/htdocs
 
 # Grep the variables, then grep the aliases in the header files
-echo Searching source tree for channel variable set/get...
+echo "Searching source tree for channel variable set/get..."
 grep -rn "[sg]et_variable(" $SRCDIR/* | grep -v Binary | grep -v svn > $TMPDIR/get-set-vars.txt
+grep -rn "[sg]et_variable_partner(" $SRCDIR/* | grep -v Binary | grep -v svn >> $TMPDIR/get-set-vars.txt
 
-echo Getting header file definitions...
+echo "Searching source tree for event_get_header channel variables... "
+grep -rn "switch_event_get_header(var_event" $SRCDIR/* | grep -v Binary > $TMPDIR/event-vars.txt
+
+echo "Getting header file definitions..."
 grep -n "_VARIABLE" $SRCDIR/src/include/*h > $TMPDIR/header-defs.txt
 
 # launch perl script here
-echo Creating HTML file in $TMPDIR directory
+echo "Creating HTML file in $TMPDIR directory"
 ./create-chanvars-html-page.pl --srcdir=$SRCDIR --tmpdir=$TMPDIR --htmldir=$HTMLDIR
========================================================================

Summary of changes:
 mcollins/create-chanvars-html-page.pl        |   60 +++++++++++++++++++++++---
 mcollins/extract-fs-vars-from-source-tree.sh |   12 +++--
 mcollins/randomize-passwords.pl              |   24 +++++++++-
 3 files changed, 83 insertions(+), 13 deletions(-)

this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630 --
FreeSWITCH user-contributed scripts, etc