rancid patches for BayRS 14.x and for encrypted .cloginrc

Mordechai T. Abzug morty at sled.gsfc.nasa.gov
Tue Oct 2 22:21:01 UTC 2001


The attached patch:

- fixes assorted issues with brancid for BayRS 14.0.2.1, including the
  changing description issue.

- adds two new env vars, CLOGIN_KEY (allows .cloginrc to be encrypted via
  "crypt") and CLOGIN_ASK (if set, do-diffs will prompt for and set
  CLOGIN_KEY.)  For the *login scripts, I've only modified blogin and
  clogin, since those are the ones I can test.  In theory, the exact same
  code should suffice for the others.

This patch is relative to a clean 2.2b7.

Thanks!

Morty
-------------- next part --------------
*** blogin.dist	Tue Oct  2 18:03:24 2001
--- blogin	Tue Oct  2 17:17:35 2001
***************
*** 262,270 ****
  	send_user "\nError: $password_file must not be world readable/writable\n"
  	exit 1
      }
!     if [ catch {source $password_file} reason ] {
! 	send_user "\nError: $reason\n"
! 	exit 1
      }
  }
  
--- 262,278 ----
  	send_user "\nError: $password_file must not be world readable/writable\n"
  	exit 1
      }
!     if {[info exists env(CLOGIN_KEY)]} {
!         set clogin_fd [open "|crypt $env(CLOGIN_KEY) < $password_file" ]
!         if [ catch {eval [read $clogin_fd]} reason ] {
! 	    send_user "\nError: $reason\n"
! 	    exit 1
!         }
!     } else {
!         if [ catch {source $password_file} reason ] {
! 	    send_user "\nError: $reason\n"
! 	    exit 1
!         }
      }
  }
  
*** brancid.dist	Tue Sep 25 16:54:22 2001
--- brancid	Tue Oct  2 17:47:00 2001
***************
*** 140,145 ****
--- 140,148 ----
  	last if (/^$prompt/);
  	next if (/^(\s*|\s*$cmd\s*)$/);
  	next if (/^Reading configuration information/);
+ 	next if (/^\# *uptime +\d+\s*$/);
+ 	next if (/^Can\'t find object or class named \"\-all\"\s*$/);
+ 	s{^(\# *description \{.* )Created on .*(\}\s*)$}{$1$2};
  	if (/community label /) {
  	    if (defined($ENV{'NOCOMMSTR'})) {
  		$_ =~ s/community label .*$/community label <removed>/;
***************
*** 178,186 ****
  
  # Main
  %commands=(
! 	'bcc'		=> "RunCommand",
! 	'show config'	=> "ShowConfig",
! 	'exit'		=> "RunCommand"
  );
  # keys() doesnt return things in the order entered and the order of the
  # cmds is important (show version first and write term last). pita
--- 181,190 ----
  
  # Main
  %commands=(
! 	'bcc'			=> "RunCommand",
! 	'show config'		=> "ShowConfig",
! 	'show config -all'	=> "ShowConfig",
! 	'exit'			=> "RunCommand"
  );
  # keys() doesnt return things in the order entered and the order of the
  # cmds is important (show version first and write term last). pita
***************
*** 187,192 ****
--- 191,197 ----
  @commands=(
  	"bcc",
  	"show config",
+ 	"show config -all",
  	"exit"
  );
  $cisco_cmds=join(";", at commands);
*** clogin.dist	Tue Sep 25 16:54:20 2001
--- clogin	Tue Oct  2 17:17:27 2001
***************
*** 271,279 ****
  	send_user "\nError: $password_file must not be world readable/writable\n"
  	exit 1
      }
!     if [ catch {source $password_file} reason ] {
! 	send_user "\nError: $reason\n"
! 	exit 1
      }
  }
  
--- 271,287 ----
  	send_user "\nError: $password_file must not be world readable/writable\n"
  	exit 1
      }
!     if {[info exists env(CLOGIN_KEY)]} {
!         set clogin_fd [open "|crypt $env(CLOGIN_KEY) < $password_file" ]
!         if [ catch {eval [read $clogin_fd]} reason ] {
!             send_user "\nError: $reason\n"
!             exit 1
!         }
!     } else {
!         if [ catch {source $password_file} reason ] {
! 	    send_user "\nError: $reason\n"
! 	    exit 1
!         }
      }
  }
  
*** do-diffs.dist	Tue Oct  2 17:31:14 2001
--- do-diffs	Tue Oct  2 17:35:32 2001
***************
*** 32,38 ****
--- 32,47 ----
  	mkdir $BASEDIR/logs
  fi
  
+ if [ "x$CLOGIN_ASK" != "x" ]; then
+ 	printf 'Could you type in the clogin key, please? '
+ 	stty -echo
+ 	read CLOGIN_KEY
+ 	stty echo
+ 	export CLOGIN_KEY
+ 	echo
+ fi
  
+ 
  for GROUP in $LIST_OF_GROUPS
  do
  


More information about the Rancid-discuss mailing list