Merge branch 'master' of git+ssh://github.com/adefaria/clearscm
authorAndrew DeFaria <Andrew@DeFaria.com>
Wed, 22 Nov 2017 16:56:36 +0000 (08:56 -0800)
committerAndrew DeFaria <Andrew@DeFaria.com>
Wed, 22 Nov 2017 16:56:36 +0000 (08:56 -0800)
maps/bin/MAPSDB.sql
maps/bin/MAPSDeliver
maps/test.msg

index 0a2a3fc..dfe0a4f 100644 (file)
@@ -1,12 +1,12 @@
 -------------------------------------------------------------------------------
 --
--- File:       $RCSFile$
--- Revision:   $Revision: 1.1 $
--- Description:        This file creates the MAPS database.
--- Author:     Andrew@DeFaria.com
--- Created:    Tue May 13 13:28:18 PDT 2003
--- Modified:   $Date: 2013/06/12 14:05:47 $
--- Language:   SQL
+-- File:        $RCSFile$
+-- Revision:    $Revision: 1.1 $
+-- Description: This file creates the MAPS database.
+-- Author:      Andrew@DeFaria.com
+-- Created:     Tue May 13 13:28:18 PDT 2003
+-- Modified:    $Date: 2013/06/12 14:05:47 $
+-- Language:    SQL
 --
 -- Copyright (c) 2000-2006, Andrew@DeFaria.com, all rights reserved
 --
