This commit is contained in:
TLINDEN
2012-02-10 20:24:51 +01:00
parent 9cf564ffe4
commit f548a0a1e2
70 changed files with 973 additions and 9136 deletions

View File

@@ -1,2 +1,2 @@
/note/1.3/Fri Jul 21 06:41:25 2000//
/note/1.5/Fri Aug 11 00:05:58 2000//
D

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl
# $Id: note,v 1.3 2000/07/21 06:41:25 zarahg Exp $
# $Id: note,v 1.5 2000/08/11 00:05:58 zarahg Exp $
#
#
# note - console notes management with database and encryption support.
@@ -79,7 +79,7 @@ my (
#
# db specifics from .noterc
#
$db, $dbname, $dbhost, $dbuser, $dbpasswd, $encrypt_passwd, $clearstring,
$db, $dbname, $dbhost, $dbport, $dbuser, $dbpasswd, $encrypt_passwd, $clearstring,
$table, $fnum, $fnote, $fdate, $date, $dbdriver, $libpath,
#
@@ -127,14 +127,17 @@ $TIME_COLOR = "black";
$TOPIC_COLOR = "BLACK";
$TOPIC = 1;
$TopicSep = '/';
$version = "1.0.9";
$version = "1.1.0";
if ($TOPIC) {
$CurDepth = 1; # the current depth inside the topic "directory" structure...
}
$USE_CRYPT = "NO";
$TempDir = "/tmp";
# mysql stuff
$table = "note";
$fnote = "note";
$fdate = "date";
$fnum = "number";
#
# process command line args
@@ -302,6 +305,12 @@ elsif ($opt_c) {
exit(1);
}
# directly jump to encrypt, 'cause this sub does
# not require a database connection
if ($mode eq "encrypt_passwd") {
&encrypt_passwd;
exit;
}
# Always interactive?
if ($ALWAYS_INT eq "YES" && $mode ne "dump" && $mode ne "import") {
@@ -331,8 +340,8 @@ elsif ($dbdriver eq "mysql") {
# do the new() later because of the encrypted password!
eval {
require "NOTEDB/mysql.pm";
#$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd, $table, $fnum, $fnote, $fdate);
};
die $@ if($@);
}
else {
eval {
@@ -395,7 +404,8 @@ if ($USE_CRYPT eq "YES" && $NOTEDB::crypt_supported == 1) {
my $cipher = new Crypt::CBC($key, $CRYPT_METHOD);
# decrypt the dbpasswd, if it's encrypted!
my $dbpasswd = $cipher->decrypt(unpack("u",$dbpasswd)) if($encrypt_passwd);
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd, $table, $fnum, $fnote, $fdate);
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser,
$dbpasswd, $table, $fnum, $fnote, $fdate, $dbport);
};
die "Could not connect do db: $@!\n" if($@);
}
@@ -408,18 +418,22 @@ if ($USE_CRYPT eq "YES" && $NOTEDB::crypt_supported == 1) {
print "access denied.\n"; # decrypted $date is not a number!
exit(1);
}
} #else empty!
} #else empty database!
}
else {
$db->no_crypt;
# does: NOTEDB::crypt_supported = 0;
my ($cnote, $cdate) = $db->get_single(1);
if ($cdate ne "") {
if ($cdate !~ /^\d+\.\d+?/) {
print "$NOTEDB seems to be encrypted!\n";
exit(1);
if ($dbdriver eq "mysql") {
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser,
$dbpasswd, $table, $fnum, $fnote, $fdate, $dbport);
}
$db->no_crypt;
# does: NOTEDB::crypt_supported = 0;
my ($cnote, $cdate) = $db->get_single(1);
if ($cdate ne "") {
if ($cdate !~ /^\d+\.\d+?/) {
print "$NOTEDB seems to be encrypted!\n";
exit(1);
}
}
}
}
@@ -464,9 +478,6 @@ elsif ($mode eq "import") {
elsif ($mode eq "interactive") {
&interactive;
}
elsif ($mode eq "encrypt_passwd") {
&encrypt_passwd;
}
else {
#undefined :-(
}
@@ -1454,6 +1465,7 @@ sub getconfig
$libpath = $value if (/^LibPath/);
$dbdriver = $value if (/^DbDriver/);
$dbhost = $value if (/^DbHost/);
$dbport = $value if (/^DbPort/);
$dbuser = $value if (/^DbUser/);
$dbpasswd = $value if (/^DbPasswd/);
$encrypt_passwd = $value if (/^encrypt_passwd/);
@@ -1508,6 +1520,12 @@ sub getconfig
__END__
#
# $Log: note,v $
# Revision 1.5 2000/08/11 00:05:58 zarahg
# 1.1.0 beta2 ready for testing
#
# Revision 1.4 2000/08/10 09:21:56 zarahg
# ready for 1.1.0 shipping, lots of changes/additions, see Changelog
#
# Revision 1.3 2000/07/21 06:41:25 zarahg
# 638: precedence bug fixed
#