nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated


From: Ken Hornstein
Subject: [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 2645f808bdcc325e143a9c6300ff97b813e5429f
Date: Sat, 04 Feb 2012 05:11:57 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".

The branch, master has been updated
       via  2645f808bdcc325e143a9c6300ff97b813e5429f (commit)
       via  f931795fd8973c1edb40a26ecf87dbe27f7a6148 (commit)
      from  d1622b3fcf620fb6dbd1a8eeb46fd368e0e3d460 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=2645f808bdcc325e143a9c6300ff97b813e5429f


commit 2645f808bdcc325e143a9c6300ff97b813e5429f
Author: Ken Hornstein <address@hidden>
Date:   Sat Feb 4 00:11:27 2012 -0500

    Whoops, used "buffer" when I meant "buf".

diff --git a/sbr/mts.c b/sbr/mts.c
index 451a9b2..939a8c7 100644
--- a/sbr/mts.c
+++ b/sbr/mts.c
@@ -267,7 +267,7 @@ LocalName (int flag)
     if (*localname && flag == 0) {
        strncpy (buf, localname, sizeof(buffer0));
     } else {
-       memset(buffer, 0, sizeof(buffer0));
+       memset(buf, 0, sizeof(buffer0));
        /* first get our local name */
        gethostname (buf, sizeof(buffer0) - 1);
        /* now fully qualify our name */

http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=f931795fd8973c1edb40a26ecf87dbe27f7a6148


commit f931795fd8973c1edb40a26ecf87dbe27f7a6148
Author: Ken Hornstein <address@hidden>
Date:   Fri Feb 3 23:43:53 2012 -0500

    Change LocalName() to take an argument (about whether or not to use
    local hostname versus entry in mts.conf).

diff --git a/h/mts.h b/h/mts.h
index 2d2aa95..a8d795f 100644
--- a/h/mts.h
+++ b/h/mts.h
@@ -6,7 +6,7 @@
 /*
  * Local and UUCP Host Name
  */
-char *LocalName(void);
+char *LocalName(int);
 char *SystemName(void);
 
 /*
diff --git a/h/prototypes.h b/h/prototypes.h
index 12124cd..11db40d 100644
--- a/h/prototypes.h
+++ b/h/prototypes.h
@@ -133,7 +133,7 @@ int strncasecmp (const char *s1, const char *s2, size_t n);
  * some prototypes for address parsing system
  * (others are in addrsbr.h)
  */
-char *LocalName(void);
+char *LocalName(int);
 char *SystemName(void);
 char *OfficialName(char *);
 
diff --git a/mts/smtp/hosts.c b/mts/smtp/hosts.c
index 29ac6d8..94a22d5 100644
--- a/mts/smtp/hosts.c
+++ b/mts/smtp/hosts.c
@@ -48,8 +48,8 @@ OfficialName (char *name)
     *q = '\0';
     q = site;
 
-    if (!mh_strcasecmp (LocalName(), site))
-       return LocalName();
+    if (!mh_strcasecmp (LocalName(1), site))
+       return LocalName(1);
 
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_CANONNAME;
diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c
index ee98dce..faca17a 100644
--- a/mts/smtp/smtp.c
+++ b/mts/smtp/smtp.c
@@ -216,7 +216,7 @@ smtp_init (char *client, char *server, char *port, int 
watch, int verbose,
        if (clientname) {
            client = clientname;
        } else {
-           client = LocalName();       /* no clientname -> LocalName */
+           client = LocalName(1);      /* no clientname -> LocalName */
        }
     }
 
@@ -475,7 +475,7 @@ sendmail_init (char *client, char *server, int watch, int 
verbose,
        if (clientname)
            client = clientname;
        else
-           client = LocalName();       /* no clientname -> LocalName */
+           client = LocalName(1);      /* no clientname -> LocalName */
     }
 
     /*
diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c
index 07bc810..8a468bb 100644
--- a/sbr/addrsbr.c
+++ b/sbr/addrsbr.c
@@ -145,7 +145,7 @@ getm (char *str, char *dfhost, int dftype, int wanthost, 
char *eresult)
     }
 
     if (dfhost == NULL) {
-       dfhost = LocalName ();
+       dfhost = LocalName (0);
        dftype = LOCALHOST;
     }
 
@@ -202,10 +202,10 @@ getm (char *str, char *dfhost, int dftype, int wanthost, 
char *eresult)
     }
 
     if (wanthost == AD_NHST)
-       mp->m_type = !mh_strcasecmp (LocalName (), mp->m_host)
+       mp->m_type = !mh_strcasecmp (LocalName (0), mp->m_host)
            ? LOCALHOST : NETHOST;
     else
-       mp->m_type = mh_strcasecmp (LocalName(), mp->m_host) ?  NETHOST : 
LOCALHOST;
+       mp->m_type = mh_strcasecmp (LocalName(0), mp->m_host) ?  NETHOST : 
LOCALHOST;
 
 got_host: ;
     if (route)
@@ -327,7 +327,7 @@ getlocaladdr(void)
 
     return username;
 
-    domain = LocalName();
+    domain = LocalName(0);
 
     snprintf_return = snprintf (addr, sizeof(addr), "address@hidden", 
username, domain);
 
@@ -419,7 +419,7 @@ ismymbox (struct mailname *np)
     
     switch (np->m_type) {
        case NETHOST:
-           len = strlen (cp = LocalName ());
+           len = strlen (cp = LocalName (0));
            if (!uprf (np->m_host, cp) || np->m_host[len] != '.')
                break;
            goto local_test;
diff --git a/sbr/mts.c b/sbr/mts.c
index 834579d..451a9b2 100644
--- a/sbr/mts.c
+++ b/sbr/mts.c
@@ -78,7 +78,7 @@ char *sendmail = SENDMAILPATH;
  * SMTP/POP stuff
  */
 char *clientname = NULL;
-char *servers    = "localhost \01localnet";
+char *servers    = "localhost";
 char *pophost    = "";
 
 /*
@@ -238,34 +238,45 @@ tailor_value (unsigned char *s)
 
 /*
  * Get the fully qualified name of the local host.
+ *
+ * If flag is 0, then use anything out of mts.conf (like localname).
+ * If flag is 1, then only use the "proper" local hostname.
  */
 
 char *
-LocalName (void)
+LocalName (int flag)
 {
-    static char buffer[BUFSIZ] = "";
+    static char buffer0[BUFSIZ] = "";
+    static char buffer1[BUFSIZ] = "";
+    static char *buffer[] = { buffer0, buffer1 };
+    char *buf;
     struct addrinfo hints, *res;
 
+    if (flag < 0 || flag > 1)
+       return NULL;
+
+    buf = buffer[flag];
+
     /* check if we have cached the local name */
-    if (buffer[0])
-       return buffer;
+    if (buf[0])
+       return buf;
 
     mts_init ("mts");
 
     /* check if the mts.conf file specifies a "localname" */
-    if (*localname) {
-       strncpy (buffer, localname, sizeof(buffer));
+    if (*localname && flag == 0) {
+       strncpy (buf, localname, sizeof(buffer0));
     } else {
-       memset(buffer, 0, sizeof(buffer));
+       memset(buffer, 0, sizeof(buffer0));
        /* first get our local name */
-       gethostname (buffer, sizeof(buffer) - 1);
+       gethostname (buf, sizeof(buffer0) - 1);
        /* now fully qualify our name */
 
        memset(&hints, 0, sizeof(hints));
        hints.ai_flags = AI_CANONNAME;
        hints.ai_family = PF_UNSPEC;
-       if (getaddrinfo(buffer, NULL, &hints, &res) == 0) {
-           strncpy(buffer, res->ai_canonname, sizeof(buffer) - 1);
+       if (getaddrinfo(buf, NULL, &hints, &res) == 0) {
+           strncpy(buf, res->ai_canonname, sizeof(buffer0) - 1);
            freeaddrinfo(res);
        }
     }
@@ -275,11 +286,11 @@ LocalName (void)
      * we append that now.  This should rarely be needed.
      */
     if (*localdomain) {
-       strcat (buffer, ".");
-       strcat (buffer, localdomain);
+       strcat (buf, ".");
+       strcat (buf, localdomain);
     }
 
-    return buffer;
+    return buf;
 }
 
 
diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c
index 2a3f899..c349bf8 100644
--- a/uip/mhbuildsbr.c
+++ b/uip/mhbuildsbr.c
@@ -859,7 +859,7 @@ set_id (CT ct, int top)
     if (clock == 0) {
        time (&clock);
        snprintf (msgid, sizeof(msgid), "<address@hidden>\n",
-               (int) getpid(), (long) clock, LocalName());
+               (int) getpid(), (long) clock, LocalName(1));
        partno = 0;
        msgfmt = getcpy(msgid);
     }
diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c
index eef0937..6bfbade 100644
--- a/uip/mhlsbr.c
+++ b/uip/mhlsbr.c
@@ -1096,7 +1096,7 @@ mcomp_format (struct mcomp *c1, struct mcomp *c2)
            if ((c1->c_flags & FACEDFLT) && c2->c_face == NULL) {
                char   *h, *o;
                if ((h = mp->m_host) == NULL)
-                   h = LocalName ();
+                   h = LocalName (0);
                if ((o = OfficialName (h)))
                    h = o;
                c2->c_face = concat ("address ", h, " ", mp->m_mbox,
@@ -1503,7 +1503,7 @@ face_format (struct mcomp *c1)
        if ((mp = getm (cp, NULL, 0, AD_NAME, NULL))) {
            char *h, *o;
            if ((h = mp->m_host) == NULL)
-               h = LocalName ();
+               h = LocalName (0);
            if ((o = OfficialName (h)))
                h = o;
            c1->c_face = concat ("address ", h, " ", mp->m_mbox, NULL);
diff --git a/uip/mhparse.c b/uip/mhparse.c
index e151062..5b48483 100644
--- a/uip/mhparse.c
+++ b/uip/mhparse.c
@@ -2554,7 +2554,8 @@ openFTP (CT ct, char **file)
 
     if (e->eb_flags) {
        user = "anonymous";
-       snprintf (buffer, sizeof(buffer), "address@hidden", getusername (), 
LocalName ());
+       snprintf (buffer, sizeof(buffer), "address@hidden", getusername (),
+                 LocalName (1));
        pass = buffer;
     } else {
        ruserpass (e->eb_site, &username, &password);
diff --git a/uip/post.c b/uip/post.c
index dcd563b..580d3d1 100644
--- a/uip/post.c
+++ b/uip/post.c
@@ -869,7 +869,7 @@ start_headers (void)
     time (&tclock);
 
     strncpy (from, getlocaladdr(), sizeof(from));
-    strncpy (myhost, LocalName (), sizeof(myhost));
+    strncpy (myhost, LocalName (0), sizeof(myhost));
 
     for (cp = myhost; *cp; cp++)
        *cp = uptolow (*cp);
@@ -908,7 +908,7 @@ finish_headers (FILE *out)
            fprintf (out, "Date: %s\n", dtime (&tclock, 0));
            if (msgid)
                fprintf (out, "Message-ID: <address@hidden>\n",
-                       (int) getpid (), (long) tclock, LocalName ());
+                       (int) getpid (), (long) tclock, LocalName (1));
            if (msgflags & MFRM) {
                /* There was already a From: in the draft.  Don't add one. */
                if (!draft_from_masquerading)
@@ -943,7 +943,7 @@ finish_headers (FILE *out)
            fprintf (out, "Resent-Date: %s\n", dtime (&tclock, 0));
            if (msgid)
                fprintf (out, "Resent-Message-ID: <address@hidden>\n",
-                       (int) getpid (), (long) tclock, LocalName ());
+                       (int) getpid (), (long) tclock, LocalName (1));
            if (msgflags & MRFM) {
                /* There was already a Resent-From: in draft.  Don't add one. */
                if (!draft_from_masquerading)
@@ -1197,7 +1197,7 @@ make_bcc_file (int dashstuff)
     fprintf (out, "Date: %s\n", dtime (&tclock, 0));
     if (msgid)
        fprintf (out, "Message-ID: <address@hidden>\n",
-               (int) getpid (), (long) tclock, LocalName ());
+               (int) getpid (), (long) tclock, LocalName (1));
     if (msgflags & MFRM) {
       /* There was already a From: in the draft.  Don't add one. */
       if (!draft_from_masquerading)
diff --git a/uip/sendsbr.c b/uip/sendsbr.c
index f216e95..04d6ea9 100644
--- a/uip/sendsbr.c
+++ b/uip/sendsbr.c
@@ -669,7 +669,7 @@ splitmsg (char **vec, int vecp, char *drft, struct stat 
*st, int delay)
 
     time (&clock);
     snprintf (msgid, sizeof(msgid), "<address@hidden>",
-               (int) getpid(), (long) clock, LocalName());
+               (int) getpid(), (long) clock, LocalName(1));
 
     fseek (in, start, SEEK_SET);
     for (partno = 1; partno <= nparts; partno++) {
diff --git a/uip/viamail.c b/uip/viamail.c
index 2e1c51c..49bbdf4 100644
--- a/uip/viamail.c
+++ b/uip/viamail.c
@@ -185,7 +185,7 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char 
*descsw,
     strncpy (tmpfil, tfile, sizeof(tmpfil));
 
     if (!strchr(mailsw, '@'))
-       mailsw = concat (mailsw, "@", LocalName (), NULL);
+       mailsw = concat (mailsw, "@", LocalName (0), NULL);
     fprintf (fp, "To: %s\n", mailsw);
 
     if (subjsw)
@@ -193,7 +193,7 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char 
*descsw,
 
     if (fromsw) {
        if (!strchr(fromsw, '@'))
-           fromsw = concat (fromsw, "@", LocalName (), NULL);
+           fromsw = concat (fromsw, "@", LocalName (0), NULL);
        fprintf (fp, "From: %s\n", fromsw);
     }
 

-----------------------------------------------------------------------

Summary of changes:
 h/mts.h          |    2 +-
 h/prototypes.h   |    2 +-
 mts/smtp/hosts.c |    4 ++--
 mts/smtp/smtp.c  |    4 ++--
 sbr/addrsbr.c    |   10 +++++-----
 sbr/mts.c        |   39 +++++++++++++++++++++++++--------------
 uip/mhbuildsbr.c |    2 +-
 uip/mhlsbr.c     |    4 ++--
 uip/mhparse.c    |    3 ++-
 uip/post.c       |    8 ++++----
 uip/sendsbr.c    |    2 +-
 uip/viamail.c    |    4 ++--
 12 files changed, 48 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
The nmh Mail Handling System



reply via email to

[Prev in Thread] Current Thread [Next in Thread]