This file is indexed.

/usr/share/ada/adainclude/alog/alog-facilities-smtp.ads is in libalog0.4.1-base-dev 0.4.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--
--  Copyright (c) 2008-2009,
--  Reto Buerki, Adrian-Ken Rueegsegger
--
--  This file is part of Alog.
--
--  Alog is free software; you can redistribute it and/or modify
--  it under the terms of the GNU Lesser General Public License as published
--  by the Free Software Foundation; either version 2.1 of the License, or
--  (at your option) any later version.
--
--  Alog is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU Lesser General Public License for more details.
--
--  You should have received a copy of the GNU Lesser General Public License
--  along with Alog; if not, write to the Free Software
--  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
--  MA  02110-1301  USA

with Ada.Characters.Latin_1;

with AWS;

with GNAT.Sockets;

--  SMTP-Logging facility. Used to send log-messages to a configurable
--  mailserver. AWS must be installed for this facility to work.
package Alog.Facilities.SMTP is

   type Instance is new Alog.Facilities.Instance with private;
   --  SMTP based logging facility.

   type Handle is access all Instance;

   procedure Set_Recipient
     (Facility : in out Instance;
      Name     :        String;
      EMail    :        String);
   --  Set recipient for log-messages. This procedure MUST be called before
   --  subsequent calls to Write_Message().

   procedure Set_Server
     (Facility : in out Instance;
      Name     :        String);
   --  Set server for log-messages. This procedure MUST be called before
   --  subsequent calls to Write_Message().

   procedure Set_Header
     (Facility : in out Instance;
      Header   :        String);
   --  Set Message-Header of log-messages.

   function Get_Header (Facility : Instance) return String;
   --  Get actual Message-Header of log-messages.

   --  Exceptions.

   No_Recipient    : exception;
   --  No recipient specified. Cannot send mail.

   No_Server       : exception;
   --  No server specified. Cannot send mail.

   Delivery_Failed : exception;
   --  Mail could not be delivered.

private

   overriding
   procedure Write
     (Facility : Instance;
      Level    : Log_Level := Info;
      Msg      : String);
   --  Implementation of the Write procedure for SMTP.

   function Format_Message
     (Facility : Instance;
      Level    : Log_Level;
      Msg      : String)
      return String;
   --  Compose a message from Msg, Header, Loglevel, Timestamp, PID.

   EOL : constant Character := Ada.Characters.Latin_1.LF;
   --  EOL used in mail-messages.

   type Mail_Address is tagged record
      Name  : Unbounded_String;
      EMail : Unbounded_String;
   end record;
   --  Holds Sender / Recipient information.

   type Instance is new Alog.Facilities.Instance with record
      Server       : Unbounded_String;
      --  Server to connect when sending log-mails.

      Is_Server    : Boolean := False;
      --  Indicates whether a server is set.

      Recipient    : Mail_Address;
      --  Recipient for log-mails. Must be specified before calling
      --  Write_Message(), else No_Recipient exception is thrown.

      Is_Recipient : Boolean := False;
      --  Indicates whether a recipient is set.

      Sender       : Mail_Address :=
        (Name  => To_Unbounded_String ("alog"),
         EMail => To_Unbounded_String ("alog@" &
           GNAT.Sockets.Host_Name));
      --  Notification sender address/name.

      Subject      : Unbounded_String := To_Unbounded_String
        ("Log-Message");
      --  Subject of messages from Alog-System (default: Alog: Log-Message).

      Header       : Unbounded_String := To_Unbounded_String
        ("This is a message from the Alog-logsystem running on host "
         & GNAT.Sockets.Host_Name & ":" & EOL & EOL);
      --  Message-Header. Can be set by calling Set_Header().
   end record;

end Alog.Facilities.SMTP;