Some minor changes to maps
authorAndrew DeFaria <Andrew@DeFaria.com>
Tue, 21 Nov 2017 18:22:41 +0000 (10:22 -0800)
committerAndrew DeFaria <Andrew@DeFaria.com>
Tue, 21 Nov 2017 18:22:41 +0000 (10:22 -0800)
. Changed MAPSDB.sql to work with MariaDB. MariaDB doesn't like type=innodb even
  though it's the default
. MAPSDeliever no longer tries to setgid
. A more testy test.msg

maps/bin/MAPSDB.sql
maps/bin/MAPSDeliver
maps/test.msg

index 0a2a3fc..54a4917 100644 (file)
@@ -27,7 +27,7 @@ create table user (
   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 (
@@ -36,7 +36,7 @@ create table useropts (
   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 (
@@ -48,7 +48,7 @@ create table email (
   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 (
@@ -64,7 +64,7 @@ create table list (
   key user_listtype (userid, type),
   unique (userid, type, sequence),
   foreign key (userid) references user (userid) on delete cascade
-) type=innodb; -- list
+); -- list
 
 -- log: Table to hold log information
 create table log (
@@ -85,7 +85,7 @@ create table log (
   message                      varchar (255)   not null,
   key user_index (userid),
   foreign key (userid) references user (userid) on delete cascade
-) type=innodb; -- log
+); -- log
 
 -- Create users
 --grant all privileges 
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