@@ -22,56 +22,56 @@ use MAPS;
 
 -- user: Valid users and their passwords are contained here
 create table user (
-  userid                       varchar (128)   not null,
-  name                         tinytext        not null,
-  email                                varchar (128)   not null,
-  password                     tinytext        not null,
+  userid      varchar (128) not null,
+  name        tinytext      not null,
+  email       varchar (128) not null,
+  password    tinytext      not null,
   primary key (userid)
-) type=innodb; -- user
+); -- user
 
 -- useropts: User's options are stored here
 create table useropts (
-  userid                       varchar (128)   not null,
-  name                         tinytext,
-  value                                varchar (128),
+  userid         varchar (128) not null,
+  name           tinytext,
+  value          varchar (128),
   key user_index (userid),
   foreign key (userid) references user (userid) on delete cascade
-) type=innodb; -- useropts
+); -- useropts
 
 -- email: Table that holds the email
 create table email (
-  userid                       varchar (128)   not null,
-  sender                       varchar (128)   not null,
-  subject                      varchar (255),
-  timestamp                    datetime,
-  data                         longblob,
-  key user_index (userid),
-  foreign key (userid) references user (userid) on delete cascade,
+  userid           varchar (128) not null,
+  sender           varchar (128) not null,
+  subject          varchar (255),
+  timestamp        datetime,
+  data             longblob,
+  key user_index   (userid),
+  foreign key      (userid) references user (userid) on delete cascade,
   key sender_index (sender)
-) type=innodb; -- email
+); -- email
 
 -- whitelist: Table holds the users' whitelists
 create table list (
-  userid                       varchar (128)   not null,
-  type                         enum ("white", "black", "null") not null,
-  pattern                      varchar (128),
-  domain                       varchar (128),
-  comment                      varchar (128),
-  sequence                     smallint,
-  hit_count                    integer,
-  last_hit                     datetime,
-  key user_index (userid),
+  userid            varchar (128)                   not null,
+  type              enum ("white", "black", "null") not null,
+  pattern           varchar (128),
+  domain            varchar (128),
+  comment           varchar (128),
+  sequence          smallint,
+  hit_count         integer,
+  last_hit          datetime,
+  key user_index    (userid),
   key user_listtype (userid, type),
-  unique (userid, type, sequence),
-  foreign key (userid) references user (userid) on delete cascade
-) type=innodb; -- list
+  unique            (userid, type, sequence),
+  foreign key       (userid) references user (userid) on delete cascade
+); -- list
 
 -- log: Table to hold log information
 create table log (
-  userid                       varchar (128)   not null,
-  timestamp                    datetime,
-  sender                       varchar (128),
-  type                         enum (
+  userid    varchar (128) not null,
+  timestamp datetime,
+  sender    varchar (128),
+  type      enum (
     "blacklist",
     "debug",
     "error",
@@ -82,15 +82,15 @@ create table log (
     "returned",
     "whitelist"
   ) not null,
-  message                      varchar (255)   not null,
+  message        varchar (255) not null,
   key user_index (userid),
-  foreign key (userid) references user (userid) on delete cascade
-) type=innodb; -- log
+  foreign key     (userid) references user (userid) on delete cascade
+); -- log
 
 -- Create users
---grant all privileges 
---  on MAPS.* to mapsadmin@"%"  identified by "mapsadmin";
---grant select
---  on MAPS.* to mapsreader@"%" identified by "reader";
---grant insert, select, update, delete
---  on MAPS.* to mapswriter@"%" identified by "writer";
+grant all privileges 
+  on MAPS.* to mapsadmin@"localhost"  identified by "mapsadmin";
+grant select
+  on MAPS.* to mapsreader@"localhost" identified by "reader";
+grant insert, select, update, delete
+  on MAPS.* to mapswriter@"localhost" identified by "writer";
index e58126c..05ceafd 100755 (executable)
@@ -2,11 +2,11 @@
 ################################################################################
 #
 # File:         $RCSfile: MAPSDeliver,v $
-# Revision:    $Revision: 1.1 $
+# Revision:     $Revision: 1.1 $
 # Description:  This script simply delivers the mail. It is separated out so
-#              it can be the only portion that is setgid to the group mail
-#              for the purposes of being able to deliver the mail to the users
-#              maildrop
+#                    it can be the only portion that is setgid to the group mail
+#               for the purposes of being able to deliver the mail to the users
+#               maildrop
 # Author:       Andrew@DeFaria.com
 # Created:      Fri Nov 29 14:17:21  2002
 # Modified:     $Date: 2013/06/12 14:05:47 $
 use strict;
 use warnings;
 
-use English;
 use FindBin;
 
-# Untaint $FindBin::Bin
-my $lib;
-
-BEGIN {
-  if ($FindBin::Bin =~ /^(.*)$/) {
-    $lib = $1;
-  } # if
-} # BEGIN
-
-use lib $lib;
+use lib $FindBin::Bin;
 
 use MAPSFile;
 use MAPSDB;
@@ -39,14 +29,6 @@ use MAPSLog;
 sub DeliverMail ($$) {
   my ($userid, $msgfileName) = @_;
 
-  # Switch to group mail
-  $EGID = getgrnam "mail";
-
-  # Untaint $userid
-  if ($userid =~ /^([-\@\w.]+)$/) {
-    $userid = $1;
-  } # if
-
   # Open maildrop file
   open my $maildrop, '>>', "/var/mail/$userid"
     or return "Unable to open maildrop file (/var/mail/$userid): $!";
@@ -59,7 +41,7 @@ sub DeliverMail ($$) {
   Lock $maildrop;
 
   # Write msgfile -> $maildrop
-  print $maildrop "\n";
+  print $maildrop "\n\n";
   print $maildrop $_
     while (<$msgfile>);
 
@@ -74,11 +56,10 @@ sub DeliverMail ($$) {
 } # DeliverMail
 
 # Main
-die 'User id not specified' unless $ARGV [0];
-die 'Msgfile not specified' unless $ARGV [1];
+my ($userid, $msgfile) = @ARGV;
 
-my $userid  = shift @ARGV;
-my $msgfile = shift @ARGV;
+die 'User id not specified' unless $userid;
+die 'Msgfile not specified' unless $msgfile;
 
 my $err  = DeliverMail $userid, $msgfile;
 
@@ -90,5 +71,4 @@ if ($err) {
   Error $err;
 } # if
 
-exit 1 if $err;
-exit 0;
+exit $err ? 1 : 0;
index fe92463..9aacd39 100644 (file)
@@ -1,171 +1,9 @@
-Message-ID: <546412AB.7090404@DeFaria.com>\r
-Date: Wed, 12 Nov 2014 18:08:43 -0800\r
-From: Andrew DeFaria <Andrew@DeFaria.com>\r
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0\r
-MIME-Version: 1.0\r
-To: Yubico Support <support@yubico.com>\r
-Subject: Glutten for punishment...\r
-Content-Type: multipart/alternative;\r
- boundary="------------060602060101040803010204"\r
-\r
-This is a multi-part message in MIME format.\r
---------------060602060101040803010204\r
-Content-Type: text/plain; charset=utf-8; format=flowed\r
-Content-Transfer-Encoding: 7bit\r
-\r
-OK I returned the Yubico Security key thing and bought the Yubikey Neo. \r
-I'm on Windows 7 with Chrome  38.0.2125.111 m. I even have the FIDO U2F \r
-(Universal 2nd Factor) extension 0.9.3 installed.\r
-\r
-I go to http://demo.yubico.com/start/u2f/neo?tab=register and insert my \r
-key. Unlike the instructions my yubikey is not a "flashing U2F device" - \r
-the light is on solid. I hit the button anyway. It does nothing but \r
-eventually times out with:\r
-\r
-\r
-        Registration failed!\r
-\r
-    Make sure you have a U2F device connected, and try again.\r
-\r
-      Traceback (most recent call last):\r
-       File "/root/python-u2flib-server-demo/examples/yubiauth_server.py", line 159, in __call__\r
-         raise Exception("FIDO Client error: %s" % error)\r
-    Exception: FIDO Client error: 5 (TIMEOUT)\r
-      \r
-\r
-/root? Really?\r
-\r
-Similarly when I go to my Google account under Security Keys and follow \r
-the instruction there the yubikey doesn't do anything! When I tap the \r
-gold circle the light goes out for a brief second then back on. But the \r
-"Now insert (and tap) your Security Key" with the spinning progress \r
-indicator goes forever...\r
-\r
-Now what?\r
--- \r
-Andrew DeFaria <http://defaria.com>\r
-ClearSCM, Inc. <http://clearscm.com>\r
-\r
---------------060602060101040803010204\r
-Content-Type: text/html; charset=utf-8\r
-Content-Transfer-Encoding: 8bit\r
-\r
-<html>\r
-  <head>\r
-\r
-    <meta http-equiv="content-type" content="text/html; charset=utf-8">\r
-  </head>\r
-  <body style="background-color: rgb(255, 255, 255); color: rgb(0, 0,\r
-    0);" bgcolor="#FFFFFF" text="#000000">\r
-    OK I returned the Yubico Security key thing and bought the Yubikey\r
-    Neo. I'm on Windows 7 with Chrome  38.0.2125.111 m. I even have the\r
-    FIDO U2F (Universal 2nd Factor) extension 0.9.3 installed. <br>\r
-    <br>\r
-    I go to <a class="moz-txt-link-freetext" href="http://demo.yubico.com/start/u2f/neo?tab=register">http://demo.yubico.com/start/u2f/neo?tab=register</a> and insert\r
-    my key. Unlike the instructions my yubikey is not a "flashing U2F\r
-    device" - the light is on solid. I hit the button anyway. It does\r
-    nothing but eventually times out with:<br>\r
-    <blockquote>\r
-      <h2 style="margin: 10px 0px; font-family: 'Helvetica Neue',\r
-        Helvetica, Arial, sans-serif; font-weight: bold; line-height:\r
-        40px; color: rgb(51, 51, 51); text-rendering:\r
-        optimizelegibility; font-size: 31.5px; font-style: normal;\r
-        font-variant: normal; letter-spacing: normal; orphans: auto;\r
-        text-align: start; text-indent: 0px; text-transform: none;\r
-        white-space: normal; widows: auto; word-spacing: 0px;\r
-        -webkit-text-stroke-width: 0px;">Registration failed!</h2>\r
-      <p style="margin: 0px 0px 10px; color: rgb(51, 51, 51);\r
-        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\r
-        font-size: 18px; font-style: normal; font-variant: normal;\r
-        font-weight: 200; letter-spacing: normal; line-height: 30px;\r
-        orphans: auto; text-align: start; text-indent: 0px;\r
-        text-transform: none; white-space: normal; widows: auto;\r
-        word-spacing: 0px; -webkit-text-stroke-width: 0px;">Make sure\r
-        you have a U2F device connected, and try again.</p>\r
-      <pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: block; margin: 0px 0px 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; border: 1px solid rgba(0, 0, 0, 0.14902); font-style: normal; font-variant: normal; font-weight: 200; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(245, 245, 245);"> Traceback (most recent call last):\r
-  File "/root/python-u2flib-server-demo/examples/yubiauth_server.py", line 159, in __call__\r
-    raise Exception("FIDO Client error: %s" % error)\r
-Exception: FIDO Client error: 5 (TIMEOUT)\r
- </pre>\r
-    </blockquote>\r
-    <div class="moz-signature">/root? Really?<br>\r
-      <br>\r
-      Similarly when I go to my Google account under Security Keys and\r
-      follow the instruction there the yubikey doesn't do anything! When\r
-      I tap the gold circle the light goes out for a brief second then\r
-      back on. But the "Now insert (and tap) your Security Key" with the\r
-      spinning progress indicator goes forever...<br>\r
-      <br>\r
-      Now what?<br>\r
-      -- <br>\r
-      <style type="text/css">\r
-body {\r
-  font:                        Helvetica, Arial, sans-serif;\r
-}\r
-p {\r
-  font:                        Helvetica, Arial, sans-serif;\r
-}\r
-.standout {\r
-  font-family:         verdana,\r
-                       arial,\r
-                       sans-serif;\r
-  font-size:           12px;\r
-  color:               #993333;\r
-  line-height:         13px;\r
-  font-weight:         bold;\r
-  margin-bottom:       10px;\r
-}\r
-.code {\r
-  border-top:          1px solid #ddd;\r
-  border-left:         1px solid #ddd;\r
-  border-right:                2px solid #000;\r
-  border-bottom:       2px solid #000;\r
-  padding:             10px;\r
-  margin-top:          5px;\r
-  margin-left:         5%;\r
-  margin-right:                5%;\r
-  background:          #ffffea;\r
-  color:               black;\r
-  font-family:         courier;\r
-  white-space:         pre;\r
-  -moz-border-radius:  10px;\r
-}\r
-.terminal {\r
-  border-top:          10px solid #03f;\r
-  border-left:         1px solid #ddd;\r
-  border-right:                2px solid grey;\r
-  border-bottom:       2px solid grey;\r
-  padding:             10px;\r
-  margin-top:          5px;\r
-  margin-left:         5%;\r
-  margin-right:                5%;\r
-  background:          black;\r
-  color:               white;\r
-  font-family:         courier;\r
-  white-space:         pre;\r
-  -moz-border-radius:  10px;\r
-}\r
-a:link { \r
-  color:               blue;\r
-}\r
-\r
-a:visited {\r
-  color:               darkblue;\r
-}\r
-\r
-a:hover { \r
-  color:               black;\r
-  background-color:    #ffffcc;\r
-  text-decoration:     underline;\r
-}\r
-\r
-a:active { \r
-  color:               red;\r
-}\r
-</style><a href="http://defaria.com">Andrew DeFaria</a><br>\r
-      <a href="http://clearscm.com">ClearSCM, Inc.</a><br>\r
-    </div>\r
-  </body>\r
-</html>\r
-\r
---------------060602060101040803010204--\r
+From andrew@defaria.com  Tue Nov 14 20:02:28 2017\r
+Return-Path: <andrew@defaria.com>\r
+X-Original-To: andrew\r
+Delivered-To: andrew@defaria.novalocal\r
+Received: from defaria.com (cpe-76-167-176-12.san.res.rr.com [76.167.176.12])\r
+       by defaria.novalocal (Postfix) with ESMTP id 93C2D84D55E\r
+       for <andrew>; Tue, 14 Nov 2017 20:02:12 +0000 (UTC)\r
+\r
+This is a test message.\r